@devops-flow/devops-flow-pipeline-detail 0.0.60 → 0.0.63-beta.0

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.
@@ -50,7 +50,7 @@ export var replaceHostWithBase = function replaceHostWithBase(url, newHost) {
50
50
  if (newHost && replaceUrls.some(function (item) {
51
51
  return host.includes(item);
52
52
  })) {
53
- return newHost + '/devops/getReport?reportPath=' + pathname;
53
+ return newHost + pathname;
54
54
  }
55
55
  return url;
56
56
  };
@@ -10,7 +10,7 @@ import intl from "../../../../locale";
10
10
  import getUrlWithContextPath from "../../../../utils/contextPathUtil";
11
11
  import { ARTIFACT_SOURCE, getCategoryFromType } from "../pipeline-source/util";
12
12
  import { getFeatures } from "../../../../utils/features";
13
- import { JsonParseWithCatch } from "../../../../utils";
13
+ import { JsonParseWithCatch, isNotConvertedCodeupUrl, generateWebUrlForCodeupInIntl } from "../../../../utils";
14
14
  import { CODEUP_ROOT_PATH } from "../../../../utils/codeupRootPath";
15
15
  import { ArtifactSourceTypes } from "../pipeline-source/artifact-source";
16
16
  var decode = function decode(text) {
@@ -70,6 +70,9 @@ var CommonGitSource = function CommonGitSource(_ref) {
70
70
  } else {
71
71
  url = c_repo.replace(reg, 'http://$1/$2').replace(/\.git$/, '');
72
72
  }
73
+ if (type === 'codeup' || isNotConvertedCodeupUrl(url)) {
74
+ url = generateWebUrlForCodeupInIntl(url);
75
+ }
73
76
  if (commitId) {
74
77
  return window.open(url + "/" + (url.includes('bitbucket.org') ? 'commits' : 'commit') + "/" + encodeURIComponent(commitId));
75
78
  }
@@ -75,3 +75,22 @@ export declare function JsonParseWithCatch(string: any, defaultValue: any): any;
75
75
  export declare function isStepAppstackPresetAppname(sign: string): RegExpMatchArray;
76
76
  export declare const isDevEnv: boolean;
77
77
  export declare const generateUUID: () => string;
78
+ /**
79
+ * 国际站环境codeup链接,无 namespace 需要加上 .git 才能跳转
80
+ * @param webUrl
81
+ */
82
+ export declare function generateWebUrlForCodeupInIntl(webUrl: string): string;
83
+ /**
84
+ * 判断codeup跳转链接
85
+ * @description 有能判断codeup的type,优先用type,url判断可能不是很准确 !!!
86
+ * @param url - 待判断的完整 URL 字符串
87
+ * @returns Boolean
88
+ */
89
+ export declare function isCodeupUrl(url: string): boolean;
90
+ /**
91
+ * 判断是否是未转化过的codeup链接
92
+ * @description 如果是未转化过的codeup链接,并且没有 .git 后缀,则需要加上 .git 才能跳转
93
+ * @param url - 链接
94
+ * @returns Boolean
95
+ */
96
+ export declare function isNotConvertedCodeupUrl(url: string): boolean;
package/es/utils/index.js CHANGED
@@ -542,4 +542,41 @@ export var generateUUID = function generateUUID() {
542
542
  randomString += Math.floor(Math.random() * 16).toString(16);
543
543
  }
544
544
  return randomString;
545
- };
545
+ };
546
+
547
+ /**
548
+ * 国际站环境codeup链接,无 namespace 需要加上 .git 才能跳转
549
+ * @param webUrl
550
+ */
551
+ export function generateWebUrlForCodeupInIntl(webUrl) {
552
+ return webUrl + ".git";
553
+ }
554
+
555
+ /**
556
+ * 判断codeup跳转链接
557
+ * @description 有能判断codeup的type,优先用type,url判断可能不是很准确 !!!
558
+ * @param url - 待判断的完整 URL 字符串
559
+ * @returns Boolean
560
+ */
561
+ export function isCodeupUrl(url) {
562
+ if (!url || typeof url !== 'string') {
563
+ return false;
564
+ }
565
+ try {
566
+ var parsedUrl = new URL(url);
567
+ return parsedUrl.pathname.startsWith('/codeup/');
568
+ } catch (e) {
569
+ // 如果 URL 解析失败(非法 URL),返回 false
570
+ return false;
571
+ }
572
+ }
573
+
574
+ /**
575
+ * 判断是否是未转化过的codeup链接
576
+ * @description 如果是未转化过的codeup链接,并且没有 .git 后缀,则需要加上 .git 才能跳转
577
+ * @param url - 链接
578
+ * @returns Boolean
579
+ */
580
+ export function isNotConvertedCodeupUrl(url) {
581
+ return isCodeupUrl(url) && !url.includes('.git');
582
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devops-flow/devops-flow-pipeline-detail",
3
- "version": "0.0.60",
3
+ "version": "0.0.63-beta.0",
4
4
  "description": "flow 流水线详情",
5
5
  "medusaName": "rdc-tb-cd-assets",
6
6
  "main": "dist/PipelineFlowDetail.js",
@@ -47,5 +47,6 @@
47
47
  "peerDependencies": {
48
48
  "react": "^18.0.0",
49
49
  "react-dom": "^18.0.0"
50
- }
50
+ },
51
+ "homepage": "https://unpkg.com/@devops-flow/devops-flow-pipeline-detail@0.0.63-beta.0/build/index.html"
51
52
  }