@devops-flow/devops-flow-pipeline-detail 0.0.51 → 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.
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
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,6 +24,7 @@ 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,
@@ -32,13 +33,19 @@ export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_r
32
33
  _ref$isAdmin = _ref.isAdmin,
33
34
  isAdmin = _ref$isAdmin === void 0 ? false : _ref$isAdmin,
34
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
+
35
41
  // 独立组件的后端返回数据格式,和 Flow 不一致,需要要type类型判断,返回结果一样
36
42
  if (type === 'LINK') {
37
43
  return function (restProps) {
38
44
  var Button = LinkButton[mode];
39
45
  return Button ? /*#__PURE__*/React.createElement(Button, _extends({}, props, restProps, {
40
46
  text: true,
41
- id: restProps.key
47
+ id: restProps.key,
48
+ reportLinkHost: reportLinkHost
42
49
  })) : null;
43
50
  };
44
51
  }
@@ -47,7 +54,8 @@ export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_r
47
54
  var button = StateInfoButton[mode];
48
55
  // 这个 Button 返回数组,不能当成 react 组件用
49
56
  return button ? button(_extends({}, props, restProps, {
50
- id: restProps.key
57
+ id: restProps.key,
58
+ scanLinkHost: scanLinkHost
51
59
  })) : null;
52
60
  };
53
61
  }
@@ -61,6 +69,7 @@ export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_r
61
69
  return function (restProps) {
62
70
  var Button = ExecuteButton[mode];
63
71
  return Button ? /*#__PURE__*/React.createElement(Button, _extends({}, props, restProps, {
72
+ type: type,
64
73
  id: restProps.key
65
74
  })) : null;
66
75
  };
@@ -98,7 +107,8 @@ export var buildButtonComponentWrapper = function buildButtonComponentWrapper(_r
98
107
  var button = StateInfoButton[mode];
99
108
  // 这个 Button 返回数组,不能当成 react 组件用
100
109
  return button ? button(_extends({}, props, restProps, {
101
- id: restProps.key
110
+ id: restProps.key,
111
+ scanLinkHost: scanLinkHost
102
112
  })) : null;
103
113
  };
104
114
  case 'STAT_INFO_WITH_REDLINES':
@@ -6,6 +6,12 @@ export var replaceHost = function replaceHost(url) {
6
6
  return getUrlWithContextPath(path);
7
7
  };
8
8
  export var replaceHostWithBase = function replaceHostWithBase(url, newHost) {
9
+ var replaceUrls = ['testing.rdc.aliyun.com', 'flow.aliyun.com'];
9
10
  var urlObj = new URL(url);
10
- return newHost + urlObj.pathname;
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;
11
17
  };
@@ -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: replaceHost(statistic._REPORT.url),
443
+ href: replaceHostWithBase(statistic._REPORT.url, scanLinkHost),
443
444
  target: '_blank'
444
445
  };
445
446
  var prefix = hasMore ? name + " - " : '';
