MCPcopy Index your code
hub / github.com/1Panel-dev/KubePi / getUrl

Function getUrl

web/dashboard/src/api/k8s.js:25–44  ·  view source on GitHub ↗
(cluster_name, kind, data)

Source from the content-addressed store, hash-verified

23}
24
25export function getUrl (cluster_name, kind, data) {
26 let url = ""
27 if (data.apiVersion === "v1") {
28 if (data.metadata.namespace !== undefined && data.metadata.namespace !== "") {
29 url = apiNsUrl(cluster_name, data.apiVersion, data.metadata.namespace, kind)
30 } else {
31 url = apiUrl(cluster_name, data.apiVersion, kind)
32 }
33 } else {
34 const apiVersions = data.apiVersion.split("/")
35 const group = apiVersions[0]
36 const version = apiVersions[1]
37 if (data.metadata.namespace !== undefined && data.metadata.namespace !== "") {
38 url = apisNsUrl(cluster_name, version, group, data.metadata.namespace, kind)
39 } else {
40 url = apisUrl(cluster_name, version, group, kind)
41 }
42 }
43 return url
44}

Callers 1

postYamlFunction · 0.85

Calls 4

apiNsUrlFunction · 0.85
apisNsUrlFunction · 0.85
apisUrlFunction · 0.85
apiUrlFunction · 0.70

Tested by

no test coverage detected