Skip to content

Commit 06c801d

Browse files
fix: layers would be duplicated when doing some changes on them
* bugfix/AB#69091_DB-layers-edition-still-broken fix: add missing FormWrapperModule to the add-aggregation-modal for layers fix: add default case when aggregation list of selected resource does not contain any item * bugfix/AB#69091_DB-layers-edition-still-broken refactor: change conditions style in order to be more readable and easy to debug for developers fix: delete addLayer method on onAddLayer event in Layer class as that method only triggers when the layer is already added fix: remaining listeners for each Layer instance trigger on switching between layers instance. Added method removeAllListeners to Layer class in order to clean up all listeners once we remove the related Layer class instance fix: main duplication layer issue by always triggering layer editor form change updates once all related layers changes of the map are finished * bugfix/AB#69091_DB-layers-edition-still-broken refactor: improve service dependency instantiation for Layer class using the Injector from map component in order to simplify and have access to all the needed dependencies from one single property fix: add renderer to Layer class in order to handle all DOM event listeners easily * bugfix/AB#69091_DB-layers-edition-still-broken refactor: delete some map listeners added from Layer class on layer removal fix: duplication of layers while loading layer changes if any map event is triggered by disabling them meanwhile layer data is setting up * bugfix/AB#69091_DB-layers-edition-still-broken fix: add recursive listener removal for children layers in the removeAllListeners method feat: move map layers set in map component's drawMap method in order to be callable from outside the component without any further config change in the map instance feat: update layers property as public in order to keep layers data sync in editor layer modal component, as the layer is created from a definition, therefor layers property in the map needs to be updated from outside the component itself to keep all listeners removal sync on switching from editor component to settings component etc. fix: add missing teardown logic for mapEvent subscription in map-settings to avoid memory leaks. fix: correct await on layer update for all layers(including grouplayers with async methods to load sublayers) fix: update layers list with edited layers(name could be changed and it was not reflected in map-layers list) --------- Co-authored-by: Antoine Hurard <[email protected]>
1 parent 6baabbc commit 06c801d

File tree

11 files changed

+329
-165
lines changed

11 files changed

+329
-165
lines changed

libs/safe/src/lib/components/aggregation/add-aggregation-modal/add-aggregation-modal.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { TranslateModule } from '@ngx-translate/core';
1414
import { ReactiveFormsModule } from '@angular/forms';
1515
import {
1616
DialogModule,
17+
FormWrapperModule,
1718
GraphQLSelectComponent,
1819
GraphQLSelectModule,
1920
} from '@oort-front/ui';
@@ -43,6 +44,7 @@ interface DialogData {
4344
GraphQLSelectModule,
4445
ReactiveFormsModule,
4546
ButtonModule,
47+
FormWrapperModule,
4648
],
4749
selector: 'safe-add-aggregation-modal',
4850
templateUrl: './add-aggregation-modal.component.html',

libs/safe/src/lib/components/editor-control/editor-control.component.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,11 @@ export class SafeEditorControlComponent
141141
/** Sets whether the field is disabled */
142142
set disabled(value: boolean) {
143143
const isDisabled = coerceBooleanProperty(value);
144-
if (isDisabled) this.ngControl.control?.disable();
145-
else this.ngControl.control?.enable();
144+
if (isDisabled) {
145+
this.ngControl.control?.disable();
146+
} else {
147+
this.ngControl.control?.enable();
148+
}
146149
this.stateChanges.next();
147150
}
148151

@@ -235,15 +238,19 @@ export class SafeEditorControlComponent
235238
const controlElement = this.elementRef.nativeElement.querySelector(
236239
'.safe-editor-control'
237240
);
238-
if (!controlElement) return;
241+
if (!controlElement) {
242+
return;
243+
}
239244
controlElement.setAttribute('aria-describedby', ids.join(' '));
240245
}
241246

242247
/**
243248
* Handles mouse click on container
244249
*/
245250
onContainerClick() {
246-
if (this.editor) this.editor.editor.focus();
251+
if (this.editor) {
252+
this.editor.editor.focus();
253+
}
247254
}
248255

249256
/**

libs/safe/src/lib/components/ui/core-grid/map-modal/map-modal.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export class MapModalComponent implements AfterViewInit {
4242

4343
ngAfterViewInit(): void {
4444
const mapComponent = this.mapComponent;
45-
if (!mapComponent) return;
45+
if (!mapComponent) {
46+
return;
47+
}
4648
this.mapLayersService
4749
.createLayerFromDefinition(
4850
{
@@ -54,8 +56,7 @@ export class MapModalComponent implements AfterViewInit {
5456
createdAt: new Date(),
5557
updatedAt: new Date(),
5658
},
57-
mapComponent.mapPopupService,
58-
mapComponent.mapLayersService
59+
mapComponent.injector
5960
)
6061
.then((layer) => {
6162
mapComponent.addLayer(layer);

0 commit comments

Comments
 (0)