Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[DATALAB-2278]: Changed names for services and messages on configurat…
Browse files Browse the repository at this point in the history
…ion page (#1064)

 [DATALAB-2278]: Changed names for services and messages on configuration page
  • Loading branch information
DG1202 committed Feb 8, 2021
1 parent cbbbba3 commit 17b2779
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 30 deletions.
Expand Up @@ -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-service'].isConfigChanged"
[disabled]="!services['provisioning'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged"
>
Save
</button>
<button mat-raised-button class="butt"
(click)="action('discard')"
[disabled]="!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged"
[disabled]="!services['provisioning'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged"
>
Discard changes
</button>
Expand All @@ -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-service'].isConfigChanged) && activeTab.index !== 0"
[disabled]="!(!services['provisioning'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged) && activeTab.index !== 0"
>
<h4>Main settings</h4>
<div class="main-wrapper">
Expand Down Expand Up @@ -72,31 +72,36 @@ <h4>Main settings</h4>
</section>
</div>
</mat-tab>
<mat-tab label="Provisioning"
[disabled]="!(!services['provisioning-service'].isConfigChanged
&& !services['self-service'].isConfigChanged
&& !services['billing-service'].isConfigChanged)
&& activeTab.index !== 1"

<mat-tab label="Self-service"
[disabled]="!(!services['provisioning'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged) && activeTab.index !== 1"

>
<h4>Edit provisioning.yml</h4>
<h4>Edit self-service.yml</h4>
<div class="editor-wrap">
<div ace-editor [(text)]="services['provisioning-service'].config" mode="yaml" (textChange)="configUpdate('provisioning-service')"></div>
<div ace-editor mode="yaml" [(text)]="services['self-service'].config" (textChange)="configUpdate('self-service')"></div>
</div>
</mat-tab>
<mat-tab label="Self service"
[disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged) && activeTab.index !== 2"
>
<h4>Edit self-service.yml</h4>

<mat-tab label="Provisioning"
[disabled]="!(!services['provisioning'].isConfigChanged
&& !services['self-service'].isConfigChanged
&& !services['billing'].isConfigChanged)
&& activeTab.index !== 2"

<h4>Edit provisioning.yml</h4>
<div class="editor-wrap">
<div ace-editor mode="yaml" [(text)]="services['self-service'].config" (textChange)="configUpdate('self-service')"></div>
<div ace-editor [(text)]="services['provisioning'].config" mode="yaml" (textChange)="configUpdate('provisioning')"></div>
</div>
</mat-tab>

<mat-tab label="Billing"
[disabled]="!(!services['provisioning-service'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing-service'].isConfigChanged) && activeTab.index !== 3"
[disabled]="!(!services['provisioning'].isConfigChanged && !services['self-service'].isConfigChanged && !services['billing'].isConfigChanged) && activeTab.index !== 3"
>
<h4>Edit billing.yml</h4>
<div class="editor-wrap">
<div ace-editor [(text)]="services['billing-service'].config" mode="yaml" (textChange)="configUpdate('billing')"></div>
<div ace-editor [(text)]="services['billing'].config" mode="yaml" (textChange)="configUpdate('billing')"></div>

</div>
</mat-tab>
</mat-tab-group>
Expand Down
Expand Up @@ -40,9 +40,9 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
public activeTab = {index: 0};
public activeService: string;
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-service': {label: 'Billing service', selected: false, config: '', serverConfig: '', isConfigChanged: false},
'self-service': {label: 'Self-service', selected: false, config: '', serverConfig: '', isConfigChanged: false},
'provisioning': {label: 'Provisioning', selected: false, config: '', serverConfig: '', isConfigChanged: false},
'billing': {label: 'Billing', selected: false, config: '', serverConfig: '', isConfigChanged: false},
};

private confirmMessages = {
Expand Down Expand Up @@ -135,16 +135,16 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
this.getServicesConfig(service);
this.toastr.success('Service configuration saved!', 'Success!');
},
error => this.toastr.error('Service configuration is not saved', 'Oops!')
error => this.toastr.error( error.message || 'Service configuration is not saved', 'Oops!')
);
}

public tabChanged(tabChangeEvent: MatTabChangeEvent): void {
this.activeTab = tabChangeEvent;
if (this.activeTab.index === 1) {
this.activeService = 'provisioning-service';
} else if (this.activeTab.index === 2) {
this.activeService = 'self-service';
} else if (this.activeTab.index === 2) {
this.activeService = 'provisioning';
} else if (this.activeTab.index === 3) {
this.activeService = 'billing-service';
} else {
Expand Down Expand Up @@ -190,8 +190,8 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
.afterClosed().subscribe(result => {
if (result) {
this.configurationService.restartServices(this.services['self-service'].selected,
this.services['provisioning-service'].selected,
this.services['billing-service'].selected
this.services['provisioning'].selected,
this.services['billing'].selected
)
.pipe(
takeUntil(this.unsubscribe$),
Expand Down Expand Up @@ -237,8 +237,10 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
</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 === 'restart'" ]>
Restarting <span class="strong">{{data.services.join(', ')}}</span> <span *ngIf="data.services.length > 1 || (data.services.length === 1 && data.services[0] !== 'self-service')">
service</span><span [hidden]="(data.services.length < 2) || data.services.length === 2 && data.services[0] === 'self-service'">s</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>
Expand All @@ -258,7 +260,7 @@ export class ConfigurationComponent implements OnInit, OnDestroy {
header h4 i { vertical-align: bottom; }
header a i { font-size: 20px; }
header a:hover i { color: #35afd5; cursor: pointer; }
.content{padding: 35px 30px 30px 30px;}
.content{padding: 35px 30px 30px 30px; text-align: center;}
label{cursor: pointer}`
]
})
Expand All @@ -268,7 +270,6 @@ export class SettingsConfirmationDialogComponent {
public dialogRef: MatDialogRef<SettingsConfirmationDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {

}
}

Expand Down
Expand Up @@ -40,8 +40,10 @@ export class ConfigurationService {
const settings = {
ymlString: config
};
const selectedService = service === 'provisioning' ? 'provisioning-service' : service;

return this.applicationServiceFacade
.buildSetServiceConfig(service, settings)
.buildSetServiceConfig(selectedService, settings)
.pipe(
map(response => response),
catchError(ErrorUtils.handleServiceError));
Expand Down
Expand Up @@ -268,6 +268,7 @@ export class BucketBrowserComponent implements OnInit, OnDestroy {
}

public deleteAddedFile(file) {
console.log('deleteAddedFile');
if ( file.subscr && file.request) {
this.dialog.open(BucketConfirmationDialogComponent, {data: {items: file, type: 'cancel-uploading'} , width: '550px'})
.afterClosed().subscribe((res) => {
Expand Down

0 comments on commit 17b2779

Please sign in to comment.