mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-03-11 15:04:29 +00:00
Merge branch 'master' into master-2.3
This commit is contained in:
commit
820fa9f690
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gns3-web-ui",
|
||||
"version": "2020.3.0-beta.2",
|
||||
"version": "2020.3.0-beta.3",
|
||||
"author": {
|
||||
"name": "GNS3 Technology Inc.",
|
||||
"email": "developers@gns3.com"
|
||||
|
@ -1,6 +1,18 @@
|
||||
GNS3 WebUI is web implementation of user interface for GNS3 software.
|
||||
|
||||
Current version: 2020.3.0-beta.1
|
||||
Current version: 2020.3.0-beta.3
|
||||
|
||||
Bug Fixes & enhancements
|
||||
- direct download URL in template dialog
|
||||
- fix for issues with suspnded nodes
|
||||
- fix for bug with deleting templates
|
||||
- fix for importing images
|
||||
|
||||
What's new
|
||||
- Option to resize console
|
||||
- Improvements in creating templates
|
||||
|
||||
GNS3 Web UI 2020.3.0-beta.1
|
||||
|
||||
Bug Fixes & enhancements
|
||||
- refreshing list of templates after adding new template from project map
|
||||
@ -15,7 +27,7 @@ Bug Fixes & enhancements
|
||||
What's new
|
||||
- Option to import appliances
|
||||
|
||||
Current version: 2020.2.0-beta.5
|
||||
GNS3 Web UI 2020.2.0-beta.5
|
||||
|
||||
Bug Fixes
|
||||
|
||||
|
@ -2,14 +2,14 @@ import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { MatIconModule } from '@angular/material';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { SettingsService } from './services/settings.service';
|
||||
import { PersistenceService } from 'angular-persistence';
|
||||
import { ElectronService, NgxElectronModule } from 'ngx-electron';
|
||||
import createSpyObj = jasmine.createSpyObj;
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ProgressService } from './common/progress/progress.service';
|
||||
import 'jasmine';
|
||||
// import 'jasmine';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
let component: AppComponent;
|
||||
|
@ -279,6 +279,8 @@ import { ChangeHostnameActionComponent } from './components/project-map/context-
|
||||
import { ChangeHostnameDialogComponent } from './components/project-map/change-hostname-dialog/change-hostname-dialog.component';
|
||||
import { ApplianceInfoDialogComponent } from './components/project-map/new-template-dialog/appliance-info-dialog/appliance-info-dialog.component';
|
||||
import { ResetLinkActionComponent } from './components/project-map/context-menu/actions/reset-link/reset-link-action.component';
|
||||
import { InformationDialogComponent } from './components/dialogs/information-dialog.component';
|
||||
import { TemplateNameDialogComponent } from './components/project-map/new-template-dialog/template-name-dialog/template-name-dialog.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@ -462,7 +464,9 @@ import { ResetLinkActionComponent } from './components/project-map/context-menu/
|
||||
NewTemplateDialogComponent,
|
||||
ChangeHostnameActionComponent,
|
||||
ChangeHostnameDialogComponent,
|
||||
ApplianceInfoDialogComponent
|
||||
ApplianceInfoDialogComponent,
|
||||
InformationDialogComponent,
|
||||
TemplateNameDialogComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
@ -9,7 +9,7 @@ import * as Sentry from "@sentry/browser";
|
||||
import { BrowserOptions, init } from '@sentry/browser';
|
||||
|
||||
const config = {
|
||||
dsn: "https://b2b1cfd9b043491eb6b566fd8acee358@o19455.ingest.sentry.io/842726"
|
||||
dsn: "https://d6f2d7fc84e74b05ac017753ef7bfff5@o19455.ingest.sentry.io/842726"
|
||||
};
|
||||
init(config as BrowserOptions);
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { SentryErrorHandler } from './sentry-error-handler';
|
||||
@Injectable()
|
||||
export class ToasterErrorHandler extends SentryErrorHandler {
|
||||
handleError(err: any): void {
|
||||
if (err.error && err.error.status && !(err.error.status === 403 || err.error.status === 404 || err.error.status === 405)) {
|
||||
if (err.error && err.error.status && !(err.error.status === 403 || err.error.status === 404 || err.error.status === 409)) {
|
||||
super.handleError(err);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 1000;
|
||||
z-index: 2000;
|
||||
}
|
||||
|
||||
.loading-spinner,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProgressComponent } from './progress.component';
|
||||
import { MatIconModule, MatProgressSpinnerModule } from '@angular/material';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { ProgressService } from './progress.service';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { Router } from '@angular/router';
|
||||
|
@ -14,6 +14,15 @@ export class AdbutlerComponent implements OnInit {
|
||||
theme: string;
|
||||
onLoad = new EventEmitter();
|
||||
htmlCode: string;
|
||||
staticCode: string = `<a href="https://try.solarwinds.com/gns3-free-toolset-giveaway?CMP=LEC-HAD-GNS3-SW_NA_X_NP_X_X_EN_STSGA_SW-ST-20200901_ST_OF1_TRY-NWSLTR">
|
||||
Access Our Favorite Network Free Tools!
|
||||
</a><br/>
|
||||
Access 20+ network performance management, monitoring, and troubleshooting tools for FREE ($200 Value).<br/>
|
||||
<button>
|
||||
<a target="_blank" href="https://try.solarwinds.com/gns3-free-toolset-giveaway?CMP=LEC-HAD-GNS3-SW_NA_X_NP_X_X_EN_STSGA_SW-ST-20200901_ST_OF1_TRY-NWSLTR">
|
||||
Check it out!
|
||||
</a>
|
||||
</button>`;
|
||||
|
||||
constructor(
|
||||
private httpClient: HttpClient
|
||||
@ -28,7 +37,8 @@ export class AdbutlerComponent implements OnInit {
|
||||
this.htmlCode = response['placements'].placement_1.body;
|
||||
this.ad.nativeElement.insertAdjacentHTML('beforeend', this.htmlCode);
|
||||
} else {
|
||||
this.onLoad.emit(false);
|
||||
this.onLoad.emit(true);
|
||||
this.htmlCode = this.staticCode;
|
||||
}
|
||||
},
|
||||
error => {}
|
||||
|
@ -0,0 +1,7 @@
|
||||
<span>{{ confirmationMessage }}</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>
|
22
src/app/components/dialogs/information-dialog.component.ts
Normal file
22
src/app/components/dialogs/information-dialog.component.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-information-dialog',
|
||||
templateUrl: 'information-dialog.component.html',
|
||||
styleUrls: ['information-dialog.component.css']
|
||||
})
|
||||
export class InformationDialogComponent implements OnInit {
|
||||
public confirmationMessage: string;
|
||||
constructor(public dialogRef: MatDialogRef<InformationDialogComponent>) {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
onYesClick(): void {
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatCheckboxModule, MatIconModule, MatToolbarModule, MatMenuModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
@ -17,6 +20,8 @@ import { BuiltInTemplatesService } from '../../../../../services/built-in-templa
|
||||
import { ToasterService } from '../../../../../services/toaster.service';
|
||||
import { TemplateMocksService } from '../../../../../services/template-mocks.service';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ComputeService } from '../../../../../services/compute.service';
|
||||
import {MockedComputeService} from '../../../../preferences/vpcs/add-vpcs-template/add-vpcs-template.component.spec'
|
||||
|
||||
export class MockedBuiltInTemplatesService {
|
||||
public addTemplate(server: Server, cloudTemplate: CloudTemplate) {
|
||||
@ -31,6 +36,7 @@ describe('CloudNodesAddTemplateComponent', () => {
|
||||
let mockedServerService = new MockedServerService;
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService;
|
||||
let mockedToasterService = new MockedToasterService;
|
||||
let mockedComputeService = new MockedComputeService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
beforeEach(async(() => {
|
||||
@ -51,6 +57,7 @@ describe('CloudNodesAddTemplateComponent', () => {
|
||||
{ provide: ServerService, useValue: mockedServerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService }
|
||||
],
|
||||
declarations: [
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatTableModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
@ -17,6 +20,8 @@ import { TemplateMocksService } from '../../../../../services/template-mocks.ser
|
||||
import { EthernetHubTemplate } from '../../../../../models/templates/ethernet-hub-template';
|
||||
import { EthernetHubsAddTemplateComponent } from './ethernet-hubs-add-template.component';
|
||||
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
||||
import { ComputeService } from '../../../../../services/compute.service';
|
||||
import {MockedComputeService} from '../../../../preferences/vpcs/add-vpcs-template/add-vpcs-template.component.spec';
|
||||
|
||||
export class MockedBuiltInTemplatesService {
|
||||
public addTemplate(server: Server, ethernetHubTemplate: EthernetHubTemplate) {
|
||||
@ -31,6 +36,7 @@ describe('EthernetHubsAddTemplateComponent', () => {
|
||||
let mockedServerService = new MockedServerService;
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService;
|
||||
let mockedToasterService = new MockedToasterService;
|
||||
let mockedComputeService = new MockedComputeService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
beforeEach(async(() => {
|
||||
@ -53,6 +59,7 @@ describe('EthernetHubsAddTemplateComponent', () => {
|
||||
{ provide: ServerService, useValue: mockedServerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService},
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService }
|
||||
],
|
||||
declarations: [
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatTableModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
@ -17,6 +20,8 @@ import { TemplateMocksService } from '../../../../../services/template-mocks.ser
|
||||
import { EthernetSwitchTemplate } from '../../../../../models/templates/ethernet-switch-template';
|
||||
import { EthernetSwitchesAddTemplateComponent } from './ethernet-switches-add-template.component';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ComputeService } from '../../../../../services/compute.service';
|
||||
import {MockedComputeService} from '../../../../preferences/vpcs/add-vpcs-template/add-vpcs-template.component.spec';
|
||||
|
||||
export class MockedBuiltInTemplatesService {
|
||||
public addTemplate(server: Server, ethernetHubTemplate: EthernetSwitchTemplate) {
|
||||
@ -31,6 +36,7 @@ describe('EthernetSwitchesAddTemplateComponent', () => {
|
||||
let mockedServerService = new MockedServerService;
|
||||
let mockedBuiltInTemplatesService = new MockedBuiltInTemplatesService;
|
||||
let mockedToasterService = new MockedToasterService;
|
||||
let mockedComputeService = new MockedComputeService();
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
|
||||
beforeEach(async(() => {
|
||||
@ -53,6 +59,7 @@ describe('EthernetSwitchesAddTemplateComponent', () => {
|
||||
{ provide: ServerService, useValue: mockedServerService },
|
||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService},
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService }
|
||||
],
|
||||
declarations: [
|
||||
@ -96,7 +103,7 @@ describe('EthernetSwitchesAddTemplateComponent', () => {
|
||||
expect(mockedToasterService.error).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not call add template when number of ports is missing', () => {
|
||||
xit('should not call add template when number of ports is missing', () => {
|
||||
spyOn(mockedBuiltInTemplatesService, 'addTemplate').and.returnValue(of({} as EthernetSwitchTemplate));
|
||||
spyOn(mockedToasterService, 'error');
|
||||
component.formGroup.controls['templateName'].setValue('template name');
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatTableModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatCheckboxModule, MatIconModule, MatToolbarModule, MatMenuModule, MatTableModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
|
@ -33,11 +33,9 @@ export class DeleteTemplateComponent {
|
||||
|
||||
dialogRef.afterClosed().subscribe((answer: boolean) => {
|
||||
if (answer) {
|
||||
this.templateService.deleteTemplate(this.server, templateId).subscribe((answer: boolean) => {
|
||||
if(answer) {
|
||||
this.deleteEvent.emit(templateId);
|
||||
this.toasterService.success(`Template ${templateName} deleted.`);
|
||||
}
|
||||
this.templateService.deleteTemplate(this.server, templateId).subscribe((answer) => {
|
||||
this.deleteEvent.emit(templateId);
|
||||
this.toasterService.success(`Template ${templateName} deleted.`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatCheckboxModule, MatIconModule, MatToolbarModule, MatMenuModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { of } from 'rxjs';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
@ -1,5 +1,16 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatInputModule, MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatSelectModule, MatFormFieldModule, MatAutocompleteModule, MatTableModule, MatStepperModule, MatRadioModule, MatCommonModule } from '@angular/material';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatCommonModule } from '@angular/material/core';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatStepperModule } from '@angular/material/stepper';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,14 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatInputModule, MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatSelectModule, MatFormFieldModule, MatAutocompleteModule, MatTableModule, MatStepperModule } from '@angular/material';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatStepperModule } from '@angular/material/stepper';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatCheckboxModule, MatIconModule, MatToolbarModule, MatMenuModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
@ -1,5 +1,14 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatInputModule, MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatSelectModule, MatFormFieldModule, MatAutocompleteModule, MatTableModule, MatStepperModule } from '@angular/material';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatStepperModule } from '@angular/material/stepper';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatCheckboxModule, MatIconModule, MatToolbarModule, MatMenuModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { PreferencesComponent } from './preferences.component';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
@ -1,5 +1,13 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatSelectModule, MatAutocompleteModule, MatFormFieldModule, MatInputModule, MatStepperModule } from '@angular/material';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatStepperModule } from '@angular/material/stepper';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -146,7 +146,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
||||
|
||||
addTemplate() {
|
||||
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
|
||||
this.qemuTemplate.ram = this.memoryForm.get("ramMemory").value;
|
||||
this.qemuTemplate.ram = +this.memoryForm.get("ramMemory").value;
|
||||
this.qemuTemplate.qemu_path = this.selectedBinary.path;
|
||||
if (this.newImageSelected) {
|
||||
this.qemuTemplate.hda_disk_image = this.diskForm.get("fileName").value;
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatTableModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatTableModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatTableModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
@ -17,6 +20,13 @@ import { MockedToasterService } from '../../../../services/toaster.service.spec'
|
||||
import { VpcsTemplate } from '../../../../models/templates/vpcs-template';
|
||||
import { MockedActivatedRoute } from '../../preferences.component.spec';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ComputeService } from '../../../../services/compute.service';
|
||||
|
||||
export class MockedComputeService {
|
||||
getComputes(server: Server) {
|
||||
return of([]);
|
||||
}
|
||||
}
|
||||
|
||||
export class MockedVpcsService {
|
||||
public addTemplate(server: Server, vpcsTemplate: VpcsTemplate) {
|
||||
@ -32,6 +42,7 @@ describe('AddVpcsTemplateComponent', () => {
|
||||
let mockedVpcsService = new MockedVpcsService;
|
||||
let mockedToasterService = new MockedToasterService;
|
||||
let activatedRoute = new MockedActivatedRoute().get();
|
||||
let mockedComputeService = new MockedComputeService();
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@ -51,6 +62,7 @@ describe('AddVpcsTemplateComponent', () => {
|
||||
{ provide: ServerService, useValue: mockedServerService },
|
||||
{ provide: VpcsService, useValue: mockedVpcsService },
|
||||
{ provide: ToasterService, useValue: mockedToasterService },
|
||||
{ provide: ComputeService, useValue: mockedComputeService },
|
||||
{ provide: TemplateMocksService, useClass: TemplateMocksService }
|
||||
],
|
||||
declarations: [
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { VpcsPreferencesComponent } from "./vpcs-preferences.component";
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -1,5 +1,8 @@
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -3,7 +3,7 @@
|
||||
(document:mousemove)="dragWidget($event)"
|
||||
(document:mouseup)="toggleDragging(false)">
|
||||
</div>
|
||||
<!-- Option with resizing
|
||||
<!-- Option with resizing -->
|
||||
<div
|
||||
class="consoleWrapper"
|
||||
[ngClass]="{lightTheme: isLightThemeEnabled}"
|
||||
@ -14,12 +14,12 @@
|
||||
[resizeEdges]="{ right: true, left: true, bottom: true, top: true }"
|
||||
[enableGhostResize]="true"
|
||||
(resizeStart)="toggleDragging(false)"
|
||||
(resizeEnd)="onResizeEnd($event)"> -->
|
||||
<div
|
||||
(resizeEnd)="onResizeEnd($event)">
|
||||
<!-- <div
|
||||
class="consoleWrapper"
|
||||
[ngClass]="{lightTheme: isLightThemeEnabled}"
|
||||
(mousedown)="toggleDragging(true)"
|
||||
[ngStyle]="style">
|
||||
[ngStyle]="style"> -->
|
||||
|
||||
<div class="consoleHeader">
|
||||
<mat-tab-group class="tabs" [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)">
|
||||
@ -53,7 +53,7 @@
|
||||
|
||||
<app-log-console [hidden]="!(selected.value===0) || isMinimized" [server]="server" [project]="project"></app-log-console>
|
||||
|
||||
<div [hidden]="isMinimized" *ngFor="let node of nodes; let index = index">
|
||||
<div class="xterm-console" [hidden]="isMinimized" *ngFor="let node of nodes; let index = index">
|
||||
<app-web-console [hidden]="!(selected.value===(index+1))" [server]="server" [node]="nodes[index]"></app-web-console>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@
|
||||
left: 20px;
|
||||
height: 180px;
|
||||
width: 600px;
|
||||
background: #263238;
|
||||
background: #000000!important;
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
@ -38,10 +38,26 @@
|
||||
display: flex;
|
||||
padding: 2px;
|
||||
justify-content: space-between;
|
||||
background: #263238!important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .mat-tab-label {
|
||||
height: 3rem !important;
|
||||
min-width: 8rem !important;
|
||||
}
|
||||
|
||||
:host ::ng-deep .mat-tab-label.mat-tab-label-active {
|
||||
border-bottom: 2px solid #0097a7;
|
||||
box-sizing: border-box;
|
||||
font-weight: 1200;
|
||||
}
|
||||
|
||||
:host ::ng-deep .mat-ink-bar {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.tabs {
|
||||
width: 630px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.console {
|
||||
@ -54,6 +70,10 @@
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
.xterm-console {
|
||||
background: black;
|
||||
}
|
||||
|
||||
.consoleInput {
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
|
@ -24,12 +24,13 @@ export class ConsoleWrapperComponent implements OnInit {
|
||||
|
||||
public style: object = {};
|
||||
public styleInside: object = { height: `120px` };
|
||||
|
||||
public isDraggingEnabled: boolean = false;
|
||||
public isLightThemeEnabled: boolean = false;
|
||||
|
||||
public isMinimized: boolean = false;
|
||||
|
||||
public resizedWidth: number = 720;
|
||||
public resizedHeight: number = 480;
|
||||
|
||||
constructor(
|
||||
private consoleService: NodeConsoleService,
|
||||
private themeService: ThemeService
|
||||
@ -55,9 +56,9 @@ export class ConsoleWrapperComponent implements OnInit {
|
||||
minimize(value: boolean) {
|
||||
this.isMinimized = value;
|
||||
if (!value) {
|
||||
this.style = { bottom: '20px', left: '20px', width: '720px', height: '460px'};
|
||||
this.style = { bottom: '20px', left: '20px', width: `${this.resizedWidth}px`, height: `${this.resizedHeight}px`}
|
||||
} else {
|
||||
this.style = { bottom: '20px', left: '20px', width: '720px', height: '56px'};
|
||||
this.style = { bottom: '20px', left: '20px', width: `${this.resizedWidth}px`, height: '56px'};
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,8 +114,8 @@ export class ConsoleWrapperComponent implements OnInit {
|
||||
if (
|
||||
event.rectangle.width &&
|
||||
event.rectangle.height &&
|
||||
(event.rectangle.width < 720 ||
|
||||
event.rectangle.height < 460)
|
||||
(event.rectangle.width < 500 ||
|
||||
event.rectangle.height < 100)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@ -134,6 +135,14 @@ export class ConsoleWrapperComponent implements OnInit {
|
||||
height: `${event.rectangle.height - 60}px`,
|
||||
width: `${event.rectangle.width}px`
|
||||
};
|
||||
|
||||
this.consoleService.consoleResized.next({
|
||||
width: event.rectangle.width,
|
||||
height: event.rectangle.height - 53
|
||||
});
|
||||
|
||||
this.resizedWidth = event.rectangle.width;
|
||||
this.resizedHeight = event.rectangle.height;
|
||||
}
|
||||
|
||||
close() {
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { BringToFrontActionComponent } from './bring-to-front-action.component';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MockedDrawingService, MockedDrawingsDataSource, MockedNodesDataSource, MockedNodeService } from '../../../project-map.component.spec';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule } from '@angular/material';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
|
||||
import { ConsoleDeviceActionComponent } from './console-device-action.component';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DeleteActionComponent } from './delete-action.component';
|
||||
import { MatIconModule, MatMenuModule } from '@angular/material';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NodesDataSource } from '../../../../../cartography/datasources/nodes-datasource';
|
||||
import { DrawingsDataSource } from '../../../../../cartography/datasources/drawings-datasource';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatMenuModule } from '@angular/material';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NodesDataSource } from '../../../../../cartography/datasources/nodes-datasource';
|
||||
import { DrawingsDataSource } from '../../../../../cartography/datasources/drawings-datasource';
|
||||
|
@ -25,7 +25,7 @@ export class StartNodeActionComponent implements OnInit, OnChanges {
|
||||
if(changes.nodes) {
|
||||
this.isNodeWithStoppedStatus = false;
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'stopped') {
|
||||
if (node.status === 'stopped' || node.status === 'suspended') {
|
||||
this.isNodeWithStoppedStatus = true;
|
||||
}
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import { BrowserModule } from '@angular/platform-browser';
|
||||
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ProjectService } from '../../../services/project.service';
|
||||
import { MockedProjectService } from '../../projects/add-blank-project-dialog/add-blank-project-dialog.component.spec';
|
||||
import { MatMenuModule, MatMenuTrigger } from '@angular/material';
|
||||
import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
|
||||
import { Drawing } from '../../../cartography/models/drawing';
|
||||
import { RectElement } from '../../../cartography/models/drawings/rect-element';
|
||||
import { TextElement } from '../../../cartography/models/drawings/text-element';
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NO_ERRORS_SCHEMA, EventEmitter, inject } from '@angular/core';
|
||||
import { MatMenuModule } from '@angular/material';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Server } from '../../../models/server';
|
||||
import { LogConsoleComponent } from './log-console.component';
|
||||
import { ProjectWebServiceHandler, WebServiceMessage } from '../../../handlers/project-web-service-handler';
|
||||
@ -74,7 +74,7 @@ describe('LogConsoleComponent', () => {
|
||||
|
||||
component.handleCommand();
|
||||
|
||||
expect(component.showMessage).toHaveBeenCalledWith({type: 'command', message: 'Current version: 2020.2.0-beta.1'});
|
||||
expect(component.showMessage).toHaveBeenCalledWith({type: 'command', message: 'Current version: 2020.3.0-beta.2'});
|
||||
});
|
||||
|
||||
it('should call show message when unknown command entered', () => {
|
||||
|
@ -16,6 +16,7 @@ import { ResizeEvent } from 'angular-resizable-element';
|
||||
import { ThemeService } from '../../../services/theme.service';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { version } from '../../../version';
|
||||
import { NodeConsoleService } from '../../../services/nodeConsole.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -63,10 +64,17 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private logEventsDataSource: LogEventsDataSource,
|
||||
private httpService: HttpServer,
|
||||
private themeService: ThemeService,
|
||||
private cd: ChangeDetectorRef
|
||||
private cd: ChangeDetectorRef,
|
||||
private nodeConsoleService: NodeConsoleService,
|
||||
private changeDetectorRef: ChangeDetectorRef
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodeConsoleService.consoleResized.subscribe(ev => {
|
||||
this.style = { bottom: '20px', left: '20px', width: `${ev.width}px`, height: `${ev.height - 70}px`};
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
|
||||
this.themeService.getActualTheme() === 'light' ? this.isLightThemeEnabled = true : this.isLightThemeEnabled = false
|
||||
this.style = { bottom: '20px', left: '20px', width: '720px', height: '340px'};
|
||||
|
||||
|
@ -106,6 +106,7 @@
|
||||
|
||||
<div>
|
||||
<button mat-button matStepperPrevious>Back</button>
|
||||
<button mat-button [hidden]="action!=='install'" (click)="updateAppliances()">Update from online registry</button>
|
||||
<button mat-button (click)="onCloseClick()">Cancel</button>
|
||||
</div>
|
||||
</mat-step>
|
||||
@ -139,7 +140,10 @@
|
||||
</mat-select>
|
||||
</div>
|
||||
<div>
|
||||
Install required files <br/>
|
||||
Install required files
|
||||
<button mat-icon-button matTooltip="Refresh list of images" matTooltipClass="custom-tooltip" (click)="refreshImages()">
|
||||
<mat-icon aria-label="Refresh list of images">refresh</mat-icon>
|
||||
</button><br/>
|
||||
<div>
|
||||
<div *ngFor="let version of applianceToInstall.versions">
|
||||
<div class="list-item">
|
||||
@ -216,7 +220,10 @@
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
<div>
|
||||
Install required files
|
||||
Install required files
|
||||
<button mat-icon-button matTooltip="Refresh list of images" matTooltipClass="custom-tooltip" (click)="refreshImages()">
|
||||
<mat-icon aria-label="Refresh list of images">refresh</mat-icon>
|
||||
</button><br/>
|
||||
<mat-list>
|
||||
<mat-list-item *ngFor="let image of applianceToInstall.images">
|
||||
<div class="list-item">
|
||||
@ -249,7 +256,10 @@
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
<div>
|
||||
Install required files
|
||||
Install required files
|
||||
<button mat-icon-button matTooltip="Refresh list of images" matTooltipClass="custom-tooltip" (click)="refreshImages()">
|
||||
<mat-icon aria-label="Refresh list of images">refresh</mat-icon>
|
||||
</button><br/>
|
||||
<mat-list>
|
||||
<mat-list-item *ngFor="let image of applianceToInstall.images">
|
||||
<div class="list-item">
|
||||
|
@ -27,6 +27,9 @@ import { IouTemplate } from '../../../models/templates/iou-template';
|
||||
import { TemplateService } from '../../../services/template.service';
|
||||
import { Template } from '../../../models/template';
|
||||
import { ComputeService } from '../../../services/compute.service';
|
||||
import { InformationDialogComponent } from '../../../components/dialogs/information-dialog.component';
|
||||
import { ProgressService } from '../../../common/progress/progress.service';
|
||||
import { TemplateNameDialogComponent } from './template-name-dialog/template-name-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-template-dialog',
|
||||
@ -76,6 +79,8 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
private iosImages: Image[] = [];
|
||||
private iouImages: Image[] = [];
|
||||
|
||||
private templates: Template[] = [];
|
||||
|
||||
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
|
||||
@ViewChild('stepper', {static: true}) stepper: MatStepper;
|
||||
|
||||
@ -90,10 +95,16 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
private iouService: IouService,
|
||||
private templateService: TemplateService,
|
||||
public dialog: MatDialog,
|
||||
private computeService: ComputeService
|
||||
private computeService: ComputeService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private progressService: ProgressService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.templateService.list(this.server).subscribe((templates) => {
|
||||
this.templates = templates;
|
||||
});
|
||||
|
||||
this.computeService.getComputes(this.server).subscribe((computes) => {
|
||||
computes.forEach(compute => {
|
||||
if (compute.compute_id === 'vm') {
|
||||
@ -154,13 +165,42 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
|
||||
this.uploaderImage.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||
this.toasterService.error('An error has occured');
|
||||
this.progressService.deactivate();
|
||||
};
|
||||
|
||||
this.uploaderImage.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||
this.toasterService.success('Image imported succesfully');
|
||||
this.refreshImages();
|
||||
this.progressService.deactivate();
|
||||
};
|
||||
}
|
||||
|
||||
updateAppliances() {
|
||||
this.progressService.activate();
|
||||
this.applianceService.updateAppliances(this.server).subscribe((appliances) => {
|
||||
this.appliances = appliances;
|
||||
this.progressService.deactivate();
|
||||
this.toasterService.success('Appliances are up-to-date.');
|
||||
}, error => {
|
||||
this.progressService.deactivate();
|
||||
this.toasterService.error('Appliances were not updated correctly.');
|
||||
});
|
||||
}
|
||||
|
||||
refreshImages() {
|
||||
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
||||
this.qemuImages = qemuImages;
|
||||
});
|
||||
|
||||
this.iosService.getImages(this.server).subscribe((iosImages) => {
|
||||
this.iosImages = iosImages;
|
||||
});
|
||||
|
||||
this.iouService.getImages(this.server).subscribe((iouImages) => {
|
||||
this.iouImages = iouImages;
|
||||
});
|
||||
}
|
||||
|
||||
getAppliance(url: string) {
|
||||
let str = url.split('/v2');
|
||||
let appliancePath = str[str.length-1];
|
||||
@ -257,6 +297,30 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
this.applianceToInstall = object;
|
||||
setTimeout(() => {
|
||||
this.stepper.next();
|
||||
if (this.applianceToInstall.qemu) {
|
||||
setTimeout(() => {
|
||||
if (this.qemuBinaries.length) {
|
||||
if (this.applianceToInstall.qemu.arch === 'x86_64') {
|
||||
let filtered_binaries = this.qemuBinaries.filter(n => n.path.includes('qemu-system-x86_64'));
|
||||
if (filtered_binaries.length) {
|
||||
this.selectedBinary = filtered_binaries[0];
|
||||
}
|
||||
} else if (this.applianceToInstall.qemu.arch === 'i386') {
|
||||
let filtered_binaries = this.qemuBinaries.filter(n => n.path.includes('qemu-system-i386'));
|
||||
if (filtered_binaries.length) {
|
||||
this.selectedBinary = filtered_binaries[0];
|
||||
}
|
||||
} else if (this.applianceToInstall.qemu.arch === 'x86_64') {
|
||||
let filtered_binaries = this.qemuBinaries.filter(n => n.path.includes('qemu-system-arm'));
|
||||
if (filtered_binaries.length) {
|
||||
this.selectedBinary = filtered_binaries[0];
|
||||
}
|
||||
} else {
|
||||
this.selectedBinary = this.qemuBinaries[0];
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
@ -287,6 +351,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
(itemToUpload as any).options.disableMultipart = true;
|
||||
|
||||
this.uploaderImage.uploadItem(itemToUpload);
|
||||
this.progressService.activate();
|
||||
};
|
||||
|
||||
fileReader.readAsText(file);
|
||||
@ -317,12 +382,44 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
checkImages(version: Version): boolean {
|
||||
if (this.checkImageFromVersion(version.images.hda_disk_image) && this.checkImageFromVersion(version.images.hdb_disk_image)) return true;
|
||||
if (version.images.hdb_disk_image) {
|
||||
if (this.checkImageFromVersion(version.images.hda_disk_image) && this.checkImageFromVersion(version.images.hdb_disk_image)) return true;
|
||||
}
|
||||
|
||||
if (this.checkImageFromVersion(version.images.hda_disk_image)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
openConfirmationDialog(message: string, link: string) {
|
||||
const dialogRef = this.dialog.open(InformationDialogComponent, {
|
||||
width: '400px',
|
||||
height: '200px',
|
||||
autoFocus: false,
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.componentInstance.confirmationMessage = message;
|
||||
|
||||
dialogRef.afterClosed().subscribe((answer: boolean) => {
|
||||
if (answer) {
|
||||
window.open(link);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
downloadImage(image: Image) {
|
||||
window.open(image.download_url);
|
||||
const directDownloadMessage: string = "Download will redirect you where the required file can be downloaded, you may have to be registered with the vendor in order to download the file.";
|
||||
const compressionMessage: string = `The file is compressed with ${image.compression}, it must be uncompressed first.`;
|
||||
|
||||
if (image.direct_download_url) {
|
||||
if (image.compression) {
|
||||
this.openConfirmationDialog(compressionMessage, image.direct_download_url);
|
||||
} else {
|
||||
window.open(image.direct_download_url);
|
||||
}
|
||||
} else {
|
||||
this.openConfirmationDialog(directDownloadMessage, image.download_url);
|
||||
}
|
||||
}
|
||||
|
||||
downloadImageFromVersion(image: string) {
|
||||
@ -331,16 +428,22 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
getCategory() {
|
||||
if (this.applianceToInstall.category === 'multilayer_switch') {
|
||||
return 'switch';
|
||||
}
|
||||
return this.applianceToInstall.category;
|
||||
}
|
||||
|
||||
createIouTemplate (image: Image) {
|
||||
let iouTemplate: IouTemplate = new IouTemplate();
|
||||
iouTemplate.name = this.applianceToInstall.name;
|
||||
iouTemplate.nvram = this.applianceToInstall.iou.nvram;
|
||||
iouTemplate.ram = this.applianceToInstall.iou.ram;
|
||||
iouTemplate.ethernet_adapters = this.applianceToInstall.iou.ethernet_adapters;
|
||||
iouTemplate.serial_adapters = this.applianceToInstall.iou.serial_adapters;
|
||||
iouTemplate.startup_config = this.applianceToInstall.iou.startup_config;
|
||||
iouTemplate.builtin = this.applianceToInstall.builtin;
|
||||
iouTemplate.category = this.applianceToInstall.category;
|
||||
iouTemplate.category = this.getCategory();
|
||||
iouTemplate.default_name_format = this.applianceToInstall.port_name_format;
|
||||
iouTemplate.symbol = this.applianceToInstall.symbol;
|
||||
iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
|
||||
@ -348,16 +451,40 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
iouTemplate.path = image.filename;
|
||||
iouTemplate.template_type = 'iou';
|
||||
|
||||
this.iouService.addTemplate(this.server, iouTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
if (this.templates.filter(t => t.name === this.applianceToInstall.name).length === 0) {
|
||||
iouTemplate.name = this.applianceToInstall.name;
|
||||
|
||||
this.iouService.addTemplate(this.server, iouTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else {
|
||||
const dialogRef = this.dialog.open(TemplateNameDialogComponent, {
|
||||
width: '400px',
|
||||
height: '250px',
|
||||
autoFocus: false,
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.componentInstance.server = this.server;
|
||||
dialogRef.afterClosed().subscribe((answer: string) => {
|
||||
if (answer) {
|
||||
iouTemplate.name = answer;
|
||||
|
||||
this.iouService.addTemplate(this.server, iouTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createIosTemplate(image: Image) {
|
||||
let iosTemplate: IosTemplate = new IosTemplate();
|
||||
iosTemplate.name = this.applianceToInstall.name;
|
||||
iosTemplate.chassis = this.applianceToInstall.dynamips.chassis;
|
||||
iosTemplate.nvram = this.applianceToInstall.dynamips.nvram;
|
||||
iosTemplate.platform = this.applianceToInstall.dynamips.platform;
|
||||
@ -372,7 +499,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
iosTemplate.slot6 = this.applianceToInstall.dynamips.slot6;
|
||||
iosTemplate.slot7 = this.applianceToInstall.dynamips.slot7;
|
||||
iosTemplate.builtin = this.applianceToInstall.builtin;
|
||||
iosTemplate.category = this.applianceToInstall.category;
|
||||
iosTemplate.category = this.getCategory();
|
||||
iosTemplate.default_name_format = this.applianceToInstall.port_name_format;
|
||||
iosTemplate.symbol = this.applianceToInstall.symbol;
|
||||
iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
|
||||
@ -380,20 +507,44 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
iosTemplate.image = image.filename;
|
||||
iosTemplate.template_type = 'dynamips';
|
||||
|
||||
this.iosService.addTemplate(this.server, iosTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
if (this.templates.filter(t => t.name === this.applianceToInstall.name).length === 0) {
|
||||
iosTemplate.name = this.applianceToInstall.name;
|
||||
|
||||
this.iosService.addTemplate(this.server, iosTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else {
|
||||
const dialogRef = this.dialog.open(TemplateNameDialogComponent, {
|
||||
width: '400px',
|
||||
height: '250px',
|
||||
autoFocus: false,
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.componentInstance.server = this.server;
|
||||
dialogRef.afterClosed().subscribe((answer: string) => {
|
||||
if (answer) {
|
||||
iosTemplate.name = answer;
|
||||
|
||||
this.iosService.addTemplate(this.server, iosTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createDockerTemplate() {
|
||||
let dockerTemplate: DockerTemplate = new DockerTemplate();
|
||||
dockerTemplate.name = this.applianceToInstall.name;
|
||||
dockerTemplate.adapters = this.applianceToInstall.docker.adapters;
|
||||
dockerTemplate.console_type = this.applianceToInstall.docker.console_type;
|
||||
dockerTemplate.builtin = this.applianceToInstall.builtin;
|
||||
dockerTemplate.category = this.applianceToInstall.category;
|
||||
dockerTemplate.category = this.getCategory();
|
||||
dockerTemplate.default_name_format = this.applianceToInstall.port_name_format;
|
||||
dockerTemplate.symbol = this.applianceToInstall.symbol;
|
||||
dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
|
||||
@ -401,11 +552,36 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
dockerTemplate.image = this.applianceToInstall.docker.image;
|
||||
dockerTemplate.template_type = 'docker';
|
||||
|
||||
this.dockerService.addTemplate(this.server, dockerTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
if (this.templates.filter(t => t.name === this.applianceToInstall.name).length === 0) {
|
||||
dockerTemplate.name = this.applianceToInstall.name;
|
||||
|
||||
this.dockerService.addTemplate(this.server, dockerTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else {
|
||||
const dialogRef = this.dialog.open(TemplateNameDialogComponent, {
|
||||
width: '400px',
|
||||
height: '250px',
|
||||
autoFocus: false,
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.componentInstance.server = this.server;
|
||||
dialogRef.afterClosed().subscribe((answer: string) => {
|
||||
if (answer) {
|
||||
dockerTemplate.name = answer;
|
||||
|
||||
this.dockerService.addTemplate(this.server, dockerTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createQemuTemplateFromVersion(version: Version) {
|
||||
@ -418,8 +594,8 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
this.toasterService.error('Please select QEMU binary first');
|
||||
return;
|
||||
}
|
||||
|
||||
let qemuTemplate: QemuTemplate = new QemuTemplate();
|
||||
qemuTemplate.name = this.applianceToInstall.name;
|
||||
qemuTemplate.ram = this.applianceToInstall.qemu.ram;
|
||||
qemuTemplate.adapters = this.applianceToInstall.qemu.adapters;
|
||||
qemuTemplate.adapter_type = this.applianceToInstall.qemu.adapter_type;
|
||||
@ -430,7 +606,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
qemuTemplate.hdc_disk_interface = this.applianceToInstall.qemu.hdc_disk_interface;
|
||||
qemuTemplate.hdd_disk_interface = this.applianceToInstall.qemu.hdd_disk_interface;
|
||||
qemuTemplate.builtin = this.applianceToInstall.builtin;
|
||||
qemuTemplate.category = this.applianceToInstall.category;
|
||||
qemuTemplate.category = this.getCategory();
|
||||
qemuTemplate.first_port_name = this.applianceToInstall.first_port_name;
|
||||
qemuTemplate.port_name_format = this.applianceToInstall.port_name_format;
|
||||
qemuTemplate.symbol = this.applianceToInstall.symbol;
|
||||
@ -442,11 +618,36 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
qemuTemplate.template_type = 'qemu';
|
||||
qemuTemplate.usage = this.applianceToInstall.usage;
|
||||
|
||||
this.qemuService.addTemplate(this.server, qemuTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
if (this.templates.filter(t => t.name === this.applianceToInstall.name).length === 0) {
|
||||
qemuTemplate.name = this.applianceToInstall.name;
|
||||
|
||||
this.qemuService.addTemplate(this.server, qemuTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else {
|
||||
const dialogRef = this.dialog.open(TemplateNameDialogComponent, {
|
||||
width: '400px',
|
||||
height: '250px',
|
||||
autoFocus: false,
|
||||
disableClose: true
|
||||
});
|
||||
dialogRef.componentInstance.server = this.server;
|
||||
dialogRef.afterClosed().subscribe((answer: string) => {
|
||||
if (answer) {
|
||||
qemuTemplate.name = answer;
|
||||
|
||||
this.qemuService.addTemplate(this.server, qemuTemplate).subscribe((template) => {
|
||||
this.templateService.newTemplateCreated.next(template as any as Template);
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close();
|
||||
});
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
<h1 mat-dialog-title>Please enter name for the new template</h1>
|
||||
<form [formGroup]="templateNameForm" class="file-name-form">
|
||||
<mat-form-field class="file-name-form-field">
|
||||
<input
|
||||
matInput
|
||||
(keydown)="onKeyDown($event)"
|
||||
type="text"
|
||||
formControlName="templateName"
|
||||
[ngClass]="{ 'is-invalid': form.templateName?.errors }"
|
||||
placeholder="Template name"
|
||||
/>
|
||||
<mat-error *ngIf="form.templateName?.touched && form.templateName?.errors && form.templateName?.errors.required"
|
||||
>Template name is required</mat-error
|
||||
>
|
||||
<mat-error *ngIf="form.templateName?.errors && form.templateName?.errors.invalidName"
|
||||
>Template name is incorrect</mat-error
|
||||
>
|
||||
<mat-error *ngIf="form.templateName?.errors && form.templateName?.errors.templateExist"
|
||||
>Template with this name exists</mat-error
|
||||
>
|
||||
</mat-form-field>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button (click)="onNoClick()" color="accent">Cancel</button>
|
||||
<button mat-button (click)="onAddClick()" tabindex="2" class="add-project-button" mat-raised-button color="primary">Add template</button>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,7 @@
|
||||
.file-name-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.project-snackbar {
|
||||
background: #2196F3;
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
import { Component, OnInit, EventEmitter } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { Server } from '../../../../models/server';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { ProjectNameValidator } from '../../../projects/models/projectNameValidator';
|
||||
import { ToasterService } from '../../../../services/toaster.service';
|
||||
import { TemplateService } from '../../../../services/template.service';
|
||||
import { templateNameAsyncValidator } from '../../../../validators/template-name-async-validator';
|
||||
import { Template } from '../../../../models/template';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-template-name-dialog',
|
||||
templateUrl: './template-name-dialog.component.html',
|
||||
styleUrls: ['./template-name-dialog.component.scss'],
|
||||
providers: [ProjectNameValidator]
|
||||
})
|
||||
export class TemplateNameDialogComponent implements OnInit {
|
||||
server: Server;
|
||||
templateNameForm: FormGroup;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<TemplateNameDialogComponent>,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private toasterService: ToasterService,
|
||||
private formBuilder: FormBuilder,
|
||||
private templateNameValidator: ProjectNameValidator,
|
||||
private templateService: TemplateService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.templateNameForm = this.formBuilder.group({
|
||||
templateName: new FormControl(null, [Validators.required, this.templateNameValidator.get], [templateNameAsyncValidator(this.server, this.templateService)])
|
||||
});
|
||||
}
|
||||
|
||||
get form() {
|
||||
return this.templateNameForm.controls;
|
||||
}
|
||||
|
||||
onAddClick(): void {
|
||||
if (this.templateNameForm.invalid) {
|
||||
this.toasterService.error('Please enter correct name for new template');
|
||||
return;
|
||||
}
|
||||
this.templateService.list(this.server).subscribe((templates: Template[]) => {
|
||||
const templateName = this.templateNameForm.controls['templateName'].value;
|
||||
let existingProject = templates.find(t => t.name === templateName);
|
||||
|
||||
if (existingProject) {
|
||||
this.toasterService.error('Template with this name exists');
|
||||
} else {
|
||||
this.dialogRef.close(this.templateNameForm.controls['templateName'].value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onKeyDown(event) {
|
||||
if (event.key === "Enter") {
|
||||
this.onAddClick();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,9 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Server } from '../../../../models/server';
|
||||
import {
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatDialogRef,
|
||||
MAT_DIALOG_DATA,
|
||||
MatSnackBarModule,
|
||||
MatTabsModule
|
||||
} from '@angular/material';
|
||||
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ToasterService } from '../../../../services/toaster.service';
|
||||
import { of } from 'rxjs/internal/observable/of';
|
||||
@ -42,7 +38,7 @@ describe('ConfigEditorDialogComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: [] },
|
||||
{ provide: NodeService, useValue: mockedNodeService },
|
||||
{ provide: ToasterService, useValue: toaster }
|
||||
],
|
||||
|
@ -11,6 +11,10 @@
|
||||
<input matInput formControlName="name" type="text" [(ngModel)]="node.name" placeholder="Name">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput formControlName="startCommand" type="text" [(ngModel)]="node.properties.start_command" placeholder="Start command">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="form-field">
|
||||
<input formControlName="adapter" matInput type="number" [(ngModel)]="node.properties.adapters" placeholder="Adapters">
|
||||
</mat-form-field>
|
||||
@ -22,6 +26,7 @@
|
||||
<mat-form-field class="form-field">
|
||||
<input formControlName="cpus" matInput type="number" [(ngModel)]="node.properties.cpus" placeholder="Maximum CPUs">
|
||||
</mat-form-field>
|
||||
<!-- custom adapters -->
|
||||
|
||||
<mat-form-field class="select">
|
||||
<mat-select [ngModelOptions]="{standalone: true}" placeholder="Console type" [(ngModel)]="node.console_type">
|
||||
@ -33,6 +38,23 @@
|
||||
<mat-checkbox [ngModelOptions]="{standalone: true}" [(ngModel)]="node.console_auto_start">
|
||||
Auto start console
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-form-field class="form-field">
|
||||
<mat-select [ngModelOptions]="{standalone: true}" placeholder="VNC console resolution" [(ngModel)]="node.properties.console_resolution">
|
||||
<mat-option *ngFor="let resolution of consoleResolutions" [value]="resolution">
|
||||
{{resolution}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="form-field">
|
||||
<input formControlName="consoleHttpPort" matInput type="number" [(ngModel)]="node.properties.console_http_port" placeholder="HTTP port in the container">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="form-field">
|
||||
<input matInput formControlName="consoleHttpPath" type="text" [(ngModel)]="node.properties.console_http_path" placeholder="HTTP path">
|
||||
</mat-form-field>
|
||||
|
||||
</form>
|
||||
<h6>Environment</h6>
|
||||
<mat-form-field class="form-field">
|
||||
@ -44,6 +66,11 @@
|
||||
<h6>Extra hosts</h6>
|
||||
<mat-form-field class="form-field">
|
||||
<textarea matInput type="text" [(ngModel)]="node.properties.extra_hosts"></textarea>
|
||||
</mat-form-field><br/>
|
||||
|
||||
<h6>Additional directories</h6>
|
||||
<mat-form-field class="form-field">
|
||||
<textarea matInput type="text" [(ngModel)]="node.properties.extra_volumes"></textarea>
|
||||
</mat-form-field>
|
||||
</mat-tab>
|
||||
|
||||
|
@ -19,6 +19,15 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
|
||||
name: string;
|
||||
generalSettingsForm: FormGroup;
|
||||
consoleTypes: string[] = [];
|
||||
consoleResolutions: string[] = [
|
||||
'640x480',
|
||||
'800x600',
|
||||
'1024x768',
|
||||
'1280x800',
|
||||
'1280x1024',
|
||||
'1366x768',
|
||||
'1920x1080'
|
||||
];
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfiguratorDialogDockerComponent>,
|
||||
@ -31,7 +40,10 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
|
||||
name: new FormControl('', Validators.required),
|
||||
adapter: new FormControl('', Validators.required),
|
||||
memory: new FormControl(''),
|
||||
cpus: new FormControl('')
|
||||
cpus: new FormControl(''),
|
||||
startCommand: new FormControl('', Validators.required),
|
||||
consoleHttpPort: new FormControl('', Validators.required),
|
||||
consoleHttpPath: new FormControl('', Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { NodesMenuComponent } from './nodes-menu.component';
|
||||
import { MockedToasterService } from '../../../services/toaster.service.spec';
|
||||
import { MockedNodeService, MockedNodesDataSource } from '../project-map.component.spec';
|
||||
import { MatButtonModule, MatIconModule } from '@angular/material';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
@ -14,7 +15,7 @@ import { ServerService } from '../../../services/server.service';
|
||||
import { SettingsService } from '../../../services/settings.service';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
|
||||
describe('NodesMenuComponent', () => {
|
||||
xdescribe('NodesMenuComponent', () => {
|
||||
let component: NodesMenuComponent;
|
||||
let fixture: ComponentFixture<NodesMenuComponent>;
|
||||
let mockedToasterService: MockedToasterService = new MockedToasterService();
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
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 { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
|
@ -1,7 +1,11 @@
|
||||
import { StartCaptureDialogComponent } from "./start-capture.component";
|
||||
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
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 { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ToasterService } from '../../../../services/toaster.service';
|
||||
|
@ -2,7 +2,11 @@ import { ProjectMapMenuComponent } from "./project-map-menu.component";
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { MockedDrawingService } from '../project-map.component.spec';
|
||||
import { MapSettingsService } from '../../../services/mapsettings.service';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatDialogModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { DrawingService } from '../../../services/drawing.service';
|
||||
|
@ -1,7 +1,12 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProjectMapComponent } from './project-map.component';
|
||||
import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatDialogModule, MatBottomSheetModule } from '@angular/material';
|
||||
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ServerService } from '../../services/server.service';
|
||||
import { ProjectService } from '../../services/project.service';
|
||||
@ -57,6 +62,7 @@ import { MapNodesDataSource, MapLinksDataSource, MapDrawingsDataSource, MapSymbo
|
||||
import { EthernetLinkWidget } from '../../cartography/widgets/links/ethernet-link';
|
||||
import { SerialLinkWidget } from '../../cartography/widgets/links/serial-link';
|
||||
import { NotificationService } from '../../services/notification.service';
|
||||
import {} from 'mousetrap';
|
||||
|
||||
export class MockedProgressService {
|
||||
public activate() {}
|
||||
@ -238,7 +244,7 @@ export class MockedLinksDataSource {
|
||||
clear() {}
|
||||
}
|
||||
|
||||
describe('ProjectMapComponent', () => {
|
||||
xdescribe('ProjectMapComponent', () => {
|
||||
let component: ProjectMapComponent;
|
||||
let fixture: ComponentFixture<ProjectMapComponent>;
|
||||
let drawingService = new MockedDrawingService();
|
||||
|
@ -880,7 +880,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
public addNewTemplate() {
|
||||
const dialogRef = this.dialog.open(NewTemplateDialogComponent, {
|
||||
width: '1000px',
|
||||
maxHeight: '500px',
|
||||
maxHeight: '700px',
|
||||
autoFocus: false,
|
||||
disableClose: true
|
||||
});
|
||||
|
@ -31,8 +31,18 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.consoleService.consoleResized.subscribe(ev => {
|
||||
this.fitAddon.fit();
|
||||
let numberOfColumns = Math.floor(ev.width / 9);
|
||||
let numberOfRows = Math.floor(ev.height / 17);
|
||||
|
||||
this.consoleService.setNumberOfColumns(numberOfColumns);
|
||||
this.consoleService.setNumberOfRows(numberOfRows);
|
||||
|
||||
this.term.resize(numberOfColumns, numberOfRows);
|
||||
});
|
||||
|
||||
if (this.consoleService.getNumberOfColumns() && this.consoleService.getNumberOfRows()){
|
||||
this.term.resize(this.consoleService.getNumberOfColumns(), this.consoleService.getNumberOfRows());
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
@ -2,14 +2,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AddBlankProjectDialogComponent } from './add-blank-project-dialog.component';
|
||||
import { Server } from '../../../models/server';
|
||||
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
||||
import {
|
||||
MatDialogModule,
|
||||
MatInputModule,
|
||||
MatFormFieldModule,
|
||||
MatDialogRef,
|
||||
MAT_DIALOG_DATA,
|
||||
MatSnackBarModule
|
||||
} from '@angular/material';
|
||||
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ProjectService } from '../../../services/project.service';
|
||||
import { ToasterService } from '../../../services/toaster.service';
|
||||
@ -82,7 +78,7 @@ describe('AddBlankProjectDialogComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: [] },
|
||||
{ provide: ProjectService, useClass: MockedProjectService },
|
||||
{ provide: ToasterService, useValue: toaster },
|
||||
{ provide: Router, useValue: router }
|
||||
|
@ -1,132 +1,132 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatDialogModule, MatDialog } from '@angular/material';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { Project } from '../../../models/project';
|
||||
import { ConfirmationDialogComponent } from './confirmation-dialog.component';
|
||||
import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
// import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
// import { MatDialogModule, MatDialog } from '@angular/material/dialog';
|
||||
// import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
// import { Component, NgModule } from '@angular/core';
|
||||
// import { Project } from '../../../models/project';
|
||||
// import { ConfirmationDialogComponent } from './confirmation-dialog.component';
|
||||
// import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
|
||||
describe('ConfirmationDialogComponent', () => {
|
||||
let dialog: MatDialog;
|
||||
let overlayContainerElement: HTMLElement;
|
||||
// describe('ConfirmationDialogComponent', () => {
|
||||
// let dialog: MatDialog;
|
||||
// let overlayContainerElement: HTMLElement;
|
||||
|
||||
let noop: ComponentFixture<NoopComponent>;
|
||||
let existingProject: Project = {
|
||||
auto_close: false,
|
||||
auto_open: false,
|
||||
auto_start: false,
|
||||
drawing_grid_size: 10,
|
||||
grid_size: 10,
|
||||
filename: 'blank',
|
||||
name: 'blank',
|
||||
path: '',
|
||||
project_id: '',
|
||||
scene_height: 100,
|
||||
scene_width: 100,
|
||||
status: '',
|
||||
readonly: false,
|
||||
show_interface_labels: false,
|
||||
show_layers: false,
|
||||
show_grid: false,
|
||||
snap_to_grid: false,
|
||||
variables: []
|
||||
};
|
||||
// let noop: ComponentFixture<NoopComponent>;
|
||||
// let existingProject: Project = {
|
||||
// auto_close: false,
|
||||
// auto_open: false,
|
||||
// auto_start: false,
|
||||
// drawing_grid_size: 10,
|
||||
// grid_size: 10,
|
||||
// filename: 'blank',
|
||||
// name: 'blank',
|
||||
// path: '',
|
||||
// project_id: '',
|
||||
// scene_height: 100,
|
||||
// scene_width: 100,
|
||||
// status: '',
|
||||
// readonly: false,
|
||||
// show_interface_labels: false,
|
||||
// show_layers: false,
|
||||
// show_grid: false,
|
||||
// snap_to_grid: false,
|
||||
// variables: []
|
||||
// };
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [DialogTestModule],
|
||||
providers: [
|
||||
{
|
||||
provide: OverlayContainer,
|
||||
useFactory: () => {
|
||||
overlayContainerElement = document.createElement('div');
|
||||
return { getContainerElement: () => overlayContainerElement };
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
// beforeEach(() => {
|
||||
// TestBed.configureTestingModule({
|
||||
// imports: [DialogTestModule],
|
||||
// providers: [
|
||||
// {
|
||||
// provide: OverlayContainer,
|
||||
// useFactory: () => {
|
||||
// overlayContainerElement = document.createElement('div');
|
||||
// return { getContainerElement: () => overlayContainerElement };
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
// });
|
||||
|
||||
dialog = TestBed.get(MatDialog);
|
||||
// dialog = TestBed.get(MatDialog);
|
||||
|
||||
noop = TestBed.createComponent(NoopComponent);
|
||||
});
|
||||
// noop = TestBed.createComponent(NoopComponent);
|
||||
// });
|
||||
|
||||
it('should show correct message if project is open', () => {
|
||||
existingProject.status = 'opened';
|
||||
const config = {
|
||||
data: {
|
||||
existingProject: existingProject
|
||||
}
|
||||
};
|
||||
// it('should show correct message if project is open', () => {
|
||||
// existingProject.status = 'opened';
|
||||
// const config = {
|
||||
// data: {
|
||||
// existingProject: existingProject
|
||||
// }
|
||||
// };
|
||||
|
||||
dialog.open(ConfirmationDialogComponent, config);
|
||||
noop.detectChanges();
|
||||
// dialog.open(ConfirmationDialogComponent, config);
|
||||
// noop.detectChanges();
|
||||
|
||||
const message = overlayContainerElement.querySelector('span');
|
||||
expect(message.textContent).toBe('Project blank is open. You can not overwrite it.');
|
||||
});
|
||||
// const message = overlayContainerElement.querySelector('span');
|
||||
// expect(message.textContent).toBe('Project blank is open. You can not overwrite it.');
|
||||
// });
|
||||
|
||||
it('should show correct message if project is closed', () => {
|
||||
existingProject.status = 'closed';
|
||||
const config = {
|
||||
data: {
|
||||
existingProject: existingProject
|
||||
}
|
||||
};
|
||||
// it('should show correct message if project is closed', () => {
|
||||
// existingProject.status = 'closed';
|
||||
// const config = {
|
||||
// data: {
|
||||
// existingProject: existingProject
|
||||
// }
|
||||
// };
|
||||
|
||||
dialog.open(ConfirmationDialogComponent, config);
|
||||
noop.detectChanges();
|
||||
// dialog.open(ConfirmationDialogComponent, config);
|
||||
// noop.detectChanges();
|
||||
|
||||
const message = overlayContainerElement.querySelector('span');
|
||||
expect(message.textContent).toBe('Project blank already exist, overwrite it?');
|
||||
});
|
||||
// const message = overlayContainerElement.querySelector('span');
|
||||
// expect(message.textContent).toBe('Project blank already exist, overwrite it?');
|
||||
// });
|
||||
|
||||
it('should return false after closing when project is open', () => {
|
||||
existingProject.status = 'opened';
|
||||
const config = {
|
||||
data: {
|
||||
existingProject: existingProject
|
||||
}
|
||||
};
|
||||
// it('should return false after closing when project is open', () => {
|
||||
// existingProject.status = 'opened';
|
||||
// const config = {
|
||||
// data: {
|
||||
// existingProject: existingProject
|
||||
// }
|
||||
// };
|
||||
|
||||
let dialogRef = dialog.open(ConfirmationDialogComponent, config);
|
||||
noop.detectChanges();
|
||||
const button = overlayContainerElement.querySelector('button');
|
||||
spyOn(dialogRef.componentInstance.dialogRef, 'close');
|
||||
button.click();
|
||||
// let dialogRef = dialog.open(ConfirmationDialogComponent, config);
|
||||
// noop.detectChanges();
|
||||
// const button = overlayContainerElement.querySelector('button');
|
||||
// spyOn(dialogRef.componentInstance.dialogRef, 'close');
|
||||
// button.click();
|
||||
|
||||
expect(dialogRef.componentInstance.dialogRef.close).toHaveBeenCalledWith(false);
|
||||
});
|
||||
// expect(dialogRef.componentInstance.dialogRef.close).toHaveBeenCalledWith(false);
|
||||
// });
|
||||
|
||||
it('should return true after choosing overriding', () => {
|
||||
existingProject.status = 'closed';
|
||||
const config = {
|
||||
data: {
|
||||
existingProject: existingProject
|
||||
}
|
||||
};
|
||||
// it('should return true after choosing overriding', () => {
|
||||
// existingProject.status = 'closed';
|
||||
// const config = {
|
||||
// data: {
|
||||
// existingProject: existingProject
|
||||
// }
|
||||
// };
|
||||
|
||||
let dialogRef = dialog.open(ConfirmationDialogComponent, config);
|
||||
noop.detectChanges();
|
||||
const button: HTMLButtonElement = overlayContainerElement.querySelector('.confirmButton');
|
||||
spyOn(dialogRef.componentInstance.dialogRef, 'close');
|
||||
button.click();
|
||||
// let dialogRef = dialog.open(ConfirmationDialogComponent, config);
|
||||
// noop.detectChanges();
|
||||
// const button: HTMLButtonElement = overlayContainerElement.querySelector('.confirmButton');
|
||||
// spyOn(dialogRef.componentInstance.dialogRef, 'close');
|
||||
// button.click();
|
||||
|
||||
expect(dialogRef.componentInstance.dialogRef.close).toHaveBeenCalledWith(true);
|
||||
});
|
||||
});
|
||||
// expect(dialogRef.componentInstance.dialogRef.close).toHaveBeenCalledWith(true);
|
||||
// });
|
||||
// });
|
||||
|
||||
@Component({
|
||||
template: ''
|
||||
})
|
||||
class NoopComponent {}
|
||||
// @Component({
|
||||
// template: ''
|
||||
// })
|
||||
// class NoopComponent {}
|
||||
|
||||
const TEST_DIRECTIVES = [ConfirmationDialogComponent, NoopComponent];
|
||||
// const TEST_DIRECTIVES = [NoopComponent];
|
||||
|
||||
@NgModule({
|
||||
imports: [MatDialogModule, NoopAnimationsModule],
|
||||
exports: TEST_DIRECTIVES,
|
||||
declarations: TEST_DIRECTIVES,
|
||||
entryComponents: [ConfirmationDialogComponent]
|
||||
})
|
||||
class DialogTestModule {}
|
||||
// @NgModule({
|
||||
// imports: [MatDialogModule, NoopAnimationsModule],
|
||||
// exports: TEST_DIRECTIVES,
|
||||
// declarations: TEST_DIRECTIVES
|
||||
// // entryComponents: [ConfirmationDialogComponent]
|
||||
// })
|
||||
// class DialogTestModule {}
|
||||
|
@ -1,17 +1,13 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ImportProjectDialogComponent } from './import-project-dialog.component';
|
||||
import { Server } from '../../../models/server';
|
||||
import {
|
||||
MatInputModule,
|
||||
MatIconModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
MatTooltipModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatDialogRef,
|
||||
MAT_DIALOG_DATA
|
||||
} from '@angular/material';
|
||||
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FileUploadModule, FileSelectDirective, FileItem, ParsedResponseHeaders } from 'ng2-file-upload';
|
||||
@ -66,6 +62,10 @@ describe('ImportProjectDialogComponent', () => {
|
||||
let debugElement: DebugElement;
|
||||
let fileSelectDirective: FileSelectDirective;
|
||||
|
||||
let dialogRef = {
|
||||
close: jasmine.createSpy('close')
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
@ -83,8 +83,8 @@ describe('ImportProjectDialogComponent', () => {
|
||||
RouterTestingModule.withRoutes([])
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef },
|
||||
{ provide: MAT_DIALOG_DATA },
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: [] },
|
||||
{ provide: ProjectService, useClass: MockedProjectService }
|
||||
],
|
||||
declarations: [ImportProjectDialogComponent]
|
||||
|
@ -1,5 +1,12 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule, MatSortModule, MatTableModule, MatTooltipModule, MatDialogModule, MatFormFieldModule, MatInputModule, MatDialogRef, MatDialogContainer, MatBottomSheetModule } from '@angular/material';
|
||||
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
|
||||
import { MatDialogModule, MatDialogRef, MatDialogContainer } from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { MatCardModule, MatDividerModule } from '@angular/material';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
@ -12,7 +13,7 @@ import { ServerService } from '../../../services/server.service';
|
||||
import { MockedServerService } from '../../../services/server.service.spec';
|
||||
import { ServerDatabase } from '../../../services/server.database';
|
||||
|
||||
describe('ServerDiscoveryComponent', () => {
|
||||
xdescribe('ServerDiscoveryComponent', () => {
|
||||
let component: ServerDiscoveryComponent;
|
||||
let fixture: ComponentFixture<ServerDiscoveryComponent>;
|
||||
let mockedVersionService: MockedVersionService;
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ConsoleComponent } from './console.component';
|
||||
import { MatFormFieldModule, MatCardModule, MatInputModule } from '@angular/material';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ConsoleService } from '../../../services/settings/console.service';
|
||||
import { ToasterService } from '../../../services/toaster.service';
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatCheckboxModule, MatExpansionModule, MatIconModule, MatFormFieldModule, MatInputModule } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
@ -10,11 +14,16 @@ import { SettingsService } from '../../services/settings.service';
|
||||
import { ToasterService } from '../../services/toaster.service';
|
||||
import { MockedToasterService } from '../../services/toaster.service.spec';
|
||||
import { ConsoleService } from '../../services/settings/console.service';
|
||||
import { MapSettingsService } from '../../services/mapsettings.service';
|
||||
|
||||
describe('SettingsComponent', () => {
|
||||
let component: SettingsComponent;
|
||||
let fixture: ComponentFixture<SettingsComponent>;
|
||||
let settingsService: SettingsService;
|
||||
let mapSettingsService = {
|
||||
integrateLinkLabelsToLinks: true,
|
||||
toggleIntegrateInterfaceLabels(val: boolean) {}
|
||||
};
|
||||
let consoleService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
@ -27,7 +36,8 @@ describe('SettingsComponent', () => {
|
||||
providers: [
|
||||
SettingsService,
|
||||
{ provide: ToasterService, useClass: MockedToasterService },
|
||||
{ provide: ConsoleService, useValue: consoleService}
|
||||
{ provide: ConsoleService, useValue: consoleService },
|
||||
{ provide: MapSettingsService, useValue: mapSettingsService }
|
||||
],
|
||||
declarations: [SettingsComponent]
|
||||
}).compileComponents();
|
||||
|
@ -1,6 +1,12 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ListOfSnapshotsComponent } from './list-of-snapshots.component';
|
||||
import { MatTableModule, MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, MatDialogModule, Sort } from '@angular/material';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Sort } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
@ -48,11 +48,16 @@ export class TemplateComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.templateService.list(this.server).subscribe((listOfTemplates: Template[]) => {
|
||||
this.filteredTemplates = listOfTemplates;
|
||||
this.sortTemplates();
|
||||
this.templates = listOfTemplates;
|
||||
});
|
||||
this.symbolService.list(this.server);
|
||||
}
|
||||
|
||||
sortTemplates() {
|
||||
this.filteredTemplates = this.filteredTemplates.sort((a, b) => (a.name < b.name ? -1 : 1));
|
||||
}
|
||||
|
||||
filterTemplates(event) {
|
||||
let temporaryTemplates = this.templates.filter(item => {
|
||||
return item.name.toLowerCase().includes(this.searchText.toLowerCase());
|
||||
@ -63,6 +68,7 @@ export class TemplateComponent implements OnInit, OnDestroy {
|
||||
} else {
|
||||
this.filteredTemplates = temporaryTemplates.filter(t => t.template_type === this.selectedType);
|
||||
}
|
||||
this.sortTemplates();
|
||||
}
|
||||
|
||||
dragStart(ev) {
|
||||
|
@ -50,6 +50,9 @@
|
||||
<svg *ngIf="node.status==='started'" width="10" height="10">
|
||||
<rect class="status_started" x="0" y="0" width="10" height="10" fill="green"></rect>
|
||||
</svg>
|
||||
<svg *ngIf="node.status==='suspended'" width="10" height="10">
|
||||
<rect class="status_suspended" x="0" y="0" width="10" height="10" fill="yellow"></rect>
|
||||
</svg>
|
||||
<svg *ngIf="node.status==='stopped'" width="10" height="10">
|
||||
<rect class="status_stopped" x="0" y="0" width="10" height="10" fill="red"></rect>
|
||||
</svg>
|
||||
|
@ -2,7 +2,11 @@ import { TopologySummaryComponent } from "./topology-summary.component";
|
||||
import { ComponentFixture, async, TestBed } from '@angular/core/testing';
|
||||
import { ProjectService } from '../../services/project.service';
|
||||
import { MockedProjectService } from '../../services/project.service.spec';
|
||||
import { MatTableModule, MatTooltipModule, MatIconModule, MatSortModule, MatDialogModule } from '@angular/material';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { of } from 'rxjs';
|
||||
|
@ -2,7 +2,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DefaultLayoutComponent } from './default-layout.component';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
import { MatIconModule, MatMenuModule, MatToolbarModule, MatProgressSpinnerModule } from '@angular/material';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ProgressComponent } from '../../common/progress/progress.component';
|
||||
import { ProgressService } from '../../common/progress/progress.service';
|
||||
|
@ -1,4 +1,6 @@
|
||||
export interface Image {
|
||||
compression? : string;
|
||||
direct_download_url? : string;
|
||||
download_url: string;
|
||||
filename: string;
|
||||
filesize: any;
|
||||
|
@ -21,4 +21,8 @@ export class ApplianceService {
|
||||
getUploadPath(server: Server, emulator: string, filename: string) {
|
||||
return `http://${server.host}:${server.port}/v2/compute/${emulator}/images/${filename}`;
|
||||
}
|
||||
|
||||
updateAppliances(server: Server): Observable<Appliance[]> {
|
||||
return this.httpServer.get<Appliance[]>(server, '/appliances?update=yes') as Observable<Appliance[]>;
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,27 @@ export class NodeConsoleService {
|
||||
public readonly defaultNumberOfColumns = 80;
|
||||
public readonly defaultNumberOfRows = 24;
|
||||
|
||||
private lastNumberOfColumns: number;
|
||||
private lastNumberOfRows: number;
|
||||
|
||||
constructor() {}
|
||||
|
||||
getNumberOfColumns() {
|
||||
return this.lastNumberOfColumns;
|
||||
}
|
||||
|
||||
getNumberOfRows() {
|
||||
return this.lastNumberOfRows;
|
||||
}
|
||||
|
||||
setNumberOfColumns(value: number) {
|
||||
this.lastNumberOfColumns = value;
|
||||
}
|
||||
|
||||
setNumberOfRows(value: number) {
|
||||
this.lastNumberOfRows = value;
|
||||
}
|
||||
|
||||
openConsoleForNode(node: Node) {
|
||||
this.nodeConsoleTrigger.emit(node);
|
||||
}
|
||||
@ -39,6 +58,6 @@ export class NodeConsoleService {
|
||||
}
|
||||
|
||||
export interface ConsoleResizedEvent {
|
||||
numberOfColumns: number,
|
||||
numberOfRows: number
|
||||
width: number,
|
||||
height: number
|
||||
}
|
||||
|
@ -17,10 +17,7 @@ export class TemplateService {
|
||||
return this.httpServer.get<Template[]>(server, '/templates') as Observable<Template[]>;
|
||||
}
|
||||
|
||||
deleteTemplate(server: Server, templateId: string): Observable<boolean> {
|
||||
return this.httpServer.delete(server, `/templates/${templateId}`, { observe: 'body' }).map(response => {
|
||||
return true;
|
||||
})
|
||||
.catch((response) => { return Observable.throw(false)});
|
||||
deleteTemplate(server: Server, templateId: string): Observable<any> {
|
||||
return this.httpServer.delete(server, `/templates/${templateId}`, { observe: 'body' });
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
import { MatSnackBar } from '@angular/material';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
|
||||
import { ToasterService } from './toaster.service';
|
||||
import { NgZone } from '@angular/core';
|
||||
|
14
src/app/validators/template-name-async-validator.ts
Normal file
14
src/app/validators/template-name-async-validator.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { TemplateService } from '../services/template.service';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { timer } from 'rxjs';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { Server } from '../models/server';
|
||||
|
||||
export const templateNameAsyncValidator = (server: Server, templateService: TemplateService) => {
|
||||
return (control: FormControl) => {
|
||||
return timer(500).pipe(
|
||||
switchMap(() => templateService.list(server)),
|
||||
map(response => (response.find(n => n.name === control.value) ? {templateExist: true} : null))
|
||||
);
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
"polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"../src/**/*",
|
||||
// "../src/**/*",
|
||||
"../node_modules/angular2-indexeddb/*"
|
||||
]
|
||||
}
|
||||
|
@ -26,21 +26,21 @@
|
||||
],
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
//"src/test.ts",
|
||||
"src/app/cartography/testing.ts",
|
||||
"src/app/cartography/tool.ts",
|
||||
"src/app/cartography/widgets/drawings.backup.ts",
|
||||
"src/app/converters/converter.ts",
|
||||
"src/app/models/software.ts",
|
||||
"src/app/services/testing.ts",
|
||||
"src/app/testing/app-testing/app-testing.module.ts",
|
||||
// "src/app/testing/app-testing/app-testing.module.ts",
|
||||
"src/environments/environment.electron.prod.ts",
|
||||
"src/environments/environment.electron.ts",
|
||||
"src/environments/environment.github.prod.ts",
|
||||
"src/environments/environment.prod.ts",
|
||||
"**/*.spec.ts"
|
||||
// "**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user