mikrofront/src/app/containers/default-layout/default-header/default-header.component.ts
sepehr 95d84faf17 Bugs:
Fixed Firmware download from the Mikrotik website when there are multiple npk available
Fixed Mikrowizard system permission error when it is set to None
Fixed user device group permissions
Some minor UI improvements
Fix IP scan for one IP scan / Fix not scanning the last IP in the range
Fix manual snippet execution not working when device groups are selected
Some minor bug fixes and improvements

New:
Show background tasks and be able to stop them while running in the background (like an IP scanner)
Add support for manual MikroWizard update dashboard/settings page
update to version 1.0.5

Enhancement:
Show permission error in some pages when the  user doesn't have permission for that page/action
show better charts/graphs in the dashboard and device interface details
show more info on the dashboard about update and version information and license
2025-01-02 20:20:59 +03:00

93 lines
2.5 KiB
TypeScript

import { Component, Input ,Output,EventEmitter} from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { loginChecker } from '../../../providers/login_checker';
import { Router } from "@angular/router";
import { dataProvider } from '../../../providers/mikrowizard/data';
import { User } from '../../../providers/mikrowizard/user';
import { ClassToggleService, HeaderComponent } from '@coreui/angular';
@Component({
selector: 'app-default-header',
templateUrl: './default-header.component.html',
})
export class DefaultHeaderComponent extends HeaderComponent {
@Input() sidebarId: string = "sidebar";
@Output() UserModalEvent = new EventEmitter<any>();
@Output() ConfirmModalEvent = new EventEmitter<any>();
public newMessages = new Array(4)
public newTasks = new Array(5)
public newNotifications = new Array(5)
public current_user: User;
public uid: number;
public uname: string;
public fname: string;
public lname: string;
public ConfirmModalVisible : boolean = false;
public tasks : any = [];
public timer : any;
constructor(
private classToggler: ClassToggleService,
private router: Router,
private login_checker: loginChecker,
private data_provider: dataProvider,
) {
super();
var _self = this;
var session_info: string = localStorage.getItem('current_user') || "[]";
this.current_user = JSON.parse(session_info);
}
submit(){
}
get_user_info() {
var _self = this;
this.uid = this.current_user.partner_id;
this.uname = this.current_user.name;
this.fname = this.current_user.firstname;
this.lname = this.current_user.lastname;
}
callParent(action:string): void {
this.UserModalEvent.next(action);
}
callParentConfirm(action:string,data:any): void {
this.ConfirmModalEvent.next({action:action,data:data});
}
logout() {
this.data_provider.logout().then(res => {
this.router.navigate(['login']);
})
}
ngOnInit(): void {
var _self = this;
console.log('DefaultHeaderComponent');
this.get_user_info();
this.data_provider.get_running_tasks().then(res => {
_self.tasks = res['tasks'].filter((x:any) => x.status);
})
// get running tasks every 5 seconds
this.timer=setInterval(function(){
_self.get_running_tasks();
}, 5000);
}
get_running_tasks(){
var _self = this;
this.data_provider.get_running_tasks().then(res => {
_self.tasks = res['tasks'].filter((x:any) => x.status);
})
}
ngOnDestroy(): void {
clearInterval(this.timer);
}
}