Skip to content

Fc/clound #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e1737c3
钉钉通知组件文案修改
Feb 3, 2023
2ed9cc3
trigger组件文案修改
Feb 3, 2023
e23e213
trigger组件严格模式数据优化
Feb 7, 2023
efb4bb4
严格模式 tag类型初始化数据回填逻辑修改
Feb 7, 2023
cb6a1b2
优化trigger组件数据格式转化逻辑
Feb 7, 2023
94cedb3
trigger组件标准模式改造
Feb 8, 2023
ada08ea
trigger组件 完善标准模式改造
Feb 8, 2023
91a167c
Merge pull request #1 from g-fengchen/fc/dev
g-fengchen Feb 8, 2023
976ffc1
Merge branch 'main' of github.com:g-fengchen/ui
Feb 13, 2023
6f29f2f
钉钉组件:新增自定义信息校验,提示文案改为外部传入的形式
Feb 13, 2023
a73f7cd
新增环境变量组件
Feb 13, 2023
5fa1ffc
环境组件:修改创建、删除逻辑
Feb 21, 2023
69738d2
trigger组件:新增preview组件
Feb 21, 2023
ee70fcb
trigger:previewFormaData逻辑修改
Feb 22, 2023
3861c61
Merge branch 'main' into fc/dev
g-fengchen Feb 22, 2023
c8c9587
新增步骤条组件
Feb 24, 2023
054d0d9
钉钉组件修改
Feb 24, 2023
303a285
trigger 组件修改
Feb 27, 2023
5a83c48
步骤组件修改
Feb 27, 2023
f72b43b
Merge branch 'main' into main
g-fengchen Feb 27, 2023
fc03d97
钉钉组件文案修改
Feb 28, 2023
2a86142
Merge branch 'main' into main
g-fengchen Feb 28, 2023
c376b53
appCard readme 组件国际话处理、新增visiable 字段可外部直接打开slide
Mar 1, 2023
3181ff0
Merge branch 'serverless-cd:main' into main
g-fengchen Mar 3, 2023
2ee938a
trigger组件文案修改、新增自定义分支下拉框value渲染、分支下拉框disable 属性配置
Mar 9, 2023
55961e7
步骤组件: 新增子任务执行成功的样式、支持全局重试类型
Mar 13, 2023
f026d41
步骤组件:update version 0.0.3
Mar 13, 2023
c7c14b4
步骤组件:新增配置帮助信息项
Mar 16, 2023
40eec3b
新增资源组件
Mar 21, 2023
2e7f570
资源组件:新增服务、函数配置
Mar 21, 2023
dd7a551
创建流程组件修改
Mar 22, 2023
f3dd18c
流程组件修改
Mar 28, 2023
797878c
资源组件修改
Mar 30, 2023
cd637ab
创建流程组件:md修改
Mar 30, 2023
4512e5b
组件兼容cd项目样式
Apr 6, 2023
96b3ffd
流程组件修改
Apr 17, 2023
beb5ba3
Merge branch 'fc/clound' of github.com:g-fengchen/ui into fc/clound
Apr 17, 2023
04296e0
云账号新增回填逻辑
Apr 18, 2023
347f45a
fix: runtime 逻辑修改
Jun 1, 2023
3e54a80
s.yaml 配置层 逻辑修改
Jun 12, 2023
6c00b62
s.yaml args 字段名修改
Jun 12, 2023
d728b39
update package version
Jun 12, 2023
10eb8b9
fix: 白屏化 构建命令
Jun 14, 2023
9a4df04
codeU riUri
Jun 15, 2023
7067b4e
钉钉通知和环境变量修改
Sep 4, 2023
348c830
修复资源选项js报错
Sep 19, 2023
4ef4e8a
update style
Oct 13, 2023
b4a5ec0
fix: 样式修改
Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dingtalk-ui/.fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
// more father 4 config: https://github.com/umijs/father-next/blob/master/docs/config.md
esm: {},
};
2 changes: 1 addition & 1 deletion packages/creating-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@serverless-cd/creating-ui",
"version": "0.0.3",
"version": "0.0.8",
"scripts": {
"start": "dumi dev",
"docs:build": "dumi build",
Expand Down
40 changes: 34 additions & 6 deletions packages/creating-ui/src/components/StepContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ type Props = {
isSuspend?: boolean;
currentTask: Request;
onRetry: () => void;
onResume: () => void;
showRetry: boolean;
isChild?: boolean;
isExecutePendingTask: boolean;
resumeText?: string;
};

const StepContent = (props: Props) => {
Expand All @@ -19,38 +22,63 @@ const StepContent = (props: Props) => {
currentTask = {} as any,
isSuspend,
onRetry,
onResume,
showRetry,
isChild = false,
isExecutePendingTask = false,
resumeText,
} = props;

const className = isChild ? 'mt-4' : '';

const currentTaskStatusRender = (task) => {
const statusRender = {
pending: (
<div className={className}>
{!isExecutePendingTask ? task.title : task.runningMsg || task.title}
{!isExecutePendingTask && (
<span className="ml-8 cursor-pointer color-primary" onClick={onResume}>
{resumeText || '立即执行'}
</span>
)}
</div>
),
wait: <div className={className}>{task.runningMsg || task.title}</div>,
};
return statusRender[task.runStatus];
};

return (
<>
{map(tasks, (task) => {
if (task.runStatus === 'finish')
return (
<div className={isChild ? 'color-success' : ''}> {task.successMsg || task.title} </div>
<div className={isChild ? `color-success` : className}>
{task.successMsg || task.title}
</div>
);
if (currentTask.key === task.key) {
return (
<>
{isSuspend ? (
<div>
<span className="color-error">{task.errorMsg}</span>
<div className={className}>
<span className="color-error">{task.errorMsg || task.title}</span>
{showRetry && (
<Icon
className="ml-8 cursor-pointer"
type="refresh"
size="xs"
size="small"
onClick={onRetry}
/>
)}
</div>
) : (
<div> {task.runningMsg || task.title} </div>
currentTaskStatusRender(currentTask)
)}
</>
);
}
return <div>{task.title}</div>;
return <div className={className}>{task.title}</div>;
})}
</>
);
Expand Down
86 changes: 73 additions & 13 deletions packages/creating-ui/src/components/StepTask/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,81 @@ import { Step, Icon } from '@alicloud/console-components';
import { size, find, map, isEmpty, get } from 'lodash';
import StepContent from '../StepContent';
import { Request } from '../../constants';
import { onTaskOrderContrast } from '../../utils/util';
import '../../index.less';

type Props = {
stepList: Request[];
isSuspend?: boolean;
count?: number;
onRetry: () => void;
onResume: () => void;
showRetry?: boolean;
isExecutePendingTask?: boolean;
resumeText?: string;
};
const StepTask = (props: Props) => {
const { stepList, isSuspend, count, onRetry, showRetry } = props;
const { found, current, currentTask } = useMemo(() => {
const found: any = find(stepList, { runStatus: 'wait' });
const current = !isEmpty(found) ? found?.index : size(stepList);
const currentTask = find(found?.tasks, { runStatus: 'wait' });
return { current, currentTask, found };
}, [stepList]);
const {
stepList,
isSuspend,
count,
onRetry,
onResume,
showRetry,
isExecutePendingTask,
resumeText,
} = props;

const getTaskInfo = (values) => {
const found: any = find(values, { runStatus: 'wait' });
const pendingFound: any = find(values, { runStatus: 'pending' });
const isOrderFound = onTaskOrderContrast(found, pendingFound);
const currentIndex =
(!isEmpty(found) && isOrderFound) || isEmpty(pendingFound)
? getCurrentIndex(found, values)
: getCurrentIndex(pendingFound, values);
const currentFound =
(!isEmpty(found) && isOrderFound) || isEmpty(pendingFound) ? found : pendingFound;
const task = find(found?.tasks, { runStatus: 'wait' });
const pendingTask = find(found?.tasks, { runStatus: 'pending' });
const isOrderTask = onTaskOrderContrast(task, pendingTask);
const currentTask =
(!isEmpty(task) && isOrderTask) || isEmpty(pendingTask) ? task : pendingTask;

return { currentIndex, currentTask, currentFound };
};

const getCurrentIndex = (task, values) => {
return !isEmpty(task) ? task?.index : size(values);
};
const { currentFound, currentIndex, currentTask } = useMemo(
() => getTaskInfo(stepList),
[stepList],
);

const itemRender = (index, status) => {
switch (status) {
case 'process':
if (index === current && isSuspend)
if (index === currentIndex && isSuspend)
return <Icon size="small" type="error" className="mt-3" />;
if (index === currentIndex && currentFound.runStatus === 'pending' && !isExecutePendingTask)
return (
<svg
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="5166"
width="20"
height="20"
className="mt-5"
>
<path
d="M512 917.381727c-223.886093 0-405.381727-181.495634-405.381727-405.381727S288.113907 106.618273 512 106.618273s405.381727 181.495634 405.381727 405.381727S735.886093 917.381727 512 917.381727zM528.21531 498.606968l0-278.482549-32.43062 0 0 291.834648-0.040932 0.040932 206.386534 206.386534 22.932292-22.932292L528.21531 498.606968z"
p-id="5167"
fill="#cccccc"
></path>
</svg>
);
return <Icon size="small" type="loading" className="mt-3" />;
case 'finish':
return <Icon size="small" type="success" className="mt-3" />;
Expand All @@ -51,7 +103,7 @@ const StepTask = (props: Props) => {
};
return (
<div className="mt-16 application-container-step">
<Step itemRender={itemRender} current={current} direction="ver" animation={false}>
<Step itemRender={itemRender} current={currentIndex} direction="ver" animation={false}>
{map(stepList, (item: Request, index) => {
const tasks = get(item, 'tasks', []);
return (
Expand All @@ -61,14 +113,19 @@ const StepTask = (props: Props) => {
<div style={{ display: 'flex', alignItems: 'center' }}>
<StepContent
tasks={[item]}
currentTask={found}
currentTask={currentFound}
isSuspend={isEmpty(tasks) ? isSuspend : false}
onRetry={onRetry}
onResume={onResume}
isExecutePendingTask={isExecutePendingTask}
resumeText={resumeText}
showRetry={showRetry}
/>
{count !== 0 && index === size(stepList) - 1 && current === size(stepList) && (
<>{count && <span className="color-error mr-8 ml-8">{`${count} s`}</span>}</>
)}
{count !== 0 &&
index === size(stepList) - 1 &&
currentIndex === size(stepList) && (
<>{count && <span className="color-error mr-8 ml-8">{`${count} s`}</span>}</>
)}
</div>
}
content={
Expand All @@ -78,6 +135,9 @@ const StepTask = (props: Props) => {
currentTask={currentTask}
isSuspend={isSuspend}
onRetry={onRetry}
onResume={onResume}
isExecutePendingTask={isExecutePendingTask}
resumeText={resumeText}
showRetry={showRetry}
/>
}
Expand Down
14 changes: 9 additions & 5 deletions packages/creating-ui/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
export type Props = {
dataSource: Request[];
runStatus?: status;
onError?: (error: any) => void;
onComplete?: (value: any) => void;
onCountdownComplete?: () => void;
onRetry?: () => void;
showRetry?: boolean;
countdown?: number;
retryType?: string;
resumeText?: string;
help?: string | HTMLElement;
};

export type Request = {
title: string;
title: string | any;
key: string;
runStatus?: status;
errorMsg?: string;
successMsg?: string;
runningMsg?: string;
errorMsg?: string | any;
successMsg?: string | any;
runningMsg?: string | any;
tasks?: Request[];
run?: (content: any) => void;
};

type status = 'wait' | 'finish';
type status = 'wait' | 'finish' | 'pending';
7 changes: 7 additions & 0 deletions packages/creating-ui/src/index.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.mt-3 {
margin-top: 3px;
}
.mt-4 {
margin-top: 4px;
}
.mr-8 {
margin-right: 8px;
}
Expand Down Expand Up @@ -66,3 +69,7 @@
.display-inline-block {
display: inline-block;
}

.color-primary {
color: #0064c8;
}
Loading