Skip to content

Commit a7e493a

Browse files
committed
[feat] update designer
1 parent 3192efc commit a7e493a

File tree

20 files changed

+392
-761
lines changed

20 files changed

+392
-761
lines changed

src/Passingwind.ElsaDesigner/src/pages/auth/login/index.tsx

Lines changed: 3 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import React, { useState } from 'react';
1111
import { ProFormCaptcha, ProFormCheckbox, ProFormText, LoginForm } from '@ant-design/pro-form';
1212
import { useIntl, history, FormattedMessage, SelectLang, useModel } from 'umi';
1313
import Footer from '@/components/Footer';
14-
import { getFakeCaptcha } from '@/services/ant-design-pro/login';
1514

1615
import styles from './index.less';
1716
import { loginLogin } from '@/services/Login';
17+
import type { API } from '@/services/typings';
1818

1919
const LoginMessage: React.FC<{
2020
content: string;
@@ -46,7 +46,7 @@ const Login: React.FC = () => {
4646
}
4747
};
4848

49-
const handleSubmit = async (values: API.LoginParams) => {
49+
const handleSubmit = async (values) => {
5050
try {
5151
// 登录
5252
const msg = await loginLogin(values as API.UserLoginInfo);
@@ -57,10 +57,7 @@ const Login: React.FC = () => {
5757
});
5858
message.success(defaultLoginSuccessMessage);
5959
await fetchUserInfo();
60-
/** 此方法会跳转到 redirect 参数所在的位置 */
6160
if (!history) return;
62-
// const { query } = history.location;
63-
// const { redirect } = query as { redirect: string };
6461
history.push('/');
6562
return;
6663
} else {
@@ -71,8 +68,6 @@ const Login: React.FC = () => {
7168
message.error(msg.description ?? defaultLoginFailureMessage);
7269
}
7370
console.log(msg);
74-
// 如果失败去设置用户错误信息
75-
// setUserLoginState(msg);
7671
} catch (error) {
7772
const defaultLoginFailureMessage = intl.formatMessage({
7873
id: 'pages.login.failure',
@@ -91,21 +86,11 @@ const Login: React.FC = () => {
9186
<div className={styles.content}>
9287
<LoginForm
9388
logo={<img alt="logo" src="/logo.svg" />}
94-
title="Ant Design"
89+
title="Elsa Demo"
9590
subTitle={intl.formatMessage({ id: 'pages.layouts.userLayout.title' })}
9691
initialValues={{
9792
autoLogin: true,
9893
}}
99-
actions={[
100-
<FormattedMessage
101-
key="loginWith"
102-
id="pages.login.loginWith"
103-
defaultMessage="其他登录方式"
104-
/>,
105-
<AlipayCircleOutlined key="AlipayCircleOutlined" className={styles.icon} />,
106-
<TaobaoCircleOutlined key="TaobaoCircleOutlined" className={styles.icon} />,
107-
<WeiboCircleOutlined key="WeiboCircleOutlined" className={styles.icon} />,
108-
]}
10994
onFinish={async (values) => {
11095
await handleSubmit(values as API.LoginParams);
11196
}}
@@ -118,23 +103,8 @@ const Login: React.FC = () => {
118103
defaultMessage: '账户密码登录',
119104
})}
120105
/>
121-
{/* <Tabs.TabPane
122-
key="mobile"
123-
tab={intl.formatMessage({
124-
id: 'pages.login.phoneLogin.tab',
125-
defaultMessage: '手机号登录',
126-
})}
127-
/> */}
128106
</Tabs>
129107

130-
{status === 'error' && loginType === 'account' && (
131-
<LoginMessage
132-
content={intl.formatMessage({
133-
id: 'pages.login.accountLogin.errorMessage',
134-
defaultMessage: '账户或密码错误(admin/ant.design)',
135-
})}
136-
/>
137-
)}
138108
{type === 'account' && (
139109
<>
140110
<ProFormText
@@ -183,113 +153,6 @@ const Login: React.FC = () => {
183153
/>
184154
</>
185155
)}
186-
187-
{status === 'error' && loginType === 'mobile' && (
188-
<LoginMessage content="验证码错误" />
189-
)}
190-
{type === 'mobile' && (
191-
<>
192-
<ProFormText
193-
fieldProps={{
194-
size: 'large',
195-
prefix: <MobileOutlined className={styles.prefixIcon} />,
196-
}}
197-
name="mobile"
198-
placeholder={intl.formatMessage({
199-
id: 'pages.login.phoneNumber.placeholder',
200-
defaultMessage: '手机号',
201-
})}
202-
rules={[
203-
{
204-
required: true,
205-
message: (
206-
<FormattedMessage
207-
id="pages.login.phoneNumber.required"
208-
defaultMessage="请输入手机号!"
209-
/>
210-
),
211-
},
212-
{
213-
pattern: /^1\d{10}$/,
214-
message: (
215-
<FormattedMessage
216-
id="pages.login.phoneNumber.invalid"
217-
defaultMessage="手机号格式错误!"
218-
/>
219-
),
220-
},
221-
]}
222-
/>
223-
<ProFormCaptcha
224-
fieldProps={{
225-
size: 'large',
226-
prefix: <LockOutlined className={styles.prefixIcon} />,
227-
}}
228-
captchaProps={{
229-
size: 'large',
230-
}}
231-
placeholder={intl.formatMessage({
232-
id: 'pages.login.captcha.placeholder',
233-
defaultMessage: '请输入验证码',
234-
})}
235-
captchaTextRender={(timing, count) => {
236-
if (timing) {
237-
return `${count} ${intl.formatMessage({
238-
id: 'pages.getCaptchaSecondText',
239-
defaultMessage: '获取验证码',
240-
})}`;
241-
}
242-
return intl.formatMessage({
243-
id: 'pages.login.phoneLogin.getVerificationCode',
244-
defaultMessage: '获取验证码',
245-
});
246-
}}
247-
name="captcha"
248-
rules={[
249-
{
250-
required: true,
251-
message: (
252-
<FormattedMessage
253-
id="pages.login.captcha.required"
254-
defaultMessage="请输入验证码!"
255-
/>
256-
),
257-
},
258-
]}
259-
onGetCaptcha={async (phone) => {
260-
const result = await getFakeCaptcha({
261-
phone,
262-
});
263-
if (result === false) {
264-
return;
265-
}
266-
message.success('获取验证码成功!验证码为:1234');
267-
}}
268-
/>
269-
</>
270-
)}
271-
<div
272-
style={{
273-
marginBottom: 24,
274-
}}
275-
>
276-
<ProFormCheckbox noStyle name="autoLogin">
277-
<FormattedMessage
278-
id="pages.login.rememberMe"
279-
defaultMessage="自动登录"
280-
/>
281-
</ProFormCheckbox>
282-
<a
283-
style={{
284-
float: 'right',
285-
}}
286-
>
287-
<FormattedMessage
288-
id="pages.login.forgotPassword"
289-
defaultMessage="忘记密码"
290-
/>
291-
</a>
292-
</div>
293156
</LoginForm>
294157
</div>
295158
<Footer />

src/Passingwind.ElsaDesigner/src/pages/definition/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { Button, Form, message, Modal } from 'antd';
1616
import React, { useRef, useState } from 'react';
1717
import { useHistory } from 'umi';
1818
import EditFormItems from './edit-form-items';
19-
import { useForm } from 'antd/lib/form/Form';
2019

2120
const handleEdit = async (id: string, data: any) => {
2221
const response = await updateWorkflowDefinitionDefinition(id, data);

src/Passingwind.ElsaDesigner/src/pages/designer/service.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export const conventToServerData = (data: IGraphData) => {
355355
sourceId: item.source.cell,
356356
targetId: item.target.cell,
357357
outcome: item.name ?? item.outcome ?? 'Done',
358-
arrtibutes: {
358+
attributes: {
359359
sourcePort: item.source.port,
360360
targetPort: item.target.port,
361361
},
@@ -378,7 +378,7 @@ export const conventToServerData = (data: IGraphData) => {
378378
displayName: item.label ?? item.displayName,
379379
description: item.description,
380380
properties: item.properties,
381-
arrtibutes: {
381+
attributes: {
382382
x: Math.round(item.position?.x ?? 0),
383383
y: Math.round(item.position?.y ?? 0),
384384
outcomes: outcomes,
@@ -405,10 +405,10 @@ export const conventToGraphData = async (
405405
shape: 'activity', // TODO
406406
id: item.activityId,
407407
// @ts-ignore
408-
x: parseInt(item.arrtibutes?.x ?? 0),
408+
x: parseInt(item.attributes?.x ?? 0),
409409
// @ts-ignore
410-
y: parseInt(item.arrtibutes?.y ?? 0),
411-
outcomes: item.arrtibutes?.outcomes ?? [],
410+
y: parseInt(item.attributes?.y ?? 0),
411+
outcomes: item.attributes?.outcomes ?? [],
412412
label: item.displayName ?? item.type,
413413
//
414414
// data: {
@@ -432,7 +432,7 @@ export const conventToGraphData = async (
432432
connections.forEach((item) => {
433433
const sourceId = item.sourceId;
434434
const targetId = item.targetId;
435-
const attr = item.arrtibutes ?? {};
435+
const attr = item.attributes ?? {};
436436

437437
// check source
438438
if (

src/Passingwind.ElsaDesigner/src/pages/instance/detail.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { WorkflowStatus } from '@/services/enums';
2+
import type { API } from '@/services/typings';
23
import { getWorkflowDefinitionVersion } from '@/services/WorkflowDefinition';
34
import { getWorkflowInstance, getWorkflowInstanceExecutionLogs } from '@/services/WorkflowInstance';
45
import { ClockCircleOutlined } from '@ant-design/icons';
@@ -79,7 +80,7 @@ const Index: React.FC = () => {
7980
return;
8081
}
8182

82-
await loadWorkflowDefinition(result.definitionId!, result.version!);
83+
await loadWorkflowDefinition(result.workflowDefinitionId!, result.version!);
8384

8485
setLoading(false);
8586
};

src/Passingwind.ElsaDesigner/src/services/AbpApiDefinition.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
/**
1+
/**
22
* Generate from swagger json url: https://localhost:44324/swagger/v1/swagger.json
33
* It is recommended not to modify the document
44
* Total count: 1
55
**/
66
// @ts-ignore
77
/* eslint-disable */
8+
import type { API } from "./typings";
89
import { request } from 'umi';
910

1011
/**
11-
* *TODO* GET /api/abp/api-definition
12-
*
12+
* *TODO* GET /api/abp/api-definition
1313
**/
1414
export async function getAbpApiDefinition(
1515
params: {

src/Passingwind.ElsaDesigner/src/services/AbpApplicationConfiguration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
/**
1+
/**
22
* Generate from swagger json url: https://localhost:44324/swagger/v1/swagger.json
33
* It is recommended not to modify the document
44
* Total count: 1
55
**/
66
// @ts-ignore
77
/* eslint-disable */
8+
import type { API } from "./typings";
89
import { request } from 'umi';
910

1011
/**
11-
* *TODO* GET /api/abp/application-configuration
12-
*
12+
* *TODO* GET /api/abp/application-configuration
1313
**/
1414
export async function getAbpApplicationConfiguration(
1515
options?: { [key: string]: any }

src/Passingwind.ElsaDesigner/src/services/AbpTenant.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
/**
1+
/**
22
* Generate from swagger json url: https://localhost:44324/swagger/v1/swagger.json
33
* It is recommended not to modify the document
44
* Total count: 2
55
**/
66
// @ts-ignore
77
/* eslint-disable */
8+
import type { API } from "./typings";
89
import { request } from 'umi';
910

1011
/**
11-
* *TODO* GET /api/abp/multi-tenancy/tenants/by-name/{name}
12-
*
12+
* *TODO* GET /api/abp/multi-tenancy/tenants/by-id/{id}
1313
**/
14-
export async function abpTenantFindTenantByName(
15-
name: string,
14+
export async function abpTenantFindTenantById(
15+
id: string,
1616
options?: { [key: string]: any }
1717
) {
18-
return request<API.FindTenantResult>(`/api/abp/multi-tenancy/tenants/by-name/${name}`, {
18+
return request<API.FindTenantResult>(`/api/abp/multi-tenancy/tenants/by-id/${id}`, {
1919
method: 'GET',
2020
...(options || {}),
2121
});
2222
}
2323

2424
/**
25-
* *TODO* GET /api/abp/multi-tenancy/tenants/by-id/{id}
26-
*
25+
* *TODO* GET /api/abp/multi-tenancy/tenants/by-name/{name}
2726
**/
28-
export async function abpTenantFindTenantById(
29-
id: string,
27+
export async function abpTenantFindTenantByName(
28+
name: string,
3029
options?: { [key: string]: any }
3130
) {
32-
return request<API.FindTenantResult>(`/api/abp/multi-tenancy/tenants/by-id/${id}`, {
31+
return request<API.FindTenantResult>(`/api/abp/multi-tenancy/tenants/by-name/${name}`, {
3332
method: 'GET',
3433
...(options || {}),
3534
});

src/Passingwind.ElsaDesigner/src/services/Designer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
/**
1+
/**
22
* Generate from swagger json url: https://localhost:44324/swagger/v1/swagger.json
33
* It is recommended not to modify the document
44
* Total count: 2
55
**/
66
// @ts-ignore
77
/* eslint-disable */
8+
import type { API } from "./typings";
89
import { request } from 'umi';
910

1011
/**
11-
* *TODO* GET /api/designer/activity-types
12-
*
12+
* *TODO* GET /api/designer/activity-types
1313
**/
1414
export async function getDesignerActivityTypes(
1515
options?: { [key: string]: any }
@@ -21,8 +21,7 @@ export async function getDesignerActivityTypes(
2121
}
2222

2323
/**
24-
* *TODO* GET /api/designer/script-type-definitions/{id}
25-
*
24+
* *TODO* GET /api/designer/script-type-definitions/{id}
2625
**/
2726
export async function getDesignerScriptTypeDefinition(
2827
id: string,

0 commit comments

Comments
 (0)