@devops-flow/devops-flow-pipeline-detail 0.0.49 → 0.0.51

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.
Files changed (29) hide show
  1. package/dist/PipelineFlowDetail.css +1 -1
  2. package/dist/PipelineFlowDetail.js +14 -14
  3. package/es/components/common/teambition/flow-job-btn/cardsMap.d.ts +2 -1
  4. package/es/components/common/teambition/flow-job-btn/cardsMap.js +21 -1
  5. package/es/components/common/teambition/flow-job-btn/execute-button/index.js +10 -4
  6. package/es/components/common/teambition/flow-job-btn/link/index.d.ts +1 -1
  7. package/es/components/common/teambition/flow-job-btn/link/index.js +7 -3
  8. package/es/components/common/teambition/flow-job-btn/log-btn/index.js +90 -128
  9. package/es/components/common/teambition/flow-job-btn/replaceHost.d.ts +1 -0
  10. package/es/components/common/teambition/flow-job-btn/replaceHost.js +4 -0
  11. package/es/components/common/teambition/flow-job-btn/stat-info-s-common/common.js +8 -2
  12. package/es/components/common/teambition/flow-job-btn/state-info/index.js +3 -12
  13. package/es/components/common/teambition/flow-job-new/index.js +10 -4
  14. package/es/components/common/teambition/flow-job-runtime-menu/index.scss +1 -0
  15. package/es/components/common/teambition/pipeline-instance-new/SourceElement.js +1 -1
  16. package/es/components/common/teambition/pipeline-instance-new/source.js +4 -2
  17. package/es/components/detailMain/recent/index.js +1 -1
  18. package/es/contexts/config.d.ts +5 -1
  19. package/es/contexts/config.js +7 -1
  20. package/es/index.js +5 -4
  21. package/es/style.js +0 -1
  22. package/es/utils/api/index.d.ts +18 -6
  23. package/es/utils/api/index.js +59 -30
  24. package/es/utils/index.js +10 -8
  25. package/package.json +1 -1
  26. package/dist/1.css +0 -1
  27. package/dist/1.js +0 -24
  28. package/dist/2.css +0 -1
  29. 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,6 +1,6 @@
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
5
  import React from 'react';
6
6
  import ExecuteButton from "./execute-button";
@@ -27,10 +27,30 @@ import { getFeature } from "../../../../utils";
27
27
  export var ExecuteableButtons = ['EXECUTE'];
