@devops-flow/devops-flow-pipeline-detail 0.0.56 → 0.0.57
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.
|
@@ -5,20 +5,60 @@ export var replaceHost = function replaceHost(url) {
|
|
|
5
5
|
var path = url.replace(reg, ToReplace);
|
|
6
6
|
return getUrlWithContextPath(path);
|
|
7
7
|
};
|
|
8
|
+
var parseUrl = function parseUrl(url) {
|
|
9
|
+
// 默认值
|
|
10
|
+
var host = '';
|
|
11
|
+
var pathname = '/';
|
|
12
|
+
|
|
13
|
+
// 检查 URL 是否包含协议(如 http:// 或 https://)
|
|
14
|
+
var protocolIndex = url.indexOf('://');
|
|
15
|
+
if (protocolIndex !== -1) {
|
|
16
|
+
// 去掉协议部分
|
|
17
|
+
url = url.slice(protocolIndex + 3);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 提取 host 和 pathname
|
|
21
|
+
var pathIndex = url.indexOf('/');
|
|
22
|
+
if (pathIndex !== -1) {
|
|
23
|
+
// 提取 host
|
|
24
|
+
host = url.slice(0, pathIndex);
|
|
25
|
+
// 提取 pathname
|
|
26
|
+
pathname = url.slice(pathIndex);
|
|
27
|
+
} else {
|
|
28
|
+
// 如果没有路径部分,则整个字符串是 host
|
|
29
|
+
host = url;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 去掉 pathname 中的查询参数和哈希部分
|
|
33
|
+
var queryIndex = pathname.indexOf('?');
|
|
34
|
+
var hashIndex = pathname.indexOf('#');
|
|
35
|
+
if (queryIndex !== -1) {
|
|
36
|
+
pathname = pathname.slice(0, queryIndex);
|
|
37
|
+
} else if (hashIndex !== -1) {
|
|
38
|
+
pathname = pathname.slice(0, hashIndex);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
host: host,
|
|
42
|
+
pathname: pathname
|
|
43
|
+
};
|
|
44
|
+
};
|
|
8
45
|
export var replaceHostWithBase = function replaceHostWithBase(url, newHost) {
|
|
9
46
|
var replaceUrls = ['testing.rdc.aliyun.com', 'flow.aliyun.com'];
|
|
10
|
-
var
|
|
47
|
+
var _parseUrl = parseUrl(url),
|
|
48
|
+
host = _parseUrl.host,
|
|
49
|
+
pathname = _parseUrl.pathname;
|
|
11
50
|
if (newHost && replaceUrls.some(function (item) {
|
|
12
|
-
return
|
|
51
|
+
return host.includes(item);
|
|
13
52
|
})) {
|
|
14
|
-
return newHost + '/devops/getReport?reportPath=' +
|
|
53
|
+
return newHost + '/devops/getReport?reportPath=' + pathname;
|
|
15
54
|
}
|
|
16
55
|
return url;
|
|
17
56
|
};
|
|
18
57
|
export var replaceAppstack = function replaceAppstack(url, newHost) {
|
|
19
|
-
var
|
|
58
|
+
var _parseUrl2 = parseUrl(url),
|
|
59
|
+
pathname = _parseUrl2.pathname;
|
|
20
60
|
if (newHost) {
|
|
21
|
-
return newHost +
|
|
61
|
+
return newHost + pathname;
|
|
22
62
|
}
|
|
23
63
|
return url;
|
|
24
64
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devops-flow/devops-flow-pipeline-detail",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"description": "flow 流水线详情",
|
|
5
5
|
"medusaName": "rdc-tb-cd-assets",
|
|
6
6
|
"main": "dist/PipelineFlowDetail.js",
|
|
@@ -47,6 +47,5 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": "^18.0.0",
|
|
49
49
|
"react-dom": "^18.0.0"
|
|
50
|
-
}
|
|
51
|
-
"homepage": "https://unpkg.com/@devops-flow/devops-flow-pipeline-detail@0.0.56/build/index.html"
|
|
50
|
+
}
|
|
52
51
|
}
|