You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by dg...@apache.org on 2021/02/05 10:28:31 UTC

[incubator-datalab] branch develop updated: [DATALAB-2272]: Adjusted confirmation message according to selected services (#1060)

This is an automated email from the ASF dual-hosted git repository.

dgnatyshyn pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/develop by this push:
     new 32d5bcd  [DATALAB-2272]: Adjusted confirmation message according to selected services (#1060)
32d5bcd is described below

commit 32d5bcda0773ee2b90dcd1b65ecc21fc417c1bb1
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Fri Feb 5 12:28:25 2021 +0200

    [DATALAB-2272]: Adjusted confirmation message according to selected services (#1060)
    
    [DATALAB-2272]: Adjusted confirmation message according to selected service(s)
---
 .../configuration/configuration.component.html     | 14 +++++-----
 .../configuration/configuration.component.ts       | 31 ++++++++++++++++------
 .../app/administration/roles/roles.component.scss  |  4 ---
 .../src/main/resources/webapp/src/styles.scss      |  2 +-
 4 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.html
index 6ddd080..d085a4f 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.html
@@ -22,13 +22,13 @@
     <ng-template [ngIf]="activeTab.index !== 0">
       <button mat-raised-button class="butt"
               (click)="action('save')"
-              [disabled]="!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged"
+              [disabled]="!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged"
       >
         Save
       </button>
       <button mat-raised-button class="butt"
               (click)="action('discard')"
-              [disabled]="!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged"
+              [disabled]="!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged"
       >
         Discard changes
       </button>
@@ -41,7 +41,7 @@
   <div class="configuration-wrapper">
     <mat-tab-group animationDuration="0.5ms" (selectedTabChange)="tabChanged($event)">
       <mat-tab label="Main"
-               [disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged) && activeTab.index !== 0"
+               [disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged) && activeTab.index !== 0"
       >
         <h4>Main settings</h4>
         <div class="main-wrapper">
@@ -75,7 +75,7 @@
       <mat-tab label="Provisioning"
                [disabled]="!(!services['provisioning-service'].isConfigChanged
                && !services['self-service'].isConfigChanged
-               && !services['billing'].isConfigChanged)
+               && !services['billing-service'].isConfigChanged)
                && activeTab.index !== 1"
       >
         <h4>Edit provisioning.yml</h4>
@@ -84,7 +84,7 @@
         </div>
       </mat-tab>
       <mat-tab label="Self service"
-               [disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged) && activeTab.index !== 2"
+               [disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged) && activeTab.index !== 2"
       >
          <h4>Edit self-service.yml</h4>
         <div class="editor-wrap">
@@ -92,11 +92,11 @@
         </div>
       </mat-tab>
       <mat-tab label="Billing"
-               [disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged) && activeTab.index !== 3"
+               [disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged) && activeTab.index !== 3"
       >
         <h4>Edit billing.yml</h4>
         <div class="editor-wrap">
-          <div ace-editor [(text)]="services.billing.config" mode="yaml" (textChange)="configUpdate('billing')"></div>
+          <div ace-editor [(text)]="services['billing-service'].config" mode="yaml" (textChange)="configUpdate('billing')"></div>
         </div>
       </mat-tab>
     </mat-tab-group>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.ts
index 7c61b42..43a555e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/configuration/configuration.component.ts
@@ -42,7 +42,7 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
   public services = {
     'self-service': {label: 'Self service', selected: false, config: '', serverConfig: '', isConfigChanged: false},
     'provisioning-service': {label: 'Provisioning service', selected: false, config: '', serverConfig: '', isConfigChanged: false},
-    'billing': {label: 'Billing', selected: false, config: '', serverConfig: '', isConfigChanged: false},
+    'billing-service': {label: 'Billing service', selected: false, config: '', serverConfig: '', isConfigChanged: false},
   };
 
   private confirmMessages = {
@@ -146,7 +146,7 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
     } else if (this.activeTab.index === 2) {
       this.activeService = 'self-service';
     } else if (this.activeTab.index === 3) {
-      this.activeService = 'billing';
+      this.activeService = 'billing-service';
     } else {
       this.activeService = '';
     }
@@ -177,14 +177,21 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
   }
 
   public restartServices(): void  {
+    const selectedServices = [];
+    for (const service in this.services) {
+      if (this.services[service].selected) {
+        selectedServices.push(service);
+      }
+    }
+
     this.dialog.open(SettingsConfirmationDialogComponent, { data: {
-        action: 'Restart services', message: this.confirmMessages.restartService
+        action: 'restart', services: selectedServices
       }, panelClass: 'modal-sm' })
       .afterClosed().subscribe(result => {
         if (result) {
           this.configurationService.restartServices(this.services['self-service'].selected,
             this.services['provisioning-service'].selected,
-            this.services['billing'].selected
+            this.services['billing-service'].selected
           )
             .pipe(
               takeUntil(this.unsubscribe$),
@@ -195,9 +202,12 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
                 this.toastr.success('Service restarting started!', 'Success!');
               },
               error => {
-                return this.services['self-service'].selected ?
-                  this.toastr.success('Service restarting started!', 'Success!') :
-                  this.toastr.error('Service restarting failed', 'Oops!');
+              if (this.services['self-service'].selected) {
+                this.clearSelectedServices();
+                return this.toastr.success('Service restarting started!', 'Success!');
+              } else {
+                this.toastr.error('Service restarting failed', 'Oops!');
+              }
               }
             );
         } else {
@@ -220,12 +230,17 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
   template: `
   <div id="dialog-box">
     <div class="dialog-header">
-      <h4 class="modal-title"><span class="capitalize">{{ data.action }}</span> <span *ngIf="data.action === 'save' || data.action === 'discard'"> changes</span></h4>
+      <h4 class="modal-title"><span class="capitalize">{{ data.action }}</span> <span *ngIf="data.action === 'save' || data.action === 'discard'"> changes</span><span *ngIf="data.action === 'restart'">
+        service<span *ngIf="data.services.length > 1">s</span>
+      </span></h4>
       <button type="button" class="close" (click)="dialogRef.close()">&times;</button>
     </div>
 
     <div mat-dialog-content class="content">
       {{data.message}}
+      <ng-template [ngIf]="data.action === 'restart'" ]>Restarting <span class="strong">{{data.services.join(', ')}}</span> will make DataLab unavailable for some time.</ng-template>
+      <ng-template [ngIf]="data.action === 'discard'" ]>Discard all unsaved changes.</ng-template>
+      <ng-template [ngIf]="data.action === 'save'" ]>After you save changes you need to restart service.</ng-template>
     </div>
     <div class="text-center ">
       <p class="strong">Do you want to proceed?</p>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss
index 6e6e63d..2704779 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss
@@ -295,10 +295,6 @@ mat-chip.mat-chip a {
   right: 15px;
 }
 
-mat-chip:hover::after {
-  opacity: .12;
-}
-
 mat-form-field.chip-list {
   &.mat-form-field {
     position: absolute;
diff --git a/services/self-service/src/main/resources/webapp/src/styles.scss b/services/self-service/src/main/resources/webapp/src/styles.scss
index 51aef16..2e48da8 100644
--- a/services/self-service/src/main/resources/webapp/src/styles.scss
+++ b/services/self-service/src/main/resources/webapp/src/styles.scss
@@ -448,7 +448,7 @@ input[type='number'] {
 .mat-chip.mat-standard-chip::after {
   height: 0;
   width: 0;
-  opacity: 0;
+  position: unset;
 }
 
 .capitalize {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org