@devops-flow/devops-flow-pipeline-detail 0.0.50 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PipelineFlowDetail.css +1 -1
- package/dist/PipelineFlowDetail.js +14 -14
- package/es/components/common/teambition/flow-job-btn/cardsMap.d.ts +2 -1
- package/es/components/common/teambition/flow-job-btn/cardsMap.js +33 -3
- package/es/components/common/teambition/flow-job-btn/execute-button/index.js +10 -4
- package/es/components/common/teambition/flow-job-btn/link/index.d.ts +1 -1
- package/es/components/common/teambition/flow-job-btn/link/index.js +7 -3
- package/es/components/common/teambition/flow-job-btn/log-btn/index.js +90 -128
- package/es/components/common/teambition/flow-job-btn/replaceHost.d.ts +1 -0
- package/es/components/common/teambition/flow-job-btn/replaceHost.js +10 -0
- package/es/components/common/teambition/flow-job-btn/stat-info-s-common/common.js +8 -2
- package/es/components/common/teambition/flow-job-btn/state-info/index.js +7 -15
- package/es/components/common/teambition/flow-job-new/index.js +10 -4
- package/es/components/common/teambition/flow-job-runtime-menu/index.scss +1 -0
- package/es/components/common/teambition/pipeline-instance-new/SourceElement.js +1 -1
- package/es/components/common/teambition/pipeline-instance-new/StatusBar.js +2 -2
- package/es/components/common/teambition/pipeline-instance-new/source.js +4 -2
- package/es/components/detailMain/current/index.js +9 -12
- package/es/components/detailMain/recent/index.js +3 -3
- package/es/contexts/config.d.ts +5 -1
- package/es/contexts/config.js +7 -1
- package/es/index.js +5 -4
- package/es/style.js +0 -1
- package/es/utils/api/index.d.ts +18 -6
- package/es/utils/api/index.js +59 -30
- package/es/utils/index.js +10 -8
- package/package.json +1 -1
- package/dist/1.css +0 -1
- package/dist/1.js +0 -24
- package/dist/2.css +0 -1
- package/dist/2.js +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const ExecuteableButtons: string[];
|
|
2
|
-
export declare const buildButtonComponentWrapper: ({ displayType, mode, isAdmin, ...props }: {
|
|
2
|
+
export declare const buildButtonComponentWrapper: ({ displayType, type, mode, isAdmin, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
displayType: any;
|
|
5
|
+
type: any;
|
|
5
6
|
mode: any;
|
|
6
7
|
isAdmin?: boolean;
|
|
7
8
|
}) => (restProps: any) => any;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["displayType", "mode", "isAdmin"],
|
|
3
|
+
var _excluded = ["displayType", "type", "mode", "isAdmin"],
|
|
4
4
|
_excluded2 = ["displayType", "type"];
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useContext } from 'react';
|
|
6
6
|
import ExecuteButton from "./execute-button";
|
|
7
7
|
import LogButton from "./log-btn";
|
|
8
8
|
import AuiTestSummaryButton from "./aui-test-summary";
|
|
@@ -24,13 +24,41 @@ import DebugButton from "./debug-button";
|
|
|
24
24
|
import ReleaseOrderButton from "./release-order";
|
|
25
25
|
import ChangeInfoButton from "./change-info-btn";
|
|
26
26
|
import { getFeature } from "../../../../utils";
|
|
27
|
+
import ConfigContext from "../../../../contexts/config";
|
|
27
28
|
export var ExecuteableButtons = ['EXECUTE'];
|
|
28
29
|
export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_ref) {
|
|
29
30
|
var displayType = _ref.displayType,
|
|
31
|
+
type = _ref.type,
|
|
30
32
|
mode = _ref.mode,
|
|
31
33
|
_ref$isAdmin = _ref.isAdmin,
|
|
32
34
|
isAdmin = _ref$isAdmin === void 0 ? false : _ref$isAdmin,
|
|
33
35
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
36
|
+
var globalConfig = useContext(ConfigContext);
|
|
37
|
+
var _globalConfig$replace = globalConfig.replaceLinks,
|
|
38
|
+
reportLinkHost = _globalConfig$replace.report,
|
|
39
|
+
scanLinkHost = _globalConfig$replace.scan;
|
|
40
|
+
|
|
41
|
+
// 独立组件的后端返回数据格式,和 Flow 不一致,需要要type类型判断,返回结果一样
|
|
42
|
+
if (type === 'LINK') {
|
|
43
|
+
return function (restProps) {
|
|
44
|
+
var Button = LinkButton[mode];
|
|
45
|
+
return Button ? /*#__PURE__*/React.createElement(Button, _extends({}, props, restProps, {
|
|
46
|
+
text: true,
|
|
47
|
+
id: restProps.key,
|
|
48
|
+
reportLinkHost: reportLinkHost
|
|
49
|
+
})) : null;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (type === 'STAT_INFO') {
|
|
53
|
+
return function (restProps) {
|
|
54
|
+
var button = StateInfoButton[mode];
|
|
55
|
+
// 这个 Button 返回数组,不能当成 react 组件用
|
|
56
|
+
return button ? button(_extends({}, props, restProps, {
|
|
57
|
+
id: restProps.key,
|
|
58
|
+
scanLinkHost: scanLinkHost
|
|
59
|
+
})) : null;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
34
62
|
if (!displayType) {
|
|
35
63
|
return function () {
|
|
36
64
|
return null;
|
|
@@ -41,6 +69,7 @@ export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_r
|
|
|
41
69
|
return function (restProps) {
|
|
42
70
|
var Button = ExecuteButton[mode];
|
|
43
71
|
return Button ? /*#__PURE__*/React.createElement(Button, _extends({}, props, restProps, {
|
|
72
|
+
type: type,
|
|
44
73
|
id: restProps.key
|
|
45
74
|
})) : null;
|
|
46
75
|
};
|
|
@@ -78,7 +107,8 @@ export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_r
|
|
|
78
107
|
var button = StateInfoButton[mode];
|
|
79
108
|
// 这个 Button 返回数组,不能当成 react 组件用
|
|
80
109
|
return button ? button(_extends({}, props, restProps, {
|
|
81
|
-
id: restProps.key
|
|
110
|
+
id: restProps.key,
|
|
111
|
+
scanLinkHost: scanLinkHost
|
|
82
112
|
})) : null;
|
|
83
113
|
};
|
|
84
114
|
case 'STAT_INFO_WITH_REDLINES':
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useContext, useState } from 'react';
|
|
2
2
|
import { Button } from '@teamix/ui';
|
|
3
3
|
import { locale } from "../../../../../utils";
|
|
4
4
|
import { BaiscIconFont } from "../../icon-font";
|
|
5
5
|
import { YunxiaoIcon } from '@alife/devops-ui';
|
|
6
6
|
import intl from "../../../../../locale";
|
|
7
7
|
import { callApiAndRefresh, RetryPipelineJobRun, SkipPipelineJobRun, StopPipelineJobRun } from "../../../../../utils/api";
|
|
8
|
+
import ConfigContext from "../../../../../contexts/config";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* 执行按钮
|
|
@@ -33,6 +34,8 @@ var ExecuteButton = function ExecuteButton(_ref) {
|
|
|
33
34
|
var _useState2 = useState(disable),
|
|
34
35
|
disabled = _useState2[0],
|
|
35
36
|
setDisabled = _useState2[1];
|
|
37
|
+
var globalConfig = useContext(ConfigContext);
|
|
38
|
+
var apiHost = globalConfig.replaceLinks.api;
|
|
36
39
|
var doCallApiAndRefresh = function doCallApiAndRefresh(apiFunc, params) {
|
|
37
40
|
return callApiAndRefresh(apiFunc, params, onRefresh, setLoading, setDisabled, name);
|
|
38
41
|
};
|
|
@@ -47,7 +50,8 @@ var ExecuteButton = function ExecuteButton(_ref) {
|
|
|
47
50
|
doCallApiAndRefresh(RetryPipelineJobRun, {
|
|
48
51
|
pipelineId: pipelineId,
|
|
49
52
|
pipelineRunId: pipelineRunId,
|
|
50
|
-
jobId: job.id
|
|
53
|
+
jobId: job.id,
|
|
54
|
+
host: apiHost
|
|
51
55
|
});
|
|
52
56
|
break;
|
|
53
57
|
}
|
|
@@ -56,7 +60,8 @@ var ExecuteButton = function ExecuteButton(_ref) {
|
|
|
56
60
|
doCallApiAndRefresh(SkipPipelineJobRun, {
|
|
57
61
|
pipelineId: pipelineId,
|
|
58
62
|
pipelineRunId: pipelineRunId,
|
|
59
|
-
jobId: job.id
|
|
63
|
+
jobId: job.id,
|
|
64
|
+
host: apiHost
|
|
60
65
|
});
|
|
61
66
|
break;
|
|
62
67
|
}
|
|
@@ -65,7 +70,8 @@ var ExecuteButton = function ExecuteButton(_ref) {
|
|
|
65
70
|
doCallApiAndRefresh(StopPipelineJobRun, {
|
|
66
71
|
pipelineId: pipelineId,
|
|
67
72
|
pipelineRunId: pipelineRunId,
|
|
68
|
-
jobId: job.id
|
|
73
|
+
jobId: job.id,
|
|
74
|
+
host: apiHost
|
|
69
75
|
});
|
|
70
76
|
break;
|
|
71
77
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Button } from '@teamix/ui';
|
|
3
3
|
import { BaiscIconFont as Icon } from "../../icon-font";
|
|
4
|
-
import {
|
|
4
|
+
import { replaceHostWithBase } from "../replaceHost";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 按钮实现模板
|
|
8
|
-
*/
|
|
8
|
+
*/
|
|
9
9
|
var LinkButton = function LinkButton(props) {
|
|
10
|
+
var url = props.params.url;
|
|
11
|
+
if (props.reportLinkHost) {
|
|
12
|
+
url = replaceHostWithBase(props.params.url, props.reportLinkHost);
|
|
13
|
+
}
|
|
10
14
|
return /*#__PURE__*/React.createElement(Button, {
|
|
11
15
|
key: props.id,
|
|
12
16
|
onClick: function onClick() {
|
|
13
|
-
return window.open(
|
|
17
|
+
return window.open(url);
|
|
14
18
|
},
|
|
15
19
|
text: true
|
|
16
20
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -2,10 +2,9 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutP
|
|
|
2
2
|
var _excluded = ["view"],
|
|
3
3
|
_excluded2 = ["onClick", "id", "text"];
|
|
4
4
|
/* eslint-disable react/no-array-index-key */
|
|
5
|
-
import React, { useState, useEffect, Fragment } from 'react';
|
|
5
|
+
import React, { useState, useEffect, Fragment, useContext } from 'react';
|
|
6
6
|
import { Tree, Loading, Button } from '@teamix/ui';
|
|
7
|
-
import
|
|
8
|
-
import { every, dropWhile } from 'lodash-es';
|
|
7
|
+
import { dropWhile, isEmpty } from 'lodash-es';
|
|
9
8
|
import Ansi from 'ansi-to-react';
|
|
10
9
|
import { Title } from '@alife/devops-ui';
|
|
11
10
|
import PluginLogTable from "../../../../pluginLogTable";
|
|
@@ -15,21 +14,19 @@ import { BaiscIconFont } from "../../icon-font";
|
|
|
15
14
|
import { StatusAbleIcon } from "../../instance-status-icon";
|
|
16
15
|
import intl from "../../../../../locale";
|
|
17
16
|
import "./index.scss";
|
|
18
|
-
import { GetPipelineJobSteps, GetPipelineJobStepLog } from "../../../../../utils/api";
|
|
19
|
-
|
|
20
|
-
loader: function loader() {
|
|
21
|
-
return import("./AI");
|
|
22
|
-
}
|
|
23
|
-
});
|
|
17
|
+
import { GetPipelineJobSteps, GetPipelineJobStepLog, GetPipelineLogOrigin } from "../../../../../utils/api";
|
|
18
|
+
import ConfigContext from "../../../../../contexts/config";
|
|
24
19
|
var TreeNode = Tree.Node;
|
|
25
20
|
|
|
26
21
|
// 默认拉取的日志行数
|
|
27
|
-
|
|
22
|
+
// const DEFAULT_LIMIT = 1000;
|
|
28
23
|
// 默认拉取日志时间间隔
|
|
29
24
|
var DEFAULT_INTERVAL = 1000;
|
|
30
25
|
// 已完成节点加速加载
|
|
31
26
|
var DEFAULT_RATE = 10;
|
|
32
|
-
|
|
27
|
+
|
|
28
|
+
// const AI_DIAGNOSIS_MAX_SUPPORT_LOG_LINES = 100000;
|
|
29
|
+
|
|
33
30
|
var logPulltimer; // 日志加载
|
|
34
31
|
var nodePullTimer; // 日志节点加载
|
|
35
32
|
var scrollTimer;
|
|
@@ -41,50 +38,6 @@ var tooltip = function tooltip(trigger, text) {
|
|
|
41
38
|
align: "t"
|
|
42
39
|
}, text || trigger);
|
|
43
40
|
};
|
|
44
|
-
var i18n = function i18n(nodeName) {
|
|
45
|
-
var map = {
|
|
46
|
-
申请运行环境: {
|
|
47
|
-
en_US: 'Apply Env',
|
|
48
|
-
zh_CN: intl.get({
|
|
49
|
-
id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.ApplyForARunningEnvironment',
|
|
50
|
-
defaultMessage: '申请运行环境'
|
|
51
|
-
})
|
|
52
|
-
},
|
|
53
|
-
清理工作区: {
|
|
54
|
-
en_US: 'Clean Workspace',
|
|
55
|
-
zh_CN: intl.get({
|
|
56
|
-
id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.CleanUpTheWorkspace',
|
|
57
|
-
defaultMessage: '清理工作区'
|
|
58
|
-
})
|
|
59
|
-
},
|
|
60
|
-
流水线缓存: {
|
|
61
|
-
en_US: 'Restore Cache',
|
|
62
|
-
zh_CN: intl.get({
|
|
63
|
-
id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.PipelineCache',
|
|
64
|
-
defaultMessage: '流水线缓存'
|
|
65
|
-
})
|
|
66
|
-
},
|
|
67
|
-
克隆代码: {
|
|
68
|
-
en_US: 'Clone Repo',
|
|
69
|
-
zh_CN: intl.get({
|
|
70
|
-
id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.CloneCode',
|
|
71
|
-
defaultMessage: '克隆代码'
|
|
72
|
-
})
|
|
73
|
-
},
|
|
74
|
-
缓存上传: {
|
|
75
|
-
en_US: 'Archive Cache',
|
|
76
|
-
zh_CN: intl.get({
|
|
77
|
-
id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.CacheUpload',
|
|
78
|
-
defaultMessage: '缓存上传'
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
if (map[nodeName]) {
|
|
83
|
-
return map[nodeName][locale || 'zh_CN'];
|
|
84
|
-
} else {
|
|
85
|
-
return nodeName;
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
41
|
var i18nActionName = function i18nActionName(action) {
|
|
89
42
|
var map = {
|
|
90
43
|
构建: {
|
|
@@ -102,8 +55,7 @@ var i18nActionName = function i18nActionName(action) {
|
|
|
102
55
|
}
|
|
103
56
|
};
|
|
104
57
|
var SubTree = function SubTree(props) {
|
|
105
|
-
var
|
|
106
|
-
treeSummaryUrl = props.treeSummaryUrl,
|
|
58
|
+
var treeSummaryUrl = props.treeSummaryUrl,
|
|
107
59
|
nodeUrl = props.nodeUrl,
|
|
108
60
|
headerUrl = props.headerUrl,
|
|
109
61
|
downloadUrl = props.downloadUrl,
|
|
@@ -118,6 +70,8 @@ var SubTree = function SubTree(props) {
|
|
|
118
70
|
instance = props.instance,
|
|
119
71
|
job = props.job,
|
|
120
72
|
setBuildId = props.setBuildId;
|
|
73
|
+
var globalConfig = useContext(ConfigContext);
|
|
74
|
+
var apiHost = globalConfig.replaceLinks.api;
|
|
121
75
|
var _useState = useState([]),
|
|
122
76
|
tree = _useState[0],
|
|
123
77
|
setTree = _useState[1];
|
|
@@ -130,18 +84,10 @@ var SubTree = function SubTree(props) {
|
|
|
130
84
|
var _useState4 = useState(false),
|
|
131
85
|
selectedNode = _useState4[0],
|
|
132
86
|
setSelectedNode = _useState4[1];
|
|
133
|
-
var logTreeIsFinished = function logTreeIsFinished(logTree) {
|
|
134
|
-
var nodes = logTree[0].steps;
|
|
135
|
-
return nodes.find(function (node) {
|
|
136
|
-
return node.status === 'fail';
|
|
137
|
-
}) || every(nodes, function (node) {
|
|
138
|
-
return node.status === 'success';
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
87
|
var getPipelineJobSteps = function getPipelineJobSteps() {
|
|
142
88
|
var pipelineRunId = instance.pipelineRunId,
|
|
143
89
|
pipelineId = instance.pipelineId;
|
|
144
|
-
GetPipelineJobSteps(pipelineId, pipelineRunId, job.id).then(function (jobSteps) {
|
|
90
|
+
GetPipelineJobSteps(pipelineId, pipelineRunId, job.id, apiHost).then(function (jobSteps) {
|
|
145
91
|
setLoading(false);
|
|
146
92
|
if (jobSteps && jobSteps[0]) {
|
|
147
93
|
setTree(jobSteps);
|
|
@@ -205,12 +151,12 @@ var SubTree = function SubTree(props) {
|
|
|
205
151
|
setCurrent(treeIndex);
|
|
206
152
|
setPluginLogVisible(false);
|
|
207
153
|
}
|
|
208
|
-
}, tree.map(function (item
|
|
154
|
+
}, tree.map(function (item) {
|
|
209
155
|
return /*#__PURE__*/React.createElement(TreeNode, {
|
|
210
156
|
label: i18nActionName(item.actionName),
|
|
211
157
|
key: item.jobId,
|
|
212
158
|
disabled: true
|
|
213
|
-
}, item.buildProcessNodes.map(function (node
|
|
159
|
+
}, item.buildProcessNodes.map(function (node) {
|
|
214
160
|
return /*#__PURE__*/React.createElement(TreeNode, {
|
|
215
161
|
className: ["job-log-tree__node--" + node.status, node.nodeIndex === selectedNode.nodeIndex && treeIndex === current ? 'selected' : ''].join(' '),
|
|
216
162
|
key: JSON.stringify(node),
|
|
@@ -249,11 +195,9 @@ var LogButton = function LogButton(_ref) {
|
|
|
249
195
|
context = _useState9[0],
|
|
250
196
|
setContext = _useState9[1];
|
|
251
197
|
var _useState10 = useState(''),
|
|
252
|
-
downloadURL = _useState10[0]
|
|
253
|
-
setDownloadURL = _useState10[1];
|
|
198
|
+
downloadURL = _useState10[0];
|
|
254
199
|
var _useState11 = useState(''),
|
|
255
|
-
downloadLogAction = _useState11[0]
|
|
256
|
-
setDownloadLogAction = _useState11[1];
|
|
200
|
+
downloadLogAction = _useState11[0];
|
|
257
201
|
var _useState12 = useState(''),
|
|
258
202
|
viewLogAction = _useState12[0],
|
|
259
203
|
setViewLogAction = _useState12[1];
|
|
@@ -263,6 +207,8 @@ var LogButton = function LogButton(_ref) {
|
|
|
263
207
|
var _useState14 = useState(),
|
|
264
208
|
buildId = _useState14[0],
|
|
265
209
|
setBuildId = _useState14[1];
|
|
210
|
+
var globalConfig = useContext(ConfigContext);
|
|
211
|
+
var apiHost = globalConfig.replaceLinks.api;
|
|
266
212
|
var isFinishStatus = function isFinishStatus(status) {
|
|
267
213
|
return ['success', 'fail'].includes(status);
|
|
268
214
|
};
|
|
@@ -309,11 +255,11 @@ var LogButton = function LogButton(_ref) {
|
|
|
309
255
|
jobId: job.id,
|
|
310
256
|
buildId: buildId,
|
|
311
257
|
offset: offset,
|
|
312
|
-
stepIndex: selectNode.nodeIndex
|
|
258
|
+
stepIndex: selectNode.nodeIndex,
|
|
259
|
+
host: apiHost
|
|
313
260
|
}).then(function (res) {
|
|
314
261
|
var logs = res.logs,
|
|
315
|
-
last = res.last
|
|
316
|
-
more = res.more;
|
|
262
|
+
last = res.last;
|
|
317
263
|
cache = cache + "\n" + logs;
|
|
318
264
|
if (!/[^\s]/.test(cache)) {
|
|
319
265
|
setLogs(intl.get({
|
|
@@ -344,6 +290,7 @@ var LogButton = function LogButton(_ref) {
|
|
|
344
290
|
offset: 0,
|
|
345
291
|
cache: ''
|
|
346
292
|
});
|
|
293
|
+
if (!isEmpty(context) && buildId) setLogOrigin();
|
|
347
294
|
}, [context, buildId]);
|
|
348
295
|
useEffect(function () {
|
|
349
296
|
setLoading(true);
|
|
@@ -403,48 +350,57 @@ var LogButton = function LogButton(_ref) {
|
|
|
403
350
|
}, /*#__PURE__*/React.createElement(Ansi, null, log.replace(/ /g, "\xA0")));
|
|
404
351
|
});
|
|
405
352
|
};
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
353
|
+
// const logsWithoutScripts = (logs.split('LoG_TaB_HeaD')[2] || '').split(
|
|
354
|
+
// /\n/,
|
|
355
|
+
// );
|
|
356
|
+
// if (
|
|
357
|
+
// logsWithoutScripts
|
|
358
|
+
// .slice(0, 20)
|
|
359
|
+
// .join()
|
|
360
|
+
// .includes('heartbeat timeout,please contact with system administrator')
|
|
361
|
+
// ) {
|
|
362
|
+
// return intl.get({
|
|
363
|
+
// id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.TheTaskWasTerminatedUnexpectedly',
|
|
364
|
+
// defaultMessage: '任务执行意外终止,请尝试重试',
|
|
365
|
+
// });
|
|
366
|
+
// }
|
|
367
|
+
|
|
368
|
+
// if (loading) {
|
|
369
|
+
// return '';
|
|
370
|
+
// }
|
|
371
|
+
|
|
372
|
+
// if (logsWithoutScripts.filter((log) => log).length === 0) {
|
|
373
|
+
// return intl.get({
|
|
374
|
+
// id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.NoLogs',
|
|
375
|
+
// defaultMessage: '没有日志',
|
|
376
|
+
// });
|
|
377
|
+
// }
|
|
378
|
+
|
|
379
|
+
// const format = (log) => {
|
|
380
|
+
// if (/HIGHLIGHT__GREEN/.test(log)) {
|
|
381
|
+
// return (
|
|
382
|
+
// <span style={{ color: 'var(--color-success-5, #23b066)' }}>
|
|
383
|
+
// {log.replace(/HIGHLIGHT__GREEN/, '')}
|
|
384
|
+
// </span>
|
|
385
|
+
// );
|
|
386
|
+
// }
|
|
387
|
+
|
|
388
|
+
// if (/HIGHLIGHT__/.test(log)) {
|
|
389
|
+
// return (
|
|
390
|
+
// <span style={{ color: 'var(--color-help-5, #fad414)' }}>
|
|
391
|
+
// {log.replace(/HIGHLIGHT__/, '')}
|
|
392
|
+
// </span>
|
|
393
|
+
// );
|
|
394
|
+
// }
|
|
395
|
+
|
|
396
|
+
// return log;
|
|
397
|
+
// };
|
|
398
|
+
|
|
399
|
+
// return logsWithoutScripts.map((log, index) => (
|
|
400
|
+
// <div key={index}>{format(log)}</div>
|
|
401
|
+
// ));
|
|
402
|
+
// };
|
|
403
|
+
|
|
448
404
|
var handleScroll = function handleScroll() {
|
|
449
405
|
if (scrollTimer) {
|
|
450
406
|
clearTimeout(scrollTimer);
|
|
@@ -490,18 +446,27 @@ var LogButton = function LogButton(_ref) {
|
|
|
490
446
|
// step日志
|
|
491
447
|
return context.selectNode ? context.selectNode.nodeName : props.name;
|
|
492
448
|
};
|
|
449
|
+
var setLogOrigin = function setLogOrigin() {
|
|
450
|
+
var pipelineRunId = instance.pipelineRunId,
|
|
451
|
+
pipelineId = instance.pipelineId;
|
|
452
|
+
GetPipelineLogOrigin({
|
|
453
|
+
pipelineId: pipelineId,
|
|
454
|
+
pipelineRunId: pipelineRunId,
|
|
455
|
+
jobId: job.id,
|
|
456
|
+
stepIndex: context.selectNode.stepIndex,
|
|
457
|
+
buildId: buildId
|
|
458
|
+
}, apiHost).then(function (res) {
|
|
459
|
+
setViewLogAction(res);
|
|
460
|
+
})["catch"](function () {
|
|
461
|
+
setViewLogAction('');
|
|
462
|
+
});
|
|
463
|
+
};
|
|
493
464
|
var butttonToGetDownloadUrlAndOpen = function butttonToGetDownloadUrlAndOpen(url, title) {
|
|
494
465
|
return /*#__PURE__*/React.createElement(Button, {
|
|
495
466
|
text: true,
|
|
496
467
|
size: "small",
|
|
497
468
|
onClick: function onClick() {
|
|
498
|
-
|
|
499
|
-
url: url
|
|
500
|
-
}).then(function (res) {
|
|
501
|
-
if (res.successful && res.object) {
|
|
502
|
-
window.open(res.object);
|
|
503
|
-
}
|
|
504
|
-
})["catch"](console.error);
|
|
469
|
+
url && window.open(url);
|
|
505
470
|
}
|
|
506
471
|
}, title);
|
|
507
472
|
};
|
|
@@ -544,14 +509,11 @@ var LogButton = function LogButton(_ref) {
|
|
|
544
509
|
className: "log-panel__title__head"
|
|
545
510
|
}, getLogsPanelTitle()), !pluginLogVisible && /*#__PURE__*/React.createElement("div", {
|
|
546
511
|
className: "log-panel__title__ops"
|
|
547
|
-
},
|
|
512
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
548
513
|
className: "log-panel__view-log-btn"
|
|
549
514
|
}, butttonToGetDownloadUrlAndOpen(viewLogAction, intl.get({
|
|
550
515
|
id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.View',
|
|
551
516
|
defaultMessage: '查看原始日志'
|
|
552
|
-
}))), butttonToGetDownloadUrlAndOpen(downloadLogAction, intl.get({
|
|
553
|
-
id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.View',
|
|
554
|
-
defaultMessage: '下载日志'
|
|
555
517
|
}))), !downloadLogAction && downloadURL && /*#__PURE__*/React.createElement(Button, {
|
|
556
518
|
text: true,
|
|
557
519
|
size: "small",
|
|
@@ -4,4 +4,14 @@ export var replaceHost = function replaceHost(url) {
|
|
|
4
4
|
var ToReplace = '/';
|
|
5
5
|
var path = url.replace(reg, ToReplace);
|
|
6
6
|
return getUrlWithContextPath(path);
|
|
7
|
+
};
|
|
8
|
+
export var replaceHostWithBase = function replaceHostWithBase(url, newHost) {
|
|
9
|
+
var replaceUrls = ['testing.rdc.aliyun.com', 'flow.aliyun.com'];
|
|
10
|
+
var urlObj = new URL(url);
|
|
11
|
+
if (newHost && replaceUrls.some(function (item) {
|
|
12
|
+
return urlObj.host.includes(item);
|
|
13
|
+
})) {
|
|
14
|
+
return newHost + '/devops/getReport?reportPath=' + urlObj.pathname;
|
|
15
|
+
}
|
|
16
|
+
return url;
|
|
7
17
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/* eslint-disable react/prop-types */
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
4
4
|
import { Button } from '@teamix/ui';
|
|
5
5
|
import { Title } from '@alife/devops-ui';
|
|
6
6
|
import { BaiscIconFont } from "../../icon-font";
|
|
7
7
|
import confirmOpenReportDialog, { getTrustPipelineReportConfig } from "./RememberConfirm";
|
|
8
|
+
import ConfigContext from "../../../../../contexts/config";
|
|
9
|
+
import { replaceHostWithBase } from "../replaceHost";
|
|
8
10
|
export var CommonButton = function CommonButton(_ref) {
|
|
9
11
|
var text = _ref.text,
|
|
10
12
|
link = _ref.link,
|
|
@@ -13,6 +15,8 @@ export var CommonButton = function CommonButton(_ref) {
|
|
|
13
15
|
var _useState = useState(),
|
|
14
16
|
trustReport = _useState[0],
|
|
15
17
|
setTrustReport = _useState[1];
|
|
18
|
+
var globalConfig = useContext(ConfigContext);
|
|
19
|
+
var scanHost = globalConfig.replaceLinks.scan;
|
|
16
20
|
function getTrustReport() {
|
|
17
21
|
getTrustPipelineReportConfig().then(function (v) {
|
|
18
22
|
setTrustReport(v);
|
|
@@ -29,7 +33,9 @@ export var CommonButton = function CommonButton(_ref) {
|
|
|
29
33
|
cb: getTrustReport
|
|
30
34
|
});
|
|
31
35
|
} else {
|
|
32
|
-
|
|
36
|
+
var url = link.href;
|
|
37
|
+
if (scanHost) url = replaceHostWithBase(url, scanHost);
|
|
38
|
+
window.open(url);
|
|
33
39
|
}
|
|
34
40
|
};
|
|
35
41
|
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
@@ -7,7 +7,7 @@ import Avatar from "../../avatar";
|
|
|
7
7
|
import { BaiscIconFont } from "../../icon-font";
|
|
8
8
|
import intl from "../../../../../locale";
|
|
9
9
|
import "./index.scss";
|
|
10
|
-
import { replaceHost } from "../replaceHost";
|
|
10
|
+
import { replaceHost, replaceHostWithBase } from "../replaceHost";
|
|
11
11
|
import { CommonButton, StatInfoItem } from "../stat-info-s-common/common";
|
|
12
12
|
import confirmOpenReportDialog, { getTrustPipelineReportConfig } from "../stat-info-s-common/RememberConfirm";
|
|
13
13
|
var skippedOrOthers = function skippedOrOthers(stat) {
|
|
@@ -416,7 +416,8 @@ var StateInfoButton = function StateInfoButton(args) {
|
|
|
416
416
|
var data = args.data,
|
|
417
417
|
id = args.id,
|
|
418
418
|
name = args.name,
|
|
419
|
-
hasMore = args.hasMore
|
|
419
|
+
hasMore = args.hasMore,
|
|
420
|
+
scanLinkHost = args.scanLinkHost;
|
|
420
421
|
var statistic = JSON.parse(data);
|
|
421
422
|
if (statistic.QIXI) {
|
|
422
423
|
var url = statistic.QIXI.url;
|
|
@@ -439,7 +440,7 @@ var StateInfoButton = function StateInfoButton(args) {
|
|
|
439
440
|
}
|
|
440
441
|
var link = {
|
|
441
442
|
component: 'a',
|
|
442
|
-
href:
|
|
443
|
+
href: replaceHostWithBase(statistic._REPORT.url, scanLinkHost),
|
|
443
444
|
target: '_blank'
|
|
444
445
|
};
|
|
445
446
|
var prefix = hasMore ? name + " - " : '';
|
|
@@ -587,18 +588,9 @@ var Summary = function Summary(props) {
|
|
|
587
588
|
if (cancelBy) {
|
|
588
589
|
return /*#__PURE__*/React.createElement("div", {
|
|
589
590
|
className: "stat-info danger p12"
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
uid: cancelBy,
|
|
594
|
-
nameOnly: true
|
|
595
|
-
})
|
|
596
|
-
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
597
|
-
uid: cancelBy,
|
|
598
|
-
nameOnly: true
|
|
599
|
-
})), intl.get({
|
|
600
|
-
id: 'rdc-tb-cd-assets.flow-job-btn.state-info.CanceledTask',
|
|
601
|
-
defaultMessage: '取消了任务'
|
|
591
|
+
}, intl.get({
|
|
592
|
+
id: 'rdc-tb-cd-assets.dashboardMain.main.HeaderExtra.Canceled',
|
|
593
|
+
defaultMessage: '已取消'
|
|
602
594
|
}));
|
|
603
595
|
}
|
|
604
596
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
// /* eslint-disable react/jsx-filename-extension */
|
|
3
|
-
import React, { useState, useEffect, useMemo } from 'react';
|
|
3
|
+
import React, { useState, useEffect, useMemo, useContext } from 'react';
|
|
4
4
|
import { Balloon, Message, MenuButton, Divider, Tag } from '@teamix/ui';
|
|
5
5
|
import { YunxiaoIcon, Title, ButtonIcon } from '@alife/devops-ui';
|
|
6
6
|
import Avatar from '@alife/yunxiao-avatar';
|
|
@@ -20,6 +20,7 @@ import hackCls from "./hack.module.scss";
|
|
|
20
20
|
import AnimatedContainer from "../../../PipelineGraph/AnimatedContainer";
|
|
21
21
|
import "./avatar-group/index.scss";
|
|
22
22
|
import { StartPipelineJobRun } from "../../../../utils/api";
|
|
23
|
+
import ConfigContext from "../../../../contexts/config";
|
|
23
24
|
var Tooltip = Balloon.Tooltip;
|
|
24
25
|
var manualApprovePrefix = 'manual-approve-avatar';
|
|
25
26
|
|
|
@@ -84,7 +85,6 @@ var FlowSwitch = function FlowSwitch(_ref) {
|
|
|
84
85
|
var pipelineJobId = _ref.pipelineJobId,
|
|
85
86
|
pipelineRunId = _ref.pipelineRunId,
|
|
86
87
|
status = _ref.status,
|
|
87
|
-
stageInstId = _ref.stageInstId,
|
|
88
88
|
pipelineId = _ref.pipelineId,
|
|
89
89
|
_ref$isOld = _ref.isOld,
|
|
90
90
|
isOld = _ref$isOld === void 0 ? false : _ref$isOld,
|
|
@@ -93,13 +93,16 @@ var FlowSwitch = function FlowSwitch(_ref) {
|
|
|
93
93
|
var _useState = useState(false),
|
|
94
94
|
requesting = _useState[0],
|
|
95
95
|
setRequesting = _useState[1];
|
|
96
|
+
var globalConfig = useContext(ConfigContext);
|
|
97
|
+
var apiHost = globalConfig.replaceLinks.api;
|
|
96
98
|
var manualSwitch = function manualSwitch() {
|
|
97
99
|
if (requesting || status === 'SUCCESS' && !isOld) return;
|
|
98
100
|
setRequesting(true);
|
|
99
101
|
StartPipelineJobRun({
|
|
100
102
|
pipelineId: pipelineId,
|
|
101
103
|
pipelineRunId: pipelineRunId,
|
|
102
|
-
jobId: pipelineJobId
|
|
104
|
+
jobId: pipelineJobId,
|
|
105
|
+
host: apiHost
|
|
103
106
|
}).then(function (res) {
|
|
104
107
|
setRequesting(false);
|
|
105
108
|
if (res) {
|
|
@@ -210,6 +213,8 @@ export var FlowJobCard = function FlowJobCard(_ref2) {
|
|
|
210
213
|
onCardLeave = _ref2.onCardLeave,
|
|
211
214
|
instance = _ref2.instance,
|
|
212
215
|
onRefresh = _ref2.onRefresh;
|
|
216
|
+
var globalConfig = useContext(ConfigContext);
|
|
217
|
+
var reportLinkHost = globalConfig.replaceLinks.report;
|
|
213
218
|
var status = job.status,
|
|
214
219
|
resultStatus = job.resultStatus,
|
|
215
220
|
_job$result = job.result,
|
|
@@ -454,7 +459,8 @@ export var FlowJobCard = function FlowJobCard(_ref2) {
|
|
|
454
459
|
pipelineId: pipelineId,
|
|
455
460
|
onRefresh: onRefresh,
|
|
456
461
|
instance: instance,
|
|
457
|
-
job: job
|
|
462
|
+
job: job,
|
|
463
|
+
reportLinkHost: reportLinkHost
|
|
458
464
|
}))({
|
|
459
465
|
view: true,
|
|
460
466
|
onClick: function onClick(type, props) {
|