You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2024/03/28 00:37:35 UTC
(camel-karavan) branch main updated: Fix #1196
This is an automated email from the ASF dual-hosted git repository.
marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push:
new 0aac6a84 Fix #1196
0aac6a84 is described below
commit 0aac6a844534e774c39502614e701f11b8a33716
Author: Marat Gubaidullin <ma...@talismancloud.io>
AuthorDate: Wed Mar 27 20:37:21 2024 -0400
Fix #1196
---
.../src/main/webui/src/project/files/FilesToolbar.tsx | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/karavan-app/src/main/webui/src/project/files/FilesToolbar.tsx b/karavan-app/src/main/webui/src/project/files/FilesToolbar.tsx
index 7a69c373..3545aeaf 100644
--- a/karavan-app/src/main/webui/src/project/files/FilesToolbar.tsx
+++ b/karavan-app/src/main/webui/src/project/files/FilesToolbar.tsx
@@ -41,6 +41,7 @@ import UpdateIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon";
import {ProjectType} from "../../api/ProjectModels";
import {KaravanApi} from "../../api/KaravanApi";
import {EventBus} from "../../designer/utils/EventBus";
+import {isEmpty} from "../../util/StringUtils";
export function FileToolbar () {
@@ -82,6 +83,16 @@ export function FileToolbar () {
return project.projectId === 'templates' && project.type === ProjectType.templates;
}
+ function onKeyDown(event: React.KeyboardEvent<HTMLDivElement>): void {
+ event.stopPropagation();
+ if (event.key === 'Enter') {
+ event.preventDefault();
+ if (!isEmpty(commitMessage)) {
+ push();
+ }
+ }
+ }
+
function getCommitModal() {
return (
<Modal
@@ -89,8 +100,9 @@ export function FileToolbar () {
variant={ModalVariant.small}
isOpen={commitMessageIsOpen}
onClose={() => setCommitMessageIsOpen(false)}
+ onKeyDown={onKeyDown}
actions={[
- <Button key="confirm" variant="primary" onClick={() => push()}>Commit and push</Button>,
+ <Button key="confirm" variant="primary" isDisabled={isEmpty(commitMessage)} onClick={() => push()}>Commit and push</Button>,
<Button key="cancel" variant="secondary" onClick={() => setCommitMessageIsOpen(false)}>Cancel</Button>
]}
>