import {Component, OnInit, Type} from '@angular/core';
import {FramePageComponent} from "../../core/page/frame.page";
import {FrameResDetailComponent} from "../frame-res-detail/frame-res-detail.component";
import {BsModalService} from "ngx-bootstrap/modal";
import {FrameResTreeComponent} from "../frame-res-tree/frame-res-tree.component";

@Component({
  selector: 'app-frame-res-page',
  templateUrl: './frame-res-page.component.html',
  styleUrls: ['./frame-res-page.component.scss']
})
export class FrameResPageComponent extends FramePageComponent implements OnInit {

  FrameResTreeComponent = FrameResTreeComponent;

  constructor(private modalService: BsModalService) {
    super(modalService);
    this.modalComponent = FrameResDetailComponent;
  }

  ngOnInit(): void {
  }

  //资源同步
  syncRes() {
    this.MsgService.confirmAlert('确定要同步菜单吗？同步之前，就确保升级了最新的框架包。并在业务系统根目录下新建sys-res.properties了文件，格式为：【菜单url=菜单ID,菜单名称】',
     () => {
      this.AjaxService.request('frame/res/sync.htm', {}, () => {
        this.MsgService.successToastr('同步成功！');
      }, {RequestWithLoading: true});
    });
  }

}
