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
pull/4689/head
Alice Groux 2021-01-07 22:29:17 +01:00 committed by GitHub
parent b924347c5b
commit 7848bcf2f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 15 deletions

View File

@ -0,0 +1,11 @@
<information-panel title-text="Advanced deployment">
<span class="small">
<p class="text-muted">
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
As an administrator user, you have access to the advanced deployment feature allowing you to deploy any Kubernetes manifest inside your cluster.
</p>
<p>
<button type="button" class="btn btn-sm btn-primary" ui-sref="kubernetes.deploy"> <i class="fa fa-file-code space-right" aria-hidden="true"></i>Advanced deployment </button>
</p>
</span>
</information-panel>

View File

@ -5,19 +5,7 @@
<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>
<div ng-if="ctrl.state.viewReady">
<information-panel title-text="Advanced deployment" ng-if="ctrl.state.isAdmin">
<span class="small">
<p class="text-muted">
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
As an administrator user, you have access to the advanced deployment feature allowing you to deploy any Kubernetes manifest inside your cluster.
</p>
<p>
<button type="button" class="btn btn-sm btn-primary" ui-sref="kubernetes.deploy">
<i class="fa fa-file-code space-right" aria-hidden="true"></i>Advanced deployment
</button>
</p>
</span>
</information-panel>
<div ng-if="ctrl.state.isAdmin" ng-include="'app/kubernetes/templates/advancedDeploymentPanel.html'"></div>
<div class="row">
<div class="col-sm-12">

View File

@ -1,3 +1,5 @@
require('../../templates/advancedDeploymentPanel.html');
import angular from 'angular';
import * as _ from 'lodash-es';
import KubernetesStackHelper from 'Kubernetes/helpers/stackHelper';

View File

@ -7,6 +7,8 @@
<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>
<div ng-if="ctrl.state.viewReady">
<div ng-if="ctrl.state.isAdmin" ng-include="'app/kubernetes/templates/advancedDeploymentPanel.html'"></div>
<div class="row">
<div class="col-sm-12">
<rd-widget>

View File

@ -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');

View File

@ -5,6 +5,8 @@
<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>
<div ng-if="ctrl.state.viewReady">
<div ng-if="ctrl.state.isAdmin" ng-include="'app/kubernetes/templates/advancedDeploymentPanel.html'"></div>
<div class="row">
<div class="col-sm-12">
<kubernetes-configurations-datatable

View File

@ -1,12 +1,15 @@
require('../../templates/advancedDeploymentPanel.html');
import angular from 'angular';
import KubernetesConfigurationHelper from 'Kubernetes/helpers/configurationHelper';
class KubernetesConfigurationsController {
/* @ngInject */
constructor($async, $state, Notifications, KubernetesConfigurationService, KubernetesApplicationService, ModalService) {
constructor($async, $state, Notifications, Authentication, KubernetesConfigurationService, KubernetesApplicationService, ModalService) {
this.$async = $async;
this.$state = $state;
this.Notifications = Notifications;
this.Authentication = Authentication;
this.KubernetesConfigurationService = KubernetesConfigurationService;
this.KubernetesApplicationService = KubernetesApplicationService;
this.ModalService = ModalService;
@ -93,6 +96,7 @@ class KubernetesConfigurationsController {
configurationsLoading: true,
applicationsLoading: true,
viewReady: false,
isAdmin: this.Authentication.isAdmin(),
};
await this.getApplications();

View File

@ -5,6 +5,8 @@
<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>
<div ng-if="ctrl.state.viewReady">
<div ng-if="ctrl.state.isAdmin" ng-include="'app/kubernetes/templates/advancedDeploymentPanel.html'"></div>
<div class="row">
<div class="col-sm-12">
<rd-widget>

View File

@ -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();