Skip to content

Commit 7f8d7fd

Browse files
committed
more cleanup after rebase
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent 0d330da commit 7f8d7fd

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

public/pages/workflows/import_workflow/import_workflow_modal.tsx

+9-13
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ import {
4444
WORKFLOW_NAME_RESTRICTIONS,
4545
} from '../../../../common';
4646
import { WORKFLOWS_TAB } from '../workflows';
47-
import { getDataSourceId, getEffectiveVersion, formatDisplayVersion } from '../../../utils/utils';
47+
import {
48+
getDataSourceId,
49+
formatDisplayVersion,
50+
useDataSourceVersion,
51+
} from '../../../utils/utils';
4852

4953
interface ImportWorkflowModalProps {
5054
isImportModalOpen: boolean;
@@ -62,17 +66,7 @@ interface ImportWorkflowModalProps {
6266
export function ImportWorkflowModal(props: ImportWorkflowModalProps) {
6367
const dispatch = useAppDispatch();
6468
const dataSourceId = getDataSourceId();
65-
const [dataSourceVersion, setDataSourceVersion] = useState<
66-
string | undefined
67-
>(undefined);
68-
useEffect(() => {
69-
async function getVersion() {
70-
if (dataSourceId !== undefined) {
71-
setDataSourceVersion(await getEffectiveVersion(dataSourceId));
72-
}
73-
}
74-
getVersion();
75-
}, [dataSourceId]);
69+
const dataSourceVersion = useDataSourceVersion(dataSourceId);
7670
const { workflows } = useSelector((state: AppState) => state.workflows);
7771

7872
// workflow name state
@@ -171,7 +165,9 @@ export function ImportWorkflowModal(props: ImportWorkflowModalProps) {
171165
<>
172166
<EuiFlexItem>
173167
<EuiCallOut
174-
title={`The uploaded file is not compatible with the current data source version ${formatDisplayVersion(dataSourceVersion)}. Upload a compatible file or switch to another data source.`}
168+
title={`The uploaded file is not compatible with the current data source version ${formatDisplayVersion(
169+
dataSourceVersion
170+
)}. Upload a compatible file or switch to another data source.`}
175171
iconType={'alert'}
176172
color="danger"
177173
/>

0 commit comments

Comments
 (0)