mirror of
https://github.com/MikroWizard/mikrofront.git
synced 2025-07-15 13:34:20 +02:00
Allow deleting of firmwares
This commit is contained in:
parent
d6276f7246
commit
cbcc175c84
6 changed files with 58 additions and 4 deletions
|
@ -463,6 +463,13 @@ export class dataProvider {
|
|||
return this.MikroWizardRPC.sendJsonRequest("/api/firmware/get_firms", data);
|
||||
}
|
||||
|
||||
delete_firm(id:number){
|
||||
var data={
|
||||
'id':id
|
||||
}
|
||||
return this.MikroWizardRPC.sendJsonRequest("/api/firmware/delete_from_repository", data);
|
||||
}
|
||||
|
||||
get_backups(data:any) {
|
||||
return this.MikroWizardRPC.sendJsonRequest("/api/backup/list", data);
|
||||
}
|
||||
|
|
|
@ -59,9 +59,7 @@
|
|||
<input (ngModelChange)="reinitgrid('ip',$event)" [(ngModel)]="filters['ip']" matInput>
|
||||
</mat-form-field>
|
||||
</c-col>
|
||||
|
||||
</div>
|
||||
|
||||
</c-row>
|
||||
<gui-grid [rowDetail]="rowDetail" [source]="source" [columnMenu]="columnMenu" [paging]="paging"
|
||||
[sorting]="sorting" [infoPanel]="infoPanel" [autoResizeWidth]=true>
|
||||
|
|
|
@ -181,9 +181,11 @@ export class BackupsComponent implements OnInit {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
toggleCollapse(): void {
|
||||
this.filters_visible = !this.filters_visible;
|
||||
}
|
||||
|
||||
restore_backup(apply:boolean=false){
|
||||
var _slef=this;
|
||||
if (!apply){
|
||||
|
@ -209,6 +211,7 @@ export class BackupsComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
start_compare(){
|
||||
var _self=this;
|
||||
this.comparecontents=[]
|
||||
|
|
|
@ -39,7 +39,6 @@ export class DevicesComponent implements OnInit, OnDestroy {
|
|||
public tz: string;
|
||||
public ispro:boolean=false;
|
||||
|
||||
|
||||
constructor(
|
||||
private data_provider: dataProvider,
|
||||
private route: ActivatedRoute,
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
{{value}}
|
||||
</ng-template>
|
||||
</gui-grid-column>
|
||||
<gui-grid-column header="Actions" width="120" field="action">
|
||||
<ng-template let-value="item.id" let-item="item" let-index="index">
|
||||
<button cButton color="danger" size="sm" (click)="delete_fimrware(item);"><i
|
||||
class="fa-regular fa-trash-can"></i></button>
|
||||
</ng-template>
|
||||
</gui-grid-column>
|
||||
</gui-grid>
|
||||
</c-input-group>
|
||||
|
||||
|
@ -229,4 +235,22 @@
|
|||
</c-modal-footer>
|
||||
</c-modal>
|
||||
|
||||
<c-modal #DeleteConfirmModal backdrop="static" [(visible)]="DeleteConfirmModalVisible" id="DeleteConfirmModal">
|
||||
<c-modal-header>
|
||||
<h6 cModalTitle>Delete Firmware from Repo</h6>
|
||||
<button [cModalToggle]="DeleteConfirmModal.id" cButtonClose></button>
|
||||
</c-modal-header>
|
||||
<c-modal-body>
|
||||
Are you sure that You want to Delete Firmware {{currentFirm.version}}/{{currentFirm.architecture}}?
|
||||
<br />
|
||||
</c-modal-body>
|
||||
<c-modal-footer>
|
||||
<button (click)="delete_fimrware(currentFirm,true)" cButton color="danger">
|
||||
Yes,Delete.
|
||||
</button>
|
||||
<button [cModalToggle]="DeleteConfirmModal.id" cButton color="info">
|
||||
No.
|
||||
</button>
|
||||
</c-modal-footer>
|
||||
</c-modal>
|
||||
<c-toaster position="fixed" placement="top-end"></c-toaster>
|
|
@ -22,6 +22,7 @@ import {
|
|||
import { ToasterComponent } from "@coreui/angular";
|
||||
import { AppToastComponent } from "../toast-simple/toast.component";
|
||||
import { TimeZones } from "./timezones-data";
|
||||
import { error } from "console";
|
||||
|
||||
@Component({
|
||||
templateUrl: "settings.component.html",
|
||||
|
@ -75,6 +76,7 @@ export class SettingsComponent implements OnInit {
|
|||
public SysConfigloading: boolean = true;
|
||||
|
||||
public ConfirmModalVisible: boolean = false;
|
||||
public DeleteConfirmModalVisible: boolean = false;
|
||||
public rows: any = [];
|
||||
public Selectedrows: any;
|
||||
public updateBehavior: string = "keep";
|
||||
|
@ -83,7 +85,7 @@ export class SettingsComponent implements OnInit {
|
|||
public available_firmwares: any = [];
|
||||
public available_firmwaresv6: any = [];
|
||||
public sysconfigs: any = [];
|
||||
|
||||
public currentFirm:any = [];
|
||||
toasterForm = {
|
||||
autohide: true,
|
||||
delay: 3000,
|
||||
|
@ -130,7 +132,28 @@ export class SettingsComponent implements OnInit {
|
|||
this.initFirmsTable();
|
||||
this.initsettings();
|
||||
}
|
||||
delete_fimrware(firm:any,del:boolean=false) {
|
||||
var _self = this;
|
||||
_self.currentFirm=firm;
|
||||
if(del){
|
||||
this.data_provider.delete_firm(this.currentFirm.id).then((res) => {
|
||||
if (res.status == true){
|
||||
_self.DeleteConfirmModalVisible=false;
|
||||
_self.initFirmsTable();
|
||||
}
|
||||
else if ('err' in res){
|
||||
_self.show_toast(
|
||||
"Firmware Delete",
|
||||
res.err,
|
||||
"danger"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
_self.DeleteConfirmModalVisible=true;
|
||||
|
||||
}
|
||||
start_download() {
|
||||
var _self = this;
|
||||
this.loading = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue