mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-31 08:25:35 +00:00
Bottom sheet for imported projects
This commit is contained in:
parent
6cf670d5cf
commit
41c67ae6ec
@ -239,6 +239,7 @@ import { ChooseNameDialogComponent } from './components/projects/choose-name-dia
|
|||||||
import { PacketCaptureService } from './services/packet-capture.service';
|
import { PacketCaptureService } from './services/packet-capture.service';
|
||||||
import { StartCaptureOnStartedLinkActionComponent } from './components/project-map/context-menu/actions/start-capture-on-started-link/start-capture-on-started-link.component';
|
import { StartCaptureOnStartedLinkActionComponent } from './components/project-map/context-menu/actions/start-capture-on-started-link/start-capture-on-started-link.component';
|
||||||
import { LockActionComponent } from './components/project-map/context-menu/actions/lock-action/lock-action.component';
|
import { LockActionComponent } from './components/project-map/context-menu/actions/lock-action/lock-action.component';
|
||||||
|
import { NavigationDialogComponent } from './components/projects/navigation-dialog/navigation-dialog.component';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||||
@ -403,7 +404,8 @@ if (environment.production) {
|
|||||||
QemuImageCreatorComponent,
|
QemuImageCreatorComponent,
|
||||||
ChooseNameDialogComponent,
|
ChooseNameDialogComponent,
|
||||||
StartCaptureOnStartedLinkActionComponent,
|
StartCaptureOnStartedLinkActionComponent,
|
||||||
LockActionComponent
|
LockActionComponent,
|
||||||
|
NavigationDialogComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -521,7 +523,8 @@ if (environment.production) {
|
|||||||
ConfiguratorDialogNatComponent,
|
ConfiguratorDialogNatComponent,
|
||||||
ConfiguratorDialogTracengComponent,
|
ConfiguratorDialogTracengComponent,
|
||||||
QemuImageCreatorComponent,
|
QemuImageCreatorComponent,
|
||||||
ChooseNameDialogComponent
|
ChooseNameDialogComponent,
|
||||||
|
NavigationDialogComponent
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
@ -53,7 +53,7 @@ import { MapLinkNodeToLinkNodeConverter } from '../../cartography/converters/map
|
|||||||
import { ProjectMapMenuComponent } from './project-map-menu/project-map-menu.component';
|
import { ProjectMapMenuComponent } from './project-map-menu/project-map-menu.component';
|
||||||
import { ToasterService } from '../../services/toaster.service';
|
import { ToasterService } from '../../services/toaster.service';
|
||||||
import { ImportProjectDialogComponent } from '../projects/import-project-dialog/import-project-dialog.component';
|
import { ImportProjectDialogComponent } from '../projects/import-project-dialog/import-project-dialog.component';
|
||||||
import { MatDialog } from '@angular/material';
|
import { MatDialog, MatBottomSheet } from '@angular/material';
|
||||||
import { AddBlankProjectDialogComponent } from '../projects/add-blank-project-dialog/add-blank-project-dialog.component';
|
import { AddBlankProjectDialogComponent } from '../projects/add-blank-project-dialog/add-blank-project-dialog.component';
|
||||||
import { SaveProjectDialogComponent } from '../projects/save-project-dialog/save-project-dialog.component';
|
import { SaveProjectDialogComponent } from '../projects/save-project-dialog/save-project-dialog.component';
|
||||||
import { MapNodesDataSource, MapLinksDataSource, MapDrawingsDataSource, MapSymbolsDataSource, Indexed } from '../../cartography/datasources/map-datasource';
|
import { MapNodesDataSource, MapLinksDataSource, MapDrawingsDataSource, MapSymbolsDataSource, Indexed } from '../../cartography/datasources/map-datasource';
|
||||||
@ -61,6 +61,7 @@ import { MapSettingsService } from '../../services/mapsettings.service';
|
|||||||
import { EditProjectDialogComponent } from '../projects/edit-project-dialog/edit-project-dialog.component';
|
import { EditProjectDialogComponent } from '../projects/edit-project-dialog/edit-project-dialog.component';
|
||||||
import { EthernetLinkWidget } from '../../cartography/widgets/links/ethernet-link';
|
import { EthernetLinkWidget } from '../../cartography/widgets/links/ethernet-link';
|
||||||
import { SerialLinkWidget } from '../../cartography/widgets/links/serial-link';
|
import { SerialLinkWidget } from '../../cartography/widgets/links/serial-link';
|
||||||
|
import { NavigationDialogComponent } from '../projects/navigation-dialog/navigation-dialog.component';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -137,7 +138,8 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
private mapSymbolsDataSource: MapSymbolsDataSource,
|
private mapSymbolsDataSource: MapSymbolsDataSource,
|
||||||
private mapSettingsService: MapSettingsService,
|
private mapSettingsService: MapSettingsService,
|
||||||
private ethernetLinkWidget: EthernetLinkWidget,
|
private ethernetLinkWidget: EthernetLinkWidget,
|
||||||
private serialLinkWidget: SerialLinkWidget
|
private serialLinkWidget: SerialLinkWidget,
|
||||||
|
private bottomSheet: MatBottomSheet
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -510,8 +512,16 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
dialogRef.afterClosed().subscribe(() => {
|
dialogRef.afterClosed().subscribe(() => {
|
||||||
subscription.unsubscribe();
|
subscription.unsubscribe();
|
||||||
if (uuid) {
|
if (uuid) {
|
||||||
this.projectService.open(this.server, uuid).subscribe(() => {
|
this.bottomSheet.open(NavigationDialogComponent);
|
||||||
this.router.navigate(['/server', this.server.id, 'project', uuid]);
|
let bottomSheetRef = this.bottomSheet._openedBottomSheetRef;
|
||||||
|
bottomSheetRef.instance.projectMessage = 'imported project';
|
||||||
|
|
||||||
|
const bottomSheetSubscription = bottomSheetRef.afterDismissed().subscribe((result: boolean) => {
|
||||||
|
if (result) {
|
||||||
|
this.projectService.open(this.server, uuid).subscribe(() => {
|
||||||
|
this.router.navigate(['/server', this.server.id, 'project', uuid]);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
<div class="dialogWrapper">
|
||||||
|
<div class="title"> Do you want to navigate to {{projectMessage}}?</div>
|
||||||
|
<div>
|
||||||
|
<button mat-button (click)="onNoClick()">No</button>
|
||||||
|
<button mat-button (click)="onYesClick()">Yes</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,17 @@
|
|||||||
|
.dialogWrapper {
|
||||||
|
background-color: #263238;
|
||||||
|
padding: 10px 20px;
|
||||||
|
margin-bottom: -8px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-bottom-sheet-container {
|
||||||
|
background: #263238;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin-right: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { MatDialogRef, MAT_DIALOG_DATA, MatBottomSheetRef } from '@angular/material';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-navigation-dialog',
|
||||||
|
templateUrl: 'navigation-dialog.component.html',
|
||||||
|
styleUrls: ['navigation-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class NavigationDialogComponent implements OnInit {
|
||||||
|
projectMessage: string = '';
|
||||||
|
|
||||||
|
constructor(private bottomSheetRef: MatBottomSheetRef<NavigationDialogComponent>) {}
|
||||||
|
|
||||||
|
ngOnInit() {}
|
||||||
|
|
||||||
|
onNoClick(): void {
|
||||||
|
this.bottomSheetRef.dismiss(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
onYesClick(): void {
|
||||||
|
this.bottomSheetRef.dismiss(true);
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { ActivatedRoute, ParamMap } from '@angular/router';
|
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||||
import { MatSort, MatSortable, MatDialog } from '@angular/material';
|
import { MatSort, MatSortable, MatDialog, MatBottomSheet } from '@angular/material';
|
||||||
|
|
||||||
import { DataSource } from '@angular/cdk/collections';
|
import { DataSource } from '@angular/cdk/collections';
|
||||||
|
|
||||||
@ -17,6 +17,7 @@ import { ProgressService } from '../../common/progress/progress.service';
|
|||||||
import { ImportProjectDialogComponent } from './import-project-dialog/import-project-dialog.component';
|
import { ImportProjectDialogComponent } from './import-project-dialog/import-project-dialog.component';
|
||||||
import { AddBlankProjectDialogComponent } from './add-blank-project-dialog/add-blank-project-dialog.component';
|
import { AddBlankProjectDialogComponent } from './add-blank-project-dialog/add-blank-project-dialog.component';
|
||||||
import { ChooseNameDialogComponent } from './choose-name-dialog/choose-name-dialog.component';
|
import { ChooseNameDialogComponent } from './choose-name-dialog/choose-name-dialog.component';
|
||||||
|
import { NavigationDialogComponent } from './navigation-dialog/navigation-dialog.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-projects',
|
selector: 'app-projects',
|
||||||
@ -40,7 +41,9 @@ export class ProjectsComponent implements OnInit {
|
|||||||
private projectService: ProjectService,
|
private projectService: ProjectService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
private progressService: ProgressService,
|
private progressService: ProgressService,
|
||||||
public dialog: MatDialog
|
public dialog: MatDialog,
|
||||||
|
private router: Router,
|
||||||
|
private bottomSheet: MatBottomSheet
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -133,15 +136,33 @@ export class ProjectsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
importProject() {
|
importProject() {
|
||||||
|
let uuid: string = '';
|
||||||
const dialogRef = this.dialog.open(ImportProjectDialogComponent, {
|
const dialogRef = this.dialog.open(ImportProjectDialogComponent, {
|
||||||
width: '400px',
|
width: '400px',
|
||||||
autoFocus: false
|
autoFocus: false
|
||||||
});
|
});
|
||||||
let instance = dialogRef.componentInstance;
|
let instance = dialogRef.componentInstance;
|
||||||
instance.server = this.server;
|
instance.server = this.server;
|
||||||
|
const subscription = dialogRef.componentInstance.onImportProject.subscribe((projectId: string) => {
|
||||||
|
uuid = projectId;
|
||||||
|
});
|
||||||
|
|
||||||
dialogRef.afterClosed().subscribe(() => {
|
dialogRef.afterClosed().subscribe(() => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
subscription.unsubscribe();
|
||||||
|
if (uuid) {
|
||||||
|
this.bottomSheet.open(NavigationDialogComponent);
|
||||||
|
let bottomSheetRef = this.bottomSheet._openedBottomSheetRef;
|
||||||
|
bottomSheetRef.instance.projectMessage = 'imported project';
|
||||||
|
|
||||||
|
const bottomSheetSubscription = bottomSheetRef.afterDismissed().subscribe((result: boolean) => {
|
||||||
|
if (result) {
|
||||||
|
this.projectService.open(this.server, uuid).subscribe(() => {
|
||||||
|
this.router.navigate(['/server', this.server.id, 'project', uuid]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ import {
|
|||||||
MatRadioModule,
|
MatRadioModule,
|
||||||
MatGridListModule,
|
MatGridListModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
MatTreeModule
|
MatTreeModule,
|
||||||
|
MatBottomSheetModule
|
||||||
} from '@angular/material';
|
} from '@angular/material';
|
||||||
|
|
||||||
export const MATERIAL_IMPORTS = [
|
export const MATERIAL_IMPORTS = [
|
||||||
@ -47,5 +48,6 @@ export const MATERIAL_IMPORTS = [
|
|||||||
MatRadioModule,
|
MatRadioModule,
|
||||||
MatGridListModule,
|
MatGridListModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
MatTreeModule
|
MatTreeModule,
|
||||||
|
MatBottomSheetModule
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user