From b4fc00994d009e6b699c7de372ce3f0df4cb1142 Mon Sep 17 00:00:00 2001 From: Mohamed Hamou Date: Mon, 22 Jan 2024 07:05:54 +0100 Subject: [PATCH 1/5] fixes for preview update --- package-lock.json | 30 +-- package.json | 2 +- .../landing-page/landing-page.component.ts | 12 +- .../components/preview/preview.component.ts | 118 ++++++----- .../main-form-manager/config-export-helper.ts | 16 +- .../main-form-manager.service.ts | 188 +++++++++--------- .../main-form-manager/models-config.ts | 3 + .../services/main-form/main-form.service.ts | 18 +- .../resources-config-form-builder.service.ts | 66 ++++++ .../starting-config-form-builder.service.ts | 4 +- 10 files changed, 281 insertions(+), 176 deletions(-) create mode 100644 src/app/services/resources-form-builder/resources-config-form-builder.service.ts diff --git a/package-lock.json b/package-lock.json index f323f67a..d856944f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "ajv": "8.8.2", "ajv-keywords": "5.1.0", "ang-jsoneditor": "1.10.5", - "arlas-wui-toolkit": "~24.3.4", + "arlas-wui-toolkit": "24.3.5-alpha.3", "file-saver": "^2.0.2", "jsoneditor": "9.5.6", "moment": "^2.29.4", @@ -5617,9 +5617,9 @@ } }, "node_modules/arlas-persistence-api": { - "version": "24.0.4", - "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.4.tgz", - "integrity": "sha512-wx+Z1mcqT56LdRlY610Yh6LXoMf0ohC2nUd7SDw0RXNqrXvodduR5W5ScD1/HIZNwPsWQrI3Gl5Nb7cku7NyNA==", + "version": "24.0.5-SNAPSHOT-1", + "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.5-SNAPSHOT-1.tgz", + "integrity": "sha512-gl2Wk/Z81I5q8Ub4e2mlZss3PjiDoZY4aLPTLV0lJ2+pRJQc4jC4jt8WdyU7YsJN1Jd+OGSk2g9IShdH0fSynw==", "dependencies": { "portable-fetch": "3.0.0", "url": "0.11.0" @@ -5717,9 +5717,9 @@ } }, "node_modules/arlas-wui-toolkit": { - "version": "24.3.4", - "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-24.3.4.tgz", - "integrity": "sha512-cHGHlA9l6+fpB12CX97g+gAam1hOqPbEcs6VwpznvRobvOnOHeEoy3d4fAYDIQmjchbStYApvlTCv1Ny/k4d0Q==", + "version": "24.3.5-alpha.3", + "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-24.3.5-alpha.3.tgz", + "integrity": "sha512-O4B5/ztcY+blCzO4QXDzLOAtok8I05kksUexqsGhlJcbU+13eMaFCXMrzIaxiOdOMPe6lMu0Wrkw3w3Dqkt1Bg==", "dependencies": { "@danielmoncada/angular-datetime-picker": "14.2.0", "@danielmoncada/angular-datetime-picker-moment-adapter": "~2.2.0", @@ -5729,7 +5729,7 @@ "angular-oauth2-oidc-jwks": "~14.0.1", "arlas-iam-api": "24.1.0-rc.0", "arlas-permissions-api": "~24.0.4", - "arlas-persistence-api": "~24.0.4", + "arlas-persistence-api": "24.0.5-SNAPSHOT-1", "arlas-tagger-api": "~24.1.0", "arlas-web-components": "~24.3.2", "arlas-web-contributors": "~24.3.0", @@ -24627,9 +24627,9 @@ } }, "arlas-persistence-api": { - "version": "24.0.4", - "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.4.tgz", - "integrity": "sha512-wx+Z1mcqT56LdRlY610Yh6LXoMf0ohC2nUd7SDw0RXNqrXvodduR5W5ScD1/HIZNwPsWQrI3Gl5Nb7cku7NyNA==", + "version": "24.0.5-SNAPSHOT-1", + "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.5-SNAPSHOT-1.tgz", + "integrity": "sha512-gl2Wk/Z81I5q8Ub4e2mlZss3PjiDoZY4aLPTLV0lJ2+pRJQc4jC4jt8WdyU7YsJN1Jd+OGSk2g9IShdH0fSynw==", "requires": { "portable-fetch": "3.0.0", "url": "0.11.0" @@ -24708,9 +24708,9 @@ } }, "arlas-wui-toolkit": { - "version": "24.3.4", - "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-24.3.4.tgz", - "integrity": "sha512-cHGHlA9l6+fpB12CX97g+gAam1hOqPbEcs6VwpznvRobvOnOHeEoy3d4fAYDIQmjchbStYApvlTCv1Ny/k4d0Q==", + "version": "24.3.5-alpha.3", + "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-24.3.5-alpha.3.tgz", + "integrity": "sha512-O4B5/ztcY+blCzO4QXDzLOAtok8I05kksUexqsGhlJcbU+13eMaFCXMrzIaxiOdOMPe6lMu0Wrkw3w3Dqkt1Bg==", "requires": { "@danielmoncada/angular-datetime-picker": "14.2.0", "@danielmoncada/angular-datetime-picker-moment-adapter": "~2.2.0", @@ -24720,7 +24720,7 @@ "angular-oauth2-oidc-jwks": "~14.0.1", "arlas-iam-api": "24.1.0-rc.0", "arlas-permissions-api": "~24.0.4", - "arlas-persistence-api": "~24.0.4", + "arlas-persistence-api": "24.0.5-SNAPSHOT-1", "arlas-tagger-api": "~24.1.0", "arlas-web-components": "~24.3.2", "arlas-web-contributors": "~24.3.0", diff --git a/package.json b/package.json index 56f7414e..6ebea6a0 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "ajv": "8.8.2", "ajv-keywords": "5.1.0", "ang-jsoneditor": "1.10.5", - "arlas-wui-toolkit": "~24.3.4", + "arlas-wui-toolkit": "24.3.5-alpha.3", "file-saver": "^2.0.2", "jsoneditor": "9.5.6", "moment": "^2.29.4", diff --git a/src/app/components/landing-page/landing-page.component.ts b/src/app/components/landing-page/landing-page.component.ts index 57668c86..5fd95663 100644 --- a/src/app/components/landing-page/landing-page.component.ts +++ b/src/app/components/landing-page/landing-page.component.ts @@ -39,6 +39,7 @@ import { Subscription } from 'rxjs'; import { map } from 'rxjs/internal/operators/map'; import { LandingPageDialogComponent } from './landing-page-dialog.component'; import { InitialChoice, LandingPageService } from '@services/landing-page/landing-page.service'; +import { ResourcesConfigFormBuilderService } from '@services/resources-form-builder/resources-config-form-builder.service'; export interface Configuration { name: string; @@ -80,6 +81,7 @@ export class LandingPageComponent implements OnInit, AfterViewInit, OnDestroy { public persistenceService: PersistenceService, public mainFormService: MainFormService, private startingConfigFormBuilder: StartingConfigFormBuilderService, + private resourcesConfigFormBuilder: ResourcesConfigFormBuilderService, private arlasAuthentService: ArlasAuthentificationService, private dialog: MatDialog, private authService: AuthentificationService, @@ -113,6 +115,9 @@ export class LandingPageComponent implements OnInit, AfterViewInit, OnDestroy { this.mainFormService.startingConfig.init( this.startingConfigFormBuilder.build() ); + this.mainFormService.resourcesConfig.init( + this.resourcesConfigFormBuilder.build() + ); if (this.activatedRoute.snapshot.paramMap.has('id')) { this.confId = this.activatedRoute.snapshot.paramMap.get('id'); this.loadConfig(this.confId); @@ -290,7 +295,10 @@ export class LandingPageComponent implements OnInit, AfterViewInit, OnDestroy { } public loadConfig(id: string) { - this.persistenceService.get(id).subscribe(data => { + this.persistenceService.get(id).subscribe((data: DataWithLinks) => { + this.mainFormService.configurationName = data.doc_key; + this.mainFormService.configurationId = id; + this.mainFormService.dashboard = data; const configJson = JSON.parse(data.doc_value) as Config; if (configJson.arlas !== undefined) { const configMapJson = configJson.arlas.web.components.mapgl.input.mapLayers as MapConfig; @@ -299,8 +307,6 @@ export class LandingPageComponent implements OnInit, AfterViewInit, OnDestroy { this.configChoice = InitialChoice.setup; this.openChoice(this.configChoice); } - this.mainFormService.configurationName = data.doc_key; - this.mainFormService.configurationId = id; }); } public getUserInfos() { diff --git a/src/app/modules/map-config/components/preview/preview.component.ts b/src/app/modules/map-config/components/preview/preview.component.ts index a7066e41..3a764667 100644 --- a/src/app/modules/map-config/components/preview/preview.component.ts +++ b/src/app/modules/map-config/components/preview/preview.component.ts @@ -29,8 +29,9 @@ import { StartupService, ZONE_PREVIEW } from '@services/startup/startup.service' import { ArlasColorService, MapglComponent } from 'arlas-web-components'; import { MapContributor } from 'arlas-web-contributors'; import { ArlasCollaborativesearchService, ArlasConfigService, ContributorBuilder, PersistenceService } from 'arlas-wui-toolkit'; -import { merge, Subscription } from 'rxjs'; +import { catchError, map, merge, Observable, of, Subscription, tap, throwError } from 'rxjs'; import { ArlasSettingsService } from 'arlas-wui-toolkit'; +import { DataWithLinks } from 'arlas-persistence-api'; export interface MapglComponentInput { mapglContributors: MapContributor[]; @@ -187,70 +188,65 @@ export class PreviewComponent implements AfterViewInit, OnDestroy { img = rescaledCanvas.toDataURL('image/png'); } this.mapglComponent.map.resize(); - if (!!this.mainFormService.configurationName) { + const resourcesConfig = this.mainFormService.resourcesConfig.getFg(); + const previewId = resourcesConfig.customControls.resources.previewId.value; + if (!!this.mainFormService.dashboard) { + const currentConfig = this.mainFormService.dashboard; const name = this.mainFormService.configurationName.concat('_preview'); - this.persistenceService.existByZoneKey('preview', name).subscribe( - exist => { - this.persistenceService.get(this.configId).subscribe({ - next: (currentConfig) => { - let previewReaders = []; - let previewWriters = []; - if (currentConfig.doc_readers) { - previewReaders = currentConfig.doc_readers.map(reader => reader.replace('config.json', 'preview')); - } - if (currentConfig.doc_writers) { - previewWriters = currentConfig.doc_writers.map(writer => writer.replace('config.json', 'preview')); - } - if (exist.exists) { - this.persistenceService.getByZoneKey('preview', name).subscribe({ - next: (data) => { - this.persistenceService.update(data.id, img, new Date(data.last_update_date).getTime(), name, - previewReaders, previewWriters); - this.snackbar.open( - this.translate.instant('Preview updated !') - ); - }, - error: (e) => { - this.snackbar.open( - this.translate.instant('Cannot update the preview') - ); - } - }); - } else { - this.persistenceService.create( - ZONE_PREVIEW, - name, - img, - previewReaders, - previewWriters - ).subscribe({ - next: () => { - this.snackbar.open( - this.translate.instant('Preview saved !') - ); - }, - error: (e) => { - this.snackbar.open( - this.translate.instant('Cannot create the preview') - ); - } - }); - } - }, - error: (e) => { - this.snackbar.open( - this.translate.instant('Cannot fetch current config') - ); - } - }); - - - } - ); + let previewReaders = []; + let previewWriters = []; + if (currentConfig.doc_readers) { + previewReaders = currentConfig.doc_readers.map(reader => reader.replace('config.json', 'preview')); + } + if (currentConfig.doc_writers) { + previewWriters = currentConfig.doc_writers.map(writer => writer.replace('config.json', 'preview')); + } + this.previewExists$(previewId) + .pipe( + map(exists => this.createOrUpdatePreview$(exists, previewId, img, name, previewReaders, previewWriters))) + .subscribe({ + complete: () => this.snackbar.open(this.translate.instant('Preview saved !')) + }); } else { + resourcesConfig.customControls.resources.previewValue.setValue(img); this.snackbar.open( - this.translate.instant('Cannot save Preview: You need to save the dashboard first') + this.translate.instant('Preview saved !') ); } } + + private previewExists$(previewId): Observable { + if (!previewId || previewId === '') { + return of(false); + } else { + console.log(previewId); + return this.persistenceService.exists(previewId).pipe(map(r => r.exists)); + } + } + + private createOrUpdatePreview$(previewExists: boolean, previewId: string, img, name: string, previewReaders?, previewWriters?) { + const resourcesConfig = this.mainFormService.resourcesConfig.getFg(); + resourcesConfig.customControls.resources.previewValue.setValue(img); + console.log(previewExists); + if (previewExists) { + this.persistenceService.updatePreview(previewId, previewReaders, previewWriters, img); + } else { + console.log('yey'); + this.persistenceService.create(ZONE_PREVIEW, name, img, previewReaders, previewWriters) + .pipe(map((p: DataWithLinks) => { + console.log('creating'); + resourcesConfig.customControls.resources.previewId.setValue(p.id); + return p; + })) + .pipe(catchError((err) => this.catchPreviewError(err, 'Cannot update the preview'))).subscribe(); + } + } + + private catchPreviewError(err, msg) { + this.snackbar.open( + this.translate.instant(msg) + ); + return throwError(() => new Error(err)); + } + } diff --git a/src/app/services/main-form-manager/config-export-helper.ts b/src/app/services/main-form-manager/config-export-helper.ts index 695c8db2..dfbdee60 100644 --- a/src/app/services/main-form-manager/config-export-helper.ts +++ b/src/app/services/main-form-manager/config-export-helper.ts @@ -59,6 +59,7 @@ import { ARLAS_ID } from '@services/main-form/main-form.service'; import { hashCode, stringifyArlasFilter } from './tools'; import { ShortcutsService } from '@analytics-config/services/shortcuts/shortcuts.service'; import { DescribedUrl } from 'arlas-web-components/lib/components/results/utils/results.utils'; +import { ResourcesConfigFormGroup } from '@services/resources-form-builder/resources-config-form-builder.service'; export enum EXPORT_TYPE { json = 'json', @@ -130,6 +131,7 @@ export class ConfigExportHelper { } public static process( startingConfig: StartingConfigFormGroup, + resourcesConfig: ResourcesConfigFormGroup, mapConfigGlobal: MapGlobalFormGroup, mapConfigLayers: FormArray, mapConfigVisualisations: FormArray, @@ -144,7 +146,7 @@ export class ConfigExportHelper { colorService: ArlasColorService, collectionService: CollectionService, shortcutsService: ShortcutsService - ): any { + ): Config { const chipssearch: ChipSearchConfig = { name: searchConfigGlobal.customControls.name.value, icon: searchConfigGlobal.customControls.unmanagedFields.icon.value @@ -203,7 +205,8 @@ export class ConfigExportHelper { replacedAttribute: 'arlas.web.components.mapgl.input.mapLayers.externalEventLayers', replacer: 'external-event-layers' } - ] + ], + resources: {} }; let mainCollection; const collectionFormControl = startingConfig.customControls.collection; @@ -271,10 +274,17 @@ export class ConfigExportHelper { } this.exportSideModulesConfig(config, sideModulesGlobal); - + this.exportPreview(config, resourcesConfig); return config; } + + private static exportPreview(config: Config, resourcesForm: ResourcesConfigFormGroup) { + if (resourcesForm.hasPreviewId()) { + config.resources.previewId = resourcesForm.customControls.resources.previewId.value; + } + } + public static getLayerSourceConfig(layerFg: FormGroup): LayerSourceConfig { const layerValues = layerFg.value; const modeValues = layerFg.value.mode === LAYER_MODE.features ? layerFg.value.featuresFg : diff --git a/src/app/services/main-form-manager/main-form-manager.service.ts b/src/app/services/main-form-manager/main-form-manager.service.ts index d5dc3981..512fc3c5 100644 --- a/src/app/services/main-form-manager/main-form-manager.service.ts +++ b/src/app/services/main-form-manager/main-form-manager.service.ts @@ -38,7 +38,7 @@ import { SearchImportService } from '@search-config/services/search-import/searc import { SearchInitService } from '@search-config/services/search-init/search-init.service'; import { CollectionService } from '@services/collection-service/collection.service'; import { MainFormService } from '@services/main-form/main-form.service'; -import { StartupService, ZONE_WUI_BUILDER } from '@services/startup/startup.service'; +import { StartupService, ZONE_PREVIEW, ZONE_WUI_BUILDER } from '@services/startup/startup.service'; import { InputModalComponent } from '@shared-components/input-modal/input-modal.component'; import { ConfigFormControl, ConfigFormGroup } from '@shared-models/config-form'; import { TimelineImportService } from '@timeline-config/services/timeline-import/timeline-import.service'; @@ -55,6 +55,11 @@ import { importElements } from './tools'; import { ArlasColorService } from 'arlas-web-components'; import { ShortcutsService } from '@analytics-config/services/shortcuts/shortcuts.service'; +import { StartingConfigFormGroup } from '@services/starting-config-form-builder/starting-config-form-builder.service'; +import { Observable, catchError, map, of, tap } from 'rxjs'; +import { DataWithLinks } from 'arlas-persistence-api'; +import { ResourcesConfigFormGroup } from '@services/resources-form-builder/resources-config-form-builder.service'; + @Injectable({ providedIn: 'root' }) @@ -125,6 +130,7 @@ export class MainFormManagerService { private doExport(type: EXPORT_TYPE) { const startingConfig = this.mainFormService.startingConfig.getFg(); + const resourcesConfig = this.mainFormService.resourcesConfig.getFg(); const mapConfigGlobal = this.mainFormService.mapConfig.getGlobalFg(); const mapConfigLayers = this.mainFormService.mapConfig.getLayersFa(); const mapConfigVisualisations = this.mainFormService.mapConfig.getVisualisationsFa(); @@ -139,6 +145,7 @@ export class MainFormManagerService { const externalNodeGlobal = this.mainFormService.externalNodeConfig.getExternalNodeFg(); const generatedConfig = ConfigExportHelper.process( startingConfig, + resourcesConfig, mapConfigGlobal, mapConfigLayers, mapConfigVisualisations, @@ -161,54 +168,24 @@ export class MainFormManagerService { generatedMapConfig.layers ))); this.arlasStartupService.validateConfiguration(confToValidate); - if (this.persistenceService.isAvailable && type === EXPORT_TYPE.persistence) { - - // remove extraConfigs property if persistence is used delete generatedConfig.extraConfigs; // transform sets to arrays in order to be stringified generatedConfig.arlas.web.components.mapgl.input.visualisations_sets.forEach(vs => vs.layers = Array.from(vs.layers)); - const conf: any = JSON.stringify(generatedConfig).replace('"layers":[]', '"layers":' + JSON.stringify( - generatedMapConfig.layers - )).replace('"externalEventLayers":[]', '"externalEventLayers":' + JSON.stringify( - generatedMapConfig.externalEventLayers - )); if (this.mainFormService.configurationId) { // Update existing - this.persistenceService.get(this.mainFormService.configurationId).subscribe(data => { - this.persistenceService.update( - this.mainFormService.configurationId, - conf, - new Date(data.last_update_date).getTime(), this.mainFormService.configurationName, data.doc_readers, data.doc_writers - ).subscribe({ - next: () => { - ['i18n', 'tour'].forEach(zone => ['fr', 'en'] - .forEach(lg => this.renameLinkedData(zone, data.doc_key, this.mainFormService.configurationName, lg))); - - this.updatePreview( - this.mainFormService.configurationId, - this.mainFormService.configurationName.concat('_preview')); - - this.snackbar.open( - this.translate.instant('Dashboard updated !') + ' (' + this.mainFormService.configurationName + ')' - ); - }, - error: (error) => { - this.snackbar.open(this.translate.instant('Error : Dashboard not updated')); - this.raiseError(error); - } - }); - }); + this.updateDashboard(generatedConfig, generatedMapConfig, resourcesConfig); } else { // Create new config if (!!this.mainFormService.configurationName) { - this.createDashboard(this.mainFormService.configurationName, conf, generatedConfig, generatedMapConfig); + this.createDashboard(this.mainFormService.configurationName, generatedConfig, generatedMapConfig); } else { const dialogRef = this.dialog.open(InputModalComponent); dialogRef.afterClosed().subscribe(configName => { if (!!configName) { - this.createDashboard(configName, conf, generatedConfig, generatedMapConfig); + console.log(configName); + this.createDashboard(configName, generatedConfig, generatedMapConfig); } }); } @@ -221,6 +198,7 @@ export class MainFormManagerService { public doImport(config: Config, mapConfig: MapConfig) { const startingConfigControls = this.mainFormService.startingConfig.getFg().customControls; + const resourcesConfigControls = this.mainFormService.resourcesConfig.getFg().customControls; importElements([ { value: config.arlas.server.url, @@ -241,6 +219,10 @@ export class MainFormManagerService { { value: config['arlas-wui'].web.app.name_background_color, control: startingConfigControls.unmanagedFields.appNameBackgroundColor + }, + { + value: config?.resources?.previewId, + control: resourcesConfigControls.resources.previewId } ]); @@ -272,36 +254,47 @@ export class MainFormManagerService { this.updateControlsFromOtherControls(this.mainFormService.mainForm); } + /** + * The preview should be created if the a preview image has been captured by the user but no identifier has yet been created. + * @param startForm The form where the preview image is stored + * @returns Whether we should create the preview in persistence or not + */ + private shoulCreatePreview(startForm: ResourcesConfigFormGroup) { + const hasPreviewImage = startForm.hasPreviewImage(); + const hasPreviewId = startForm.hasPreviewId(); + return hasPreviewImage && !hasPreviewId; + } - public updatePreview(configId: string, previewName: string) { - this.persistenceService.existByZoneKey('preview', previewName).subscribe( - exist => { - if (exist.exists) { - this.persistenceService.getByZoneKey('preview', previewName).subscribe({ - next: (data) => { - this.persistenceService.get(configId).subscribe({ - next: (currentConfig) => { - let previewReaders = []; - let previewWriters = []; - if (currentConfig.doc_readers) { - previewReaders = currentConfig.doc_readers.map(reader => reader.replace('config.json', 'preview')); - } - if (currentConfig.doc_writers) { - previewWriters = currentConfig.doc_writers.map(writer => writer.replace('config.json', 'preview')); - } - this.persistenceService.update(data.id, data.doc_value, new Date(data.last_update_date).getTime(), previewName, - previewReaders, previewWriters); - }, - error: (e) => { - this.snackbar.open( - this.translate.instant('Cannot update the preview') - ); - } - }); - } - }); + private stringifyGeneratedConfig(generatedConfig: Config, generatedMapConfig: MapConfig): string { + return JSON.stringify(generatedConfig).replace('"layers":[]', '"layers":' + JSON.stringify( + generatedMapConfig.layers + )).replace('"externalEventLayers":[]', '"externalEventLayers":' + JSON.stringify( + generatedMapConfig.externalEventLayers + )); + } + + private updateDashboard(generatedConfig: Config, generatedMapConfig: MapConfig, resourcesConfig: ResourcesConfigFormGroup) { + this.persistenceService.get(this.mainFormService.configurationId).subscribe(data => { + this.persistenceService.update( + this.mainFormService.configurationId, + this.stringifyGeneratedConfig(generatedConfig, generatedMapConfig), + new Date(data.last_update_date).getTime(), this.mainFormService.configurationName, data.doc_readers, data.doc_writers + ).subscribe({ + next: () => { + if (resourcesConfig.hasPreviewId()) { + const previewGroups = this.persistenceService.dashboardToPreviewGroups(data.doc_readers, data.doc_writers); + this.persistenceService.updatePreview(generatedConfig.resources.previewId, previewGroups.readers, previewGroups.writers); + } + this.snackbar.open( + this.translate.instant('Dashboard updated !') + ' (' + this.mainFormService.configurationName + ')' + ); + }, + error: (error) => { + this.snackbar.open(this.translate.instant('Error : Dashboard not updated')); + this.raiseError(error); } }); + }); } private saveJson(json: any, filename: string, separator?: string) { @@ -370,36 +363,49 @@ export class MainFormManagerService { }); } } - private createDashboard(configName, conf, generatedConfig, generatedMapConfig) { - this.persistenceService.create( - ZONE_WUI_BUILDER, - configName, - conf - ).subscribe( - (data) => { - this.snackbar.open( - this.translate.instant('Dashboard saved !') + ' (' + configName + ')' - ); - this.doImport(generatedConfig, generatedMapConfig); - this.mainFormService.configurationId = data.id; - this.mainFormService.configChange.next({ id: data.id, name: data.doc_key }); - this.router.navigate(['map-config'], { queryParamsHandling: 'preserve' }); - }, - (error) => { - this.snackbar.open(this.translate.instant('Error : Dashboard not saved')); - this.raiseError(error); - } - ); + private createDashboard(configName, generatedConfig, generatedMapConfig) { + this.createPreview$(configName, generatedConfig) + .pipe( + tap((g: Config) => { + const conf = this.stringifyGeneratedConfig(g, generatedMapConfig); + this.persistenceService.create( + ZONE_WUI_BUILDER, + configName, + conf + ).subscribe({ + next: (data) => { + this.snackbar.open( + this.translate.instant('Dashboard saved !') + ' (' + configName + ')' + ); + this.doImport(generatedConfig, generatedMapConfig); + this.mainFormService.configurationId = data.id; + this.mainFormService.configChange.next({ id: data.id, name: data.doc_key }); + this.router.navigate(['map-config'], { queryParamsHandling: 'preserve' }); + }, + error: (error) => { + this.snackbar.open(this.translate.instant('Error : Dashboard not saved')); + this.raiseError(error); + } + } + ); + }) + ).subscribe(); } - private renameLinkedData(zone: string, key: string, newName: string, lg: string) { - this.persistenceService.existByZoneKey(zone, key.concat('_').concat(lg)).subscribe( - exist => { - if (exist.exists) { - this.persistenceService.getByZoneKey(zone, key.concat('_').concat(lg)) - .subscribe(i => this.persistenceService.rename(i.id, newName.concat('_').concat(lg)).subscribe(d => { })); - } - } - ); + /** Creates the preview associated to the dashbord if the user has already created one + * @returns The config object enriched with the preview id. + */ + private createPreview$(name: string, generatedConfig: Config): Observable { + const resourcesConfig = this.mainFormService.resourcesConfig.getFg(); + if (this.shoulCreatePreview(resourcesConfig)) { + const img = resourcesConfig.customControls.resources.previewValue.value; + return this.persistenceService.create(ZONE_PREVIEW, name.concat('_preview'), img) + .pipe(tap((p: DataWithLinks) => resourcesConfig.customControls.resources.previewId.setValue(p.id))) + .pipe(tap((p: DataWithLinks) => generatedConfig.resources.previewId = p.id)) + .pipe(map((p: DataWithLinks) => generatedConfig)) + .pipe(catchError((err) => of(generatedConfig))); + } else { + return of(generatedConfig); + } } } diff --git a/src/app/services/main-form-manager/models-config.ts b/src/app/services/main-form-manager/models-config.ts index 395536dd..87091ba4 100644 --- a/src/app/services/main-form-manager/models-config.ts +++ b/src/app/services/main-form-manager/models-config.ts @@ -44,6 +44,9 @@ export interface Config { }; }; }; + resources: { + previewId?: string; + }; extraConfigs?: Array; } export interface ArlasExtraConfig { diff --git a/src/app/services/main-form/main-form.service.ts b/src/app/services/main-form/main-form.service.ts index f193d5f7..ea6b0199 100644 --- a/src/app/services/main-form/main-form.service.ts +++ b/src/app/services/main-form/main-form.service.ts @@ -30,11 +30,13 @@ import { import { StartingConfigFormGroup } from '@services/starting-config-form-builder/starting-config-form-builder.service'; import { Subject } from 'rxjs/internal/Subject'; import { MapBasemapFormGroup } from '@map-config/services/map-basemap-form-builder/map-basemap-form-builder.service'; -import { ShortcutsService } from '@analytics-config/services/shortcuts/shortcuts.service'; +import { DataWithLinks } from 'arlas-persistence-api'; +import { ResourcesConfigFormGroup } from '@services/resources-form-builder/resources-config-form-builder.service'; enum MAIN_FORM_KEYS { STARTING_CONFIG = 'StartingConfig', + RESOURCES_CONFIG = 'ResourcesConfig', MAP_CONFIG = 'MapConfig', MAP_CONFIG_LAYERS = 'MapConfigLayers', MAP_CONFIG_VISUALISATIONS = 'MapConfigVisualisations', @@ -72,10 +74,13 @@ export class MainFormService { public configurationName: string; + public dashboard: DataWithLinks; + public configChange: Subject<{ id: string; name: string; }> = new Subject<{ id: string; name: string; }>(); public mainForm = new FormGroup({ [MAIN_FORM_KEYS.STARTING_CONFIG]: new FormGroup({}), + [MAIN_FORM_KEYS.RESOURCES_CONFIG]: new FormGroup({}), [MAIN_FORM_KEYS.COMMON_CONFIG]: new FormGroup({}), [MAIN_FORM_KEYS.MAP_CONFIG]: new FormGroup({}), [MAIN_FORM_KEYS.TIMELINE_CONFIG]: new FormGroup({}), @@ -99,6 +104,16 @@ export class MainFormService { }(this.mainForm); + public resourcesConfig = new class { + public constructor(public mainForm: FormGroup) { } + + public init(control: ResourcesConfigFormGroup) { + this.mainForm.setControl(MAIN_FORM_KEYS.RESOURCES_CONFIG, control); + } + public getFg = () => this.mainForm.get(MAIN_FORM_KEYS.RESOURCES_CONFIG) as ResourcesConfigFormGroup; + + }(this.mainForm); + // MAP CONFIG public mapConfig = new class { public constructor(public control: FormGroup) { } @@ -186,6 +201,7 @@ export class MainFormService { // (mapConfig, analyticsConfig...) keep the initial related instance [ this.mainForm.get(MAIN_FORM_KEYS.STARTING_CONFIG), + this.mainForm.get(MAIN_FORM_KEYS.RESOURCES_CONFIG), this.mainForm.get(MAIN_FORM_KEYS.MAP_CONFIG), this.mainForm.get(MAIN_FORM_KEYS.TIMELINE_CONFIG), this.mainForm.get(MAIN_FORM_KEYS.SEARCH_CONFIG), diff --git a/src/app/services/resources-form-builder/resources-config-form-builder.service.ts b/src/app/services/resources-form-builder/resources-config-form-builder.service.ts new file mode 100644 index 00000000..fafcab64 --- /dev/null +++ b/src/app/services/resources-form-builder/resources-config-form-builder.service.ts @@ -0,0 +1,66 @@ +/* +Licensed to Gisaïa under one or more contributor +license agreements. See the NOTICE.txt file distributed with +this work for additional information regarding copyright +ownership. Gisaïa licenses this file to you under +the Apache License, Version 2.0 (the "License"); you may +not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ +import { Injectable } from '@angular/core'; +import { FormGroup, FormControl, Validators } from '@angular/forms'; +import { DefaultValuesService } from '@services/default-values/default-values.service'; +import { HiddenFormControl } from '@shared-models/config-form'; + +export class ResourcesConfigFormGroup extends FormGroup { + public constructor() { + super({ + resources: new FormGroup({ + previewId: new HiddenFormControl(''), + previewValue: new HiddenFormControl('') + }) + }); + } + + public customControls = { + resources: { + previewId: this.get('resources.previewId'), + previewValue: this.get('resources.previewValue'), + } + }; + + public hasPreviewId() { + return !!this.customControls.resources.previewId.value && this.customControls.resources.previewId.value !== ''; + } + + public hasPreviewImage() { + return !!this.customControls.resources.previewValue.value && this.customControls.resources.previewValue.value !== ''; + } + +} + +@Injectable({ + providedIn: 'root' +}) +export class ResourcesConfigFormBuilderService { + + public constructor( + private defaultValuesService: DefaultValuesService, + ) { } + + public build() { + const formGroup = new ResourcesConfigFormGroup(); + this.defaultValuesService.setDefaultValueRecursively('global', formGroup); + formGroup.disable(); + return formGroup; + } +} diff --git a/src/app/services/starting-config-form-builder/starting-config-form-builder.service.ts b/src/app/services/starting-config-form-builder/starting-config-form-builder.service.ts index de8f974a..deabc192 100644 --- a/src/app/services/starting-config-form-builder/starting-config-form-builder.service.ts +++ b/src/app/services/starting-config-form-builder/starting-config-form-builder.service.ts @@ -19,6 +19,7 @@ under the License. import { Injectable } from '@angular/core'; import { FormGroup, FormControl, Validators } from '@angular/forms'; import { DefaultValuesService } from '@services/default-values/default-values.service'; +import { HiddenFormControl } from '@shared-models/config-form'; export class StartingConfigFormGroup extends FormGroup { public constructor() { @@ -47,9 +48,10 @@ export class StartingConfigFormGroup extends FormGroup { unmanagedFields: { appName: this.get('unmanagedFields.appName'), appNameBackgroundColor: this.get('unmanagedFields.appNameBackgroundColor'), - }, + } }; + public reset() { this.customControls.collection.setValue(''); } From 5b581c2f9e2a27d992efbce584d2029f0a7de33e Mon Sep 17 00:00:00 2001 From: Mohamed Hamou Date: Mon, 22 Jan 2024 07:08:26 +0100 Subject: [PATCH 2/5] update preview groups --- .../components/preview/preview.component.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/app/modules/map-config/components/preview/preview.component.ts b/src/app/modules/map-config/components/preview/preview.component.ts index 3a764667..b5108b1b 100644 --- a/src/app/modules/map-config/components/preview/preview.component.ts +++ b/src/app/modules/map-config/components/preview/preview.component.ts @@ -193,17 +193,10 @@ export class PreviewComponent implements AfterViewInit, OnDestroy { if (!!this.mainFormService.dashboard) { const currentConfig = this.mainFormService.dashboard; const name = this.mainFormService.configurationName.concat('_preview'); - let previewReaders = []; - let previewWriters = []; - if (currentConfig.doc_readers) { - previewReaders = currentConfig.doc_readers.map(reader => reader.replace('config.json', 'preview')); - } - if (currentConfig.doc_writers) { - previewWriters = currentConfig.doc_writers.map(writer => writer.replace('config.json', 'preview')); - } + const pGroups = this.persistenceService.dashboardToPreviewGroups(currentConfig.doc_readers, currentConfig.doc_writers); this.previewExists$(previewId) .pipe( - map(exists => this.createOrUpdatePreview$(exists, previewId, img, name, previewReaders, previewWriters))) + map(exists => this.createOrUpdatePreview$(exists, previewId, img, name, pGroups.readers, pGroups.writers))) .subscribe({ complete: () => this.snackbar.open(this.translate.instant('Preview saved !')) }); From e39c9d7f86d0671cd53b8cbaefa2d3231d705eb6 Mon Sep 17 00:00:00 2001 From: Mohamed Hamou Date: Tue, 13 Feb 2024 21:04:24 +0100 Subject: [PATCH 3/5] Adjustment to latest toolkit : updatable --- package-lock.json | 129 +++++++++++------- package.json | 5 +- .../landing-page/landing-page.component.ts | 7 +- .../components/preview/preview.component.ts | 9 +- .../main-form-manager.service.ts | 5 +- src/settings.yaml | 18 +-- 6 files changed, 103 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index d856944f..ed3cb07e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "ajv": "8.8.2", "ajv-keywords": "5.1.0", "ang-jsoneditor": "1.10.5", - "arlas-wui-toolkit": "24.3.5-alpha.3", + "arlas-wui-toolkit": "25.0.0-beta.1", "file-saver": "^2.0.2", "jsoneditor": "9.5.6", "moment": "^2.29.4", @@ -5685,9 +5685,9 @@ } }, "node_modules/arlas-web-contributors": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/arlas-web-contributors/-/arlas-web-contributors-24.3.0.tgz", - "integrity": "sha512-z6n9J1s5GgzUid40XRrMWhBUxHwDXi/JTdlfn9m/00MOkeo+Q/XBCPQPzcI4Yy4M5GlGUHj6rTO6MrOb50uUqA==", + "version": "24.3.1", + "resolved": "https://registry.npmjs.org/arlas-web-contributors/-/arlas-web-contributors-24.3.1.tgz", + "integrity": "sha512-B7AWHo4KoX73DnxEb1EaQb0U+YuXZNRGJqx67IwCKTcbbsDNlc1/XWt9dpUK5DGKgXPCNSy+oxcCOraEMJBoQw==", "dependencies": { "@turf/bbox": "^6.0.1", "@turf/bbox-polygon": "^6.0.1", @@ -5717,9 +5717,9 @@ } }, "node_modules/arlas-wui-toolkit": { - "version": "24.3.5-alpha.3", - "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-24.3.5-alpha.3.tgz", - "integrity": "sha512-O4B5/ztcY+blCzO4QXDzLOAtok8I05kksUexqsGhlJcbU+13eMaFCXMrzIaxiOdOMPe6lMu0Wrkw3w3Dqkt1Bg==", + "version": "25.0.0-beta.1", + "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-25.0.0-beta.1.tgz", + "integrity": "sha512-7cKvHQJSqnj/hLZ4jTXoM1Jdw0Y4NBrkL5RKfpx1MMkS+Hk/m7D4X+tjXYjUabll7x7duK5Pjf7n2jEdTZEHnw==", "dependencies": { "@danielmoncada/angular-datetime-picker": "14.2.0", "@danielmoncada/angular-datetime-picker-moment-adapter": "~2.2.0", @@ -5732,7 +5732,7 @@ "arlas-persistence-api": "24.0.5-SNAPSHOT-1", "arlas-tagger-api": "~24.1.0", "arlas-web-components": "~24.3.2", - "arlas-web-contributors": "~24.3.0", + "arlas-web-contributors": "~24.3.1", "cli-color": "^1.2.0", "fetch-intercept": "^2.3.1", "hopscotch": "0.3.1", @@ -10066,9 +10066,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "dev": true, "funding": [ { @@ -11248,10 +11248,29 @@ "node": ">=12" } }, - "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/ip-address/node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true + }, + "node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", "dev": true }, "node_modules/ipaddr.js": { @@ -12215,9 +12234,9 @@ } }, "node_modules/jsrsasign": { - "version": "10.8.6", - "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-10.8.6.tgz", - "integrity": "sha512-bQmbVtsfbgaKBTWCKiDCPlUPbdlRIK/FzSwT3BzIgZl/cU6TqXu6pZJsCI/dJVrZ9Gir5GC4woqw9shH/v7MBw==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-11.1.0.tgz", + "integrity": "sha512-Ov74K9GihaK9/9WncTe1mPmvrO7Py665TUfUKvraXBpu+xcTWitrtuOwcjf4KMU9maPaYn0OuaWy0HOzy/GBXg==", "funding": { "url": "https://github.com/kjur/jsrsasign#donations" } @@ -18162,16 +18181,16 @@ } }, "node_modules/socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.3.tgz", + "integrity": "sha512-vfuYK48HXCTFD03G/1/zkIls3Ebr2YNa4qU9gHDZdblHLiqhJrJGkY3+0Nx0JpN9qBhJbVObc1CNciT1bIZJxw==", "dev": true, "dependencies": { - "ip": "^2.0.0", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" }, "engines": { - "node": ">= 10.13.0", + "node": ">= 10.0.0", "npm": ">= 3.0.0" } }, @@ -24437,7 +24456,7 @@ "resolved": "https://registry.npmjs.org/angular-oauth2-oidc-jwks/-/angular-oauth2-oidc-jwks-14.0.1.tgz", "integrity": "sha512-oUzy+bcDEN1eTkwUa2+hG4ITZbpJ5538vLENaQBjSCqNpvrvfCfeDAXyGt5ofRHhBjqBeA7bW3hpMj3OQLn8tA==", "requires": { - "jsrsasign": "^10.3.0", + "jsrsasign": "^11.0.0", "tslib": "^2.0.0" } }, @@ -24676,9 +24695,9 @@ } }, "arlas-web-contributors": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/arlas-web-contributors/-/arlas-web-contributors-24.3.0.tgz", - "integrity": "sha512-z6n9J1s5GgzUid40XRrMWhBUxHwDXi/JTdlfn9m/00MOkeo+Q/XBCPQPzcI4Yy4M5GlGUHj6rTO6MrOb50uUqA==", + "version": "24.3.1", + "resolved": "https://registry.npmjs.org/arlas-web-contributors/-/arlas-web-contributors-24.3.1.tgz", + "integrity": "sha512-B7AWHo4KoX73DnxEb1EaQb0U+YuXZNRGJqx67IwCKTcbbsDNlc1/XWt9dpUK5DGKgXPCNSy+oxcCOraEMJBoQw==", "requires": { "@turf/bbox": "^6.0.1", "@turf/bbox-polygon": "^6.0.1", @@ -24708,9 +24727,9 @@ } }, "arlas-wui-toolkit": { - "version": "24.3.5-alpha.3", - "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-24.3.5-alpha.3.tgz", - "integrity": "sha512-O4B5/ztcY+blCzO4QXDzLOAtok8I05kksUexqsGhlJcbU+13eMaFCXMrzIaxiOdOMPe6lMu0Wrkw3w3Dqkt1Bg==", + "version": "25.0.0-beta.1", + "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-25.0.0-beta.1.tgz", + "integrity": "sha512-7cKvHQJSqnj/hLZ4jTXoM1Jdw0Y4NBrkL5RKfpx1MMkS+Hk/m7D4X+tjXYjUabll7x7duK5Pjf7n2jEdTZEHnw==", "requires": { "@danielmoncada/angular-datetime-picker": "14.2.0", "@danielmoncada/angular-datetime-picker-moment-adapter": "~2.2.0", @@ -24723,7 +24742,7 @@ "arlas-persistence-api": "24.0.5-SNAPSHOT-1", "arlas-tagger-api": "~24.1.0", "arlas-web-components": "~24.3.2", - "arlas-web-contributors": "~24.3.0", + "arlas-web-contributors": "~24.3.1", "cli-color": "^1.2.0", "fetch-intercept": "^2.3.1", "hopscotch": "0.3.1", @@ -27890,9 +27909,9 @@ "dev": true }, "follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "dev": true }, "for-each": { @@ -28790,11 +28809,29 @@ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==" }, - "ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", - "dev": true + "ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "requires": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "dependencies": { + "jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true + }, + "sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true + } + } }, "ipaddr.js": { "version": "2.1.0", @@ -29515,9 +29552,9 @@ } }, "jsrsasign": { - "version": "10.8.6", - "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-10.8.6.tgz", - "integrity": "sha512-bQmbVtsfbgaKBTWCKiDCPlUPbdlRIK/FzSwT3BzIgZl/cU6TqXu6pZJsCI/dJVrZ9Gir5GC4woqw9shH/v7MBw==" + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-11.1.0.tgz", + "integrity": "sha512-Ov74K9GihaK9/9WncTe1mPmvrO7Py665TUfUKvraXBpu+xcTWitrtuOwcjf4KMU9maPaYn0OuaWy0HOzy/GBXg==" }, "jsts": { "version": "2.1.0", @@ -33980,12 +34017,12 @@ } }, "socks": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", - "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.3.tgz", + "integrity": "sha512-vfuYK48HXCTFD03G/1/zkIls3Ebr2YNa4qU9gHDZdblHLiqhJrJGkY3+0Nx0JpN9qBhJbVObc1CNciT1bIZJxw==", "dev": true, "requires": { - "ip": "^2.0.0", + "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" } }, diff --git a/package.json b/package.json index 6ebea6a0..94f07d6e 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "ajv": "8.8.2", "ajv-keywords": "5.1.0", "ang-jsoneditor": "1.10.5", - "arlas-wui-toolkit": "24.3.5-alpha.3", + "arlas-wui-toolkit": "25.0.0-beta.1", "file-saver": "^2.0.2", "jsoneditor": "9.5.6", "moment": "^2.29.4", @@ -91,6 +91,9 @@ "overrides": { "portable-fetch": { "node-fetch": "3.3.0" + }, + "angular-oauth2-oidc-jwks": { + "jsrsasign": "^11.0.0" } } } diff --git a/src/app/components/landing-page/landing-page.component.ts b/src/app/components/landing-page/landing-page.component.ts index 5fd95663..fd64fbf7 100644 --- a/src/app/components/landing-page/landing-page.component.ts +++ b/src/app/components/landing-page/landing-page.component.ts @@ -211,7 +211,8 @@ export class LandingPageComponent implements OnInit, AfterViewInit, OnDestroy { actions.push({ config, configIdParam: 'config_id', - type: ConfigActionEnum.VIEW + type: ConfigActionEnum.VIEW, + enabled: data.updatable }); actions.push({ config, @@ -227,7 +228,9 @@ export class LandingPageComponent implements OnInit, AfterViewInit, OnDestroy { actions.push({ config, type: ConfigActionEnum.DUPLICATE, - name: data.doc_key + name: data.doc_key, + enabled: data.updatable + }); actions.push({ config, diff --git a/src/app/modules/map-config/components/preview/preview.component.ts b/src/app/modules/map-config/components/preview/preview.component.ts index b5108b1b..e410e60b 100644 --- a/src/app/modules/map-config/components/preview/preview.component.ts +++ b/src/app/modules/map-config/components/preview/preview.component.ts @@ -193,7 +193,7 @@ export class PreviewComponent implements AfterViewInit, OnDestroy { if (!!this.mainFormService.dashboard) { const currentConfig = this.mainFormService.dashboard; const name = this.mainFormService.configurationName.concat('_preview'); - const pGroups = this.persistenceService.dashboardToPreviewGroups(currentConfig.doc_readers, currentConfig.doc_writers); + const pGroups = this.persistenceService.dashboardToResourcesGroups(currentConfig.doc_readers, currentConfig.doc_writers); this.previewExists$(previewId) .pipe( map(exists => this.createOrUpdatePreview$(exists, previewId, img, name, pGroups.readers, pGroups.writers))) @@ -212,7 +212,6 @@ export class PreviewComponent implements AfterViewInit, OnDestroy { if (!previewId || previewId === '') { return of(false); } else { - console.log(previewId); return this.persistenceService.exists(previewId).pipe(map(r => r.exists)); } } @@ -220,14 +219,10 @@ export class PreviewComponent implements AfterViewInit, OnDestroy { private createOrUpdatePreview$(previewExists: boolean, previewId: string, img, name: string, previewReaders?, previewWriters?) { const resourcesConfig = this.mainFormService.resourcesConfig.getFg(); resourcesConfig.customControls.resources.previewValue.setValue(img); - console.log(previewExists); if (previewExists) { - this.persistenceService.updatePreview(previewId, previewReaders, previewWriters, img); - } else { - console.log('yey'); + this.persistenceService.updateResource(previewId, previewReaders, previewWriters, img); this.persistenceService.create(ZONE_PREVIEW, name, img, previewReaders, previewWriters) .pipe(map((p: DataWithLinks) => { - console.log('creating'); resourcesConfig.customControls.resources.previewId.setValue(p.id); return p; })) diff --git a/src/app/services/main-form-manager/main-form-manager.service.ts b/src/app/services/main-form-manager/main-form-manager.service.ts index 512fc3c5..b480e25c 100644 --- a/src/app/services/main-form-manager/main-form-manager.service.ts +++ b/src/app/services/main-form-manager/main-form-manager.service.ts @@ -184,7 +184,6 @@ export class MainFormManagerService { const dialogRef = this.dialog.open(InputModalComponent); dialogRef.afterClosed().subscribe(configName => { if (!!configName) { - console.log(configName); this.createDashboard(configName, generatedConfig, generatedMapConfig); } }); @@ -282,8 +281,8 @@ export class MainFormManagerService { ).subscribe({ next: () => { if (resourcesConfig.hasPreviewId()) { - const previewGroups = this.persistenceService.dashboardToPreviewGroups(data.doc_readers, data.doc_writers); - this.persistenceService.updatePreview(generatedConfig.resources.previewId, previewGroups.readers, previewGroups.writers); + const previewGroups = this.persistenceService.dashboardToResourcesGroups(data.doc_readers, data.doc_writers); + this.persistenceService.updateResource(generatedConfig.resources.previewId, previewGroups.readers, previewGroups.writers); } this.snackbar.open( this.translate.instant('Dashboard updated !') + ' (' + this.mainFormService.configurationName + ')' diff --git a/src/settings.yaml b/src/settings.yaml index fc2d9017..c24d25ba 100644 --- a/src/settings.yaml +++ b/src/settings.yaml @@ -2,14 +2,14 @@ ############ AUTHENTICATION SETTINGS ############### ######################################################## authentication: - use_authent: false + use_authent: true auth_mode: iam - force_connect: true + url: https://demo.cloud.staging.arlas.io/arlas/iam + force_connect: false threshold: 60000 - use_discovery: true + use_discovery: false issuer: https://arlas-cloud-dev.eu.auth0.com/ client_id: TrAfmjESYNWrikvK1d7RPnc5Uve7WJqs - redirect_uri: http://localhost:4200/callback scope: "openid profile" silent_refresh_redirect_uri: http://localhost:4200/silent-refresh.html require_https: true @@ -20,20 +20,16 @@ authentication: clear_hash_after_login: true disable_at_hash_check: false show_debug_information: true - logout_url: https://arlas-cloud-dev.eu.auth0.com/v2/logout?returnTo=http://localhost:4201 + logout_url: https://arlas-cloud-dev.eu.auth0.com/v2/logout?returnTo=http://localhost:4200 storage: sessionstorage custom_query_params: [{"audience":"http://arlas.io/api/server"}] - -######################################################## -############ Persistence SETTINGS ################## -######################################################## persistence: - url: 'http://localhost:19997/arlas-persistence-server' + url: 'https://demo.cloud.staging.arlas.io/arlas/persistence' ######################################################## ############ Permissions SETTINGS ################## ######################################################## permission: - url: 'http://localhost:19996/arlas-permissions-server' + url: 'https://demo.cloud.staging.arlas.io/arlas/permissions' ######################################################## ############ URLs to WUI app ####################### ######################################################## From 0c4dfeee6db02048ea93b5fcd3bc3d7b6cea219f Mon Sep 17 00:00:00 2001 From: Mohamed Hamou Date: Thu, 15 Feb 2024 12:06:52 +0100 Subject: [PATCH 4/5] Fix CI --- package-lock.json | 125 +++++++++--------- package.json | 2 +- src/app/app.module.ts | 1 - .../landing-page/landing-page.component.ts | 4 +- 4 files changed, 67 insertions(+), 65 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed3cb07e..0db13181 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "ajv": "8.8.2", "ajv-keywords": "5.1.0", "ang-jsoneditor": "1.10.5", - "arlas-wui-toolkit": "25.0.0-beta.1", + "arlas-wui-toolkit": "25.0.0-beta.3", "file-saver": "^2.0.2", "jsoneditor": "9.5.6", "moment": "^2.29.4", @@ -4264,9 +4264,9 @@ } }, "node_modules/@types/d3-path": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.0.2.tgz", - "integrity": "sha512-WAIEVlOCdd/NKRYTsqCpOMHQHemKBEINf8YXMYOtXH0GA7SY0dqMB78P3Uhgfy+4X+/Mlw2wDtlETkN6kQUCMA==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-P2dlU/q51fkOc/Gfl3Ul9kicV7l+ra934qBFXCFhrZMOL6du1TM0pm1ThYvENukyOn5h9v+yMJ9Fn5JK4QozrQ==" }, "node_modules/@types/d3-scale": { "version": "4.0.8", @@ -4363,9 +4363,9 @@ "integrity": "sha512-zv9kNf3keYegP5oThGLaPk8E081DFDuwfqjtiTzm6PoxChdJ1raSuADf2YGCVIyrSynLrgc8JWv296s7Q7pQSQ==" }, "node_modules/@types/geojson": { - "version": "7946.0.13", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.13.tgz", - "integrity": "sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ==" + "version": "7946.0.14", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", + "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==" }, "node_modules/@types/glob": { "version": "7.2.0", @@ -5593,9 +5593,9 @@ } }, "node_modules/arlas-iam-api": { - "version": "24.1.0-rc.0", - "resolved": "https://registry.npmjs.org/arlas-iam-api/-/arlas-iam-api-24.1.0-rc.0.tgz", - "integrity": "sha512-BC9RElid/5fIcaL04wA/XZ0Ey3wANoEYQh67+ygChoKKA5h63rrUB6CF7+jS8ZzrCrstV/3mflzcHxj4lJT1hg==", + "version": "24.1.1-rc.0", + "resolved": "https://registry.npmjs.org/arlas-iam-api/-/arlas-iam-api-24.1.1-rc.0.tgz", + "integrity": "sha512-NGz9+eBvEimqmToC5K8GeQBKiV6I44A09ZIb+QNcDHwpENmNeN6DHIiKFiJPtnMGQVbOWfpbzVvaMUo9sTT5dQ==", "dependencies": { "es6-promise": "4.2.4", "portable-fetch": "3.0.0", @@ -5617,9 +5617,9 @@ } }, "node_modules/arlas-persistence-api": { - "version": "24.0.5-SNAPSHOT-1", - "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.5-SNAPSHOT-1.tgz", - "integrity": "sha512-gl2Wk/Z81I5q8Ub4e2mlZss3PjiDoZY4aLPTLV0lJ2+pRJQc4jC4jt8WdyU7YsJN1Jd+OGSk2g9IShdH0fSynw==", + "version": "24.0.5", + "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.5.tgz", + "integrity": "sha512-a4XGlJitW57tPk0Tab+1rMCqInCEGO1PNHZC5zKBEgOp5gTxC4qMMNrdP4Zp4RrWj8al0FCYXMG67dapTTlbzA==", "dependencies": { "portable-fetch": "3.0.0", "url": "0.11.0" @@ -5635,9 +5635,9 @@ } }, "node_modules/arlas-web-components": { - "version": "24.3.2", - "resolved": "https://registry.npmjs.org/arlas-web-components/-/arlas-web-components-24.3.2.tgz", - "integrity": "sha512-BZhtx6q8UZd1FIXTaNVs/G3wVuixGWBetiFMm3yF0DV6hmHtbSKGKO3zHNfj88rUCR/iW3ePm2s6tImshwnn9g==", + "version": "25.0.0-beta.1", + "resolved": "https://registry.npmjs.org/arlas-web-components/-/arlas-web-components-25.0.0-beta.1.tgz", + "integrity": "sha512-JKg9ErRawxadWvQ0nlAXh2HtAAZuyBVBSVeRe5WlP2w3DllnPnVP1+/eZjsWGxmcyCxQJHdhKsWIzwFVhpAQBQ==", "dependencies": { "@mapbox/mapbox-gl-draw": "1.3.0", "@mapbox/mapbox-gl-draw-static-mode": "^1.0.1", @@ -5717,9 +5717,9 @@ } }, "node_modules/arlas-wui-toolkit": { - "version": "25.0.0-beta.1", - "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-25.0.0-beta.1.tgz", - "integrity": "sha512-7cKvHQJSqnj/hLZ4jTXoM1Jdw0Y4NBrkL5RKfpx1MMkS+Hk/m7D4X+tjXYjUabll7x7duK5Pjf7n2jEdTZEHnw==", + "version": "25.0.0-beta.3", + "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-25.0.0-beta.3.tgz", + "integrity": "sha512-IkglvQ/FSlR7gaboqcdSxY544E7x0RgunX4Y9OaOzVPMmDzt6oe4mgyH1d/h6u/WheFxLJXtYLFH3udJtZpSlQ==", "dependencies": { "@danielmoncada/angular-datetime-picker": "14.2.0", "@danielmoncada/angular-datetime-picker-moment-adapter": "~2.2.0", @@ -5727,11 +5727,11 @@ "ajv-keywords": "5.1.0", "angular-oauth2-oidc": "~14.0.1", "angular-oauth2-oidc-jwks": "~14.0.1", - "arlas-iam-api": "24.1.0-rc.0", + "arlas-iam-api": "24.1.1-rc.0", "arlas-permissions-api": "~24.0.4", - "arlas-persistence-api": "24.0.5-SNAPSHOT-1", + "arlas-persistence-api": "24.0.5", "arlas-tagger-api": "~24.1.0", - "arlas-web-components": "~24.3.2", + "arlas-web-components": "25.0.0-beta.1", "arlas-web-contributors": "~24.3.1", "cli-color": "^1.2.0", "fetch-intercept": "^2.3.1", @@ -9908,9 +9908,9 @@ "integrity": "sha512-BPZ2LM9Dh1ua2ovQf03N6rhWg1qxdVD5qK/G4llvcemt6M+jjxCuIDxJ+6IiG+uz//3UQmgfKEv0gOGvYIxZ7g==" }, "node_modules/fflate": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.1.tgz", - "integrity": "sha512-/exOvEuc+/iaUm105QIiOt4LpBdMTWsXxqR0HDF35vx3fmaKzw7354gTilCh5rkzEt8WYyG//ku3h3nRmd7CHQ==" + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==" }, "node_modules/figures": { "version": "3.2.0", @@ -16312,9 +16312,9 @@ "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==" }, "node_modules/proj4": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.9.2.tgz", - "integrity": "sha512-bdyfNmtlWjQN/rHEHEiqFvpTUHhuzDaeQ6Uu1G4sPGqk+Xkxae6ahh865fClJokSGPBmlDOQWWaO6465TCfv5Q==", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.10.0.tgz", + "integrity": "sha512-0eyB8h1PDoWxucnq88/EZqt7UZlvjhcfbXCcINpE7hqRN0iRPWE/4mXINGulNa/FAvK+Ie7F+l2OxH/0uKV36A==", "dependencies": { "mgrs": "1.0.0", "wkt-parser": "^1.3.3" @@ -19073,9 +19073,12 @@ } }, "node_modules/traverse": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.7.tgz", - "integrity": "sha512-/y956gpUo9ZNCb99YjxG7OaslxZWHfCHAUUfshwqOXmxUIvqLjVO581BT+gM59+QV9tFe6/CGG53tsA1Y7RSdg==", + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.8.tgz", + "integrity": "sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA==", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -23558,9 +23561,9 @@ } }, "@types/d3-path": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.0.2.tgz", - "integrity": "sha512-WAIEVlOCdd/NKRYTsqCpOMHQHemKBEINf8YXMYOtXH0GA7SY0dqMB78P3Uhgfy+4X+/Mlw2wDtlETkN6kQUCMA==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-P2dlU/q51fkOc/Gfl3Ul9kicV7l+ra934qBFXCFhrZMOL6du1TM0pm1ThYvENukyOn5h9v+yMJ9Fn5JK4QozrQ==" }, "@types/d3-scale": { "version": "4.0.8", @@ -23657,9 +23660,9 @@ "integrity": "sha512-zv9kNf3keYegP5oThGLaPk8E081DFDuwfqjtiTzm6PoxChdJ1raSuADf2YGCVIyrSynLrgc8JWv296s7Q7pQSQ==" }, "@types/geojson": { - "version": "7946.0.13", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.13.tgz", - "integrity": "sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ==" + "version": "7946.0.14", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", + "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==" }, "@types/glob": { "version": "7.2.0", @@ -24620,9 +24623,9 @@ } }, "arlas-iam-api": { - "version": "24.1.0-rc.0", - "resolved": "https://registry.npmjs.org/arlas-iam-api/-/arlas-iam-api-24.1.0-rc.0.tgz", - "integrity": "sha512-BC9RElid/5fIcaL04wA/XZ0Ey3wANoEYQh67+ygChoKKA5h63rrUB6CF7+jS8ZzrCrstV/3mflzcHxj4lJT1hg==", + "version": "24.1.1-rc.0", + "resolved": "https://registry.npmjs.org/arlas-iam-api/-/arlas-iam-api-24.1.1-rc.0.tgz", + "integrity": "sha512-NGz9+eBvEimqmToC5K8GeQBKiV6I44A09ZIb+QNcDHwpENmNeN6DHIiKFiJPtnMGQVbOWfpbzVvaMUo9sTT5dQ==", "requires": { "es6-promise": "4.2.4", "portable-fetch": "3.0.0", @@ -24646,9 +24649,9 @@ } }, "arlas-persistence-api": { - "version": "24.0.5-SNAPSHOT-1", - "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.5-SNAPSHOT-1.tgz", - "integrity": "sha512-gl2Wk/Z81I5q8Ub4e2mlZss3PjiDoZY4aLPTLV0lJ2+pRJQc4jC4jt8WdyU7YsJN1Jd+OGSk2g9IShdH0fSynw==", + "version": "24.0.5", + "resolved": "https://registry.npmjs.org/arlas-persistence-api/-/arlas-persistence-api-24.0.5.tgz", + "integrity": "sha512-a4XGlJitW57tPk0Tab+1rMCqInCEGO1PNHZC5zKBEgOp5gTxC4qMMNrdP4Zp4RrWj8al0FCYXMG67dapTTlbzA==", "requires": { "portable-fetch": "3.0.0", "url": "0.11.0" @@ -24664,9 +24667,9 @@ } }, "arlas-web-components": { - "version": "24.3.2", - "resolved": "https://registry.npmjs.org/arlas-web-components/-/arlas-web-components-24.3.2.tgz", - "integrity": "sha512-BZhtx6q8UZd1FIXTaNVs/G3wVuixGWBetiFMm3yF0DV6hmHtbSKGKO3zHNfj88rUCR/iW3ePm2s6tImshwnn9g==", + "version": "25.0.0-beta.1", + "resolved": "https://registry.npmjs.org/arlas-web-components/-/arlas-web-components-25.0.0-beta.1.tgz", + "integrity": "sha512-JKg9ErRawxadWvQ0nlAXh2HtAAZuyBVBSVeRe5WlP2w3DllnPnVP1+/eZjsWGxmcyCxQJHdhKsWIzwFVhpAQBQ==", "requires": { "@mapbox/mapbox-gl-draw": "1.3.0", "@mapbox/mapbox-gl-draw-static-mode": "^1.0.1", @@ -24727,9 +24730,9 @@ } }, "arlas-wui-toolkit": { - "version": "25.0.0-beta.1", - "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-25.0.0-beta.1.tgz", - "integrity": "sha512-7cKvHQJSqnj/hLZ4jTXoM1Jdw0Y4NBrkL5RKfpx1MMkS+Hk/m7D4X+tjXYjUabll7x7duK5Pjf7n2jEdTZEHnw==", + "version": "25.0.0-beta.3", + "resolved": "https://registry.npmjs.org/arlas-wui-toolkit/-/arlas-wui-toolkit-25.0.0-beta.3.tgz", + "integrity": "sha512-IkglvQ/FSlR7gaboqcdSxY544E7x0RgunX4Y9OaOzVPMmDzt6oe4mgyH1d/h6u/WheFxLJXtYLFH3udJtZpSlQ==", "requires": { "@danielmoncada/angular-datetime-picker": "14.2.0", "@danielmoncada/angular-datetime-picker-moment-adapter": "~2.2.0", @@ -24737,11 +24740,11 @@ "ajv-keywords": "5.1.0", "angular-oauth2-oidc": "~14.0.1", "angular-oauth2-oidc-jwks": "~14.0.1", - "arlas-iam-api": "24.1.0-rc.0", + "arlas-iam-api": "24.1.1-rc.0", "arlas-permissions-api": "~24.0.4", - "arlas-persistence-api": "24.0.5-SNAPSHOT-1", + "arlas-persistence-api": "24.0.5", "arlas-tagger-api": "~24.1.0", - "arlas-web-components": "~24.3.2", + "arlas-web-components": "25.0.0-beta.1", "arlas-web-contributors": "~24.3.1", "cli-color": "^1.2.0", "fetch-intercept": "^2.3.1", @@ -27782,9 +27785,9 @@ "integrity": "sha512-BPZ2LM9Dh1ua2ovQf03N6rhWg1qxdVD5qK/G4llvcemt6M+jjxCuIDxJ+6IiG+uz//3UQmgfKEv0gOGvYIxZ7g==" }, "fflate": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.1.tgz", - "integrity": "sha512-/exOvEuc+/iaUm105QIiOt4LpBdMTWsXxqR0HDF35vx3fmaKzw7354gTilCh5rkzEt8WYyG//ku3h3nRmd7CHQ==" + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==" }, "figures": { "version": "3.2.0", @@ -32553,9 +32556,9 @@ "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==" }, "proj4": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.9.2.tgz", - "integrity": "sha512-bdyfNmtlWjQN/rHEHEiqFvpTUHhuzDaeQ6Uu1G4sPGqk+Xkxae6ahh865fClJokSGPBmlDOQWWaO6465TCfv5Q==", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/proj4/-/proj4-2.10.0.tgz", + "integrity": "sha512-0eyB8h1PDoWxucnq88/EZqt7UZlvjhcfbXCcINpE7hqRN0iRPWE/4mXINGulNa/FAvK+Ie7F+l2OxH/0uKV36A==", "requires": { "mgrs": "1.0.0", "wkt-parser": "^1.3.3" @@ -34689,9 +34692,9 @@ } }, "traverse": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.7.tgz", - "integrity": "sha512-/y956gpUo9ZNCb99YjxG7OaslxZWHfCHAUUfshwqOXmxUIvqLjVO581BT+gM59+QV9tFe6/CGG53tsA1Y7RSdg==" + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.8.tgz", + "integrity": "sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA==" }, "tree-kill": { "version": "1.2.2", diff --git a/package.json b/package.json index 94f07d6e..7beab2e0 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "ajv": "8.8.2", "ajv-keywords": "5.1.0", "ang-jsoneditor": "1.10.5", - "arlas-wui-toolkit": "25.0.0-beta.1", + "arlas-wui-toolkit": "25.0.0-beta.3", "file-saver": "^2.0.2", "jsoneditor": "9.5.6", "moment": "^2.29.4", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6acd1b26..3a75101d 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -57,7 +57,6 @@ import enComponents from 'arlas-web-components/assets/i18n/en.json'; import frComponents from 'arlas-web-components/assets/i18n/fr.json'; import enToolkit from 'arlas-wui-toolkit/assets/i18n/en.json'; import frToolkit from 'arlas-wui-toolkit/assets/i18n/fr.json'; -import { ColorGeneratorLoader, ColorGeneratorModule } from 'arlas-web-components'; export function loadServiceFactory(defaultValuesService: DefaultValuesService) { diff --git a/src/app/components/landing-page/landing-page.component.ts b/src/app/components/landing-page/landing-page.component.ts index fd64fbf7..e764fcfa 100644 --- a/src/app/components/landing-page/landing-page.component.ts +++ b/src/app/components/landing-page/landing-page.component.ts @@ -112,10 +112,10 @@ export class LandingPageComponent implements OnInit, AfterViewInit, OnDestroy { this.mainFormService.configChange.next({ id: undefined, name: undefined }); } - this.mainFormService.startingConfig.init( + this.mainFormService.startingConfig?.init( this.startingConfigFormBuilder.build() ); - this.mainFormService.resourcesConfig.init( + this.mainFormService.resourcesConfig?.init( this.resourcesConfigFormBuilder.build() ); if (this.activatedRoute.snapshot.paramMap.has('id')) { From 8d616817f3eef94053c9632daec0474c85e1a2be Mon Sep 17 00:00:00 2001 From: Mohamed Hamou Date: Thu, 15 Feb 2024 21:02:29 +0100 Subject: [PATCH 5/5] Fix CI + resolve discussions --- .../services/main-form-manager/main-form-manager.service.ts | 4 ++-- .../resources-config-form-builder.service.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/services/main-form-manager/main-form-manager.service.ts b/src/app/services/main-form-manager/main-form-manager.service.ts index b480e25c..f4621918 100644 --- a/src/app/services/main-form-manager/main-form-manager.service.ts +++ b/src/app/services/main-form-manager/main-form-manager.service.ts @@ -258,7 +258,7 @@ export class MainFormManagerService { * @param startForm The form where the preview image is stored * @returns Whether we should create the preview in persistence or not */ - private shoulCreatePreview(startForm: ResourcesConfigFormGroup) { + private shouldCreatePreview(startForm: ResourcesConfigFormGroup) { const hasPreviewImage = startForm.hasPreviewImage(); const hasPreviewId = startForm.hasPreviewId(); return hasPreviewImage && !hasPreviewId; @@ -396,7 +396,7 @@ export class MainFormManagerService { */ private createPreview$(name: string, generatedConfig: Config): Observable { const resourcesConfig = this.mainFormService.resourcesConfig.getFg(); - if (this.shoulCreatePreview(resourcesConfig)) { + if (this.shouldCreatePreview(resourcesConfig)) { const img = resourcesConfig.customControls.resources.previewValue.value; return this.persistenceService.create(ZONE_PREVIEW, name.concat('_preview'), img) .pipe(tap((p: DataWithLinks) => resourcesConfig.customControls.resources.previewId.setValue(p.id))) diff --git a/src/app/services/resources-form-builder/resources-config-form-builder.service.ts b/src/app/services/resources-form-builder/resources-config-form-builder.service.ts index fafcab64..0b02b3d1 100644 --- a/src/app/services/resources-form-builder/resources-config-form-builder.service.ts +++ b/src/app/services/resources-form-builder/resources-config-form-builder.service.ts @@ -39,11 +39,11 @@ export class ResourcesConfigFormGroup extends FormGroup { }; public hasPreviewId() { - return !!this.customControls.resources.previewId.value && this.customControls.resources.previewId.value !== ''; + return !!this.customControls.resources.previewId.value; } public hasPreviewImage() { - return !!this.customControls.resources.previewValue.value && this.customControls.resources.previewValue.value !== ''; + return !!this.customControls.resources.previewValue.value; } }