Skip to content

Commit

Permalink
added flow status
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshamoon committed Nov 17, 2023
1 parent a65afff commit d4b32e9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 22 deletions.
4 changes: 4 additions & 0 deletions src/containers/Flow/FlowList/FlowList.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,7 @@
.RadioLabel {
margin-right: 24px;
}

.ImportDialog {
max-width: 395px;
}
66 changes: 44 additions & 22 deletions src/containers/Flow/FlowList/FlowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { ImportButton } from 'components/UI/ImportButton/ImportButton';
import Loading from 'components/UI/Layout/Loading/Loading';
import { DATE_TIME_FORMAT } from 'common/constants';
import { exportFlowMethod, organizationHasDynamicRole } from 'common/utils';
import { setNotification } from 'common/notification';
import styles from './FlowList.module.css';
import { GET_TAGS } from 'graphql/queries/Tags';
import { AutoComplete } from 'components/UI/Form/AutoComplete/AutoComplete';
import { DialogBox } from 'components/UI/DialogBox/DialogBox';

const getName = (text: string, keywordsList: any, roles: any) => {
const keywords = keywordsList.map((keyword: any) => keyword);
Expand Down Expand Up @@ -82,6 +82,7 @@ export const FlowList = () => {
const [selectedtag, setSelectedTag] = useState<any>(null);
const [flowName, setFlowName] = useState('');
const [importing, setImporting] = useState(false);
const [importStatus, setImportStatus] = useState([]);

const [releaseFlow] = useLazyQuery(RELEASE_FLOW);

Expand All @@ -92,10 +93,7 @@ export const FlowList = () => {
const [importFlow] = useMutation(IMPORT_FLOW, {
onCompleted: (result: any) => {
const { status } = result.importFlow;
if (status) {
const statusValue = status.map((stat: any) => `${stat.flowName}: ${stat.status}`);
setNotification(t(statusValue.join('\n')));
}
setImportStatus(status);

Check warning on line 96 in src/containers/Flow/FlowList/FlowList.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/Flow/FlowList/FlowList.tsx#L95-L96

Added lines #L95 - L96 were not covered by tests
setImporting(false);
},
});
Expand All @@ -116,6 +114,27 @@ export const FlowList = () => {
setFlowName(item.name);
exportFlowMutation({ variables: { id } });
};
let dialog;

if (importStatus.length > 0) {
dialog = (

Check warning on line 120 in src/containers/Flow/FlowList/FlowList.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/Flow/FlowList/FlowList.tsx#L120

Added line #L120 was not covered by tests
<DialogBox
title="Import flow Status"
buttonOk="Okay"
alignButtons="center"
handleOk={() => setImportStatus([])}

Check warning on line 125 in src/containers/Flow/FlowList/FlowList.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/Flow/FlowList/FlowList.tsx#L125

Added line #L125 was not covered by tests
skipCancel
>
<div className={styles.ImportDialog}>
{importStatus.map((status: any) => (
<div>

Check warning on line 130 in src/containers/Flow/FlowList/FlowList.tsx

View check run for this annotation

Codecov / codecov/patch

src/containers/Flow/FlowList/FlowList.tsx#L130

Added line #L130 was not covered by tests
<strong>{status.flowName}:</strong> {status.status}
</div>
))}
</div>
</DialogBox>
);
}

const importButton = (
<ImportButton
Expand Down Expand Up @@ -256,23 +275,26 @@ export const FlowList = () => {
}

return (
<List
title={t('Flows')}
listItem="flows"
listItemName="flow"
pageLink="flow"
listIcon={flowIcon}
dialogMessage={dialogMessage}
{...queries}
{...columnAttributes}
searchParameter={['name_or_keyword_or_tags']}
additionalAction={additionalAction}
button={{ show: true, label: t('Create Flow'), symbol: '+' }}
secondaryButton={importButton}
filters={filters}
filterList={activeFilter}
filterDropdowm={tagFilter}
/>
<>
{dialog}
<List
title={t('Flows')}
listItem="flows"
listItemName="flow"
pageLink="flow"
listIcon={flowIcon}
dialogMessage={dialogMessage}
{...queries}
{...columnAttributes}
searchParameter={['name_or_keyword_or_tags']}
additionalAction={additionalAction}
button={{ show: true, label: t('Create Flow'), symbol: '+' }}
secondaryButton={importButton}
filters={filters}
filterList={activeFilter}
filterDropdowm={tagFilter}
/>
</>
);
};

Expand Down

0 comments on commit d4b32e9

Please sign in to comment.