mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-09 20:12:53 +00:00
Code cleaned up
This commit is contained in:
parent
b515f53b24
commit
37aa6191ab
@ -188,7 +188,7 @@ import { NodeCreatedLabelStylesFixer } from './components/project-map/helpers/no
|
|||||||
import { NonNegativeValidator } from './validators/non-negative-validator';
|
import { NonNegativeValidator } from './validators/non-negative-validator';
|
||||||
import { RotationValidator } from './validators/rotation-validator';
|
import { RotationValidator } from './validators/rotation-validator';
|
||||||
import { DuplicateActionComponent } from './components/project-map/context-menu/actions/duplicate-action/duplicate-action.component';
|
import { DuplicateActionComponent } from './components/project-map/context-menu/actions/duplicate-action/duplicate-action.component';
|
||||||
import { MapSettingService } from './services/mapsettings.service';
|
import { MapSettingsService } from './services/mapsettings.service';
|
||||||
import { ProjectMapMenuComponent } from './components/project-map/project-map-menu/project-map-menu.component';
|
import { ProjectMapMenuComponent } from './components/project-map/project-map-menu/project-map-menu.component';
|
||||||
import { HelpComponent } from './components/help/help.component';
|
import { HelpComponent } from './components/help/help.component';
|
||||||
import { TopologySummaryComponent } from './components/topology-summary/topology-summary.component';
|
import { TopologySummaryComponent } from './components/topology-summary/topology-summary.component';
|
||||||
@ -397,7 +397,7 @@ if (environment.production) {
|
|||||||
NodeCreatedLabelStylesFixer,
|
NodeCreatedLabelStylesFixer,
|
||||||
NonNegativeValidator,
|
NonNegativeValidator,
|
||||||
RotationValidator,
|
RotationValidator,
|
||||||
MapSettingService,
|
MapSettingsService,
|
||||||
InfoService
|
InfoService
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
|
@ -21,7 +21,7 @@ import { MapLabel } from '../../models/map/map-label';
|
|||||||
import { MapLinkNode } from '../../models/map/map-link-node';
|
import { MapLinkNode } from '../../models/map/map-link-node';
|
||||||
import { select } from 'd3-selection';
|
import { select } from 'd3-selection';
|
||||||
import { MapLink } from '../../models/map/map-link';
|
import { MapLink } from '../../models/map/map-link';
|
||||||
import { MapSettingService } from '../../../services/mapsettings.service';
|
import { MapSettingsService } from '../../../services/mapsettings.service';
|
||||||
|
|
||||||
describe('DraggableSelectionComponent', () => {
|
describe('DraggableSelectionComponent', () => {
|
||||||
let component: DraggableSelectionComponent;
|
let component: DraggableSelectionComponent;
|
||||||
@ -123,7 +123,7 @@ describe('DraggableSelectionComponent', () => {
|
|||||||
{ provide: DrawingsEventSource, useValue: drawingsEventSourceStub },
|
{ provide: DrawingsEventSource, useValue: drawingsEventSourceStub },
|
||||||
{ provide: GraphDataManager, useValue: mockedGraphDataManager },
|
{ provide: GraphDataManager, useValue: mockedGraphDataManager },
|
||||||
{ provide: LinksEventSource, useValue: linksEventSourceStub },
|
{ provide: LinksEventSource, useValue: linksEventSourceStub },
|
||||||
{ provide: MapSettingService, useClass: MapSettingService }
|
{ provide: MapSettingsService, useClass: MapSettingsService }
|
||||||
],
|
],
|
||||||
declarations: [DraggableSelectionComponent]
|
declarations: [DraggableSelectionComponent]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@ -17,7 +17,7 @@ import { LabelWidget } from '../../widgets/label';
|
|||||||
import { InterfaceLabelWidget } from '../../widgets/interface-label';
|
import { InterfaceLabelWidget } from '../../widgets/interface-label';
|
||||||
import { MapLinkNode } from '../../models/map/map-link-node';
|
import { MapLinkNode } from '../../models/map/map-link-node';
|
||||||
import { LinksEventSource } from '../../events/links-event-source';
|
import { LinksEventSource } from '../../events/links-event-source';
|
||||||
import { MapSettingService } from '../../../services/mapsettings.service';
|
import { MapSettingsService } from '../../../services/mapsettings.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-draggable-selection',
|
selector: 'app-draggable-selection',
|
||||||
@ -44,7 +44,7 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
|||||||
private drawingsEventSource: DrawingsEventSource,
|
private drawingsEventSource: DrawingsEventSource,
|
||||||
private graphDataManager: GraphDataManager,
|
private graphDataManager: GraphDataManager,
|
||||||
private linksEventSource: LinksEventSource,
|
private linksEventSource: LinksEventSource,
|
||||||
private mapSettingsService: MapSettingService
|
private mapSettingsService: MapSettingsService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ProjectMapMenuComponent } from "./project-map-menu.component";
|
import { ProjectMapMenuComponent } from "./project-map-menu.component";
|
||||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||||
import { MockedDrawingService } from '../project-map.component.spec';
|
import { MockedDrawingService } from '../project-map.component.spec';
|
||||||
import { MapSettingService } from '../../../services/mapsettings.service';
|
import { MapSettingsService } from '../../../services/mapsettings.service';
|
||||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
@ -15,7 +15,7 @@ describe('ProjectMapMenuComponent', () => {
|
|||||||
let component: ProjectMapMenuComponent;
|
let component: ProjectMapMenuComponent;
|
||||||
let fixture: ComponentFixture<ProjectMapMenuComponent>;
|
let fixture: ComponentFixture<ProjectMapMenuComponent>;
|
||||||
let drawingService = new MockedDrawingService();
|
let drawingService = new MockedDrawingService();
|
||||||
let mapSettingService = new MapSettingService();
|
let mapSettingService = new MapSettingsService();
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@ -23,7 +23,7 @@ describe('ProjectMapMenuComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{ provide: DrawingService, useValue: drawingService },
|
{ provide: DrawingService, useValue: drawingService },
|
||||||
{ provide: ToolsService },
|
{ provide: ToolsService },
|
||||||
{ provide: MapSettingService, useValue: mapSettingService }
|
{ provide: MapSettingsService, useValue: mapSettingService }
|
||||||
],
|
],
|
||||||
declarations: [ProjectMapMenuComponent, D3MapComponent, ...ANGULAR_MAP_DECLARATIONS],
|
declarations: [ProjectMapMenuComponent, D3MapComponent, ...ANGULAR_MAP_DECLARATIONS],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy, Input } from '@angular/core';
|
|||||||
import { Project } from '../../../models/project';
|
import { Project } from '../../../models/project';
|
||||||
import { Server } from '../../../models/server';
|
import { Server } from '../../../models/server';
|
||||||
import { ToolsService } from '../../../services/tools.service';
|
import { ToolsService } from '../../../services/tools.service';
|
||||||
import { MapSettingService } from '../../../services/mapsettings.service';
|
import { MapSettingsService } from '../../../services/mapsettings.service';
|
||||||
import { DrawingService } from '../../../services/drawing.service';
|
import { DrawingService } from '../../../services/drawing.service';
|
||||||
|
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ export class ProjectMapMenuComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private toolsService: ToolsService,
|
private toolsService: ToolsService,
|
||||||
private mapSettingsService: MapSettingService,
|
private mapSettingsService: MapSettingsService,
|
||||||
private drawingService: DrawingService
|
private drawingService: DrawingService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ import { NodeCreatedLabelStylesFixer } from './helpers/node-created-label-styles
|
|||||||
import { LabelWidget } from '../../cartography/widgets/label';
|
import { LabelWidget } from '../../cartography/widgets/label';
|
||||||
import { InterfaceLabelWidget } from '../../cartography/widgets/interface-label';
|
import { InterfaceLabelWidget } from '../../cartography/widgets/interface-label';
|
||||||
import { MapLinkNodeToLinkNodeConverter } from '../../cartography/converters/map/map-link-node-to-link-node-converter';
|
import { MapLinkNodeToLinkNodeConverter } from '../../cartography/converters/map/map-link-node-to-link-node-converter';
|
||||||
import { MapSettingService } from '../../services/mapsettings.service';
|
import { MapSettingsService } from '../../services/mapsettings.service';
|
||||||
import { ProjectMapMenuComponent } from './project-map-menu/project-map-menu.component';
|
import { ProjectMapMenuComponent } from './project-map-menu/project-map-menu.component';
|
||||||
import { MockedToasterService } from '../../services/toaster.service.spec';
|
import { MockedToasterService } from '../../services/toaster.service.spec';
|
||||||
import { ToasterService } from '../../services/toaster.service';
|
import { ToasterService } from '../../services/toaster.service';
|
||||||
@ -261,7 +261,8 @@ describe('ProjectMapComponent', () => {
|
|||||||
{ provide: MapNodesDataSource, useClass: MapNodesDataSource },
|
{ provide: MapNodesDataSource, useClass: MapNodesDataSource },
|
||||||
{ provide: MapLinksDataSource, useClass: LinksDataSource },
|
{ provide: MapLinksDataSource, useClass: LinksDataSource },
|
||||||
{ provide: MapDrawingsDataSource, useClass: MapDrawingsDataSource },
|
{ provide: MapDrawingsDataSource, useClass: MapDrawingsDataSource },
|
||||||
{ provide: MapSymbolsDataSource, useClass: MapSymbolsDataSource }
|
{ provide: MapSymbolsDataSource, useClass: MapSymbolsDataSource },
|
||||||
|
{ provide: MapSettingsService, useClass: MapSettingsService }
|
||||||
],
|
],
|
||||||
declarations: [ProjectMapComponent, ProjectMapMenuComponent, D3MapComponent, ...ANGULAR_MAP_DECLARATIONS],
|
declarations: [ProjectMapComponent, ProjectMapMenuComponent, D3MapComponent, ...ANGULAR_MAP_DECLARATIONS],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
@ -52,6 +52,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 { MapNodesDataSource, MapLinksDataSource, MapDrawingsDataSource, MapSymbolsDataSource, Indexed } from '../../cartography/datasources/map-datasource';
|
import { MapNodesDataSource, MapLinksDataSource, MapDrawingsDataSource, MapSymbolsDataSource, Indexed } from '../../cartography/datasources/map-datasource';
|
||||||
|
import { MapSettingsService } from '../../services/mapsettings.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -122,11 +123,13 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
private mapNodesDataSource: MapNodesDataSource,
|
private mapNodesDataSource: MapNodesDataSource,
|
||||||
private mapLinksDataSource: MapLinksDataSource,
|
private mapLinksDataSource: MapLinksDataSource,
|
||||||
private mapDrawingsDataSource: MapDrawingsDataSource,
|
private mapDrawingsDataSource: MapDrawingsDataSource,
|
||||||
private mapSymbolsDataSource: MapSymbolsDataSource
|
private mapSymbolsDataSource: MapSymbolsDataSource,
|
||||||
|
private mapSettingsService: MapSettingsService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.settings = this.settingsService.getAll();
|
this.settings = this.settingsService.getAll();
|
||||||
|
this.isTopologySummaryVisible = this.mapSettingsService.isTopologySummaryVisible;
|
||||||
|
|
||||||
this.progressService.activate();
|
this.progressService.activate();
|
||||||
const routeSub = this.route.paramMap.subscribe((paramMap: ParamMap) => {
|
const routeSub = this.route.paramMap.subscribe((paramMap: ParamMap) => {
|
||||||
@ -397,6 +400,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
public toggleShowTopologySummary(visible: boolean) {
|
public toggleShowTopologySummary(visible: boolean) {
|
||||||
this.isTopologySummaryVisible = visible;
|
this.isTopologySummaryVisible = visible;
|
||||||
|
this.mapSettingsService.toggleTopologySummary(this.isTopologySummaryVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public hideMenu() {
|
public hideMenu() {
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="summarySorting">
|
<div class="summarySorting">
|
||||||
Sorting <br/>
|
Sorting <br/>
|
||||||
<div class="radio-group">
|
<div class="radio-group-wrapper">
|
||||||
<mat-radio-group aria-label="Sorting">
|
<mat-radio-group class="radio-group" aria-label="Sorting">
|
||||||
<mat-radio-button value="1" (click)="setSortingOrder('asc')" checked>By name ascending </mat-radio-button><br/>
|
<mat-radio-button value="1" (click)="setSortingOrder('asc')" checked>By name ascending</mat-radio-button>
|
||||||
<mat-radio-button value="2" (click)="setSortingOrder('desc')">By name descending</mat-radio-button>
|
<mat-radio-button value="2" (click)="setSortingOrder('desc')">By name descending</mat-radio-button>
|
||||||
</mat-radio-group>
|
</mat-radio-group>
|
||||||
</div>
|
</div>
|
||||||
@ -40,21 +40,5 @@
|
|||||||
none
|
none
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div>
|
|
||||||
<table mat-table [dataSource]="dataSource">
|
|
||||||
<ng-container matColumnDef="name">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Name</th>
|
|
||||||
<td mat-cell *matCellDef="let element">{{element.name}}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<ng-container matColumnDef="console">
|
|
||||||
<th mat-header-cell *matHeaderCellDef>Console</th>
|
|
||||||
<td mat-cell *matCellDef="let element">{{element.console}}</td>
|
|
||||||
</ng-container>
|
|
||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
||||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
||||||
</table>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
.summaryContent {
|
.summaryContent {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
max-height: 220px;
|
max-height: 240px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
scrollbar-color: darkgrey #263238;
|
scrollbar-color: darkgrey #263238;
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
@ -80,10 +80,15 @@ mat-icon {
|
|||||||
outline: 1px solid #263238;
|
outline: 1px solid #263238;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-group {
|
.radio-group-wrapper {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.radio-group {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
.closeButton {
|
.closeButton {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import { Project } from '../../models/project';
|
|||||||
import { Node } from '../../cartography/models/node';
|
import { Node } from '../../cartography/models/node';
|
||||||
|
|
||||||
|
|
||||||
fdescribe('TopologySummaryComponent', () => {
|
describe('TopologySummaryComponent', () => {
|
||||||
let component: TopologySummaryComponent;
|
let component: TopologySummaryComponent;
|
||||||
let fixture: ComponentFixture<TopologySummaryComponent>;
|
let fixture: ComponentFixture<TopologySummaryComponent>;
|
||||||
let mockedProjectService: MockedProjectService = new MockedProjectService();
|
let mockedProjectService: MockedProjectService = new MockedProjectService();
|
||||||
|
@ -23,8 +23,6 @@ export class TopologySummaryComponent implements OnInit, OnDestroy {
|
|||||||
projectsStatistics: ProjectStatistics;
|
projectsStatistics: ProjectStatistics;
|
||||||
nodes: Node[] = [];
|
nodes: Node[] = [];
|
||||||
filteredNodes: Node[] = [];
|
filteredNodes: Node[] = [];
|
||||||
dataSource: Node[] = [];
|
|
||||||
displayedColumns: string[] = ['name', 'console'];
|
|
||||||
sortingOrder: string = 'asc';
|
sortingOrder: string = 'asc';
|
||||||
startedStatusFilterEnabled: boolean = false;
|
startedStatusFilterEnabled: boolean = false;
|
||||||
suspendedStatusFilterEnabled: boolean = false;
|
suspendedStatusFilterEnabled: boolean = false;
|
||||||
|
@ -2,12 +2,17 @@ import { Injectable } from "@angular/core";
|
|||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MapSettingService {
|
export class MapSettingsService {
|
||||||
public isMapLocked = new Subject<boolean>();
|
public isMapLocked = new Subject<boolean>();
|
||||||
|
public isTopologySummaryVisible: boolean = false;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
changeMapLockValue(value: boolean) {
|
changeMapLockValue(value: boolean) {
|
||||||
this.isMapLocked.next(value);
|
this.isMapLocked.next(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleTopologySummary(value: boolean) {
|
||||||
|
this.isTopologySummaryVisible = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user