@spinnaker/kubernetes 0.0.0-main-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 +1663 -0
- package/LICENSE.txt +203 -0
- package/dist/help/kubernetes.help.d.ts +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6024 -0
- package/dist/index.js.map +1 -0
- package/dist/instance/details/details.controller.d.ts +1 -0
- package/dist/instance/index.d.ts +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/infrastructure.types.d.ts +24 -0
- package/dist/kubernetes.module.d.ts +6 -0
- package/dist/loadBalancer/details/details.controller.d.ts +1 -0
- package/dist/loadBalancer/index.d.ts +1 -0
- package/dist/loadBalancer/transformer.d.ts +1 -0
- package/dist/manifest/IManifestCoordinates.d.ts +5 -0
- package/dist/manifest/ManifestImageDetails.d.ts +18 -0
- package/dist/manifest/ManifestKindSearch.d.ts +13 -0
- package/dist/manifest/ManifestLabels.d.ts +15 -0
- package/dist/manifest/ManifestQos.d.ts +15 -0
- package/dist/manifest/ManifestResources.d.ts +35 -0
- package/dist/manifest/ManifestSource.d.ts +4 -0
- package/dist/manifest/annotationCustomSections.component.d.ts +1 -0
- package/dist/manifest/artifact/artifact.component.d.ts +1 -0
- package/dist/manifest/delete/delete.controller.d.ts +12 -0
- package/dist/manifest/delete/deleteOptionsForm.component.d.ts +1 -0
- package/dist/manifest/editor/json/JsonEditor.d.ts +12 -0
- package/dist/manifest/editor/json/jsonEditor.component.d.ts +1 -0
- package/dist/manifest/index.d.ts +10 -0
- package/dist/manifest/manifest.service.d.ts +25 -0
- package/dist/manifest/manifestCommandBuilder.service.d.ts +30 -0
- package/dist/manifest/manifestEvents.component.d.ts +1 -0
- package/dist/manifest/manifestImageDetails.component.d.ts +1 -0
- package/dist/manifest/manifestLabels.component.d.ts +1 -0
- package/dist/manifest/manifestQos.component.d.ts +1 -0
- package/dist/manifest/manifestResources.component.d.ts +1 -0
- package/dist/manifest/rollout/RollingRestart.d.ts +1 -0
- package/dist/manifest/rollout/pause.controller.d.ts +1 -0
- package/dist/manifest/rollout/resume.controller.d.ts +1 -0
- package/dist/manifest/rollout/undo.controller.d.ts +1 -0
- package/dist/manifest/scale/ScaleSettingsForm.d.ts +10 -0
- package/dist/manifest/scale/scale.controller.d.ts +8 -0
- package/dist/manifest/scale/scaleSettingsForm.component.d.ts +1 -0
- package/dist/manifest/selector/IManifestLabelSelector.d.ts +9 -0
- package/dist/manifest/selector/IManifestSelector.d.ts +30 -0
- package/dist/manifest/selector/ManifestSelector.d.ts +46 -0
- package/dist/manifest/selector/labelEditor/LabelEditor.d.ts +15 -0
- package/dist/manifest/selector/selector.component.d.ts +1 -0
- package/dist/manifest/status/ManifestCondition.d.ts +13 -0
- package/dist/manifest/status/condition.component.d.ts +1 -0
- package/dist/manifest/status/status.component.d.ts +1 -0
- package/dist/manifest/traffic/ManifestTrafficService.d.ts +12 -0
- package/dist/manifest/wizard/BasicSettings.d.ts +17 -0
- package/dist/manifest/wizard/ManifestEntry.d.ts +16 -0
- package/dist/manifest/wizard/ManifestWizard.d.ts +22 -0
- package/dist/pipelines/stages/ManifestCoordinates.d.ts +31 -0
- package/dist/pipelines/stages/ManifestExecutionDetails.d.ts +69 -0
- package/dist/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.d.ts +18 -0
- package/dist/pipelines/stages/deleteManifest/DeleteManifestStageConfig.d.ts +14 -0
- package/dist/pipelines/stages/deleteManifest/deleteManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/deployManifest/CopyFromTemplateButton.d.ts +15 -0
- package/dist/pipelines/stages/deployManifest/DeployManifestStageConfig.d.ts +15 -0
- package/dist/pipelines/stages/deployManifest/DeployManifestStageForm.d.ts +31 -0
- package/dist/pipelines/stages/deployManifest/ManifestBindArtifactsSelector.d.ts +17 -0
- package/dist/pipelines/stages/deployManifest/ManifestCopier.d.ts +36 -0
- package/dist/pipelines/stages/deployManifest/ManifestDeploymentOptions.d.ts +34 -0
- package/dist/pipelines/stages/deployManifest/NamespaceSelector.d.ts +16 -0
- package/dist/pipelines/stages/deployManifest/deployManifest.validator.d.ts +2 -0
- package/dist/pipelines/stages/deployManifest/deployManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/DeployStatus.d.ts +23 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/DeployStatusPills.d.ts +8 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.d.ts +20 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestEvents.d.ts +9 -0
- package/dist/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.d.ts +8 -0
- package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.d.ts +3 -0
- package/dist/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.d.ts +7 -0
- package/dist/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.d.ts +1 -0
- package/dist/pipelines/stages/index.d.ts +8 -0
- package/dist/pipelines/stages/patchManifest/PatchManifestOptionsForm.d.ts +8 -0
- package/dist/pipelines/stages/patchManifest/PatchManifestStageConfig.d.ts +7 -0
- package/dist/pipelines/stages/patchManifest/PatchManifestStageForm.d.ts +21 -0
- package/dist/pipelines/stages/patchManifest/patchManifestStage.d.ts +4 -0
- package/dist/pipelines/stages/rolloutRestartManifest/RolloutRestartManifestStageConfig.d.ts +13 -0
- package/dist/pipelines/stages/rolloutRestartManifest/rolloutRestartManifestStage.d.ts +4 -0
- package/dist/pipelines/stages/runJob/KubernetesV2RunJobStageConfig.d.ts +31 -0
- package/dist/pipelines/stages/runJob/RunJobExecutionDetails.d.ts +7 -0
- package/dist/pipelines/stages/runJob/runJobStage.d.ts +1 -0
- package/dist/pipelines/stages/scaleManifest/ScaleManifestConfig.d.ts +3 -0
- package/dist/pipelines/stages/scaleManifest/ScaleManifestStageForm.d.ts +7 -0
- package/dist/pipelines/stages/scaleManifest/scaleManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/traffic/ManifestTrafficStageConfig.d.ts +11 -0
- package/dist/pipelines/stages/traffic/disableManifest.stage.d.ts +1 -0
- package/dist/pipelines/stages/traffic/enableManifest.stage.d.ts +1 -0
- package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.d.ts +3 -0
- package/dist/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.d.ts +7 -0
- package/dist/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.d.ts +1 -0
- package/dist/pipelines/stages/validators/manifestSelectorValidators.d.ts +2 -0
- package/dist/pipelines/validation/manifestSelector.validator.d.ts +8 -0
- package/dist/rawResource/component/K8sResources.d.ts +25 -0
- package/dist/rawResource/component/K8sResourcesFilters.d.ts +20 -0
- package/dist/rawResource/component/RawResourceUtils.d.ts +5 -0
- package/dist/rawResource/component/group/RawResouceGroup.d.ts +15 -0
- package/dist/rawResource/component/group/RawResource.d.ts +12 -0
- package/dist/rawResource/component/group/RawResourceDetails.d.ts +32 -0
- package/dist/rawResource/component/group/RawResourceGroups.d.ts +14 -0
- package/dist/rawResource/controller/FiltersPubSub.d.ts +12 -0
- package/dist/rawResource/index.d.ts +1 -0
- package/dist/rawResource/model/resource.d.ts +17 -0
- package/dist/rawResource/rawResource.dataSource.d.ts +2 -0
- package/dist/rawResource/rawResource.module.d.ts +1 -0
- package/dist/rawResource/rawResource.states.d.ts +6 -0
- package/dist/resources/ResourceDetails.d.ts +17 -0
- package/dist/resources/resources.state.d.ts +7 -0
- package/dist/rolloutStrategy/bluegreen.strategy.d.ts +2 -0
- package/dist/rolloutStrategy/highlander.strategy.d.ts +2 -0
- package/dist/rolloutStrategy/index.d.ts +1 -0
- package/dist/rolloutStrategy/none.strategy.d.ts +2 -0
- package/dist/rolloutStrategy/redblack.strategy.d.ts +2 -0
- package/dist/securityGroup/details/details.controller.d.ts +1 -0
- package/dist/securityGroup/index.d.ts +1 -0
- package/dist/securityGroup/securityGroup.reader.d.ts +4 -0
- package/dist/securityGroup/transformer.d.ts +1 -0
- package/dist/serverGroup/details/details.controller.d.ts +1 -0
- package/dist/serverGroup/details/resize/resize.controller.d.ts +1 -0
- package/dist/serverGroup/index.d.ts +4 -0
- package/dist/serverGroup/serverGroupCommandBuilder.service.d.ts +6 -0
- package/dist/serverGroup/serverGroupTransformer.service.d.ts +6 -0
- package/dist/serverGroupManager/details/details.controller.d.ts +1 -0
- package/dist/serverGroupManager/index.d.ts +1 -0
- package/dist/validation/applicationName.validator.d.ts +9 -0
- package/package.json +58 -0
- package/src/help/kubernetes.help.ts +236 -0
- package/src/index.ts +7 -0
- package/src/instance/details/details.controller.ts +186 -0
- package/src/instance/details/details.html +80 -0
- package/src/instance/index.ts +1 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/infrastructure.types.ts +35 -0
- package/src/kubernetes.module.ts +144 -0
- package/src/loadBalancer/details/details.controller.ts +101 -0
- package/src/loadBalancer/details/details.html +187 -0
- package/src/loadBalancer/index.ts +1 -0
- package/src/loadBalancer/transformer.ts +60 -0
- package/src/logo/kubernetes.icon.svg +102 -0
- package/src/logo/kubernetes.logo.less +6 -0
- package/src/logo/kubernetes.logo.svg +1 -0
- package/src/manifest/IManifestCoordinates.ts +5 -0
- package/src/manifest/ManifestImageDetails.spec.tsx +76 -0
- package/src/manifest/ManifestImageDetails.tsx +64 -0
- package/src/manifest/ManifestKindSearch.tsx +31 -0
- package/src/manifest/ManifestLabels.tsx +31 -0
- package/src/manifest/ManifestQos.tsx +68 -0
- package/src/manifest/ManifestResources.tsx +69 -0
- package/src/manifest/ManifestSource.ts +4 -0
- package/src/manifest/annotationCustomSections.component.ts +114 -0
- package/src/manifest/artifact/artifact.component.ts +23 -0
- package/src/manifest/delete/delete.controller.ts +80 -0
- package/src/manifest/delete/delete.html +42 -0
- package/src/manifest/delete/deleteOptionsForm.component.ts +52 -0
- package/src/manifest/editor/json/JsonEditor.tsx +56 -0
- package/src/manifest/editor/json/jsonEditor.component.ts +12 -0
- package/src/manifest/index.ts +10 -0
- package/src/manifest/manifest.service.ts +90 -0
- package/src/manifest/manifestCommandBuilder.service.ts +126 -0
- package/src/manifest/manifestEvents.component.ts +12 -0
- package/src/manifest/manifestImageDetails.component.ts +12 -0
- package/src/manifest/manifestLabels.component.ts +12 -0
- package/src/manifest/manifestLabels.less +3 -0
- package/src/manifest/manifestQos.component.ts +12 -0
- package/src/manifest/manifestResources.component.ts +12 -0
- package/src/manifest/rollout/RollingRestart.tsx +54 -0
- package/src/manifest/rollout/pause.controller.ts +66 -0
- package/src/manifest/rollout/pause.html +28 -0
- package/src/manifest/rollout/resume.controller.ts +66 -0
- package/src/manifest/rollout/resume.html +28 -0
- package/src/manifest/rollout/undo.controller.ts +74 -0
- package/src/manifest/rollout/undo.html +44 -0
- package/src/manifest/scale/ScaleSettingsForm.tsx +43 -0
- package/src/manifest/scale/scale.controller.ts +75 -0
- package/src/manifest/scale/scale.html +32 -0
- package/src/manifest/scale/scaleSettingsForm.component.ts +11 -0
- package/src/manifest/selector/IManifestLabelSelector.ts +19 -0
- package/src/manifest/selector/IManifestSelector.ts +64 -0
- package/src/manifest/selector/ManifestSelector.spec.tsx +414 -0
- package/src/manifest/selector/ManifestSelector.tsx +424 -0
- package/src/manifest/selector/labelEditor/LabelEditor.spec.tsx +81 -0
- package/src/manifest/selector/labelEditor/LabelEditor.tsx +126 -0
- package/src/manifest/selector/labelEditor/labelEditor.less +3 -0
- package/src/manifest/selector/selector.component.ts +17 -0
- package/src/manifest/status/ManifestCondition.tsx +32 -0
- package/src/manifest/status/condition.component.ts +12 -0
- package/src/manifest/status/status.component.ts +36 -0
- package/src/manifest/traffic/ManifestTrafficService.spec.ts +30 -0
- package/src/manifest/traffic/ManifestTrafficService.ts +67 -0
- package/src/manifest/wizard/BasicSettings.tsx +57 -0
- package/src/manifest/wizard/ManifestEntry.tsx +46 -0
- package/src/manifest/wizard/ManifestWizard.tsx +94 -0
- package/src/pipelines/stages/ManifestCoordinates.spec.tsx +90 -0
- package/src/pipelines/stages/ManifestCoordinates.tsx +128 -0
- package/src/pipelines/stages/ManifestExecutionDetails.tsx +58 -0
- package/src/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.spec.tsx +85 -0
- package/src/pipelines/stages/deleteManifest/DeleteManifestOptionsForm.tsx +87 -0
- package/src/pipelines/stages/deleteManifest/DeleteManifestStageConfig.tsx +62 -0
- package/src/pipelines/stages/deleteManifest/deleteManifestOptionsForm.less +9 -0
- package/src/pipelines/stages/deleteManifest/deleteManifestStage.ts +21 -0
- package/src/pipelines/stages/deployManifest/CopyFromTemplateButton.tsx +45 -0
- package/src/pipelines/stages/deployManifest/DeployManifestStageConfig.tsx +77 -0
- package/src/pipelines/stages/deployManifest/DeployManifestStageForm.tsx +265 -0
- package/src/pipelines/stages/deployManifest/ManifestBindArtifactsSelector.tsx +69 -0
- package/src/pipelines/stages/deployManifest/ManifestCopier.spec.ts +110 -0
- package/src/pipelines/stages/deployManifest/ManifestCopier.tsx +222 -0
- package/src/pipelines/stages/deployManifest/ManifestDeploymentOptions.spec.tsx +75 -0
- package/src/pipelines/stages/deployManifest/ManifestDeploymentOptions.tsx +203 -0
- package/src/pipelines/stages/deployManifest/NamespaceSelector.tsx +40 -0
- package/src/pipelines/stages/deployManifest/deployManifest.validator.ts +38 -0
- package/src/pipelines/stages/deployManifest/deployManifestStage.ts +28 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatus.less +11 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatus.tsx +120 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/DeployStatusPills.tsx +47 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestDetailsLink.tsx +92 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestEvents.tsx +87 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.less +24 -0
- package/src/pipelines/stages/deployManifest/manifestStatus/ManifestStatus.tsx +46 -0
- package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceConfig.tsx +35 -0
- package/src/pipelines/stages/findArtifactsFromResource/FindArtifactsFromResourceStageForm.tsx +37 -0
- package/src/pipelines/stages/findArtifactsFromResource/findArtifactsFromResourceStage.ts +21 -0
- package/src/pipelines/stages/index.ts +8 -0
- package/src/pipelines/stages/patchManifest/PatchManifestOptionsForm.tsx +35 -0
- package/src/pipelines/stages/patchManifest/PatchManifestStageConfig.tsx +57 -0
- package/src/pipelines/stages/patchManifest/PatchManifestStageForm.tsx +157 -0
- package/src/pipelines/stages/patchManifest/patchManifestStage.ts +30 -0
- package/src/pipelines/stages/rolloutRestartManifest/RolloutRestartManifestStageConfig.tsx +46 -0
- package/src/pipelines/stages/rolloutRestartManifest/rolloutRestartManifestStage.ts +20 -0
- package/src/pipelines/stages/runJob/KubernetesV2RunJobStageConfig.tsx +242 -0
- package/src/pipelines/stages/runJob/RunJobExecutionDetails.tsx +67 -0
- package/src/pipelines/stages/runJob/runJobStage.ts +39 -0
- package/src/pipelines/stages/scaleManifest/ScaleManifestConfig.tsx +38 -0
- package/src/pipelines/stages/scaleManifest/ScaleManifestStageForm.tsx +46 -0
- package/src/pipelines/stages/scaleManifest/scaleManifestStage.ts +24 -0
- package/src/pipelines/stages/traffic/ManifestTrafficStageConfig.tsx +44 -0
- package/src/pipelines/stages/traffic/disableManifest.stage.ts +26 -0
- package/src/pipelines/stages/traffic/enableManifest.stage.ts +26 -0
- package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestConfig.tsx +37 -0
- package/src/pipelines/stages/undoRolloutManifest/UndoRolloutManifestStageForm.tsx +60 -0
- package/src/pipelines/stages/undoRolloutManifest/undoRolloutManifestStage.ts +21 -0
- package/src/pipelines/stages/validators/manifestSelectorValidators.ts +43 -0
- package/src/pipelines/validation/manifestSelector.validator.ts +36 -0
- package/src/rawResource/component/K8sResources.less +9 -0
- package/src/rawResource/component/K8sResources.tsx +112 -0
- package/src/rawResource/component/K8sResourcesFilters.tsx +112 -0
- package/src/rawResource/component/RawResourceUtils.ts +19 -0
- package/src/rawResource/component/group/RawResouceGroup.tsx +41 -0
- package/src/rawResource/component/group/RawResource.less +79 -0
- package/src/rawResource/component/group/RawResource.tsx +51 -0
- package/src/rawResource/component/group/RawResourceDetails.tsx +236 -0
- package/src/rawResource/component/group/RawResourceGroups.tsx +53 -0
- package/src/rawResource/controller/FiltersPubSub.ts +35 -0
- package/src/rawResource/index.ts +1 -0
- package/src/rawResource/model/resource.ts +18 -0
- package/src/rawResource/rawResource.dataSource.ts +39 -0
- package/src/rawResource/rawResource.module.ts +8 -0
- package/src/rawResource/rawResource.states.ts +64 -0
- package/src/resources/ResourceDetails.tsx +121 -0
- package/src/resources/resources.state.ts +45 -0
- package/src/rolloutStrategy/bluegreen.strategy.ts +7 -0
- package/src/rolloutStrategy/highlander.strategy.ts +7 -0
- package/src/rolloutStrategy/index.ts +6 -0
- package/src/rolloutStrategy/none.strategy.ts +8 -0
- package/src/rolloutStrategy/redblack.strategy.ts +7 -0
- package/src/securityGroup/details/details.controller.ts +118 -0
- package/src/securityGroup/details/details.html +91 -0
- package/src/securityGroup/index.ts +1 -0
- package/src/securityGroup/securityGroup.reader.ts +11 -0
- package/src/securityGroup/transformer.ts +19 -0
- package/src/serverGroup/details/details.controller.ts +207 -0
- package/src/serverGroup/details/details.html +153 -0
- package/src/serverGroup/details/resize/resize.controller.ts +73 -0
- package/src/serverGroup/details/resize/resize.html +57 -0
- package/src/serverGroup/index.ts +4 -0
- package/src/serverGroup/serverGroupCommandBuilder.service.ts +18 -0
- package/src/serverGroup/serverGroupTransformer.service.spec.ts +67 -0
- package/src/serverGroup/serverGroupTransformer.service.ts +34 -0
- package/src/serverGroupManager/details/details.controller.ts +191 -0
- package/src/serverGroupManager/details/details.html +136 -0
- package/src/serverGroupManager/index.ts +1 -0
- package/src/validation/applicationName.validator.spec.ts +19 -0
- package/src/validation/applicationName.validator.ts +44 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Application, ApplicationDataSource } from '@spinnaker/core';
|
|
4
|
+
import { FilterCheckbox, FilterSection } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import { RawResourceUtils } from './RawResourceUtils';
|
|
7
|
+
import { FiltersPubSub } from '../controller/FiltersPubSub';
|
|
8
|
+
import { KUBERNETS_RAW_RESOURCE_DATA_SOURCE_KEY } from '../rawResource.dataSource';
|
|
9
|
+
|
|
10
|
+
export interface IK8sResourcesFiltersProps {
|
|
11
|
+
app: Application;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IK8sResourcesFiltersState {
|
|
15
|
+
accounts: Record<string, boolean>;
|
|
16
|
+
kinds: Record<string, boolean>;
|
|
17
|
+
namespaces: Record<string, boolean>;
|
|
18
|
+
displayNamespaces: Record<string, boolean>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class K8sResourcesFilters extends React.Component<IK8sResourcesFiltersProps, IK8sResourcesFiltersState> {
|
|
22
|
+
private dataSource: ApplicationDataSource<IApiKubernetesResource[]>;
|
|
23
|
+
private filterPubSub: FiltersPubSub = FiltersPubSub.getInstance(this.props.app.name);
|
|
24
|
+
|
|
25
|
+
constructor(props: IK8sResourcesFiltersProps) {
|
|
26
|
+
super(props);
|
|
27
|
+
this.dataSource = this.props.app.getDataSource(KUBERNETS_RAW_RESOURCE_DATA_SOURCE_KEY);
|
|
28
|
+
|
|
29
|
+
this.state = {
|
|
30
|
+
accounts: {},
|
|
31
|
+
kinds: {},
|
|
32
|
+
namespaces: {},
|
|
33
|
+
displayNamespaces: {},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async componentDidMount() {
|
|
38
|
+
await this.dataSource.ready();
|
|
39
|
+
const ns = Object.assign({}, ...this.dataSource.data.map((resource) => ({ [resource.namespace]: false })));
|
|
40
|
+
const displayNs = { ...ns };
|
|
41
|
+
if ('' in displayNs) {
|
|
42
|
+
delete displayNs[''];
|
|
43
|
+
displayNs[RawResourceUtils.GLOBAL_LABEL] = false;
|
|
44
|
+
}
|
|
45
|
+
this.setState({
|
|
46
|
+
accounts: Object.assign({}, ...this.dataSource.data.map((resource) => ({ [resource.account]: false }))),
|
|
47
|
+
kinds: Object.assign({}, ...this.dataSource.data.map((resource) => ({ [resource.kind]: false }))),
|
|
48
|
+
namespaces: ns,
|
|
49
|
+
displayNamespaces: displayNs,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public render() {
|
|
54
|
+
return (
|
|
55
|
+
<div className="content">
|
|
56
|
+
<FilterSection heading={'Kind'} expanded={true}>
|
|
57
|
+
{...Object.keys(this.state.kinds)
|
|
58
|
+
.sort((a, b) => a.localeCompare(b))
|
|
59
|
+
.map((key) => (
|
|
60
|
+
<FilterCheckbox
|
|
61
|
+
heading={key}
|
|
62
|
+
key={key}
|
|
63
|
+
sortFilterType={this.state.kinds}
|
|
64
|
+
onChange={this.onCheckbox.bind(this)}
|
|
65
|
+
></FilterCheckbox>
|
|
66
|
+
))}
|
|
67
|
+
</FilterSection>
|
|
68
|
+
<FilterSection heading={'Account'} expanded={true}>
|
|
69
|
+
{...Object.keys(this.state.accounts)
|
|
70
|
+
.sort((a, b) => a.localeCompare(b))
|
|
71
|
+
.map((key) => (
|
|
72
|
+
<FilterCheckbox
|
|
73
|
+
heading={key}
|
|
74
|
+
key={key}
|
|
75
|
+
sortFilterType={this.state.accounts}
|
|
76
|
+
onChange={this.onCheckbox.bind(this)}
|
|
77
|
+
></FilterCheckbox>
|
|
78
|
+
))}
|
|
79
|
+
</FilterSection>
|
|
80
|
+
<FilterSection heading={'Namespace'} expanded={true}>
|
|
81
|
+
{...Object.keys(this.state.displayNamespaces)
|
|
82
|
+
.sort((a, b) => a.localeCompare(b))
|
|
83
|
+
.map((key) => (
|
|
84
|
+
<FilterCheckbox
|
|
85
|
+
heading={key}
|
|
86
|
+
key={key}
|
|
87
|
+
sortFilterType={this.state.displayNamespaces}
|
|
88
|
+
onChange={this.onNsCheckbox.bind(this)}
|
|
89
|
+
></FilterCheckbox>
|
|
90
|
+
))}
|
|
91
|
+
</FilterSection>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private onNsCheckbox() {
|
|
97
|
+
const { namespaces, displayNamespaces } = { ...this.state };
|
|
98
|
+
for (const p in displayNamespaces) {
|
|
99
|
+
if (p == RawResourceUtils.GLOBAL_LABEL) {
|
|
100
|
+
namespaces[''] = displayNamespaces[p];
|
|
101
|
+
}
|
|
102
|
+
namespaces[p] = displayNamespaces[p];
|
|
103
|
+
}
|
|
104
|
+
this.setState({ namespaces });
|
|
105
|
+
this.filterPubSub.publish(this.state);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private onCheckbox() {
|
|
109
|
+
this.setState(this.state);
|
|
110
|
+
this.filterPubSub.publish(this.state);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class RawResourceUtils {
|
|
2
|
+
static GLOBAL_LABEL = '(global)';
|
|
3
|
+
|
|
4
|
+
static namespaceDisplayName(ns: string): string {
|
|
5
|
+
if (ns === null || ns === '') {
|
|
6
|
+
return RawResourceUtils.GLOBAL_LABEL;
|
|
7
|
+
}
|
|
8
|
+
return ns;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static resourceKey(resource: IApiKubernetesResource): string {
|
|
12
|
+
if (resource === null) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
return resource.namespace === ''
|
|
16
|
+
? resource.account + '-' + resource.kind + '-' + resource.name
|
|
17
|
+
: resource.account + '-' + resource.namespace + '-' + resource.kind + '-' + resource.name;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './RawResource.less';
|
|
3
|
+
|
|
4
|
+
interface IRawResourceGroupProps {
|
|
5
|
+
title: string;
|
|
6
|
+
resources?: IApiKubernetesResource[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface IRawResourceGroupState {
|
|
10
|
+
open: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class RawResourceGroup extends React.Component<IRawResourceGroupProps, IRawResourceGroupState> {
|
|
14
|
+
constructor(props: IRawResourceGroupProps) {
|
|
15
|
+
super(props);
|
|
16
|
+
|
|
17
|
+
this.state = {
|
|
18
|
+
open: true,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public render() {
|
|
23
|
+
return (
|
|
24
|
+
<div className="RawResourceGroup">
|
|
25
|
+
<div className="clickable sticky-header header" onClick={this.onHeaderClick.bind(this)}>
|
|
26
|
+
<span className={`glyphicon pipeline-toggle glyphicon-chevron-${this.state.open ? 'down' : 'right'}`} />
|
|
27
|
+
<div className="shadowed">
|
|
28
|
+
<h4 className="group-title">{this.props.title}</h4>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div className={`items${this.state.open ? '' : ' hidden'}`}>{this.props.children}</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private onHeaderClick() {
|
|
37
|
+
this.setState({
|
|
38
|
+
open: !this.state.open,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.RawResource {
|
|
2
|
+
&.card {
|
|
3
|
+
background-color: white;
|
|
4
|
+
padding: 1em;
|
|
5
|
+
margin-top: 1em;
|
|
6
|
+
margin-left: 3em;
|
|
7
|
+
border: thin solid lightgrey;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.clickable-row {
|
|
11
|
+
background-color: var(--color-white);
|
|
12
|
+
border: 1px solid var(--color-alto);
|
|
13
|
+
margin: 5px 15px 3px;
|
|
14
|
+
position: relative;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
|
|
17
|
+
&.active {
|
|
18
|
+
border-color: var(--color-accent-g1);
|
|
19
|
+
background-color: var(--color-accent-g3);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
border-color: var(--color-accent-g1);
|
|
24
|
+
box-shadow: 0 0 4px 2px var(--color-accent-g1);
|
|
25
|
+
z-index: 2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.managed {
|
|
29
|
+
margin: 5px;
|
|
30
|
+
border-style: dashed;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.details {
|
|
35
|
+
color: grey;
|
|
36
|
+
display: flex;
|
|
37
|
+
|
|
38
|
+
.column {
|
|
39
|
+
margin-right: 5em;
|
|
40
|
+
|
|
41
|
+
.title {
|
|
42
|
+
margin-right: 1em;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.title {
|
|
48
|
+
margin: 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.RawResourceGroup {
|
|
53
|
+
margin-top: 2em;
|
|
54
|
+
|
|
55
|
+
.header {
|
|
56
|
+
display: flex;
|
|
57
|
+
height: 37px;
|
|
58
|
+
padding: 0;
|
|
59
|
+
color: var(--color-primary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.title {
|
|
63
|
+
display: inline-block;
|
|
64
|
+
padding-left: 1em;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.pipeline-toggle {
|
|
68
|
+
background-color: var(--color-alabaster);
|
|
69
|
+
display: inline-block;
|
|
70
|
+
padding: 10px 10px 10px 0;
|
|
71
|
+
height: 36px;
|
|
72
|
+
flex: 0 0 auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.shadowed {
|
|
76
|
+
position: relative;
|
|
77
|
+
display: flex;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { UISref, UISrefActive } from '@uirouter/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { CloudProviderLogo } from '@spinnaker/core';
|
|
5
|
+
|
|
6
|
+
import { RawResourceUtils } from '../RawResourceUtils';
|
|
7
|
+
|
|
8
|
+
import './RawResource.less';
|
|
9
|
+
|
|
10
|
+
interface IRawResourceProps {
|
|
11
|
+
resource: IApiKubernetesResource;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface IRawResourceState {}
|
|
15
|
+
|
|
16
|
+
export class RawResource extends React.Component<IRawResourceProps, IRawResourceState> {
|
|
17
|
+
constructor(props: IRawResourceProps) {
|
|
18
|
+
super(props);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public render() {
|
|
22
|
+
const { account, name, region } = this.props.resource;
|
|
23
|
+
const params = { account, name, region };
|
|
24
|
+
return (
|
|
25
|
+
<UISrefActive class="active">
|
|
26
|
+
<UISref to=".rawResourceDetails" params={params}>
|
|
27
|
+
<div className="RawResource card clickable clickable-row">
|
|
28
|
+
<h4 className="title">
|
|
29
|
+
<CloudProviderLogo provider="kubernetes" height="20px" width="20px" />
|
|
30
|
+
{this.props.resource.kind} {this.props.resource.displayName}
|
|
31
|
+
</h4>
|
|
32
|
+
<div className="details">
|
|
33
|
+
<div className="column">
|
|
34
|
+
<div className="title">account:</div>
|
|
35
|
+
<div>{this.props.resource.account}</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div className="column">
|
|
38
|
+
<div className="title">namespace:</div>
|
|
39
|
+
<div>{RawResourceUtils.namespaceDisplayName(this.props.resource.namespace)}</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div className="column">
|
|
42
|
+
<div className="title">apiVersion:</div>
|
|
43
|
+
<div>{this.props.resource.apiVersion}</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</UISref>
|
|
48
|
+
</UISrefActive>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { UISref } from '@uirouter/react';
|
|
2
|
+
import { get } from 'lodash';
|
|
3
|
+
import { DateTime } from 'luxon';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Dropdown } from 'react-bootstrap';
|
|
6
|
+
import { Subject } from 'rxjs';
|
|
7
|
+
|
|
8
|
+
import type { IManifest } from '@spinnaker/core';
|
|
9
|
+
import {
|
|
10
|
+
AccountTag,
|
|
11
|
+
CloudProviderLogo,
|
|
12
|
+
CollapsibleSection,
|
|
13
|
+
ConfirmationModalService,
|
|
14
|
+
logger,
|
|
15
|
+
ManifestWriter,
|
|
16
|
+
Overridable,
|
|
17
|
+
SETTINGS,
|
|
18
|
+
Spinner,
|
|
19
|
+
timestamp,
|
|
20
|
+
} from '@spinnaker/core';
|
|
21
|
+
|
|
22
|
+
import { RawResourceUtils } from '../RawResourceUtils';
|
|
23
|
+
import { ManifestLabels } from '../../../manifest/ManifestLabels';
|
|
24
|
+
import { KubernetesManifestService } from '../../../manifest/manifest.service';
|
|
25
|
+
import { KubernetesManifestCommandBuilder } from '../../../manifest/manifestCommandBuilder.service';
|
|
26
|
+
import type { IKubernetesManifestCondition } from '../../../manifest/status/ManifestCondition';
|
|
27
|
+
import { ManifestCondition } from '../../../manifest/status/ManifestCondition';
|
|
28
|
+
import { ManifestWizard } from '../../../manifest/wizard/ManifestWizard';
|
|
29
|
+
import { ManifestEvents } from '../../../pipelines/stages/deployManifest/manifestStatus/ManifestEvents';
|
|
30
|
+
|
|
31
|
+
export interface IRawResourceDetailsProps {
|
|
32
|
+
app: any;
|
|
33
|
+
$stateParams: {
|
|
34
|
+
account: string;
|
|
35
|
+
application: string;
|
|
36
|
+
name: string;
|
|
37
|
+
region: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IRawResourcesDetailState {
|
|
42
|
+
account: string;
|
|
43
|
+
application: string;
|
|
44
|
+
name: string;
|
|
45
|
+
region: string;
|
|
46
|
+
loading: boolean;
|
|
47
|
+
manifest?: IManifest;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
Overridable('k8s.rawResource.details');
|
|
51
|
+
export class RawResourceDetails extends React.Component<IRawResourceDetailsProps, IRawResourcesDetailState> {
|
|
52
|
+
constructor(props: IRawResourceDetailsProps) {
|
|
53
|
+
super(props);
|
|
54
|
+
this.state = {
|
|
55
|
+
account: null,
|
|
56
|
+
application: null,
|
|
57
|
+
name: null,
|
|
58
|
+
region: null,
|
|
59
|
+
loading: true,
|
|
60
|
+
manifest: null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
private destroy$ = new Subject();
|
|
64
|
+
private props$ = new Subject<IRawResourceDetailsProps>();
|
|
65
|
+
private unsubscribeManifest?: () => void;
|
|
66
|
+
|
|
67
|
+
public componentDidMount() {
|
|
68
|
+
this.setState({
|
|
69
|
+
account: this.props.$stateParams.account,
|
|
70
|
+
application: this.props.$stateParams.application,
|
|
71
|
+
name: this.props.$stateParams.name,
|
|
72
|
+
region: this.props.$stateParams.region,
|
|
73
|
+
});
|
|
74
|
+
const params = {
|
|
75
|
+
account: this.props.$stateParams.account,
|
|
76
|
+
location: this.props.$stateParams.region == '' ? '_' : this.props.$stateParams.region,
|
|
77
|
+
name: this.props.$stateParams.name,
|
|
78
|
+
};
|
|
79
|
+
this.unsubscribeManifest = KubernetesManifestService.subscribe(this.props.app, params, (manifest) => {
|
|
80
|
+
if (this.unsubscribeManifest != null) {
|
|
81
|
+
this.setState({ manifest, loading: false });
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public componentWillReceiveProps(nextProps: IRawResourceDetailsProps) {
|
|
87
|
+
this.props$.next(nextProps);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public componentWillUnmount() {
|
|
91
|
+
this.destroy$.next();
|
|
92
|
+
if (this.unsubscribeManifest) {
|
|
93
|
+
this.unsubscribeManifest();
|
|
94
|
+
this.unsubscribeManifest = null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private editRawResource() {
|
|
99
|
+
const { app } = this.props;
|
|
100
|
+
const { account, application, manifest } = this.state;
|
|
101
|
+
|
|
102
|
+
KubernetesManifestCommandBuilder.buildNewManifestCommand(
|
|
103
|
+
app,
|
|
104
|
+
manifest.manifest,
|
|
105
|
+
{ app: application },
|
|
106
|
+
account,
|
|
107
|
+
).then((builtCommand) => {
|
|
108
|
+
ManifestWizard.show({ title: 'Edit Manifest', application: app, command: builtCommand });
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private deletedRawResource = () => {
|
|
113
|
+
const { app } = this.props;
|
|
114
|
+
const { account, manifest } = this.state;
|
|
115
|
+
const name = manifest?.manifest?.metadata?.name ?? null;
|
|
116
|
+
const kind = manifest?.manifest?.kind;
|
|
117
|
+
const taskMonitor = {
|
|
118
|
+
application: app,
|
|
119
|
+
title: 'Deleting ' + name,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const submitMethod = () => {
|
|
123
|
+
logger.log({ category: 'RawResource', action: 'Delete clicked' });
|
|
124
|
+
const command = {
|
|
125
|
+
manifestName: this.state.name,
|
|
126
|
+
location: this.state.region,
|
|
127
|
+
account: this.state.account,
|
|
128
|
+
reason: null as string,
|
|
129
|
+
cloudProvider: 'kubernetes',
|
|
130
|
+
options: {
|
|
131
|
+
cascading: false,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
return ManifestWriter.deleteManifest(command, this.props.app);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
ConfirmationModalService.confirm({
|
|
138
|
+
header: 'Are you sure you want to delete the ' + kind + ' ' + name + '?',
|
|
139
|
+
buttonText: 'Delete',
|
|
140
|
+
account: account,
|
|
141
|
+
taskMonitorConfig: taskMonitor,
|
|
142
|
+
submitMethod,
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
private handleEditClick = (): void => {
|
|
147
|
+
logger.log({ category: 'RawResource', action: 'Edit clicked' });
|
|
148
|
+
this.editRawResource();
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
public render() {
|
|
152
|
+
const { account, region, manifest } = this.state;
|
|
153
|
+
const kind = manifest?.manifest?.kind;
|
|
154
|
+
const apiVersion = manifest?.manifest?.apiVersion;
|
|
155
|
+
const metadata = manifest?.manifest?.metadata;
|
|
156
|
+
const name = metadata?.name;
|
|
157
|
+
const creationUnixMs =
|
|
158
|
+
get(metadata, 'creationTimestamp') && DateTime.fromISO(metadata.creationTimestamp).toMillis();
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<div className="details-panel">
|
|
162
|
+
<div className="header">
|
|
163
|
+
<div className="close-button">
|
|
164
|
+
<UISref to="^">
|
|
165
|
+
<span className="glyphicon glyphicon-remove" />
|
|
166
|
+
</UISref>
|
|
167
|
+
</div>
|
|
168
|
+
{this.state.loading ? (
|
|
169
|
+
<div className="horizontal center middle">
|
|
170
|
+
<Spinner size="small" />
|
|
171
|
+
</div>
|
|
172
|
+
) : (
|
|
173
|
+
<div className="header-text horizontal middle">
|
|
174
|
+
<CloudProviderLogo provider="kubernetes" height="36px" width="36px" />
|
|
175
|
+
<h3 className="horizontal middle space-between flex-1">
|
|
176
|
+
{kind} {name}
|
|
177
|
+
</h3>
|
|
178
|
+
</div>
|
|
179
|
+
)}
|
|
180
|
+
{!this.state.loading && SETTINGS.kubernetesAdHocInfraWritesEnabled && (
|
|
181
|
+
<div className="actions">
|
|
182
|
+
<Dropdown className="dropdown" id="resource-actions-dropdown">
|
|
183
|
+
<Dropdown.Toggle className="btn btn-sm btn-primary dropdown-toggle">
|
|
184
|
+
<span>{kind} Actions</span>
|
|
185
|
+
</Dropdown.Toggle>
|
|
186
|
+
<Dropdown.Menu>
|
|
187
|
+
<li key="action-edit" id="resource-action-edit">
|
|
188
|
+
<a onClick={this.handleEditClick}>Edit</a>
|
|
189
|
+
</li>
|
|
190
|
+
<li key="action-delete" id="resource-action-delete">
|
|
191
|
+
<a onClick={this.deletedRawResource}>Delete</a>
|
|
192
|
+
</li>
|
|
193
|
+
</Dropdown.Menu>
|
|
194
|
+
</Dropdown>
|
|
195
|
+
</div>
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
{!this.state.loading && (
|
|
199
|
+
<div className="content">
|
|
200
|
+
<CollapsibleSection heading="Information" defaultExpanded={true}>
|
|
201
|
+
<dl className="dl-horizontal dl-narrow">
|
|
202
|
+
<dt>Created</dt>
|
|
203
|
+
<dd>{timestamp(creationUnixMs)}</dd>
|
|
204
|
+
<dt>Account</dt>
|
|
205
|
+
<dd>
|
|
206
|
+
<AccountTag account={account} />
|
|
207
|
+
</dd>
|
|
208
|
+
<dt>API Version</dt>
|
|
209
|
+
<dd>{apiVersion}</dd>
|
|
210
|
+
<dt>Kind</dt>
|
|
211
|
+
<dd>{kind}</dd>
|
|
212
|
+
<dt>Namespace</dt>
|
|
213
|
+
<dd>{RawResourceUtils.namespaceDisplayName(region)}</dd>
|
|
214
|
+
</dl>
|
|
215
|
+
</CollapsibleSection>
|
|
216
|
+
<CollapsibleSection key="status" heading="status" defaultExpanded={true}>
|
|
217
|
+
<ul>
|
|
218
|
+
{(manifest?.manifest?.status?.conditions ?? []).map((condition: IKubernetesManifestCondition) => (
|
|
219
|
+
<li key={condition.type + condition.lastTransitionTime} style={{ marginBottom: '10px' }}>
|
|
220
|
+
<ManifestCondition condition={condition} />
|
|
221
|
+
</li>
|
|
222
|
+
))}
|
|
223
|
+
</ul>
|
|
224
|
+
</CollapsibleSection>
|
|
225
|
+
<CollapsibleSection key="events" heading="events" defaultExpanded={true}>
|
|
226
|
+
<ManifestEvents manifest={manifest} />
|
|
227
|
+
</CollapsibleSection>
|
|
228
|
+
<CollapsibleSection key="labels" heading="labels" defaultExpanded={true}>
|
|
229
|
+
<ManifestLabels manifest={get(manifest, ['manifest'], {})} />
|
|
230
|
+
</CollapsibleSection>
|
|
231
|
+
</div>
|
|
232
|
+
)}
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RawResourceGroup } from './RawResouceGroup';
|
|
3
|
+
import { RawResource } from './RawResource';
|
|
4
|
+
import { RawResourceUtils } from '../RawResourceUtils';
|
|
5
|
+
|
|
6
|
+
interface IRawResourceGroupsProps {
|
|
7
|
+
resources: IApiKubernetesResource[];
|
|
8
|
+
groupBy: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface IRawResourceGroupsState {}
|
|
12
|
+
|
|
13
|
+
export class RawResourceGroups extends React.Component<IRawResourceGroupsProps, IRawResourceGroupsState> {
|
|
14
|
+
constructor(props: IRawResourceGroupsProps) {
|
|
15
|
+
super(props);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private buildGroupByModel(resources: IApiKubernetesResource[]) {
|
|
19
|
+
const values = resources.map((r: Record<string, any>) => String(r[this.props.groupBy]));
|
|
20
|
+
return Object.assign(
|
|
21
|
+
{},
|
|
22
|
+
...values.map((value) => ({
|
|
23
|
+
[value]: resources.filter((r: Record<string, any>) => String(r[this.props.groupBy]) === value),
|
|
24
|
+
})),
|
|
25
|
+
) as Record<string, IApiKubernetesResource[]>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private groupTitle(title: string): string {
|
|
29
|
+
if (this.props.groupBy == 'namespace') {
|
|
30
|
+
return RawResourceUtils.namespaceDisplayName(title);
|
|
31
|
+
}
|
|
32
|
+
return title;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public render() {
|
|
36
|
+
const groups = this.buildGroupByModel(this.props.resources);
|
|
37
|
+
return (
|
|
38
|
+
<div className="RawResourceGroups">
|
|
39
|
+
{...Object.entries(groups).map(([key, value]) => {
|
|
40
|
+
return key !== 'undefined' ? (
|
|
41
|
+
<RawResourceGroup title={this.groupTitle(key)} key={key}>
|
|
42
|
+
{...value.map((resource) => (
|
|
43
|
+
<RawResource resource={resource} key={RawResourceUtils.resourceKey(resource)}></RawResource>
|
|
44
|
+
))}
|
|
45
|
+
</RawResourceGroup>
|
|
46
|
+
) : (
|
|
47
|
+
<></>
|
|
48
|
+
);
|
|
49
|
+
})}
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { IK8sResourcesFiltersState } from '../component/K8sResourcesFilters';
|
|
2
|
+
|
|
3
|
+
type ISubscriber = (message: IK8sResourcesFiltersState) => void;
|
|
4
|
+
|
|
5
|
+
export class FiltersPubSub {
|
|
6
|
+
private subscribers: ISubscriber[] = [];
|
|
7
|
+
private static intances: Record<string, FiltersPubSub> = {};
|
|
8
|
+
|
|
9
|
+
private constructor() {}
|
|
10
|
+
|
|
11
|
+
public static getInstance(name: string) {
|
|
12
|
+
let instance = FiltersPubSub.intances[name];
|
|
13
|
+
if (!FiltersPubSub.intances[name]) {
|
|
14
|
+
FiltersPubSub.intances[name] = new FiltersPubSub();
|
|
15
|
+
instance = FiltersPubSub.intances[name];
|
|
16
|
+
}
|
|
17
|
+
return instance;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public subscribe(subscriber: ISubscriber) {
|
|
21
|
+
this.subscribers.push(subscriber);
|
|
22
|
+
return () => (this.subscribers = this.subscribers.filter((x) => x !== subscriber));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public unsubscribe(subscriber: ISubscriber) {
|
|
26
|
+
const index = this.subscribers.indexOf(subscriber);
|
|
27
|
+
if (index > -1) {
|
|
28
|
+
this.subscribers.splice(index, 1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public publish(message: IK8sResourcesFiltersState) {
|
|
33
|
+
this.subscribers.forEach((sub) => sub(message));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rawResource.module';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface IResource {
|
|
2
|
+
name: String;
|
|
3
|
+
labels: {
|
|
4
|
+
[key: string]: String;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface IApiKubernetesResource {
|
|
9
|
+
account: string;
|
|
10
|
+
apiVersion: string;
|
|
11
|
+
displayName: string;
|
|
12
|
+
kind: string;
|
|
13
|
+
labels: Record<string, string>;
|
|
14
|
+
moniker: Record<string, string>;
|
|
15
|
+
name: string;
|
|
16
|
+
namespace: string;
|
|
17
|
+
region: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IQService } from 'angular';
|
|
2
|
+
import { module } from 'angular';
|
|
3
|
+
|
|
4
|
+
import type { Application } from '@spinnaker/core';
|
|
5
|
+
import { ApplicationDataSourceRegistry, INFRASTRUCTURE_KEY, REST } from '@spinnaker/core';
|
|
6
|
+
|
|
7
|
+
export const KUBERNETS_RAW_RESOURCE_DATA_SOURCE = 'spinnaker.core.rawresource.dataSource';
|
|
8
|
+
export const KUBERNETS_RAW_RESOURCE_DATA_SOURCE_KEY = 'k8s';
|
|
9
|
+
const KUBERNETS_RAW_RESOURCE_DATA_SOURCE_SREF = `.insight.${KUBERNETS_RAW_RESOURCE_DATA_SOURCE_KEY}`;
|
|
10
|
+
|
|
11
|
+
type ApiK8sResource = any;
|
|
12
|
+
|
|
13
|
+
const fetchK8sResources = (application: Application): PromiseLike<ApiK8sResource> =>
|
|
14
|
+
REST('applications').path(application.name, 'rawResources').get();
|
|
15
|
+
|
|
16
|
+
const formatK8sResources = ($q: IQService) => (_: Application, result: ApiK8sResource): PromiseLike<ApiK8sResource> =>
|
|
17
|
+
$q.resolve(result);
|
|
18
|
+
|
|
19
|
+
module(KUBERNETS_RAW_RESOURCE_DATA_SOURCE, []).run([
|
|
20
|
+
'$q',
|
|
21
|
+
($q: IQService) => {
|
|
22
|
+
ApplicationDataSourceRegistry.registerDataSource({
|
|
23
|
+
key: KUBERNETS_RAW_RESOURCE_DATA_SOURCE_KEY,
|
|
24
|
+
label: 'Kubernetes',
|
|
25
|
+
category: INFRASTRUCTURE_KEY,
|
|
26
|
+
sref: KUBERNETS_RAW_RESOURCE_DATA_SOURCE_SREF,
|
|
27
|
+
primary: true,
|
|
28
|
+
icon: 'fas fa-xs fa-fw fa-th-large',
|
|
29
|
+
iconName: 'spMenuK8s',
|
|
30
|
+
loader: fetchK8sResources,
|
|
31
|
+
onLoad: formatK8sResources($q),
|
|
32
|
+
providerField: 'cloudProvider',
|
|
33
|
+
credentialsField: 'account',
|
|
34
|
+
regionField: 'region',
|
|
35
|
+
description: 'Collections of kubernetes resources',
|
|
36
|
+
defaultData: [],
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
]);
|