[DATALAB-2208]: Clear all previous selected items after canceling
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 1e19fc6..8306868 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
@@ -17,7 +17,7 @@
* under the License.
*/
-import {Component, OnInit, Inject, HostListener} from '@angular/core';
+import {Component, OnInit, Inject, HostListener, OnDestroy} from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import {HealthStatusService, AppRoutingService} from '../../core/services';
import {MatTabChangeEvent} from '@angular/material/tabs';
@@ -26,13 +26,16 @@
import 'brace';
import 'brace/mode/yaml';
import {ToastrService} from 'ngx-toastr';
+import {Subject} from 'rxjs';
+import {takeUntil} from 'rxjs/operators';
@Component({
selector: 'datalab-configuration',
templateUrl: './configuration.component.html',
styleUrls: ['./configuration.component.scss']
})
-export class ConfigurationComponent implements OnInit {
+export class ConfigurationComponent implements OnInit, OnDestroy {
+ private unsubscribe$ = new Subject();
private healthStatus: any;
public activeTab = {index: 0};
public activeService: string;
@@ -75,8 +78,16 @@
this.getServicesConfig(...Object.keys(this.services));
}
- private getEnvironmentHealthStatus() {
+ ngOnDestroy() {
+ this.unsubscribe$.next();
+ this.unsubscribe$.complete();
+ }
+
+ private getEnvironmentHealthStatus(): void {
this.healthStatusService.getEnvironmentHealthStatus()
+ .pipe(
+ takeUntil(this.unsubscribe$)
+ )
.subscribe((result: any) => {
this.healthStatus = result;
!this.healthStatus.admin && !this.healthStatus.projectAdmin && this.appRoutingService.redirectToHomePage();
@@ -84,11 +95,11 @@
);
}
- public refreshConfig() {
+ public refreshConfig(): void {
this.getServicesConfig(...Object.keys(this.services));
}
- public action(action) {
+ public action(action: string): void {
this.dialog.open(SettingsConfirmationDialogComponent, { data: {
action: action, message: action === 'discard' ? this.confirmMessages.discardChanges : this.confirmMessages.saveChanges
}, panelClass: 'modal-sm' })
@@ -99,9 +110,13 @@
});
}
- private getServicesConfig(...services) {
+ private getServicesConfig(...services): void {
services.forEach(service => {
- this.configurationService.getServiceSettings(service).subscribe(config => {
+ this.configurationService.getServiceSettings(service)
+ .pipe(
+ takeUntil(this.unsubscribe$)
+ )
+ .subscribe(config => {
this.services[service].config = config;
this.services[service].serverConfig = config;
this.configUpdate(service);
@@ -111,8 +126,12 @@
this.clearSelectedServices();
}
- private setServiceConfig(service, config) {
- this.configurationService.setServiceConfig(service, config).subscribe(res => {
+ private setServiceConfig(service, config): void {
+ this.configurationService.setServiceConfig(service, config)
+ .pipe(
+ takeUntil(this.unsubscribe$)
+ )
+ .subscribe(res => {
this.getServicesConfig(service);
this.toastr.success('Service configuration saved!', 'Success!');
},
@@ -149,15 +168,15 @@
this.clearSelectedServices();
}
- private clearSelectedServices() {
+ private clearSelectedServices(): void {
Object.keys(this.services).forEach(service => this.services[service].selected = false);
}
- public toggleSetings(service) {
+ public toggleSetings(service): void {
this.services[service].selected = !this.services[service].selected;
}
- public restartServices() {
+ public restartServices(): void {
this.dialog.open(SettingsConfirmationDialogComponent, { data: {
action: 'Restart services', message: this.confirmMessages.restartService
}, panelClass: 'modal-sm' })
@@ -167,17 +186,22 @@
this.services['provisioning-service'].selected,
this.services['billing'].selected
)
+ .pipe(
+ takeUntil(this.unsubscribe$)
+ )
.subscribe(res => {
- this.clearSelectedServices();
+ this.clearSelectedServices();
this.toastr.success('Service restarting started!', 'Success!');
},
error => this.toastr.error('Service restarting failed', 'Oops!')
);
+ } else {
+ this.clearSelectedServices();
}
});
}
- public configUpdate(service: string) {
+ public configUpdate(service: string): void {
this.services[service].isConfigChanged = this.services[service].config !== this.services[service].serverConfig;
}
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
index 98b7a9e..8c879af 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
@@ -71,7 +71,7 @@
<input type="number" (keypress)="CheckUtils.numberOnly($event)" formControlName="total"
placeholder="Enter total budget, in USD">
<span class="error" *ngIf="manageUsersForm?.controls['total'].hasError('overrun')
- && !manageUsersForm?.controls['total'].hasError('max')">Total budget cannot be lower than a sum of projects quotes.</span>
+ && !manageUsersForm?.controls['total'].hasError('max')">Total budget cannot be lower than a sum of project quotes.</span>
<span class="error"
*ngIf="manageUsersForm?.controls['total'].hasError('max')">Total budget cannot be higher than 1000000000.</span>
</div>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
index b97ddf8..53d00cb 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
@@ -266,7 +266,7 @@
this.filterConfiguration = new ManagementConfigModel(users, '', projects, shapes, statuses, resources, endpoints);
}
- openNotebookDetails(data) {
+ public openNotebookDetails(data) {
if (!data.exploratory_urls || !data.exploratory_urls.length) {
return;
}
@@ -277,13 +277,13 @@
.afterClosed().subscribe(() => {});
}
- toggleActionForAll(element) {
+ public toggleActionForAll(element) {
element.isSelected = !element.isSelected;
this.selected = this.allFilteredEnvironmentData.filter(item => !!item.isSelected);
this.emitSelectedList.emit(this.selected);
}
- toggleSelectionAll() {
+ public toggleSelectionAll() {
if (this.selected && this.selected.length === this.allActiveNotebooks.length) {
this.allActiveNotebooks.forEach(notebook => notebook.isSelected = false);
} else {
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
index 0bbc66d..38779fc 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
@@ -243,6 +243,8 @@
);
});
this.clearSelection();
+ } else {
+ this.clearSelection();
}
this.isActionsOpen = false;
});
@@ -261,6 +263,8 @@
);
});
this.clearSelection();
+ } else {
+ this.clearSelection();
}
this.isActionsOpen = false;
});
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
index 73d04f1..bc4ab9e 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
@@ -120,7 +120,7 @@
public toggleStatus($event) {
const data = { 'project_name': $event.project.name, endpoint: $event.endpoint.map(endpoint => endpoint.name)};
- this.toggleStatusRequest(data, $event.action);
+ this.toggleStatusRequest(data, $event.action);
}
private toggleStatusRequest(data, action) {
@@ -148,7 +148,10 @@
this.projectService.toggleProjectStatus(data, action).subscribe(() => {
this.refreshGrid();
this.toastr.success(`Edge node ${this.toEndpointAction(action)} is in progress!`, 'Processing!');
- }, error => this.toastr.error(error.message, 'Oops!'));
+ }, error => {
+ console.log(error);
+ this.toastr.error(error.message, 'Oops!');
+ });
}
private getEnvironmentHealthStatus() {
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts
index 5d25db2..f9f6aa4 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/errorUtils.ts
@@ -41,6 +41,7 @@
// }
public static handleServiceError(errorMessage) {
+ console.log(errorMessage);
const error = CheckUtils.isJSON(errorMessage.error) ? JSON.parse(errorMessage.error) : errorMessage.error;
return observableThrowError({
status: error.code,