Merge pull request #1050 from automatisch/add-virtual-flow-status

feat(flow): add virtual paused/published/draft status
This commit is contained in:
Ömer Faruk Aydın
2023-04-11 17:04:32 +02:00
committed by GitHub
12 changed files with 110 additions and 64 deletions

View File

@@ -18,6 +18,26 @@ type FlowRowProps = {
flow: IFlow;
};
function getFlowStatusTranslationKey(status: IFlow["status"]): string {
if (status === 'published') {
return 'flow.published';
} else if (status === 'paused') {
return 'flow.paused';
}
return 'flow.draft';
}
function getFlowStatusColor(status: IFlow["status"]): 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' {
if (status === 'published') {
return 'success';
} else if (status === 'paused') {
return 'error';
}
return 'info';
}
export default function FlowRow(props: FlowRowProps): React.ReactElement {
const formatMessage = useFormatMessage();
const contextButtonRef = React.useRef<HTMLButtonElement | null>(null);
@@ -76,10 +96,10 @@ export default function FlowRow(props: FlowRowProps): React.ReactElement {
<ContextMenu>
<Chip
size="small"
color={flow?.active ? 'success' : 'info'}
color={getFlowStatusColor(flow?.status)}
variant={flow?.active ? 'filled' : 'outlined'}
label={formatMessage(
flow?.active ? 'flow.published' : 'flow.draft'
getFlowStatusTranslationKey(flow?.status)
)}
/>

View File

@@ -6,6 +6,7 @@ export const GET_FLOW = gql`
id
name
active
status
steps {
id
type

View File

@@ -26,6 +26,7 @@ export const GET_FLOWS = gql`
createdAt
updatedAt
active
status
steps {
iconUrl
}

View File

@@ -43,6 +43,7 @@
"flow.active": "ON",
"flow.inactive": "OFF",
"flow.published": "Published",
"flow.paused": "Paused",
"flow.draft": "Draft",
"flow.successfullyDeleted": "The flow and associated executions have been deleted.",
"flowEditor.publish": "PUBLISH",