Finish merging code from master-3.0

This commit is contained in:
grossmj 2022-07-23 10:58:17 +02:00
parent c3bfad647f
commit dc94d22822
5 changed files with 19 additions and 36 deletions

View File

@ -7,8 +7,8 @@ import { MatToolbarModule } from '@angular/material/toolbar';
import { MockedProjectService } from '../../../services/project.service.spec';
import { MockedToasterService } from '../../../services/toaster.service.spec';
import { ProjectService } from '../../../services/project.service';
import { ServerService } from '../../../services/server.service';
import { MockedServerService } from '../../../services/server.service.spec';
import { ControllerService } from '../../../services/controller.service';
import { MockedControllerService } from '../../../services/controller.service.spec';
import { ToasterService } from '../../../services/toaster.service';
import { ConfirmationDeleteAllProjectsComponent } from './confirmation-delete-all-projects.component';
@ -16,7 +16,7 @@ import { ConfirmationDeleteAllProjectsComponent } from './confirmation-delete-al
describe('ConfirmationDeleteAllProjectsComponent', () => {
let component: ConfirmationDeleteAllProjectsComponent;
let fixture: ComponentFixture<ConfirmationDeleteAllProjectsComponent>;
let mockedServerService = new MockedServerService();
let mockedControllerService = new MockedControllerService();
let mockedImageManagerService = new MockedProjectService()
let mockedToasterService = new MockedToasterService()
@ -30,7 +30,7 @@ describe('ConfirmationDeleteAllProjectsComponent', () => {
MatDialogModule,
],
providers: [
{ provide: ServerService, useValue: mockedServerService },
{ provide: ControllerService, useValue: mockedControllerService },
{ provide: ProjectService, useValue: mockedImageManagerService },
{ provide: MAT_DIALOG_DATA, useValue: {} },
{ provide: MatDialogRef, useValue: {} },

View File

@ -34,7 +34,7 @@ export class ConfirmationDeleteAllProjectsComponent implements OnInit {
deleteFile() {
const calls = [];
this.deleteData.deleteFilesPaths.forEach(project => {
calls.push(this.projectService.delete(this.deleteData.server, project.project_id).pipe(catchError(error => of(error))))
calls.push(this.projectService.delete(this.deleteData.controller, project.project_id).pipe(catchError(error => of(error))))
});
Observable.forkJoin(calls).subscribe(responses => {
this.deleteFliesDetails = responses.filter(x => x !== null)

View File

@ -200,7 +200,7 @@ export class ProjectsComponent implements OnInit {
autoFocus: false,
disableClose: true,
data: {
server: this.server,
controller: this.controller,
deleteFilesPaths: this.selection.selected
}
});
@ -251,7 +251,7 @@ exportSelectProject(project: Project){
maxHeight: '850px',
autoFocus: false,
disableClose: true,
data: {serverDetails:this.server,projectDetails:this.project},
data: {controllerDetails:this.controller,projectDetails:this.project},
});
dialogRef.afterClosed().subscribe((isAddes: boolean) => {});
@ -276,8 +276,6 @@ export class ProjectDatabase {
this.dataChange.next(this.data.slice());
}
}
}
export class ProjectDataSource extends DataSource<any> {

View File

@ -19,15 +19,22 @@
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="goToSystemStatus()">
<button mat-menu-item
[disabled]="!controllerId"
[routerLink]="['controller', controllerId, 'systemstatus']">
<mat-icon>info</mat-icon>
<span>System status</span>
</button>
<button mat-menu-item (click)="goToPreferences()">
<button mat-menu-item
[disabled]="!controllerId"
[routerLink]="['controller', controllerId, 'preferences']">
<mat-icon>settings_applications</mat-icon>
<span>Template preferences</span>
</button>
<button mat-menu-item (click)="goToImageManager()">
<button mat-menu-item
[disabled]="!controllerId"
[routerLink]="['controller', controllerId, 'image-manager']">
<mat-icon>collections</mat-icon>
<span>Image manager</span>
</button>

View File

@ -36,7 +36,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
private controllerManagement: ControllerManagementService,
private toasterService: ToasterService,
private progressService: ProgressService,
private router: Router,
public router: Router,
private route: ActivatedRoute,
private controllerService: ControllerService
) {
@ -50,8 +50,6 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
ngOnInit() {
this.checkIfUserIsLoginPage();
this.controller = this.route.snapshot.data['server'];
this.routeSubscription = this.router.events.subscribe((val) => {
if (val instanceof NavigationEnd) this.checkIfUserIsLoginPage();
});
@ -85,7 +83,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
}
checkIfUserIsLoginPage() {
if (this.router.url.includes('login')) {
if (this.router.url.includes("login")) {
this.isLoginPage = true;
} else {
this.isLoginPage = false;
@ -111,26 +109,6 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
.catch((error) => this.toasterService.error('Cannot navigate to the last opened project'));
}
goToPreferences() {
let controllerId = this.router.url.split('/server/')[1].split('/')[0];
this.router
.navigate(['/server', controllerId, 'preferences'])
.catch((error) => this.toasterService.error('Cannot navigate to the preferences'));
}
goToSystemStatus() {
let controllerId = this.router.url.split('/server/')[1].split('/')[0];
this.router
.navigate(['/server', controllerId, 'systemstatus'])
.catch((error) => this.toasterService.error('Cannot navigate to the system status'));
}
goToImageManager() {
let controllerId = this.router.url.split('/server/')[1].split('/')[0];
this.router
.navigate(['/server', controllerId, 'image-manager'])
.catch((error) => this.toasterService.error('Cannot navigate to the system status'));
}
@HostListener('window:beforeunload', ['$event'])
async onBeforeUnload($event) {
if (!this.shouldStopControllersOnClosing) {