-
+
diff --git a/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.scss b/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.scss
index 89cba97a..e69de29b 100644
--- a/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.scss
+++ b/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.scss
@@ -1,63 +0,0 @@
-.row {
- width: 100%;
- margin-left: 0px;
-}
-
-.select {
- width: 100%;
-}
-
-.nonvisible {
- display: none;
-}
-
-.file-button {
- width: 18%;
-}
-
-.file-name-form-field {
- padding-right: 2%;
- width: 80%;
-}
-
-.configButton {
- width: 100%;
- margin-bottom: 10px;
-}
-
-.configHideButton {
- margin-left: 80%;
- width: 20%;
- margin-bottom: 10px;
-}
-
-.shadowed {
- display: none;
- transition: 0.25s;
-}
-
-.top-button {
- height: 36px;
- margin-top: 22px
-}
-
-.symbolSelectionButton {
- width: 100%;
-}
-
-.nonshadowed {
- opacity: 0;
- transition: 0.25s;
-}
-
-th {
- border: 0px!important;
-}
-
-th.mat-header-cell {
- padding-bottom: 15px;
-}
-
-td.mat-cell {
- padding-top: 15px;
-}
diff --git a/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.spec.ts b/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.spec.ts
index 4e311df6..625ff091 100644
--- a/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.spec.ts
+++ b/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.spec.ts
@@ -68,6 +68,10 @@ describe('DockerTemplateDetailsComponent', () => {
it('should call save template', () => {
spyOn(mockedDockerService, 'saveTemplate').and.returnValue(of({} as DockerTemplate));
+ component.generalSettingsForm.controls['templateName'].setValue('template name');
+ component.generalSettingsForm.controls['defaultName'].setValue('default name');
+ component.generalSettingsForm.controls['adapter'].setValue(1);
+ component.generalSettingsForm.controls['symbol'].setValue('symbol path');
component.onSave();
diff --git a/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.ts b/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.ts
index 1902fc3c..18ffaa61 100644
--- a/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.ts
+++ b/src/app/components/preferences/docker/docker-template-details/docker-template-details.component.ts
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
-import { ActivatedRoute, ParamMap } from '@angular/router';
+import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { ServerService } from '../../../../services/server.service';
import { Server } from '../../../../models/server';
import { ToasterService } from '../../../../services/toaster.service';
@@ -7,12 +7,13 @@ import { CustomAdapter } from '../../../../models/qemu/qemu-custom-adapter';
import { DockerTemplate } from '../../../../models/templates/docker-template';
import { DockerService } from '../../../../services/docker.service';
import { DockerConfigurationService } from '../../../../services/docker-configuration.service';
+import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms';
@Component({
selector: 'app-docker-template-details',
templateUrl: './docker-template-details.component.html',
- styleUrls: ['./docker-template-details.component.scss']
+ styleUrls: ['./docker-template-details.component.scss', '../../preferences.component.scss']
})
export class DockerTemplateDetailsComponent implements OnInit {
server: Server;
@@ -26,13 +27,24 @@ export class DockerTemplateDetailsComponent implements OnInit {
adapters: CustomAdapter[] = [];
displayedColumns: string[] = ['adapter_number', 'port_name'];
+ generalSettingsForm: FormGroup;
+
constructor(
private route: ActivatedRoute,
private serverService: ServerService,
private dockerService: DockerService,
private toasterService: ToasterService,
- private configurationService: DockerConfigurationService
- ){}
+ private configurationService: DockerConfigurationService,
+ private formBuilder: FormBuilder,
+ private router: Router
+ ){
+ this.generalSettingsForm = this.formBuilder.group({
+ templateName: new FormControl('', Validators.required),
+ defaultName: new FormControl('', Validators.required),
+ adapter: new FormControl('', Validators.required),
+ symbol: new FormControl('', Validators.required)
+ });
+ }
ngOnInit(){
const server_id = this.route.snapshot.paramMap.get("server_id");
@@ -53,10 +65,18 @@ export class DockerTemplateDetailsComponent implements OnInit {
this.consoleResolutions = this.configurationService.getConsoleResolutions();
}
+ goBack() {
+ this.router.navigate(['/server', this.server.id, 'preferences', 'docker', 'templates']);
+ }
+
onSave(){
- this.dockerService.saveTemplate(this.server, this.dockerTemplate).subscribe((savedTemplate: DockerTemplate) => {
- this.toasterService.success("Changes saved");
- });
+ if (this.generalSettingsForm.invalid) {
+ this.toasterService.error(`Fill all required fields`);
+ } else {
+ this.dockerService.saveTemplate(this.server, this.dockerTemplate).subscribe((savedTemplate: DockerTemplate) => {
+ this.toasterService.success("Changes saved");
+ });
+ }
}
chooseSymbol() {
diff --git a/src/app/components/preferences/docker/docker-templates/docker-templates.component.html b/src/app/components/preferences/docker/docker-templates/docker-templates.component.html
index 3d2b2a88..c760a4fa 100644
--- a/src/app/components/preferences/docker/docker-templates/docker-templates.component.html
+++ b/src/app/components/preferences/docker/docker-templates/docker-templates.component.html
@@ -2,6 +2,7 @@
@@ -9,8 +10,8 @@
-
- {{template.name}}
+
+ {{template.name}}
@@ -22,7 +23,7 @@
content_copyCopy
-
+
diff --git a/src/app/components/preferences/docker/docker-templates/docker-templates.component.scss b/src/app/components/preferences/docker/docker-templates/docker-templates.component.scss
index b0726321..e69de29b 100644
--- a/src/app/components/preferences/docker/docker-templates/docker-templates.component.scss
+++ b/src/app/components/preferences/docker/docker-templates/docker-templates.component.scss
@@ -1,12 +0,0 @@
-.top-button {
- height: 36px;
- margin-top: 22px
-}
-
-.name {
- width: 95%;
-}
-
-.menu-button {
- width: 5%;
-}
diff --git a/src/app/components/preferences/docker/docker-templates/docker-templates.component.ts b/src/app/components/preferences/docker/docker-templates/docker-templates.component.ts
index e5d48cf2..4ca6e1c3 100644
--- a/src/app/components/preferences/docker/docker-templates/docker-templates.component.ts
+++ b/src/app/components/preferences/docker/docker-templates/docker-templates.component.ts
@@ -1,8 +1,7 @@
import { Component, OnInit, ViewChild } from "@angular/core";
import { Server } from '../../../../models/server';
-import { ActivatedRoute, ParamMap, Router } from '@angular/router';
+import { ActivatedRoute, Router } from '@angular/router';
import { ServerService } from '../../../../services/server.service';
-import { switchMap } from 'rxjs/operators';
import { DeleteTemplateComponent } from '../../common/delete-template-component/delete-template.component';
import { DockerTemplate } from '../../../../models/templates/docker-template';
import { DockerService } from '../../../../services/docker.service';
@@ -11,7 +10,7 @@ import { DockerService } from '../../../../services/docker.service';
@Component({
selector: 'app-docker-templates',
templateUrl: './docker-templates.component.html',
- styleUrls: ['./docker-templates.component.scss']
+ styleUrls: ['./docker-templates.component.scss', '../../preferences.component.scss']
})
export class DockerTemplatesComponent implements OnInit {
server: Server;
diff --git a/src/app/components/preferences/dynamips/ios-templates/ios-templates.component.ts b/src/app/components/preferences/dynamips/ios-templates/ios-templates.component.ts
index 2aad69b6..00fde8ff 100644
--- a/src/app/components/preferences/dynamips/ios-templates/ios-templates.component.ts
+++ b/src/app/components/preferences/dynamips/ios-templates/ios-templates.component.ts
@@ -34,7 +34,6 @@ export class IosTemplatesComponent implements OnInit {
}
getTemplates() {
- this.iosTemplates = [];
this.iosService.getTemplates(this.server).subscribe((templates: IosTemplate[]) => {
this.iosTemplates = templates.filter((elem) => elem.template_type === 'dynamips');
});
diff --git a/src/app/components/preferences/preferences.component.scss b/src/app/components/preferences/preferences.component.scss
index b9f070fc..ffe18d4f 100644
--- a/src/app/components/preferences/preferences.component.scss
+++ b/src/app/components/preferences/preferences.component.scss
@@ -31,6 +31,16 @@
display: none;
}
+.configButton {
+ width: 100%;
+}
+
+.configHideButton {
+ margin-left: 80%;
+ width: 20%;
+ margin-bottom: 10px;
+}
+
.symbolSelectionButton {
width: 100%;
}
diff --git a/src/app/components/preferences/preferences.component.ts b/src/app/components/preferences/preferences.component.ts
index 5d36c142..78ecb2f8 100644
--- a/src/app/components/preferences/preferences.component.ts
+++ b/src/app/components/preferences/preferences.component.ts
@@ -1,7 +1,5 @@
import { Component, OnInit } from "@angular/core";
-import { ActivatedRoute, ParamMap } from '@angular/router';
-import { ServerService } from '../../services/server.service';
-import { switchMap } from 'rxjs/operators';
+import { ActivatedRoute } from '@angular/router';
@Component({
diff --git a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html
index 5949f1f0..cf51b441 100644
--- a/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html
+++ b/src/app/components/preferences/qemu/add-qemu-vm-template/add-qemu-vm-template.component.html
@@ -8,7 +8,7 @@
-
-
-
-
+