|
|
|
import {Component, OnInit} from '@angular/core';
|
|
|
|
|
|
|
|
import { Platform } from '@ionic/angular';
|
|
|
|
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
|
|
import { StatusBar } from '@ionic-native/status-bar/ngx';
|
|
|
|
import { ApiService } from './service/api.service';
|
|
|
|
import {Router} from '@angular/router';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: 'app.component.html',
|
|
|
|
styleUrls: ['app.component.scss']
|
|
|
|
})
|
|
|
|
export class AppComponent implements OnInit {
|
|
|
|
|
|
|
|
public nodes = [];
|
|
|
|
public options = {
|
|
|
|
actionMapping: {
|
|
|
|
mouse: {
|
|
|
|
dblClick: (tree, node, $event) => {
|
|
|
|
console.log({tree, node, $event});
|
|
|
|
const id = node.data.id;
|
|
|
|
this.router.navigate(['/editor', {id}]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private platform: Platform,
|
|
|
|
private splashScreen: SplashScreen,
|
|
|
|
private statusBar: StatusBar,
|
|
|
|
private api: ApiService,
|
|
|
|
protected router: Router,
|
|
|
|
) {
|
|
|
|
this.initializeApp();
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.api.get('/menu/items').subscribe(result => {
|
|
|
|
this.nodes = result.data;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
initializeApp() {
|
|
|
|
this.platform.ready().then(() => {
|
|
|
|
this.statusBar.styleDefault();
|
|
|
|
this.splashScreen.hide();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|