Skip to content

Commit

Permalink
[fix] fix same know issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jxnkwlp committed Apr 25, 2022
1 parent 98a5235 commit 8b07c1b
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class WorkflowInstanceBasicDto : AuditedEntityDto<Guid>
public string Name { get; set; }
public int Version { get; set; }

public WorkflowStatus WorkflowStatus { get; set; }
// public WorkflowStatus WorkflowStatus { get; set; }
public int WorkflowStatus { get; set; }
public string CorrelationId { get; set; }
public string ContextType { get; set; }
public string ContextId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class WorkflowInstanceDto : AuditedEntityDto<Guid>
public string Name { get; set; }
public int Version { get; set; }

public WorkflowStatus WorkflowStatus { get; set; }
public int WorkflowStatus { get; set; }
public string CorrelationId { get; set; }
public string ContextType { get; set; }
public string ContextId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public override void ConfigureServices(ServiceConfigurationContext context)
{
options.UnsupportedTypes.AddIfNotContains(typeof(ActivityTypeDescriptorListResultDto));
options.UnsupportedTypes.AddIfNotContains(typeof(WorkflowInstanceDto));
options.UnsupportedTypes.AddIfNotContains(typeof(WorkflowInstanceBasicDto));
options.UnsupportedTypes.AddIfNotContains(typeof(PagedResultDto<WorkflowInstanceBasicDto>));
options.UnsupportedTypes.AddIfNotContains(typeof(ListResultDto<WorkflowExecutionLogDto>));
options.UnsupportedTypes.AddIfNotContains(typeof(WorkflowDefinitionVersionCreateOrUpdateDto));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public class ElsaEFJsonValueConverter<TModel> : ValueConverter<TModel, string>
static ElsaEFJsonValueConverter()
{
JsonSerializerSettings.Converters.Add(new TypeJsonConverter());
JsonSerializerSettings.Error += (e, s) =>
{
// ignore error
s.ErrorContext.Handled = true;
};
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
import { WorkflowPersistenceBehavior } from '@/services/enums';
import { ProFormText, ProFormTextArea, ProFormSwitch, ProFormSelect } from '@ant-design/pro-form';
import { isNumber } from 'lodash';

const EditFormItems: React.FC = () => {
return (
<>
<ProFormText label="Name" name="name" rules={[{ required: true }, { max: 16 }]} />
<ProFormText label="Name" name="name" rules={[{ required: true }, { max: 32 }]} />
<ProFormText
label="Display Name"
name="displayName"
rules={[{ required: true }, { max: 16 }]}
rules={[{ required: true }, { max: 64 }]}
/>
<ProFormTextArea
label="Description"
name="description"
fieldProps={{ rows: 2, autoSize: { minRows: 2, maxRows: 5 } }}
rules={[{ max: 64 }]}
rules={[{ max: 128 }]}
/>
<ProFormSwitch label="Singleton" name="isSingleton" />
<ProFormText label="Tag" name="tag" />
<ProFormSelect
label="Persistence Behavior"
name="persistenceBehavior"
options={Object.entries(WorkflowPersistenceBehavior).map(([key, value]) => ({
label: value,
value: key,
}))}
request={async () => {
return Object.keys(WorkflowPersistenceBehavior)
.filter((x) => parseInt(x) >= 0)
.map((key) => {
return {
value: parseInt(key),
label: WorkflowPersistenceBehavior[key],
};
});
}}
initialValue={WorkflowPersistenceBehavior.WorkflowBurst}
/>
{/* <ProFormTextArea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ const MonacorEditorInput: React.FC<MonacorEditorInputProps> = (props) => {
}
id={props.id}
style={{ width: currentSize?.w, height: currentSize?.h }}
onKeyDown={(e) => {
// keyCode: 27
if (e.code == 'Escape') {
if (isFullscreen) {
handleToggleFullScreen();
}
e.preventDefault();
e.stopPropagation();
}
}}
>
<MonacoEditor
ref={ref}
Expand Down
25 changes: 19 additions & 6 deletions src/Passingwind.ElsaDesigner/src/pages/designer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,22 @@ const Index: React.FC = () => {
}

if (result) {
if (id) {
message.success('Save successed. version: ' + result.version);
if (publish) {
message.success('Publish workflow success. version: ' + result.version);
} else {
message.success('Create successed.');
message.success('Save draft successed. version: ' + result.version);
}
// new
if (!id) {
// message.success('Create successed.');
history.replace(`/designer?id=${result.definition?.id}`);
}

setId(result.definition!.id);
setVersion(result.version!);
//
setDefinitionVersion(result);
setDefinition(result.definition);
}

setSubmiting(false);
Expand Down Expand Up @@ -437,9 +444,10 @@ const Index: React.FC = () => {
<Col flex={1} className="title-bar">
<Typography.Text>
{definition?.name}{' '}
<Tag>
<Tooltip title={'Current Version'}>{version}</Tooltip>
</Tag>
<Tag>Draft :{definition?.latestVersion ?? 1}</Tag>
{definition?.publishedVersion && (
<Tag> Published :{definition?.publishedVersion}</Tag>
)}
</Typography.Text>
</Col>
<Col>
Expand Down Expand Up @@ -532,6 +540,7 @@ const Index: React.FC = () => {
actionRef={flowAction}
graphData={graphData}
onNodeDoubleClick={handleOnShowNodeEditForm}
height={800}
/>
</Spin>
</Card>
Expand Down Expand Up @@ -618,17 +627,21 @@ const Index: React.FC = () => {
{
title: 'Latest',
dataIndex: 'isLatest',
align: 'center',
valueEnum: { true: { text: 'Y' }, false: { text: '-' } },
},
{
title: 'Published',
dataIndex: 'isPublished',
align: 'center',
valueEnum: { true: { text: 'Y' }, false: { text: '-' } },
},
{
title: 'Modification Time',
dataIndex: 'creationTime',
valueType: 'dateTime',
width: 160,
align: 'center',
renderText: (_, record) => {
return record.lastModificationTime ?? record.creationTime;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const NodePropForm: React.FC<NodePropFormProps> = (props) => {
<ProFormText
label="Display Name"
name="displayName"
rules={[{ required: false }, { max: 32 }]}
rules={[{ required: true }, { max: 32 }]}
/>
<ProFormTextArea
label="Description"
Expand Down
43 changes: 35 additions & 8 deletions src/Passingwind.ElsaDesigner/src/pages/instance/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { WorkflowStatus } from '@/services/enums';
import {
getWorkflowInstanceList,
workflowInstanceCancel,
Expand All @@ -15,10 +16,10 @@ const Index: React.FC = () => {

const history = useHistory();

const [editModalVisible, setEditModalVisible] = useState<boolean>(false);
const [editModalTitle, setEditModalTitle] = useState<string>('');
const [editModalData, setEditModalData] = useState<API.WorkflowInstance>();
const [editModalDataId, setEditModalDataId] = useState<string>();
// const [editModalVisible, setEditModalVisible] = useState<boolean>(false);
// const [editModalTitle, setEditModalTitle] = useState<string>('');
// const [editModalData, setEditModalData] = useState<API.WorkflowInstance>();
// const [editModalDataId, setEditModalDataId] = useState<string>();

// const [searchKey, setSearchKey] = useState<string>();

Expand Down Expand Up @@ -54,6 +55,32 @@ const Index: React.FC = () => {
dataIndex: 'workflowStatus',
title: 'Status',
// valueEnum: enumToStatus(WorkflowStatus),
valueEnum: {
[WorkflowStatus.Idle]: {
text: WorkflowStatus[WorkflowStatus.Idle],
status: 'default',
},
[WorkflowStatus.Running]: {
text: WorkflowStatus[WorkflowStatus.Running],
status: 'processing',
},
[WorkflowStatus.Finished]: {
text: WorkflowStatus[WorkflowStatus.Finished],
status: 'success',
},
[WorkflowStatus.Suspended]: {
text: WorkflowStatus[WorkflowStatus.Suspended],
status: 'warning',
},
[WorkflowStatus.Faulted]: {
text: WorkflowStatus[WorkflowStatus.Faulted],
status: 'error',
},
[WorkflowStatus.Cancelled]: {
text: WorkflowStatus[WorkflowStatus.Cancelled],
status: 'default',
},
},
},
{
title: 'Creation Time',
Expand Down Expand Up @@ -106,9 +133,9 @@ const Index: React.FC = () => {
});
}}
>
{(record.workflowStatus == 'Idle' ||
record.workflowStatus == 'Running' ||
record.workflowStatus == 'Suspended') && <span>Cancel</span>}
{(record.workflowStatus == WorkflowStatus.Idle ||
record.workflowStatus == WorkflowStatus.Running ||
record.workflowStatus == WorkflowStatus.Suspended) && <span>Cancel</span>}
</a>,
<a
key="retry"
Expand All @@ -126,7 +153,7 @@ const Index: React.FC = () => {
});
}}
>
{record.workflowStatus == 'Faulted' && <span>Retry</span>}
{record.workflowStatus == WorkflowStatus.Faulted && <span>Retry</span>}
</a>,
],
},
Expand Down
10 changes: 9 additions & 1 deletion src/Passingwind.ElsaDesigner/src/services/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ export const enumToStatus = (value: any) => {
},
};
});
console.log(result);
return result;
};

// export const enumToRecord = (value: any) => {
// return Object.keys(value)
// .filter((x) => parseInt(x) >= 0)
// .map((key) => {
// const v = parseInt(key);
// return [v]:value[key]
// });
// };

0 comments on commit 8b07c1b

Please sign in to comment.