blob: a3dde96a1d5ed9287b3ef37b443c155188ea5a7d [file] [log] [blame]
Max Chu3c8b65f2017-07-19 17:47:59 -07001let self;
2
3class ElineSide {
4
5 static $inject = ['XosSidePanel', 'XosModelStore', '$http', '$log', 'toastr'];
6
7 constructor(
8 private XosSidePanel: any,
9 private XosModelStore: any,
10 private $http: any,
11 private $log: any,
12 private toastr: any,
13 ) {
14 self = this;
15 }
16
17 public saveEline(item: any) {
18 let path = item.path;
19 delete item.path;
20 item.$save().then((res) => {
21 item.path = path;
22 this.toastr.success(`${item.name} successfully saved!`);
23 })
24 .catch((error) => {
25 this.toastr.error(`Error while saving ${item.name}: ${error.specific_error}`);
26 });
27 }
28
Max Chudafc0ba2017-08-15 11:03:09 -070029 public deleteEline(item: any) {
30 let name = item.name;
31 item.$delete().then((res) => {
32 this.toastr.success(`${name} successfully deleted!`);
33 })
34 .catch((error) => {
35 this.toastr.error(`Error while deleting ${name}: ${error.specific_error}`);
36 });
37 }
Max Chu3c8b65f2017-07-19 17:47:59 -070038
39}
40
41export const elineSide: angular.IComponentOptions = {
42 template: require('./eline-side.component.html'),
43 controllerAs: 'vm',
44 controller: ElineSide,
45 bindings: {
46 mng: '='
47 }
48};