Review fixes

This commit is contained in:
Piotr Pekala 2019-02-20 04:41:32 -08:00
parent 31f22728a9
commit 369743e2ea
40 changed files with 164 additions and 77 deletions

View File

@ -162,6 +162,7 @@ import { CopyDockerTemplateComponent } from './components/preferences/docker/cop
import { EmptyTemplatesListComponent } from './components/preferences/common/empty-templates-list/empty-templates-list.component';
import { SymbolsMenuComponent } from './components/preferences/common/symbols-menu/symbols-menu.component';
import { SearchFilter } from './filters/searchFilter.pipe';
import { RecentlyOpenedProjectService } from './services/recentlyOpenedProject.service';
if (environment.production) {
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
@ -330,7 +331,8 @@ if (environment.production) {
DockerService,
DockerConfigurationService,
IouService,
IouConfigurationService
IouConfigurationService,
RecentlyOpenedProjectService
],
entryComponents: [
AddServerDialogComponent,

View File

@ -3,7 +3,7 @@
<h1>Installed software</h1>
</div>
<div class="default-content">
<div class="example-container mat-elevation-z8">
<div class="container mat-elevation-z8">
<mat-table #table [dataSource]="dataSource">
<ng-container matColumnDef="name">

View File

@ -6,7 +6,7 @@
</div>
</div>
<div class="default-content">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list>
<mat-list-item routerLink="/server/{{serverId}}/preferences/builtin/ethernet-hubs">
Ethernet hubs

View File

@ -8,13 +8,18 @@
</div>
<app-empty-templates-list *ngIf="!cloudNodesTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="cloudNodesTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of cloudNodesTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button class="delete-button" mat-icon-button (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon>
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon><span>Delete</span>
</button>
</mat-menu>
</div>
</mat-nav-list>
</div>

View File

@ -32,7 +32,6 @@ export class CloudNodesTemplatesComponent implements OnInit {
}
getTemplates() {
this.cloudNodesTemplates = [];
this.builtInTemplatesService.getTemplates(this.server).subscribe((cloudNodesTemplates: CloudTemplate[]) => {
this.cloudNodesTemplates = cloudNodesTemplates.filter((elem) => elem.template_type === "cloud" && !elem.builtin);
});

View File

@ -8,13 +8,18 @@
</div>
<app-empty-templates-list *ngIf="!ethernetHubsTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="ethernetHubsTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of ethernetHubsTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button class="delete-button" mat-icon-button (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon>
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon><span>Delete</span>
</button>
</mat-menu>
</div>
</mat-nav-list>
</div>

View File

@ -32,7 +32,6 @@ export class EthernetHubsTemplatesComponent implements OnInit {
}
getTemplates() {
this.ethernetHubsTemplates = [];
this.builtInTemplatesService.getTemplates(this.server).subscribe((ethernetHubsTemplates: EthernetHubTemplate[]) => {
this.ethernetHubsTemplates = ethernetHubsTemplates.filter((elem) => elem.template_type === "ethernet_hub" && !elem.builtin);
});

View File

@ -8,13 +8,18 @@
</div>
<app-empty-templates-list *ngIf="!ethernetSwitchesTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="ethernetSwitchesTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of ethernetSwitchesTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button class="delete-button" mat-icon-button (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon>
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon><span>Delete</span>
</button>
</mat-menu>
</div>
</mat-nav-list>
</div>

View File

@ -32,7 +32,6 @@ export class EthernetSwitchesTemplatesComponent implements OnInit {
}
getTemplates() {
this.ethernetSwitchesTemplates = [];
this.builtInTemplatesService.getTemplates(this.server).subscribe((ethernetSwitchesTemplates: EthernetSwitchTemplate[]) => {
this.ethernetSwitchesTemplates = ethernetSwitchesTemplates.filter((elem) => elem.template_type === "ethernet_switch" && !elem.builtin);
});

View File

@ -1,9 +1,15 @@
<span>Are you sure you want to delete template {{templateName}}?</span>
<div mat-dialog-actions>
<button mat-button class="cancelButton" (click)="onNoClick()" color="accent">
No
</button>
<button mat-button class="confirmButton" (click)="onYesClick()" tabindex="2" mat-raised-button color="primary">
Yes
</button>
<div class="dialogcontainer">
<h1 mat-dialog-title>Delete template</h1>
<div mat-dialog-content>Are you sure you want to delete template {{templateName}}?</div>
<div class="spacer"></div>
<div mat-dialog-actions>
<button mat-button class="cancelButton" (click)="onNoClick()" color="accent">
No
</button>
<button mat-button class="confirmButton" (click)="onYesClick()" tabindex="2" mat-raised-button color="primary">
Yes
</button>
</div>
</div>

View File

@ -0,0 +1,9 @@
.dialogcontainer {
height: 100%;
display: flex;
flex-direction: column;
}
.spacer {
flex-grow: 1;
}

View File

@ -23,7 +23,7 @@ export class DeleteTemplateComponent {
deleteItem(templateName, templateId) {
const dialogRef = this.dialog.open(DeleteConfirmationDialogComponent, {
width: '300px',
height: '150px',
height: '250px',
data: {
templateName: templateName
}

View File

@ -1,3 +1,7 @@
<h6 class="header">
{{emptyTemplatesListMessage}}
</h6>
<div class="default-content">
<mat-card class="matCard">
<h6 class="header">
{{emptyTemplatesListMessage}}
</h6>
</mat-card>
</div>

View File

@ -1,3 +1,4 @@
.header {
text-align: center;
color: darkgray;
}

View File

@ -1,4 +1,4 @@
import { Component } from "@angular/core";
import { Component, Input } from "@angular/core";
@Component({
@ -7,5 +7,12 @@ import { Component } from "@angular/core";
styleUrls: ['./empty-templates-list.component.scss']
})
export class EmptyTemplatesListComponent {
@Input() textMessage: string;
emptyTemplatesListMessage: string = 'Empty templates list';
constructor(){
if (this.textMessage) {
this.emptyTemplatesListMessage = this.textMessage;
}
}
}

View File

@ -8,11 +8,11 @@
</div>
<app-empty-templates-list *ngIf="!dockerTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="dockerTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of dockerTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button mat-icon-button class="menu-button" [matMenuTriggerFor]="menu">
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">

View File

@ -33,13 +33,8 @@ export class DockerTemplatesComponent implements OnInit {
}
getTemplates() {
this.dockerTemplates = [];
this.dockerService.getTemplates(this.server).subscribe((dockerTemplates: DockerTemplate[]) => {
dockerTemplates.forEach((template) => {
if ((template.template_type === 'docker') && !template.builtin) {
this.dockerTemplates.push(template);
}
});
this.dockerTemplates = dockerTemplates.filter((elem) => elem.template_type === 'docker' && !elem.builtin);
});
}

View File

@ -8,11 +8,11 @@
</div>
<app-empty-templates-list *ngIf="!iosTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="iosTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of iosTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button mat-icon-button class="menu-button" [matMenuTriggerFor]="menu">
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">

View File

@ -35,7 +35,7 @@ export class IosTemplatesComponent implements OnInit {
getTemplates() {
this.iosService.getTemplates(this.server).subscribe((templates: IosTemplate[]) => {
this.iosTemplates = templates.filter((elem) => elem.template_type === 'dynamips');
this.iosTemplates = templates.filter((elem) => elem.template_type === 'dynamips' && !elem.builtin);
});
}

View File

@ -8,11 +8,11 @@
</div>
<app-empty-templates-list *ngIf="!iouTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="iouTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of iouTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button mat-icon-button class="menu-button" [matMenuTriggerFor]="menu">
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">

View File

@ -33,13 +33,8 @@ export class IouTemplatesComponent implements OnInit {
}
getTemplates() {
this.iouTemplates = [];
this.iouService.getTemplates(this.server).subscribe((iouTemplates: IouTemplate[]) => {
iouTemplates.forEach((template) => {
if ((template.template_type === 'iou') && !template.builtin) {
this.iouTemplates.push(template);
}
});
this.iouTemplates = iouTemplates.filter((elem) => elem.template_type === 'iou' && !elem.builtin);
});
}

View File

@ -5,7 +5,7 @@
</div>
</div>
<div class="default-content">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list>
<mat-list-item routerLink="/server/{{serverId}}/preferences/builtin">
Built-in

View File

@ -1,3 +1,8 @@
.listcontainer {
padding-left: 0px!important;
padding-right: 0px!important;
}
.top-button {
height: 36px;
margin-top: 22px
@ -50,7 +55,7 @@
}
.template-name {
width: 90%;
width: 95%;
}
.delete-button {
@ -59,7 +64,8 @@
}
.menu-button {
width: 10%;
width: 5%;
outline: none!important;
}
th {

View File

@ -8,11 +8,11 @@
</div>
<app-empty-templates-list *ngIf="!qemuTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="qemuTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of qemuTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button mat-icon-button class="menu-button" [matMenuTriggerFor]="menu">
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">

View File

@ -34,7 +34,7 @@ export class QemuVmTemplatesComponent implements OnInit {
getTemplates() {
this.qemuService.getTemplates(this.server).subscribe((qemuTemplates: QemuTemplate[]) => {
this.qemuTemplates = qemuTemplates.filter((elem) => elem.template_type === 'dynamips');
this.qemuTemplates = qemuTemplates.filter((elem) => elem.template_type === 'qemu' && !elem.builtin);
});
}

View File

@ -8,13 +8,18 @@
</div>
<app-empty-templates-list *ngIf="!virtualBoxTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="virtualBoxTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of virtualBoxTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button class="delete-button" mat-icon-button (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon>
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon><span>Delete</span>
</button>
</mat-menu>
</div>
</mat-nav-list>
</div>

View File

@ -34,7 +34,7 @@ export class VirtualBoxTemplatesComponent implements OnInit {
getTemplates(){
this.virtualBoxService.getTemplates(this.server).subscribe((virtualBoxTemplates: VirtualBoxTemplate[]) => {
this.virtualBoxTemplates = virtualBoxTemplates.filter((elem) => elem.template_type === 'virtualbox');
this.virtualBoxTemplates = virtualBoxTemplates.filter((elem) => elem.template_type === 'virtualbox' && !elem.builtin);
});
}

View File

@ -8,13 +8,18 @@
</div>
<app-empty-templates-list *ngIf="!vmwareTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="vmwareTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of vmwareTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button class="delete-button" mat-icon-button (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon>
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon><span>Delete</span>
</button>
</mat-menu>
</div>
</mat-nav-list>
</div>

View File

@ -32,13 +32,8 @@ export class VmwareTemplatesComponent implements OnInit {
}
getTemplates() {
this.vmwareTemplates = [];
this.vmwareService.getTemplates(this.server).subscribe((vpcsTemplates: VmwareTemplate[]) => {
vpcsTemplates.forEach((template) => {
if ((template.template_type === 'vmware') && !template.builtin) {
this.vmwareTemplates.push(template);
}
});
this.vmwareService.getTemplates(this.server).subscribe((vmwareTemplates: VmwareTemplate[]) => {
this.vmwareTemplates = vmwareTemplates.filter((elem) => elem.template_type === 'vmware' && !elem.builtin);
});
}

View File

@ -8,13 +8,18 @@
</div>
<app-empty-templates-list *ngIf="!vpcsTemplates.length"></app-empty-templates-list>
<div class="default-content" *ngIf="vpcsTemplates.length">
<div class="container mat-elevation-z8">
<div class="listcontainer mat-elevation-z8">
<mat-nav-list *ngIf="server">
<div class="list-item" *ngFor='let template of vpcsTemplates'>
<mat-list-item class="template-name" routerLink="{{template.template_id}}">{{template.name}}</mat-list-item>
<button class="delete-button" mat-icon-button (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon>
<button mat-button class="menu-button" [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="deleteTemplate(template)">
<mat-icon>delete</mat-icon><span>Delete</span>
</button>
</mat-menu>
</div>
</mat-nav-list>
</div>

View File

@ -33,7 +33,7 @@ export class VpcsTemplatesComponent implements OnInit {
getTemplates() {
this.vpcsService.getTemplates(this.server).subscribe((vpcsTemplates: VpcsTemplate[]) => {
this.vpcsTemplates = vpcsTemplates.filter((elem) => elem.template_type === 'vpcs');
this.vpcsTemplates = vpcsTemplates.filter((elem) => elem.template_type === 'vpcs' && !elem.builtin);
});
}

View File

@ -39,6 +39,7 @@ import { MapLabel } from '../../cartography/models/map/map-label';
import { Label } from '../../cartography/models/label';
import { MapNode } from '../../cartography/models/map/map-node';
import { MapLabelToLabelConverter } from '../../cartography/converters/map/map-label-to-label-converter';
import { RecentlyOpenedProjectService } from '../../services/recentlyOpenedProject.service';
@Component({
@ -101,7 +102,8 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
private settingsService: SettingsService,
private toolsService: ToolsService,
private selectionManager: SelectionManager,
private selectionTool: SelectionTool
private selectionTool: SelectionTool,
private recentlyOpenedProjectService: RecentlyOpenedProjectService
) {}
ngOnInit() {
@ -123,6 +125,9 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}),
mergeMap((project: Project) => {
this.project = project;
this.recentlyOpenedProjectService.setServerId(this.server.id.toString());
this.recentlyOpenedProjectService.setProjectId(this.project.project_id);
if (this.project.status === 'opened') {
return new Observable<Project>(observer => {

View File

@ -25,7 +25,7 @@
</div>
</div>
<div class="default-content">
<div class="container mat-elevation-z8">
<div class="mat-elevation-z8">
<mat-table #table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header> Name </mat-header-cell>

View File

@ -0,0 +1,3 @@
.buttons-bar {
padding-top: 22px;
}

View File

@ -3,7 +3,7 @@
<div class="default-content">
<app-server-discovery></app-server-discovery>
<div class="container mat-elevation-z8">
<div class="mat-elevation-z8">
<mat-table #table [dataSource]="dataSource">
<ng-container matColumnDef="id">
<mat-header-cell *matHeaderCellDef> ID </mat-header-cell>

View File

@ -1,7 +1,7 @@
<div class="content">
<div class="default-header"><h1>Settings</h1></div>
<div class="default-content">
<div class="example-container mat-elevation-z8">
<div class="container mat-elevation-z8">
<mat-accordion>
<mat-expansion-panel [expanded]="true">
<mat-expansion-panel-header>

View File

@ -4,6 +4,8 @@
<button mat-button routerLink="/servers">Servers</button>
<button *ngIf="recentlyOpenedProjectId && recentlyOpenedServerId" mat-button routerLink="/server/{{recentlyOpenedServerId}}/project/{{recentlyOpenedProjectId}}">Back to project</button>
<span class="fill-space"></span>
<button mat-button [matMenuTriggerFor]="menu" >

View File

@ -1,5 +1,6 @@
import { ElectronService } from 'ngx-electron';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { RecentlyOpenedProjectService } from '../../services/recentlyOpenedProject.service';
@Component({
selector: 'app-default-layout',
@ -10,12 +11,18 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
export class DefaultLayoutComponent implements OnInit {
public isInstalledSoftwareAvailable = false;
recentlyOpenedServerId : string;
recentlyOpenedProjectId : string;
constructor(
private electronService: ElectronService
private electronService: ElectronService,
private recentlyOpenedProjectService: RecentlyOpenedProjectService
) {}
ngOnInit() {
this.isInstalledSoftwareAvailable = this.electronService.isElectronApp;
}
this.recentlyOpenedServerId = this.recentlyOpenedProjectService.getServerId();
this.recentlyOpenedProjectId = this.recentlyOpenedProjectService.getProjectId();
}
}

View File

@ -0,0 +1,23 @@
import { Injectable } from '@angular/core';
@Injectable()
export class RecentlyOpenedProjectService {
private serverId: string;
private projectId: string;
setServerId(serverId: string) {
this.serverId = serverId;
}
setProjectId(projectId: string) {
this.projectId = projectId;
}
getServerId() : string {
return this.serverId;
}
getProjectId() : string {
return this.projectId;
}
}