Skip to content

Commit

Permalink
other minor usability improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Aug 16, 2024
1 parent 1b794d4 commit 9b45d0e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function JsonField(props: JsonFieldProps) {
{({ field, form }: FieldProps) => {
return (
<EuiCompressedFormRow
fullWidth={true}
key={props.fieldPath}
label={props.label || camelCaseToTitleString(field.name)}
labelAppend={
Expand Down Expand Up @@ -97,6 +98,9 @@ export function JsonField(props: JsonFieldProps) {
setOptions={{
fontSize: '14px',
useWorker: validate,
highlightActiveLine: !props.readOnly,
highlightSelectedWord: !props.readOnly,
highlightGutterLine: !props.readOnly,
}}
aria-label="Code Editor"
tabSize={2}
Expand Down
10 changes: 8 additions & 2 deletions public/pages/workflows/import_workflow/import_workflow_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '../../../store';
import { FETCH_ALL_QUERY_BODY, Workflow } from '../../../../common';
import { WORKFLOWS_TAB } from '../workflows';
import { getDataSourceId } from '../../../utils/utils';
import { getDataSourceId } from '../../../utils/utils';

interface ImportWorkflowModalProps {
isImportModalOpen: boolean;
Expand All @@ -51,6 +51,9 @@ export function ImportWorkflowModal(props: ImportWorkflowModalProps) {
const dispatch = useAppDispatch();
const dataSourceId = getDataSourceId();

// transient importing state for button state
const [isImporting, setIsImporting] = useState<boolean>(false);

// file contents & file obj state
const [fileContents, setFileContents] = useState<string | undefined>(
undefined
Expand Down Expand Up @@ -133,8 +136,10 @@ export function ImportWorkflowModal(props: ImportWorkflowModalProps) {
<EuiModalFooter>
<EuiButtonEmpty onClick={() => onModalClose()}>Cancel</EuiButtonEmpty>
<EuiButton
disabled={!isValidWorkflow(fileObj)}
disabled={!isValidWorkflow(fileObj) || isImporting}
isLoading={isImporting}
onClick={() => {
setIsImporting(true);
dispatch(
createWorkflow({
apiBody: fileObj as Workflow,
Expand All @@ -159,6 +164,7 @@ export function ImportWorkflowModal(props: ImportWorkflowModalProps) {
getCore().notifications.toasts.addDanger(error);
})
.finally(() => {
setIsImporting(false);
onModalClose();
});
}}
Expand Down
7 changes: 4 additions & 3 deletions public/pages/workflows/workflow_list/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const columns = (actions: any[]) => {
{
field: 'name',
name: 'Name',
width: '33%',
width: '35%',
sortable: true,
render: (name: string, workflow: Workflow) => (
<EuiLink
Expand All @@ -40,13 +40,13 @@ export const columns = (actions: any[]) => {
{
field: 'ui_metadata.type',
name: 'Type',
width: '33%',
width: '20%',
sortable: true,
},
{
field: 'lastUpdated',
name: 'Last saved',
width: '33%',
width: '35%',
sortable: true,
render: (lastUpdated: number) =>
lastUpdated !== undefined
Expand All @@ -55,6 +55,7 @@ export const columns = (actions: any[]) => {
},
{
name: 'Actions',
width: '10%',
actions,
},
];
Expand Down

0 comments on commit 9b45d0e

Please sign in to comment.