28
28
  export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_ref) {
29
29
  var displayType = _ref.displayType,
30
+ type = _ref.type,
30
31
  mode = _ref.mode,
31
32
  _ref$isAdmin = _ref.isAdmin,
32
33
  isAdmin = _ref$isAdmin === void 0 ? false : _ref$isAdmin,
33
34
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
35
+ // 独立组件的后端返回数据格式,和 Flow 不一致,需要要type类型判断,返回结果一样
36
+ if (type === 'LINK') {
37
+ return function (restProps) {
38
+ var Button = LinkButton[mode];
39
+ return Button ? /*#__PURE__*/React.createElement(Button, _extends({}, props, restProps, {
40
+ text: true,
41
+ id: restProps.key
42
+ })) : null;
43
+ };
44
+ }
45
+ if (type === 'STAT_INFO') {
46
+ return function (restProps) {
47
+ var button = StateInfoButton[mode];
48
+ // 这个 Button 返回数组,不能当成 react 组件用
49
+ return button ? button(_extends({}, props, restProps, {
50
+ id: restProps.key
51
+ })) : null;
52
+ };
53
+ }
34
54
  if (!displayType) {
35
55
  return function () {
36
56
  return null;
@@ -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,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  /**
3
3
  * 按钮实现模板
4
- */
4
+ */
5
5
  declare const LinkButton: {
6
6
  (props: any): JSX.Element;
7
7
  Button: any;
@@ -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 { replaceHost } from "../replaceHost";
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(replaceHost(props.url));
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 Loadable from "../../../../../utils/loadable";
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
- var AI = Loadable({
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
- var DEFAULT_LIMIT = 1000;
22
+ // const DEFAULT_LIMIT = 1000;
28
23
  // 默认拉取日志时间间隔
29
24
  var DEFAULT_INTERVAL = 1000;
30
25
  // 已完成节点加速加载
31
26
  var DEFAULT_RATE = 10;
32
- var AI_DIAGNOSIS_MAX_SUPPORT_LOG_LINES = 100000;
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 treeUrl = props.treeUrl,
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, i) {
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, i) {
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
- var formatedAppBuildLogs = function formatedAppBuildLogs() {
407
- var logsWithoutScripts = (logs.split('LoG_TaB_HeaD')[2] || '').split(/\n/);
408
- if (logsWithoutScripts.slice(0, 20).join().includes('heartbeat timeout,please contact with system administrator')) {
409
- return intl.get({
410
- id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.TheTaskWasTerminatedUnexpectedly',
411
- defaultMessage: '任务执行意外终止,请尝试重试'
412
- });
413
- }
414
- if (loading) {
415
- return '';
416
- }
417
- if (logsWithoutScripts.filter(function (log) {
418
- return log;
419
- }).length === 0) {
420
- return intl.get({
421
- id: 'rdc-tb-cd-assets.flow-job-btn.log-btn.NoLogs',
422
- defaultMessage: '没有日志'
423
- });
424
- }
425
- var format = function format(log) {
426
- if (/HIGHLIGHT__GREEN/.test(log)) {
427
- return /*#__PURE__*/React.createElement("span", {
428
- style: {
429
- color: 'var(--color-success-5, #23b066)'
430
- }
431
- }, log.replace(/HIGHLIGHT__GREEN/, ''));
432
- }
433
- if (/HIGHLIGHT__/.test(log)) {
434
- return /*#__PURE__*/React.createElement("span", {
435
- style: {
436
- color: 'var(--color-help-5, #fad414)'
437
- }
438
- }, log.replace(/HIGHLIGHT__/, ''));
439
- }
440
- return log;
441
- };
442
- return logsWithoutScripts.map(function (log, index) {
443
- return /*#__PURE__*/React.createElement("div", {
444
- key: index
445
- }, format(log));
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
- fetch({
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
- }, downloadLogAction && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
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",
@@ -1 +1,2 @@
1
1
  export declare const replaceHost: (url: any) => any;
2
+ export declare const replaceHostWithBase: (url: string, newHost: string) => string;
@@ -4,4 +4,8 @@ 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 urlObj = new URL(url);
10
+ return newHost + urlObj.pathname;
7
11
  };
@@ -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
- window.open(link.href);
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({
@@ -587,18 +587,9 @@ var Summary = function Summary(props) {
587
587
  if (cancelBy) {
588
588
  return /*#__PURE__*/React.createElement("div", {
589
589
  className: "stat-info danger p12"
590
- }, /*#__PURE__*/React.createElement(Title, {
591
- align: "t",
592
- trigger: /*#__PURE__*/React.createElement(Avatar, {
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: '取消了任务'
590
+ }, intl.get({
591
+ id: 'rdc-tb-cd-assets.dashboardMain.main.HeaderExtra.Canceled',
592
+ defaultMessage: '已取消'
602
593
  }));
603
594
  }
604
595
  }
@@ -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) {
@@ -17,6 +17,7 @@
17
17
  .next-dialog-body {
18
18
  max-height: calc(100vh - 145px) !important;
19
19
  min-height: calc(100vh - 145px) !important;
20
+ padding: 0 !important;
20
21
  }
21
22
  }
22
23
 
@@ -23,7 +23,7 @@ export var SourceElement = /*#__PURE__*/React.memo(function SourceElement(props)
23
23
  var _item$data = item.data,
24
24
  _item$data$repo = _item$data.repo,
25
25
  repo = _item$data$repo === void 0 ? '' : _item$data$repo,
26
- commitMsg = _item$data.commitMsg;
26
+ commitMsg = _item$data.commit;
27
27
  var _JsonParseWithCatch = JsonParseWithCatch(commitMsg, [{}]),
28
28
  commit = _JsonParseWithCatch[0];
29
29
  var trigger = /*#__PURE__*/React.createElement(Source, {
@@ -53,7 +53,7 @@ var CommonGitSource = function CommonGitSource(_ref) {
53
53
  var _data$repo = data.repo,
54
54
  repo = _data$repo === void 0 ? '' : _data$repo,
55
55
  branch = data.branch,
56
- commitMsg = data.commitMsg,
56
+ commitMsg = data.commit,
57
57
  isBranchMode = data.isBranchMode,
58
58
  af = data.aoneFlow;
59
59
  var _JsonParseWithCatch = JsonParseWithCatch(commitMsg, [{}]),
@@ -267,7 +267,9 @@ var Packages = function Packages(_ref4) {
267
267
  var _artifactSourceInstan = artifactSourceInstanceResultProcess(item),
268
268
  artifactUrl = _artifactSourceInstan.artifactUrl,
269
269
  versionDisplayText = _artifactSourceInstan.versionDisplayText;
270
- var repoName = decodeURI(data.repoName);
270
+
271
+ // const repoName = decodeURI(data.repoName);
272
+
271
273
  return /*#__PURE__*/React.createElement("ul", {
272
274
  key: item.name,
273
275
  className: "source",
@@ -46,7 +46,7 @@ var Current = function Current(_ref) {
46
46
  return _regeneratorRuntime.wrap(function _callee$(_context) {
47
47
  while (1) switch (_context.prev = _context.next) {
48
48
  case 0:
49
- apiHost = globalConfig.apiHost;
49
+ apiHost = globalConfig.replaceLinks.api;
50
50
  api = pipelineRunId ? GetPipelineRun(pipelineId, pipelineRunId, apiHost) : GetLatestPipelineRun(pipelineId, apiHost);
51
51
  api.then(function (res) {
52
52
  setLoading(false);
@@ -1,5 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  declare const ConfigContext: import("react").Context<{
3
- apiHost: any;
3
+ replaceLinks: {
4
+ api: string;
5
+ report: string;
6
+ scan: string;
7
+ };
4
8
  }>;
5
9
  export default ConfigContext;