blob: 92ca239f86d49bb9cda40ceb1ffa9fb187e4372a [file] [log] [blame]
Max Chu886c89f2017-08-24 15:44:27 -07001/*
2 * Copyright 2017-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import './confirm.scss';
18
19export interface IXosConfirmConfig {
20 header?: string;
21 text?: string;
22 actions: IXosConfirmConfigAction[];
23}
24
25export interface IXosConfirmConfigAction {
26 label?: string;
27 cb: Function;
28 icon?: string;
29 class?: string;
30}
31
32class ConfirmCtrl {
33
34 static $inject = ['XosConfirm'];
35
36 public resolve;
37 public config: IXosConfirmConfig;
38
39 constructor(
40 private XosConfirm: any
41 ) {
42
43 }
44
45 public $onInit() {
46 this.config = this.resolve.config;
47 }
48
49 public close(cb: Function) {
50 this.XosConfirm.close(cb);
51 }
52
53 public dismiss() {
54 this.XosConfirm.dismiss();
55 }
56
57}
58
59export const xosConfirm: angular.IComponentOptions = {
60 template: require('./confirm.html'),
61 controllerAs: 'vm',
62 controller: ConfirmCtrl,
63 bindings: {
64 resolve: '<',
65 close: '&',
66 dismiss: '&'
67 }
68};