]>
Commit | Line | Data |
---|---|---|
ffdf818d DC |
1 | Ext.define('PMG.dashboard.SubscriptionInfo', { |
2 | extend: 'Ext.panel.Panel', | |
3 | xtype: 'pmgSubscriptionInfo', | |
4 | ||
5 | data: { | |
6 | icon: 'question-circle', | |
c87d46fb | 7 | message: gettext('Unknown'), |
ffdf818d DC |
8 | }, |
9 | ||
10 | style: { | |
c87d46fb | 11 | cursor: 'pointer', |
ffdf818d DC |
12 | }, |
13 | ||
14 | setSubStatus: function(status) { | |
15 | var me = this; | |
16 | var data = {}; | |
17 | ||
18 | switch (status) { | |
19 | case 2: | |
20 | data.icon = 'check green'; | |
21 | data.message = gettext('Your subscription status is valid.'); | |
22 | break; | |
c87d46fb | 23 | case 1: |
ffdf818d DC |
24 | data.icon = 'exclamation-triangle yellow'; |
25 | data.message = gettext('Warning: Your subscription levels are not the same.'); | |
26 | break; | |
c87d46fb | 27 | case 0: |
ffdf818d DC |
28 | data.icon = 'times-circle red'; |
29 | data.message = gettext('You have at least one node without subscription.'); | |
30 | break; | |
31 | default: | |
32 | throw 'invalid subscription status'; | |
33 | } | |
34 | me.update(data); | |
35 | }, | |
36 | tpl: [ | |
37 | '<table style="height: 100%;" class="dash">', | |
38 | '<tr><td class="center">', | |
39 | '<i class="fa fa-3x fa-{icon}"></i>', | |
40 | '</td><td class="center">{message}</td></tr>', | |
c87d46fb | 41 | '</table>', |
ffdf818d DC |
42 | ], |
43 | ||
44 | listeners: { | |
45 | click: { | |
46 | element: 'body', | |
47 | fn: function() { | |
48 | var mainview = this.component.up('mainview'); | |
49 | mainview.getController().redirectTo('pmgSubscription'); | |
c87d46fb TL |
50 | }, |
51 | }, | |
52 | }, | |
131ba4f6 | 53 | }); |