@backstage-community/plugin-tekton 3.27.1 → 3.27.2
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.
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@ import PermissionAlert from '../common/PermissionAlert.esm.js';
|
|
|
9
9
|
import PipelineRunList from '../PipelineRunList/PipelineRunList.esm.js';
|
|
10
10
|
import '@patternfly/react-core/dist/styles/base-no-reset.css';
|
|
11
11
|
import '@patternfly/patternfly/utilities/Accessibility/accessibility.css';
|
|
12
|
+
import { Progress } from '@backstage/core-components';
|
|
12
13
|
|
|
13
14
|
const savedStylesheets = /* @__PURE__ */ new Set();
|
|
14
15
|
const TektonCIComponent = () => {
|
|
@@ -41,8 +42,11 @@ const TektonCIComponent = () => {
|
|
|
41
42
|
ModelsPlural.pods
|
|
42
43
|
];
|
|
43
44
|
const tektonResourcesContextData = useTektonObjectsResponse(watchedResources);
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
45
|
+
const viewPermissionData = useTektonViewPermission();
|
|
46
|
+
if (viewPermissionData.loading) {
|
|
47
|
+
return /* @__PURE__ */ jsx("div", { "data-testid": "tekton-permission-progress", children: /* @__PURE__ */ jsx(Progress, {}) });
|
|
48
|
+
}
|
|
49
|
+
if (!viewPermissionData.allowed) {
|
|
46
50
|
return /* @__PURE__ */ jsx(PermissionAlert, {});
|
|
47
51
|
}
|
|
48
52
|
return /* @__PURE__ */ jsx(TektonResourcesContext.Provider, { value: tektonResourcesContextData, children: /* @__PURE__ */ jsx(PipelineRunList, {}) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TektonCIComponent.esm.js","sources":["../../../src/components/Tekton/TektonCIComponent.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useLayoutEffect } from 'react';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\nimport { useDarkTheme } from '../../hooks/useDarkTheme';\nimport { useTektonObjectsResponse } from '../../hooks/useTektonObjectsResponse';\nimport { useTektonViewPermission } from '../../hooks/useTektonViewPermission';\nimport { ModelsPlural } from '../../models';\nimport PermissionAlert from '../common/PermissionAlert';\nimport PipelineRunList from '../PipelineRunList/PipelineRunList';\n\nimport '@patternfly/react-core/dist/styles/base-no-reset.css';\nimport '@patternfly/patternfly/utilities/Accessibility/accessibility.css';\n\nconst savedStylesheets = new Set<HTMLLinkElement>();\n\nexport const TektonCIComponent = () => {\n useDarkTheme();\n\n useLayoutEffect(() => {\n const scalprumStyles = Array.from(\n document.querySelectorAll('link[rel=\"stylesheet\"]'),\n ).filter(link =>\n link.attributes\n .getNamedItem('href')\n ?.value?.includes('backstage-plugin-tekton'),\n );\n\n scalprumStyles.forEach(link =>\n savedStylesheets.add(link as HTMLLinkElement),\n );\n\n savedStylesheets.forEach(link => {\n if (!document.head.contains(link)) {\n document.head.appendChild(link);\n }\n });\n return () => {\n savedStylesheets.forEach(link => {\n if (document.head.contains(link)) {\n document.head.removeChild(link);\n }\n });\n };\n }, []);\n\n const watchedResources = [\n ModelsPlural.pipelineruns,\n ModelsPlural.taskruns,\n ModelsPlural.pods,\n ];\n const tektonResourcesContextData = useTektonObjectsResponse(watchedResources);\n const
|
|
1
|
+
{"version":3,"file":"TektonCIComponent.esm.js","sources":["../../../src/components/Tekton/TektonCIComponent.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useLayoutEffect } from 'react';\n\nimport { TektonResourcesContext } from '../../hooks/TektonResourcesContext';\nimport { useDarkTheme } from '../../hooks/useDarkTheme';\nimport { useTektonObjectsResponse } from '../../hooks/useTektonObjectsResponse';\nimport { useTektonViewPermission } from '../../hooks/useTektonViewPermission';\nimport { ModelsPlural } from '../../models';\nimport PermissionAlert from '../common/PermissionAlert';\nimport PipelineRunList from '../PipelineRunList/PipelineRunList';\n\nimport '@patternfly/react-core/dist/styles/base-no-reset.css';\nimport '@patternfly/patternfly/utilities/Accessibility/accessibility.css';\nimport { Progress } from '@backstage/core-components';\n\nconst savedStylesheets = new Set<HTMLLinkElement>();\n\nexport const TektonCIComponent = () => {\n useDarkTheme();\n\n useLayoutEffect(() => {\n const scalprumStyles = Array.from(\n document.querySelectorAll('link[rel=\"stylesheet\"]'),\n ).filter(link =>\n link.attributes\n .getNamedItem('href')\n ?.value?.includes('backstage-plugin-tekton'),\n );\n\n scalprumStyles.forEach(link =>\n savedStylesheets.add(link as HTMLLinkElement),\n );\n\n savedStylesheets.forEach(link => {\n if (!document.head.contains(link)) {\n document.head.appendChild(link);\n }\n });\n return () => {\n savedStylesheets.forEach(link => {\n if (document.head.contains(link)) {\n document.head.removeChild(link);\n }\n });\n };\n }, []);\n\n const watchedResources = [\n ModelsPlural.pipelineruns,\n ModelsPlural.taskruns,\n ModelsPlural.pods,\n ];\n const tektonResourcesContextData = useTektonObjectsResponse(watchedResources);\n const viewPermissionData = useTektonViewPermission();\n\n if (viewPermissionData.loading) {\n return (\n <div data-testid=\"tekton-permission-progress\">\n <Progress />\n </div>\n );\n }\n if (!viewPermissionData.allowed) {\n return <PermissionAlert />;\n }\n return (\n <TektonResourcesContext.Provider value={tektonResources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A;AAEnD,EAAA,IAAI,mBAAmB,OAAS,EAAA;AAC9B,IAAA,2BACG,KAAI,EAAA,EAAA,aAAA,EAAY,4BACf,EAAA,QAAA,kBAAA,GAAA,CAAC,YAAS,CACZ,EAAA,CAAA;AAAA;AAGJ,EAAI,IAAA,CAAC,mBAAmB,OAAS,EAAA;AAC/B,IAAA,2BAAQ,eAAgB,EAAA,EAAA,CAAA;AAAA;AAE1B,EACE,uBAAA,GAAA,CAAC,uBAAuB,QAAvB,EAAA,EAAgC,OAAO,0BACtC,EAAA,QAAA,kBAAA,GAAA,CAAC,mBAAgB,CACnB,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -8,7 +8,10 @@ const useTektonViewPermission = () => {
|
|
|
8
8
|
const clusterResourcesReadPermission = usePermission({
|
|
9
9
|
permission: kubernetesResourcesReadPermission
|
|
10
10
|
});
|
|
11
|
-
return
|
|
11
|
+
return {
|
|
12
|
+
loading: clusterReadPermission.loading || clusterResourcesReadPermission.loading,
|
|
13
|
+
allowed: clusterReadPermission.allowed && clusterResourcesReadPermission.allowed
|
|
14
|
+
};
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
export { useTektonViewPermission };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTektonViewPermission.esm.js","sources":["../../src/hooks/useTektonViewPermission.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport {\n kubernetesClustersReadPermission,\n kubernetesResourcesReadPermission,\n} from '@backstage/plugin-kubernetes-common';\n\nexport const useTektonViewPermission = () => {\n const clusterReadPermission = usePermission({\n permission: kubernetesClustersReadPermission,\n });\n\n const clusterResourcesReadPermission = usePermission({\n permission: kubernetesResourcesReadPermission,\n });\n\n return
|
|
1
|
+
{"version":3,"file":"useTektonViewPermission.esm.js","sources":["../../src/hooks/useTektonViewPermission.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport {\n kubernetesClustersReadPermission,\n kubernetesResourcesReadPermission,\n} from '@backstage/plugin-kubernetes-common';\n\nexport const useTektonViewPermission = () => {\n const clusterReadPermission = usePermission({\n permission: kubernetesClustersReadPermission,\n });\n\n const clusterResourcesReadPermission = usePermission({\n permission: kubernetesResourcesReadPermission,\n });\n\n return {\n loading:\n clusterReadPermission.loading || clusterResourcesReadPermission.loading,\n allowed:\n clusterReadPermission.allowed && clusterResourcesReadPermission.allowed,\n };\n};\n"],"names":[],"mappings":";;;AAsBO,MAAM,0BAA0B,MAAM;AAC3C,EAAA,MAAM,wBAAwB,aAAc,CAAA;AAAA,IAC1C,UAAY,EAAA;AAAA,GACb,CAAA;AAED,EAAA,MAAM,iCAAiC,aAAc,CAAA;AAAA,IACnD,UAAY,EAAA;AAAA,GACb,CAAA;AAED,EAAO,OAAA;AAAA,IACL,OAAA,EACE,qBAAsB,CAAA,OAAA,IAAW,8BAA+B,CAAA,OAAA;AAAA,IAClE,OAAA,EACE,qBAAsB,CAAA,OAAA,IAAW,8BAA+B,CAAA;AAAA,GACpE;AACF;;;;"}
|