diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 44adba00..d3ee975e 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -323,6 +323,7 @@ import { UploadingProcessbarComponent } from './common/uploading-processbar/uplo
import { ExportPortableProjectComponent } from './components/export-portable-project/export-portable-project.component';
import { NodesMenuConfirmationDialogComponent } from './components/project-map/nodes-menu/nodes-menu-confirmation-dialog/nodes-menu-confirmation-dialog.component';
import { ConfirmationDeleteAllProjectsComponent } from './components/projects/confirmation-delete-all-projects/confirmation-delete-all-projects.component';
+import { ProjectMapLockConfirmationDialogComponent } from './components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component';
@NgModule({
declarations: [
@@ -561,6 +562,7 @@ import { ConfirmationDeleteAllProjectsComponent } from './components/projects/co
ExportPortableProjectComponent,
NodesMenuConfirmationDialogComponent,
ConfirmationDeleteAllProjectsComponent,
+ ProjectMapLockConfirmationDialogComponent,
],
imports: [
BrowserModule,
diff --git a/src/app/components/project-map/context-menu/actions/lock-action/lock-action.component.ts b/src/app/components/project-map/context-menu/actions/lock-action/lock-action.component.ts
index 195b7e30..1a7956d6 100644
--- a/src/app/components/project-map/context-menu/actions/lock-action/lock-action.component.ts
+++ b/src/app/components/project-map/context-menu/actions/lock-action/lock-action.component.ts
@@ -3,16 +3,17 @@ import { DrawingsDataSource } from '../../../../../cartography/datasources/drawi
import { NodesDataSource } from '../../../../../cartography/datasources/nodes-datasource';
import { Drawing } from '../../../../../cartography/models/drawing';
import { Node } from '../../../../../cartography/models/node';
-import{ Controller } from '../../../../../models/controller';
+import { Controller } from '../../../../../models/controller';
import { DrawingService } from '../../../../../services/drawing.service';
import { NodeService } from '../../../../../services/node.service';
+import { ProjectService } from '../../../../../services/project.service';
@Component({
selector: 'app-lock-action',
templateUrl: './lock-action.component.html',
})
export class LockActionComponent implements OnChanges {
- @Input() controller:Controller ;
+ @Input() controller: Controller;
@Input() nodes: Node[];
@Input() drawings: Drawing[];
command: string;
@@ -21,7 +22,8 @@ export class LockActionComponent implements OnChanges {
private nodesDataSource: NodesDataSource,
private drawingsDataSource: DrawingsDataSource,
private nodeService: NodeService,
- private drawingService: DrawingService
+ private drawingService: DrawingService,
+ private projectService: ProjectService
) {}
ngOnChanges() {
@@ -34,19 +36,20 @@ export class LockActionComponent implements OnChanges {
}
}
- lock() {
- this.nodes.forEach((node) => {
+ async lock() {
+ await this.nodes.forEach((node) => {
node.locked = !node.locked;
this.nodeService.updateNode(this.controller, node).subscribe((node) => {
this.nodesDataSource.update(node);
});
});
- this.drawings.forEach((drawing) => {
+ await this.drawings.forEach((drawing) => {
drawing.locked = !drawing.locked;
this.drawingService.update(this.controller, drawing).subscribe((drawing) => {
this.drawingsDataSource.update(drawing);
});
});
+ this.projectService.projectUpdateLockIcon()
}
}
diff --git a/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.html b/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.html
new file mode 100644
index 00000000..82b5771c
--- /dev/null
+++ b/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.html
@@ -0,0 +1,14 @@
+
+
+
Confirm {{ confirmActionData.actionType}} All
+
+
+
+
+ Are you sure you want to {{confirmActionData.actionType}} all devices?
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.scss b/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.spec.ts b/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.spec.ts
new file mode 100644
index 00000000..12136226
--- /dev/null
+++ b/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.spec.ts
@@ -0,0 +1,44 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import { MatIconModule } from '@angular/material/icon';
+import { MatMenuModule } from '@angular/material/menu';
+import { MatSnackBarModule } from '@angular/material/snack-bar';
+import { MatToolbarModule } from '@angular/material/toolbar';
+
+import { ProjectMapLockConfirmationDialogComponent } from './project-map-lock-confirmation-dialog.component';
+
+describe('ProjectMapLockConfirmationDialogComponent', () => {
+ let component: ProjectMapLockConfirmationDialogComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports:[
+ MatIconModule,
+ MatToolbarModule,
+ MatMenuModule,
+ MatCheckboxModule,
+ MatDialogModule,
+ MatSnackBarModule,
+ ],
+ providers: [
+
+ { provide: MAT_DIALOG_DATA, useValue: {} },
+ { provide: MatDialogRef, useValue: {} },
+ ],
+ declarations: [ ProjectMapLockConfirmationDialogComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ProjectMapLockConfirmationDialogComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.ts b/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.ts
new file mode 100644
index 00000000..1b8141f8
--- /dev/null
+++ b/src/app/components/project-map/project-map-menu/project-map-lock-confirmation-dialog/project-map-lock-confirmation-dialog.component.ts
@@ -0,0 +1,28 @@
+import { Component, Inject, OnInit } from '@angular/core';
+import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+
+@Component({
+ selector: 'app-project-map-lock-confirmation-dialog',
+ templateUrl: './project-map-lock-confirmation-dialog.component.html',
+ styleUrls: ['./project-map-lock-confirmation-dialog.component.scss']
+})
+export class ProjectMapLockConfirmationDialogComponent implements OnInit {
+ confirmActionData = {
+ actionType: 'Unlock',
+ isAction:false
+ };
+ constructor(
+ @Inject(MAT_DIALOG_DATA) public data: any,
+ public dialogRef: MatDialogRef
+ ) {}
+
+ ngOnInit(): void {
+ this.confirmActionData.actionType = this.data.actionType;
+ }
+
+ confirmAction() {
+ this.confirmActionData.isAction = this.data.actionType == 'Lock'? true : false;
+ this.dialogRef.close(this.confirmActionData);
+ }
+
+}
diff --git a/src/app/components/project-map/project-map-menu/project-map-menu.component.html b/src/app/components/project-map/project-map-menu/project-map-menu.component.html
index 30495dc1..e3b53e86 100644
--- a/src/app/components/project-map/project-map-menu/project-map-menu.component.html
+++ b/src/app/components/project-map/project-map-menu/project-map-menu.component.html
@@ -86,7 +86,7 @@
class="menu-button"
(click)="changeLockValue()"
>
- lock
+ {{lock}}