@@ -263,10 +263,10 @@ export var StatusBar = /*#__PURE__*/React.memo(function (props) {
263
263
  className: "right"
264
264
  }, /*#__PURE__*/React.createElement("ul", {
265
265
  className: "info-list"
266
- }, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(CommitsHistory, {
266
+ }, displayConfig.codeChange && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(CommitsHistory, {
267
267
  sources: sources,
268
268
  instance: instance
269
- })), /*#__PURE__*/React.createElement("li", null, enablePackages && /*#__PURE__*/React.createElement(Packages, {
269
+ })), displayConfig.runningProduct && /*#__PURE__*/React.createElement("li", null, enablePackages && /*#__PURE__*/React.createElement(Packages, {
270
270
  packages: packages
271
271
  })), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(PipelineParams, {
272
272
  dataSource: globalParams
@@ -1,13 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["loading", "onBuildNumberChange"];
4
- import React, { useEffect, useState } from 'react';
4
+ import React, { useContext, useEffect, useState } from 'react';
5
5
  import { Loading } from '@teamix/ui';
6
- import exceed from "../../../utils/apimap";
7
6
  import Loadable from "../../../utils/loadable";
8
7
  import permissionUtil from "../../../utils/permissionUtil";
9
8
  import intl from "../../../locale";
10
9
  import "./index.scss";
10
+ import { GetLatestPipelineRun } from "../../../utils/api";
11
+ import ConfigContext from "../../../contexts/config";
11
12
  var PipelineInstance = Loadable({
12
13
  loader: function loader() {
13
14
  return import("../../common/teambition/pipeline-instance-new");
@@ -43,19 +44,16 @@ var Current = function Current(_ref) {
43
44
  var _useState4 = useState(false),
44
45
  canEditPipeline = _useState4[0],
45
46
  setCanEditPipeline = _useState4[1];
47
+ var globalConfig = useContext(ConfigContext);
48
+ var apiHost = globalConfig.replaceLinks.api;
46
49
  var checkPipelinePermission = function checkPipelinePermission() {
47
50
  permissionUtil.checkPermissionList([PERMISSION_PIPELINE_EXECUTE, PERMISSION_PIPELINE_EDIT], props.pipelineId, 'pipeline', window.AK_GLOBAL.currentUser.workid).then(function (data) {
48
51
  setCanExecutePipeline(data[PERMISSION_PIPELINE_EXECUTE]);
49
52
  setCanEditPipeline(data[PERMISSION_PIPELINE_EDIT]);
50
53
  });
51
54
  };
52
- var getLatestPiepline = function getLatestPiepline() {
53
- exceed.fetch({
54
- api: 'Pipeline.get.instance.latest',
55
- params: {
56
- pipelineId: pipelineId
57
- }
58
- }).then(function (res) {
55
+ var getLatestPipeline = function getLatestPipeline() {
56
+ GetLatestPipelineRun(pipelineId, apiHost).then(function (res) {
59
57
  setLoading(false);
60
58
  if (res.successful) {
61
59
  var _res$object;
@@ -74,7 +72,6 @@ var Current = function Current(_ref) {
74
72
  }, []);
75
73
  useEffect(function () {
76
74
  checkPipelinePermission();
77
- getLatestPiepline();
78
75
  }, [pipelineId]);
79
76
  var flowInstVo = instance.flowInstVo;
80
77
  if (parentLoading || loading) {
@@ -108,7 +105,7 @@ var Current = function Current(_ref) {
108
105
  disabled: !canExecutePipeline || type,
109
106
  notJump: true,
110
107
  onRunPost: function onRunPost() {
111
- return getLatestPiepline();
108
+ return getLatestPipeline();
112
109
  },
113
110
  onRunPipeline: props.onRunPipeline
114
111
  }))
@@ -121,7 +118,7 @@ var Current = function Current(_ref) {
121
118
  disabled: !canExecutePipeline,
122
119
  isAdmin: canEditPipeline,
123
120
  onRefresh: function onRefresh() {
124
- return getLatestPiepline();
121
+ return getLatestPipeline();
125
122
  },
126
123
  isSystemPipeline: !!type
127
124
  });
@@ -110,7 +110,7 @@ var Current = function Current(_ref) {
110
110
  }),
111
111
  disabled: !canExecutePipeline,
112
112
  onRunPost: function onRunPost() {
113
- return getLatestPiepline();
113
+ return getLatestPipeline();
114
114
  },
115
115
  onRunPipeline: props.onRunPipeline,
116
116
  notJump: true
@@ -125,7 +125,7 @@ var Current = function Current(_ref) {
125
125
  disabled: !canExecutePipeline,
126
126
  isAdmin: canEditPipeline,
127
127
  onRefresh: function onRefresh() {
128
- return getLatestPiepline();
128
+ return getLatestPipeline();
129
129
  },
130
130
  displayConfig: props.displayConfig,
131
131
  onPipelineStatusChanged: onPipelineStatusChanged,
package/es/index.js CHANGED
@@ -74,7 +74,7 @@ var enterFlowTrack = function enterFlowTrack() {
74
74
  var lang = locale || window.FORCE && window.FORCE.locale || 'zh_CN';
75
75
  var isEn = lang === 'en_US';
76
76
  var setConfigDefault = function setConfigDefault(config) {
77
- var keys = ['number', 'triggerMsg']; // 编号,触发信息
77
+ var keys = ['number', 'triggerMsg', 'codeChange', 'runningProduct']; // 编号,触发信息
78
78
  return keys.reduce(function (pre, cur) {
79
79
  pre[cur] = config && typeof config[cur] === 'boolean' ? config[cur] : true;
80
80
  return pre;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devops-flow/devops-flow-pipeline-detail",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "description": "flow 流水线详情",
5
5
  "medusaName": "rdc-tb-cd-assets",
6
6
  "main": "dist/PipelineFlowDetail.js",