From 7848bcf2f496d2406aea11bf7543348ad2c14c74 Mon Sep 17 00:00:00 2001 From: Alice Groux Date: Thu, 7 Jan 2021 22:29:17 +0100 Subject: [PATCH] feat(k8s/resources-list-view): add advanced deployment panel to resources list view (#4516) * feat(k8s/resources-list-view): add advanced deployment panel to applications view, configurations view and volumes view * feat(k8s/resources-list-view): move advanced deployment into a template and use it everywhere --- .../templates/advancedDeploymentPanel.html | 11 +++++++++++ .../views/applications/applications.html | 14 +------------- .../applications/applicationsController.js | 2 ++ .../views/applications/edit/application.html | 2 ++ .../applications/edit/applicationController.js | 5 +++++ .../views/configurations/configurations.html | 2 ++ .../configurations/configurationsController.js | 6 +++++- app/kubernetes/views/volumes/volumes.html | 2 ++ .../views/volumes/volumesController.js | 17 ++++++++++++++++- 9 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 app/kubernetes/templates/advancedDeploymentPanel.html diff --git a/app/kubernetes/templates/advancedDeploymentPanel.html b/app/kubernetes/templates/advancedDeploymentPanel.html new file mode 100644 index 000000000..1072dc615 --- /dev/null +++ b/app/kubernetes/templates/advancedDeploymentPanel.html @@ -0,0 +1,11 @@ + + +

+ + As an administrator user, you have access to the advanced deployment feature allowing you to deploy any Kubernetes manifest inside your cluster. +

+

+ +

+
+
diff --git a/app/kubernetes/views/applications/applications.html b/app/kubernetes/views/applications/applications.html index d60033ade..c0c86d0b8 100644 --- a/app/kubernetes/views/applications/applications.html +++ b/app/kubernetes/views/applications/applications.html @@ -5,19 +5,7 @@
- - -

- - As an administrator user, you have access to the advanced deployment feature allowing you to deploy any Kubernetes manifest inside your cluster. -

-

- -

-
-
+
diff --git a/app/kubernetes/views/applications/applicationsController.js b/app/kubernetes/views/applications/applicationsController.js index 1f8b137be..8a7dfec4b 100644 --- a/app/kubernetes/views/applications/applicationsController.js +++ b/app/kubernetes/views/applications/applicationsController.js @@ -1,3 +1,5 @@ +require('../../templates/advancedDeploymentPanel.html'); + import angular from 'angular'; import * as _ from 'lodash-es'; import KubernetesStackHelper from 'Kubernetes/helpers/stackHelper'; diff --git a/app/kubernetes/views/applications/edit/application.html b/app/kubernetes/views/applications/edit/application.html index 822ef9adc..e5751e236 100644 --- a/app/kubernetes/views/applications/edit/application.html +++ b/app/kubernetes/views/applications/edit/application.html @@ -7,6 +7,8 @@
+
+
diff --git a/app/kubernetes/views/applications/edit/applicationController.js b/app/kubernetes/views/applications/edit/applicationController.js index 0d4b3482a..a723cbaf9 100644 --- a/app/kubernetes/views/applications/edit/applicationController.js +++ b/app/kubernetes/views/applications/edit/applicationController.js @@ -1,3 +1,5 @@ +require('../../../templates/advancedDeploymentPanel.html'); + import angular from 'angular'; import * as _ from 'lodash-es'; import * as JsonPatch from 'fast-json-patch'; @@ -101,6 +103,7 @@ class KubernetesApplicationController { Notifications, LocalStorage, ModalService, + Authentication, KubernetesApplicationService, KubernetesEventService, KubernetesStackService, @@ -114,6 +117,7 @@ class KubernetesApplicationController { this.Notifications = Notifications; this.LocalStorage = LocalStorage; this.ModalService = ModalService; + this.Authentication = Authentication; this.KubernetesApplicationService = KubernetesApplicationService; this.KubernetesEventService = KubernetesEventService; @@ -333,6 +337,7 @@ class KubernetesApplicationController { eventWarningCount: 0, expandedNote: false, useIngress: false, + isAdmin: this.Authentication.isAdmin(), }; this.state.activeTab = this.LocalStorage.getActiveTab('application'); diff --git a/app/kubernetes/views/configurations/configurations.html b/app/kubernetes/views/configurations/configurations.html index 8e55b4fc8..6d07dc244 100644 --- a/app/kubernetes/views/configurations/configurations.html +++ b/app/kubernetes/views/configurations/configurations.html @@ -5,6 +5,8 @@
+
+
+
+
diff --git a/app/kubernetes/views/volumes/volumesController.js b/app/kubernetes/views/volumes/volumesController.js index 90d44cf9f..9dc18f866 100644 --- a/app/kubernetes/views/volumes/volumesController.js +++ b/app/kubernetes/views/volumes/volumesController.js @@ -1,3 +1,5 @@ +require('../../templates/advancedDeploymentPanel.html'); + import * as _ from 'lodash-es'; import filesizeParser from 'filesize-parser'; import angular from 'angular'; @@ -39,10 +41,22 @@ function computeSize(volumes) { class KubernetesVolumesController { /* @ngInject */ - constructor($async, $state, Notifications, ModalService, LocalStorage, EndpointProvider, KubernetesStorageService, KubernetesVolumeService, KubernetesApplicationService) { + constructor( + $async, + $state, + Notifications, + Authentication, + ModalService, + LocalStorage, + EndpointProvider, + KubernetesStorageService, + KubernetesVolumeService, + KubernetesApplicationService + ) { this.$async = $async; this.$state = $state; this.Notifications = Notifications; + this.Authentication = Authentication; this.ModalService = ModalService; this.LocalStorage = LocalStorage; this.EndpointProvider = EndpointProvider; @@ -117,6 +131,7 @@ class KubernetesVolumesController { currentName: this.$state.$current.name, endpointId: this.EndpointProvider.endpointID(), activeTab: this.LocalStorage.getActiveTab('volumes'), + isAdmin: this.Authentication.isAdmin(), }; await this.getVolumes();