Skip to content

Commit

Permalink
Implement Idle-PC finder for IOS templates
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Feb 22, 2025
1 parent aeb26b0 commit 4a34007
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ <h6>WICs</h6>
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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idlePCFinderButton {
width: 100%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ 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',
templateUrl: './ios-template-details.component.html',
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[] = [];
Expand All @@ -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({
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/app/services/ios.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}

0 comments on commit 4a34007

Please sign in to comment.