This is an automated email from the ASF dual-hosted git repository. ytykhun pushed a commit to branch DATALAB-2347 in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 173bef971da2a5b526c12fd4c09f9877ebd1b40e Author: Yurii Tykhun <[email protected]> AuthorDate: Fri Aug 6 11:08:46 2021 +0300 [DATALAB-2347] refactored classes in core folder --- .../app/core/directives/click-outside.directive.ts | 9 +- .../src/app/core/directives/scrollTo.directive.ts | 2 +- .../src/app/core/interceptors/error.interceptor.ts | 5 +- .../core/interceptors/http.token.interceptor.ts | 12 ++- ...mputationalResourceApplicationTemplate.model.ts | 7 +- .../models/computationalResourceImage.model.ts | 17 ++-- .../app/core/models/resourceShapeTypes.model.ts | 3 +- .../webapp/src/app/core/pipes/highlight.pipe.ts | 7 +- .../app/core/pipes/lib-sort-pipe/lib-sort.pipe.ts | 2 +- .../local-currency-pipe/local-currency.pipe.ts | 4 +- .../src/app/core/pipes/local-date-pipe/index.ts | 2 +- .../core/pipes/local-date-pipe/local-date.pipe.ts | 6 +- .../core/pipes/long-date-pipe/long-date.pipe.ts | 8 +- .../core/services/applicationSecurity.service.ts | 3 +- .../services/applicationServiceFacade.service.ts | 5 +- .../webapp/src/app/core/services/audit.service.ts | 6 ++ .../src/app/core/services/authorization.guard.ts | 6 +- .../app/core/services/bucket-browser.service.ts | 11 +-- .../src/app/core/services/checkParams.guard.ts | 6 +- .../app/core/services/configutration.service.ts | 3 +- .../src/app/core/services/healthStatus.service.ts | 14 +-- .../app/core/services/odahu-deployment.service.ts | 8 +- .../src/app/core/services/progress-bar.service.ts | 5 +- .../src/app/core/services/project.service.ts | 3 +- .../src/app/core/services/userAccessKey.service.ts | 15 +-- .../src/app/core/services/userResource.service.ts | 15 ++- .../webapp/src/app/core/util/checkUtils.ts | 1 + .../webapp/src/app/core/util/compareUtils.ts | 3 - .../webapp/src/app/core/util/dateUtils.ts | 4 +- .../webapp/src/app/core/util/http-status-codes.ts | 106 ++++++++++----------- .../webapp/src/app/core/util/sortUtils.ts | 3 +- 31 files changed, 158 insertions(+), 143 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/core/directives/click-outside.directive.ts b/services/self-service/src/main/resources/webapp/src/app/core/directives/click-outside.directive.ts index 5ad3baa..ad34ab2 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/directives/click-outside.directive.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/directives/click-outside.directive.ts @@ -18,14 +18,11 @@ */ -import {fromEvent as observableFromEvent, Observable } from 'rxjs'; +import { fromEvent as observableFromEvent } from 'rxjs'; -import {tap, delay} from 'rxjs/operators'; +import { tap, delay } from 'rxjs/operators'; import { Directive, OnInit, OnDestroy, Output, EventEmitter, ElementRef } from '@angular/core'; - - - @Directive({ selector: '[clickOutside]' }) @@ -79,4 +76,4 @@ export class ClickOutsideDirective implements OnInit, OnDestroy { } return false; } -} +} \ No newline at end of file diff --git a/services/self-service/src/main/resources/webapp/src/app/core/directives/scrollTo.directive.ts b/services/self-service/src/main/resources/webapp/src/app/core/directives/scrollTo.directive.ts index fb6e0c3..7160489 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/directives/scrollTo.directive.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/directives/scrollTo.directive.ts @@ -17,7 +17,7 @@ * under the License. */ -import { ElementRef, HostBinding, Input } from '@angular/core'; +import { ElementRef, Input } from '@angular/core'; import { Directive } from '@angular/core'; @Directive({ diff --git a/services/self-service/src/main/resources/webapp/src/app/core/interceptors/error.interceptor.ts b/services/self-service/src/main/resources/webapp/src/app/core/interceptors/error.interceptor.ts index ac57d6c..e60be4e 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/interceptors/error.interceptor.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/interceptors/error.interceptor.ts @@ -60,7 +60,8 @@ import { HTTP_STATUS_CODES } from '../util'; this.jwtService.destroyTokens(); return throwError(error); } - })); + }) + ); } private addToken(request: HttpRequest<any>, token: string) { @@ -92,4 +93,4 @@ import { HTTP_STATUS_CODES } from '../util'; if (error.url.indexOf('refresh') > -1) this.routingService.redirectToLoginPage(); return next.handle(request); } -} +} \ No newline at end of file diff --git a/services/self-service/src/main/resources/webapp/src/app/core/interceptors/http.token.interceptor.ts b/services/self-service/src/main/resources/webapp/src/app/core/interceptors/http.token.interceptor.ts index 5b6309a..acd92fa 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/interceptors/http.token.interceptor.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/interceptors/http.token.interceptor.ts @@ -18,10 +18,10 @@ */ import { Injectable } from '@angular/core'; -import { StorageService } from '../services'; +import { Observable } from 'rxjs'; import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http'; -import { Observable } from 'rxjs'; +import { StorageService } from '../services'; @Injectable() export class HttpTokenInterceptor implements HttpInterceptor { constructor(private jwtService: StorageService) { } @@ -30,16 +30,18 @@ import { Observable } from 'rxjs'; const token = this.jwtService.getToken(); const headersConfig = {}; - if (token) + if (token) { headersConfig['Authorization'] = `Bearer ${token}`; + } if (!request.headers.has('Content-Type') && !request.headers.has('Upload') && request.url.indexOf('upload') === -1 && request.url.indexOf('download') === -1 && request.url.indexOf('admin') === -1 - ) - headersConfig['Content-Type'] = 'application/json; charset=UTF-8'; + ) { + headersConfig['Content-Type'] = 'application/json; charset=UTF-8'; + } const header = request.clone({ setHeaders: headersConfig }); return next.handle(header); diff --git a/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceApplicationTemplate.model.ts b/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceApplicationTemplate.model.ts index 4833bba..8818179 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceApplicationTemplate.model.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceApplicationTemplate.model.ts @@ -36,9 +36,10 @@ export class ComputationalResourceApplicationTemplate { this.template_name = template_name; this.description = description; - if (jsonModel.applications && jsonModel.applications.length > 0) - for (let index = 0; index < jsonModel.applications.length; index++) + if (jsonModel.applications && jsonModel.applications.length > 0) { + for (let index = 0; index < jsonModel.applications.length; index++) { this.applications.push(new ComputationalResourceApplication(jsonModel.applications[index])); - + } + } } } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts b/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts index 102f1dc..b721b26 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/models/computationalResourceImage.model.ts @@ -40,11 +40,16 @@ export class ComputationalResourceImage { this.limits = jsonModel.limits; this.shapes = new ResourceShapeTypesModel(SortUtils.shapesSort(jsonModel.computation_resources_shapes)); - if (jsonModel.templates && jsonModel.templates.length > 0) - for (let index = 0; index < jsonModel.templates.length; index++) - this.application_templates.push( - new ComputationalResourceApplicationTemplate(jsonModel.templates[index], - this.shapes, this.image, this.template_name, this.description)); - + if (jsonModel.templates && jsonModel.templates.length > 0) { + for (let index = 0; index < jsonModel.templates.length; index++) { + this.application_templates.push(new ComputationalResourceApplicationTemplate( + jsonModel.templates[index], + this.shapes, + this.image, + this.template_name, + this.description) + ); + } + } } } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/models/resourceShapeTypes.model.ts b/services/self-service/src/main/resources/webapp/src/app/core/models/resourceShapeTypes.model.ts index 1f9cda5..b4b93ba 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/models/resourceShapeTypes.model.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/models/resourceShapeTypes.model.ts @@ -27,8 +27,9 @@ export class ResourceShapeTypesModel { for (const parentIndex in jsonModel) { if (jsonModel[parentIndex] && jsonModel[parentIndex].length > 0) { const tmpl = []; - for (let index = 0; index < jsonModel[parentIndex].length; index++) + for (let index = 0; index < jsonModel[parentIndex].length; index++) { tmpl.push(new ResourceShapeModel(jsonModel[parentIndex][index])); + } this.resourcesShapeTypes[parentIndex] = tmpl; } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts index 4770cb3..2e8a10a 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/highlight.pipe.ts @@ -19,13 +19,14 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import {PipeTransform, Pipe} from '@angular/core'; +import { PipeTransform, Pipe } from '@angular/core'; @Pipe({ name: 'highlight' }) export class HighLightPipe implements PipeTransform { transform(text: string, search: string): string { - return search ? text.replace(new RegExp(search, 'i'), function(str) { - return `<span class="highlight">${str}</span>`; }) : text; + return search + ? text.replace(new RegExp(search, 'i'), (str) => `<span class="highlight">${str}</span>`) + : text; } } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/lib-sort-pipe/lib-sort.pipe.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/lib-sort-pipe/lib-sort.pipe.ts index e8ba377..e40f85c 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/lib-sort-pipe/lib-sort.pipe.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/lib-sort-pipe/lib-sort.pipe.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Pipe, PipeTransform } from '@angular/core'; +import { Pipe } from '@angular/core'; @Pipe({name: 'libStatusSort', pure: false}) diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-currency-pipe/local-currency.pipe.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-currency-pipe/local-currency.pipe.ts index 41c2988..ab8b094 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-currency-pipe/local-currency.pipe.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-currency-pipe/local-currency.pipe.ts @@ -18,8 +18,8 @@ */ import { Pipe, PipeTransform } from '@angular/core'; -import {formatCurrency, getCurrencySymbol} from '@angular/common'; -import {LocalizationService} from '../../services/localization.service'; +import { formatCurrency, getCurrencySymbol } from '@angular/common'; +import { LocalizationService } from '../../services/localization.service'; @Pipe({ name: 'localcurrency' }) diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/index.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/index.ts index 2f29b6a..1dbbded 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/index.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/index.ts @@ -19,7 +19,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import {LocalDatePipe} from './local-date.pipe'; +import { LocalDatePipe } from './local-date.pipe'; @NgModule({ imports: [CommonModule], diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/local-date.pipe.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/local-date.pipe.ts index c55953b..d0e51e7 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/local-date.pipe.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/local-date-pipe/local-date.pipe.ts @@ -18,8 +18,8 @@ */ import { Pipe, PipeTransform } from '@angular/core'; -import {LocalizationService} from '../../services/localization.service'; -import {formatDate} from '@angular/common'; +import { LocalizationService } from '../../services/localization.service'; +import { formatDate } from '@angular/common'; @Pipe({ name: 'localDate' }) @@ -27,7 +27,7 @@ export class LocalDatePipe implements PipeTransform { constructor(private localizationService: LocalizationService) { } transform(value: any, format: string = 'shortDate') { - if (!value) { return ; } + if (!value) { return; } return formatDate(value, format, this.localizationService.locale); } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/long-date-pipe/long-date.pipe.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/long-date-pipe/long-date.pipe.ts index ba64e45..0b77648 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/long-date-pipe/long-date.pipe.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/long-date-pipe/long-date.pipe.ts @@ -18,8 +18,8 @@ */ import { Pipe, PipeTransform } from '@angular/core'; -import {LocalizationService} from '../../services/localization.service'; -import {formatDate} from '@angular/common'; +import { LocalizationService } from '../../services/localization.service'; +import { formatDate } from '@angular/common'; @Pipe({ name: 'longDate' }) @@ -27,8 +27,8 @@ export class LongDatePipe implements PipeTransform { constructor(private localizationService: LocalizationService) { } transform(value: any, format: string = 'full') { - if (!value) { return ; } + if (!value) { return; } - return formatDate(value, format, (this.localizationService.locale === 'en') ? 'en' : 'en-GB'); + return formatDate(value, format, (this.localizationService.locale === 'en') ? 'en' : 'en-GB'); } } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationSecurity.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationSecurity.service.ts index 1bcd4f8..6108067 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/applicationSecurity.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/applicationSecurity.service.ts @@ -74,7 +74,8 @@ export class ApplicationSecurityService { const refreshToken = `/${this.storage.getRefreshToken()}`; return this.serviceFacade.buildRefreshToken(refreshToken) .pipe( - tap((tokens) => this.storage.storeTokens(tokens))); + tap((tokens) => this.storage.storeTokens(tokens)) + ); } public logout(): Observable<boolean> { 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 ed78447..3bb326d 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 @@ -725,7 +725,6 @@ export class ApplicationServiceFacade { this.requestRegistry.Add(ApplicationServiceFacade.SCHEDULER, '/api/infrastructure_provision/exploratory_environment/scheduler'); - // Computational Resources this.requestRegistry.Add(ApplicationServiceFacade.COMPUTATIONAL_RESOURCES, '/infrastructure_provision/computational_resources'); @@ -786,7 +785,6 @@ export class ApplicationServiceFacade { this.requestRegistry.Add(ApplicationServiceFacade.AUDIT, '/api/audit'); // configuration - this.requestRegistry.Add(ApplicationServiceFacade.CONFIG, '/api/config/multiple'); } @@ -807,5 +805,4 @@ export class ApplicationServiceFacade { return this.http.get(body ? (url + body) : url, opt); } } - -} +} \ No newline at end of file diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/audit.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/audit.service.ts index 520f623..23cdc3b 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/audit.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/audit.service.ts @@ -30,21 +30,27 @@ export class AuditService { public getAuditData(filterData, page, itemsPrPage) { let queryString = `?page-number=${page}&page-size=${itemsPrPage}`; + if (filterData.projects.length) { queryString += `&projects=${filterData.projects.join(',')}`; } + if (filterData.resources.length) { queryString += `&resource-names=${filterData.resources.join(',')}`; } + if (filterData.resource_types.length) { queryString += `&resource-types=${filterData.resource_types.join(',')}`; } + if (filterData.users.length) { queryString += `&users=${filterData.users.join(',')}`; } + if (filterData.date_start) { queryString += `&date-start=${filterData.date_start}`; } + if (filterData.date_end) { queryString += `&date-end=${filterData.date_end}`; } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/authorization.guard.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/authorization.guard.ts index 93c0fbb..f086f6a 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/authorization.guard.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/authorization.guard.ts @@ -21,14 +21,10 @@ import { Injectable } from '@angular/core'; import { map } from 'rxjs/operators'; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { ApplicationSecurityService } from './applicationSecurity.service'; -import { AppRoutingService } from './appRouting.service'; @Injectable() export class AuthorizationGuard implements CanActivate { - constructor( - private appRoutingService: AppRoutingService, - private applicationSecurityService: ApplicationSecurityService - ) { } + constructor(private applicationSecurityService: ApplicationSecurityService) { } canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) { return this.applicationSecurityService.isLoggedIn().pipe( diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/bucket-browser.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/bucket-browser.service.ts index f412a00..447c0f0 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/bucket-browser.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/bucket-browser.service.ts @@ -18,10 +18,10 @@ */ import { Injectable } from '@angular/core'; -import {Observable} from 'rxjs'; -import {catchError, map} from 'rxjs/operators'; -import {ErrorUtils} from '../util'; -import {ApplicationServiceFacade} from './applicationServiceFacade.service'; +import { Observable } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; +import { ErrorUtils } from '../util'; +import { ApplicationServiceFacade } from './applicationServiceFacade.service'; export class TodoItemNode { children: TodoItemNode[]; @@ -41,8 +41,7 @@ export class TodoItemFlatNode { providedIn: 'root' }) export class BucketBrowserService { - constructor(private applicationServiceFacade: ApplicationServiceFacade) { - } + constructor(private applicationServiceFacade: ApplicationServiceFacade) { } public getBucketData(bucket, endpoint): Observable<{}> { const url = `/${bucket}/endpoint/${endpoint}`; diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/checkParams.guard.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/checkParams.guard.ts index cc3032d..da042ff 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/checkParams.guard.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/checkParams.guard.ts @@ -23,16 +23,12 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ApplicationSecurityService } from './applicationSecurity.service'; -import { AppRoutingService } from './appRouting.service'; @Injectable() export class CheckParamsGuard implements CanActivate { result: any; - constructor( - private applicationSecurityService: ApplicationSecurityService, - private appRoutingService: AppRoutingService - ) { } + constructor(private applicationSecurityService: ApplicationSecurityService) { } canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> | Promise<boolean> | boolean { return this.applicationSecurityService.isLoggedIn().pipe( diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/configutration.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/configutration.service.ts index 8ab0b7f..5ba030e 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/configutration.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/configutration.service.ts @@ -18,7 +18,7 @@ */ import { Injectable } from '@angular/core'; -import {Observable, of} from 'rxjs'; +import { Observable } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; import { ApplicationServiceFacade } from './applicationServiceFacade.service'; import { ErrorUtils } from '../util'; @@ -38,7 +38,6 @@ export class ConfigurationService { public setServiceConfig(service: string, config: string, endpoint: string): Observable<{}> { const settings = { - ymlString: config, endpointName: endpoint }; diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts index 204e712..5474cf0 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts @@ -40,12 +40,14 @@ export class HealthStatusService { } public reloadInitialStatusData() { - this.getEnvironmentHealthStatus().subscribe( - (res: GeneralEnvironmentStatus) => { - this._statusData.next(res); - console.log('reload Initial Status Data'); - }, - err => console.error('Error retrieving status')); + this.getEnvironmentHealthStatus() + .subscribe( + (res: GeneralEnvironmentStatus) => { + this._statusData.next(res); + console.log('reload Initial Status Data'); + }, + err => console.error('Error retrieving status') + ); } public isHealthStatusOk(): Observable<boolean> { diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/odahu-deployment.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/odahu-deployment.service.ts index cb35758..68c0a83 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/odahu-deployment.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/odahu-deployment.service.ts @@ -47,9 +47,9 @@ export class OdahuDeploymentService { public odahuAction(data, action) { return this.applicationServiceFacade - .odahuStartStop(data, action) - .pipe( - map(response => response), - catchError(ErrorUtils.handleServiceError)); + .odahuStartStop(data, action) + .pipe( + map(response => response), + catchError(ErrorUtils.handleServiceError)); } } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts index 095d937..e52eaca 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/progress-bar.service.ts @@ -17,9 +17,8 @@ * under the License. */ -import {ApplicationRef, ChangeDetectorRef, Injectable} from '@angular/core'; -import {BehaviorSubject, Subject, timer} from 'rxjs'; -import {take} from 'rxjs/operators'; +import { Injectable } from '@angular/core'; +import {BehaviorSubject, timer} from 'rxjs'; @Injectable({ providedIn: 'root' diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts index e912503..ccf93f8 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/project.service.ts @@ -19,11 +19,10 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import {map, catchError, tap} from 'rxjs/operators'; +import { map, catchError } from 'rxjs/operators'; import { ApplicationServiceFacade } from './applicationServiceFacade.service'; import { ErrorUtils } from '../util'; -import {logger} from 'codelyzer/util/logger'; @Injectable() export class ProjectService { diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/userAccessKey.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/userAccessKey.service.ts index 81e8008..a48219f 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/userAccessKey.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/userAccessKey.service.ts @@ -40,12 +40,15 @@ export class UserAccessKeyService { } public initialUserAccessKeyCheck() { - this.checkUserAccessKey().subscribe( - response => { - this._accessKeyEmitter.next(response); - }, error => { - this._accessKeyEmitter.next(error); - }); + this.checkUserAccessKey() + .subscribe( + response => { + this._accessKeyEmitter.next(response); + }, + error => { + this._accessKeyEmitter.next(error); + } + ); } public checkUserAccessKey(): Observable<{}> { diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts index 6f7c254..3f2d5f8 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/userResource.service.ts @@ -108,7 +108,12 @@ export class UserResourceService { catchError(ErrorUtils.handleServiceError)); } - public suspendComputationalResource(projectName: string, notebookName: string, computationalResourceName: string, provider: string): Observable<{}> { + public suspendComputationalResource( + projectName: string, + notebookName: string, + computationalResourceName: string, + provider: string + ): Observable<{}> { const body = JSON.stringify('/' + projectName + '/' + notebookName + '/' + computationalResourceName + '/terminate'); return this.applicationServiceFacade .buildDeleteComputationalResourcesRequest(body, provider) @@ -117,7 +122,13 @@ export class UserResourceService { catchError(ErrorUtils.handleServiceError)); } - public toggleStopStartAction(project: string, notebook: string, resource: string, action, provider: string): Observable<{}> { + public toggleStopStartAction( + project: string, + notebook: string, + resource: string, + action, + provider: string + ): Observable<{}> { const url = `/${project}/${notebook}/${resource}/${action}`; if (action === 'stop') { return this.applicationServiceFacade diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts index ab70476..d1e6f53 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/util/checkUtils.ts @@ -28,6 +28,7 @@ export class CheckUtils { STOPPING: 'DISCONNECTING', STOPPED: 'DISCONNECTED' }; + public static isJSON(str) { try { JSON.parse(str); diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/compareUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/compareUtils.ts index 919aa26..ad490e1 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/util/compareUtils.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/util/compareUtils.ts @@ -21,7 +21,6 @@ export class CompareUtils { public static compareFilters(currentData, previousData) { return Object.keys(currentData).every(el => { if (Array.isArray(previousData[el])) { - // console.log('arr', el, previousData[el], currentData[el]); if (previousData[el].length === 0 && currentData[el].length === 0) return true; if (previousData[el].length === currentData[el].length) { return currentData[el].every(element => previousData[el].includes(element)); @@ -29,10 +28,8 @@ export class CompareUtils { return false; } } else { - // console.log(el, previousData[el] === currentData[el]); return previousData[el] === currentData[el]; } }); } - } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/dateUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/dateUtils.ts index 718ddf4..9e66835 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/util/dateUtils.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/util/dateUtils.ts @@ -29,8 +29,8 @@ export class DateUtils { } public getQuarterRange() { - const currentMonth = (new Date()).getMonth(); - const yyyy = (new Date()).getFullYear(); + const currentMonth = new Date().getMonth(); + const yyyy = new Date().getFullYear(); const start = (Math.floor(currentMonth / 3) * 3 ) + 1, end = start + 3, startDate = new Date(start + '-01-' + yyyy); diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/http-status-codes.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/http-status-codes.ts index d2323e7..c365052 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/util/http-status-codes.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/util/http-status-codes.ts @@ -18,57 +18,57 @@ */ export class HTTP_STATUS_CODES { - public static readonly ACCEPTED = 202; - public static readonly BAD_GATEWAY = 502; - public static readonly BAD_REQUEST = 400; - public static readonly CONFLICT = 409; - public static readonly CONTINUE = 100; - public static readonly CREATED = 201; - public static readonly EXPECTATION_FAILED = 417; - public static readonly FAILED_DEPENDENCY = 424; - public static readonly FORBIDDEN = 403; - public static readonly GATEWAY_TIMEOUT = 504; - public static readonly GONE = 410; - public static readonly HTTP_VERSION_NOT_SUPPORTED = 505; - public static readonly INSUFFICIENT_SPACE_ON_RESOURCE = 419; - public static readonly INSUFFICIENT_STORAGE = 507; - public static readonly INTERNAL_SERVER_ERROR = 500; - public static readonly LENGTH_REQUIRED = 411; - public static readonly LOCKED = 423; - public static readonly METHOD_FAILURE = 420; - public static readonly METHOD_NOT_ALLOWED = 405; - public static readonly MOVED_PERMANENTLY = 301; - public static readonly MOVED_TEMPORARILY = 302; - public static readonly MULTI_STATUS = 207; - public static readonly MULTIPLE_CHOICES = 300; - public static readonly NETWORK_AUTHENTICATION_REQUIRED = 511; - public static readonly NO_CONTENT = 204; - public static readonly NON_AUTHORITATIVE_INFORMATION = 203; - public static readonly NOT_ACCEPTABLE = 406; - public static readonly NOT_FOUND = 404; - public static readonly NOT_IMPLEMENTED = 501; - public static readonly NOT_MODIFIED = 304; - public static readonly OK = 200; - public static readonly PARTIAL_CONTENT = 206; - public static readonly PAYMENT_REQUIRED = 402; - public static readonly PERMANENT_REDIRECT = 308; - public static readonly PRECONDITION_FAILED = 412; - public static readonly PRECONDITION_REQUIRED = 428; - public static readonly PROCESSING = 102; - public static readonly PROXY_AUTHENTICATION_REQUIRED = 407; - public static readonly REQUEST_HEADER_FIELDS_TOO_LARGE = 431; - public static readonly REQUEST_TIMEOUT = 408; - public static readonly REQUEST_TOO_LONG = 413; - public static readonly REQUEST_URI_TOO_LONG = 414; - public static readonly REQUESTED_RANGE_NOT_SATISFIABLE = 416; - public static readonly RESET_CONTENT = 205; - public static readonly SEE_OTHER = 303; - public static readonly SERVICE_UNAVAILABLE = 503; - public static readonly SWITCHING_PROTOCOLS = 101; - public static readonly TEMPORARY_REDIRECT = 307; - public static readonly TOO_MANY_REQUESTS = 429; - public static readonly UNAUTHORIZED = 401; - public static readonly UNPROCESSABLE_ENTITY = 422; - public static readonly UNSUPPORTED_MEDIA_TYPE = 415; - public static readonly USE_PROXY = 305; + public static readonly ACCEPTED = 202; + public static readonly BAD_GATEWAY = 502; + public static readonly BAD_REQUEST = 400; + public static readonly CONFLICT = 409; + public static readonly CONTINUE = 100; + public static readonly CREATED = 201; + public static readonly EXPECTATION_FAILED = 417; + public static readonly FAILED_DEPENDENCY = 424; + public static readonly FORBIDDEN = 403; + public static readonly GATEWAY_TIMEOUT = 504; + public static readonly GONE = 410; + public static readonly HTTP_VERSION_NOT_SUPPORTED = 505; + public static readonly INSUFFICIENT_SPACE_ON_RESOURCE = 419; + public static readonly INSUFFICIENT_STORAGE = 507; + public static readonly INTERNAL_SERVER_ERROR = 500; + public static readonly LENGTH_REQUIRED = 411; + public static readonly LOCKED = 423; + public static readonly METHOD_FAILURE = 420; + public static readonly METHOD_NOT_ALLOWED = 405; + public static readonly MOVED_PERMANENTLY = 301; + public static readonly MOVED_TEMPORARILY = 302; + public static readonly MULTI_STATUS = 207; + public static readonly MULTIPLE_CHOICES = 300; + public static readonly NETWORK_AUTHENTICATION_REQUIRED = 511; + public static readonly NO_CONTENT = 204; + public static readonly NON_AUTHORITATIVE_INFORMATION = 203; + public static readonly NOT_ACCEPTABLE = 406; + public static readonly NOT_FOUND = 404; + public static readonly NOT_IMPLEMENTED = 501; + public static readonly NOT_MODIFIED = 304; + public static readonly OK = 200; + public static readonly PARTIAL_CONTENT = 206; + public static readonly PAYMENT_REQUIRED = 402; + public static readonly PERMANENT_REDIRECT = 308; + public static readonly PRECONDITION_FAILED = 412; + public static readonly PRECONDITION_REQUIRED = 428; + public static readonly PROCESSING = 102; + public static readonly PROXY_AUTHENTICATION_REQUIRED = 407; + public static readonly REQUEST_HEADER_FIELDS_TOO_LARGE = 431; + public static readonly REQUEST_TIMEOUT = 408; + public static readonly REQUEST_TOO_LONG = 413; + public static readonly REQUEST_URI_TOO_LONG = 414; + public static readonly REQUESTED_RANGE_NOT_SATISFIABLE = 416; + public static readonly RESET_CONTENT = 205; + public static readonly SEE_OTHER = 303; + public static readonly SERVICE_UNAVAILABLE = 503; + public static readonly SWITCHING_PROTOCOLS = 101; + public static readonly TEMPORARY_REDIRECT = 307; + public static readonly TOO_MANY_REQUESTS = 429; + public static readonly UNAUTHORIZED = 401; + public static readonly UNPROCESSABLE_ENTITY = 422; + public static readonly UNSUPPORTED_MEDIA_TYPE = 415; + public static readonly USE_PROXY = 305; } diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts index 24dbf49..fa220da 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/util/sortUtils.ts @@ -56,7 +56,8 @@ export class SortUtils { } public static flatDeep(arr, d = 1) { - return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? this.flatDeep(val, d - 1) : val), []) + return d > 0 + ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? this.flatDeep(val, d - 1) : val), []) : arr.slice(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
