mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-26 19:34:33 +00:00
Implement Idle-PC finder for IOS templates
This commit is contained in:
parent
aeb26b0f17
commit
4a34007cf4
@ -243,6 +243,7 @@
|
||||
placeholder="Idle-PC"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<button mat-button class="idlePCFinderButton" (click)="findIdlePC()">Idle-PC finder</button><br /><br />
|
||||
<mat-form-field class="form-field">
|
||||
<input
|
||||
matInput
|
||||
|
@ -0,0 +1,3 @@
|
||||
.idlePCFinderButton {
|
||||
width: 100%;
|
||||
}
|
@ -7,6 +7,7 @@ import { IosConfigurationService } from '../../../../services/ios-configuration.
|
||||
import { IosService } from '../../../../services/ios.service';
|
||||
import { ControllerService } from '../../../../services/controller.service';
|
||||
import { ToasterService } from '../../../../services/toaster.service';
|
||||
import { ProgressService } from "../../../../common/progress/progress.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-ios-template-details',
|
||||
@ -14,7 +15,7 @@ import { ToasterService } from '../../../../services/toaster.service';
|
||||
styleUrls: ['./ios-template-details.component.scss', '../../preferences.component.scss'],
|
||||
})
|
||||
export class IosTemplateDetailsComponent implements OnInit {
|
||||
controller:Controller ;
|
||||
controller: Controller;
|
||||
iosTemplate: IosTemplate;
|
||||
isSymbolSelectionOpened: boolean = false;
|
||||
platforms: string[] = [];
|
||||
@ -41,6 +42,7 @@ export class IosTemplateDetailsComponent implements OnInit {
|
||||
private toasterService: ToasterService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private iosConfigurationService: IosConfigurationService,
|
||||
private progressService: ProgressService,
|
||||
private router: Router
|
||||
) {
|
||||
this.generalSettingsForm = this.formBuilder.group({
|
||||
@ -95,6 +97,27 @@ export class IosTemplateDetailsComponent implements OnInit {
|
||||
this.wicMatrix = this.iosConfigurationService.getWicMatrix();
|
||||
}
|
||||
|
||||
findIdlePC() {
|
||||
let data = {
|
||||
"image": this.iosTemplate.image,
|
||||
"platform": this.iosTemplate.platform,
|
||||
"ram": this.iosTemplate.ram
|
||||
};
|
||||
this.progressService.activate();
|
||||
this.iosService.findIdlePC(this.controller, data).subscribe((result: any) => {
|
||||
this.progressService.deactivate();
|
||||
if (result.idlepc !== null) {
|
||||
this.iosTemplate.idlepc = result.idlepc;
|
||||
this.toasterService.success(`Idle-PC value found: ${result.idlepc}`);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
this.progressService.deactivate();
|
||||
this.toasterService.error(`Error while finding an idle-PC value`);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
fillSlotsData() {
|
||||
|
||||
// load network adapters
|
||||
|
@ -37,4 +37,9 @@ export class IosService {
|
||||
iosTemplate
|
||||
) as Observable<IosTemplate>;
|
||||
}
|
||||
|
||||
findIdlePC(controller:Controller, body: any) {
|
||||
return this.httpController.post(controller, `/computes/${environment.compute_id}/dynamips/auto_idlepc`, body);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user