This is an automated email from the ASF dual-hosted git repository. hshpak pushed a commit to branch feat/DATALAB-2771/add-create-image-btn-for-admin in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 8b87fde610694318fe9a50fc4648a4be307c424e Author: Hennadii_Shpak <[email protected]> AuthorDate: Mon May 23 12:07:42 2022 +0300 fixed headers type for buildEnviromentManagment request --- .../management/management.component.ts | 2 +- .../administration/management/management.model.ts | 3 ++- .../services/applicationServiceFacade.service.ts | 4 ++-- .../services/managementEnvironments.service.ts | 6 +++-- .../src/app/shared/navbar/navbar.component.ts | 26 +++++++++++----------- 5 files changed, 22 insertions(+), 19 deletions(-) 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 f7d3179d0..c3326fcc4 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 @@ -313,7 +313,7 @@ export class ManagementComponent implements OnInit { return {...config, notebooks}; } - private getNotebookAction(env: EnvironmentModel, action: ActionsType): void { + private getNotebookAction(env: EnvironmentModel, action: ActionTypeOptions): void { this.manageEnvironmentsService.environmentManagement(env.user, action, env.project, env.name) .subscribe( () => this.buildGrid(), diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts index 5e7435302..b94e61b7d 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts +++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts @@ -137,4 +137,5 @@ export enum ActionsType { createImage = 'create image' } -export type ActionTypeOptions = 'stop' | 'terminate' | 'start' | 'run' | 'recreate' | 'createAmi'; +export type ActionTypeOptions = 'stop' | 'terminate' | 'start' | 'createImage'; + diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts index 13167f3eb..c4fb49bd7 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationServiceFacade.service.ts @@ -469,13 +469,13 @@ export class ApplicationServiceFacade { null); } - public buildEnvironmentManagement(param, data): Observable<any> { + public buildEnvironmentManagement(param, data, headers): Observable<any> { return this.buildRequest(HTTPMethod.POST, this.requestRegistry.Item(ApplicationServiceFacade.ENV) + param, data, { observe: 'response', - headers: { 'Content-Type': 'application/json; charset=UTF-8' } + headers }); } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/managementEnvironments.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/managementEnvironments.service.ts index 2d21fd564..30e593705 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/managementEnvironments.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/managementEnvironments.service.ts @@ -23,6 +23,7 @@ import { catchError, map } from 'rxjs/operators'; import { ApplicationServiceFacade } from './applicationServiceFacade.service'; import { ErrorUtils } from '../util'; +import { ActionTypeOptions } from '../../administration/management/management.model'; @Injectable() export class ManageEnvironmentsService { @@ -36,10 +37,11 @@ export class ManageEnvironmentsService { catchError(ErrorUtils.handleServiceError)); } - environmentManagement(data, action: string, project: string, resource: string, computational?: string): Observable<{}> { + environmentManagement(data, action: ActionTypeOptions, project: string, resource: string, computational?: string): Observable<{}> { const params = computational ? `/${action}/${project}/${resource}/${computational}` : `/${action}/${project}/${resource}`; + const headers = action === 'createImage' ? { 'Content-Type': 'application/json; charset=UTF-8' } : { 'Content-Type': 'text/plain' }; return this.applicationServiceFacade - .buildEnvironmentManagement(params, data) + .buildEnvironmentManagement(params, data, headers) .pipe( map(response => response), catchError(ErrorUtils.handleServiceError)); diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts index b01184dc8..c88094060 100644 --- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts @@ -23,12 +23,12 @@ import { Subscription, timer } from 'rxjs'; import { ToastrService } from 'ngx-toastr'; import { RouterOutlet } from '@angular/router'; -import { - ApplicationSecurityService, - HealthStatusService, - AppRoutingService, - SchedulerService, - StorageService +import { + ApplicationSecurityService, + HealthStatusService, + AppRoutingService, + SchedulerService, + StorageService } from '../../core/services'; import { GeneralEnvironmentStatus } from '../../administration/management/management.model'; import { NotificationDialogComponent } from '../modal-dialog/notification-dialog'; @@ -37,12 +37,12 @@ import { animate, transition, style, - query, + query, group, } from '@angular/animations'; import {skip, take} from 'rxjs/operators'; import {ProgressBarService} from '../../core/services/progress-bar.service'; -import{ sideBarNamesConfig, UserInfo } from './navbar.config' +import { sideBarNamesConfig, UserInfo } from './navbar.config'; interface Quota { projectQuotas: {}; @@ -197,22 +197,22 @@ export class NavbarComponent implements OnInit, OnDestroy { } else { this.storage.setBillingQuoteUsed(''); } - + if (this.dialog.openDialogs.length > 0 || this.dialog.openDialogs.length > 0) return; checkQuotaAlert && this.emitQuotes(checkQuotaAlert, params.totalQuotaUsed, exceedProjects, informProjects); }); } } - + private getUserData(): UserInfo { - const token = localStorage.getItem('JWT_TOKEN') + const token = localStorage.getItem('JWT_TOKEN'); const [_, tokenInfo] = token.split('.'); const {name, email} = JSON.parse(atob(tokenInfo)); - + return { name: name || 'Jhon Doe', email: email || 'Email not found' - } + }; } private checkAssignment(params): void { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
