]>
Commit | Line | Data |
---|---|---|
c0ac2074 DC |
1 | Ext.define('PBS.DataStorePanel', { |
2 | extend: 'Ext.tab.Panel', | |
3 | alias: 'widget.pbsDataStorePanel', | |
4 | mixins: ['Proxmox.Mixin.CBind'], | |
5 | ||
6 | cbindData: function(initalConfig) { | |
7 | let me = this; | |
8 | return { | |
9 | aclPath: `/datastore/${me.datastore}`, | |
10 | }; | |
11 | }, | |
12 | ||
1dceaed1 DC |
13 | stateId: 'pbs-datastore-panel', |
14 | stateful: true, | |
15 | ||
16 | stateEvents: ['tabchange'], | |
17 | ||
18 | applyState: function(state) { | |
19 | let me = this; | |
240b2ffb | 20 | if (state.tab !== undefined && me.rendered) { |
1dceaed1 | 21 | me.setActiveTab(state.tab); |
240b2ffb DC |
22 | } else if (state.tab) { |
23 | // if we are not rendered yet, defer setting the activetab | |
a502bc56 | 24 | setTimeout(() => me.setActiveTab(state.tab), 10); |
1dceaed1 DC |
25 | } |
26 | }, | |
27 | ||
28 | getState: function() { | |
29 | let me = this; | |
30 | return { | |
31 | tab: me.getActiveTab().getItemId(), | |
32 | }; | |
33 | }, | |
34 | ||
c0ac2074 DC |
35 | border: false, |
36 | defaults: { | |
37 | border: false, | |
38 | }, | |
39 | ||
31112c79 DM |
40 | tools: [PBS.Utils.get_help_tool("datastore_intro")], |
41 | ||
c0ac2074 DC |
42 | items: [ |
43 | { | |
68931742 DC |
44 | xtype: 'pbsDataStoreSummary', |
45 | title: gettext('Summary'), | |
46 | itemId: 'summary', | |
028d0a13 | 47 | iconCls: 'fa fa-book', |
3ea14859 DC |
48 | cbind: { |
49 | datastore: '{datastore}', | |
50 | }, | |
51 | }, | |
52 | { | |
68931742 DC |
53 | xtype: 'pbsDataStoreContent', |
54 | itemId: 'content', | |
028d0a13 | 55 | iconCls: 'fa fa-th', |
c0ac2074 DC |
56 | cbind: { |
57 | datastore: '{datastore}', | |
58 | }, | |
59 | }, | |
1a0d3d11 | 60 | { |
cd828700 | 61 | title: gettext('Prune & GC'), |
68931742 DC |
62 | xtype: 'pbsDataStorePruneAndGC', |
63 | itemId: 'prunegc', | |
028d0a13 DC |
64 | iconCls: 'fa fa-trash-o', |
65 | cbind: { | |
66 | datastore: '{datastore}', | |
67 | }, | |
68 | }, | |
69 | { | |
70 | iconCls: 'fa fa-refresh', | |
71 | itemId: 'syncjobs', | |
72 | xtype: 'pbsSyncJobView', | |
73 | cbind: { | |
74 | datastore: '{datastore}', | |
75 | }, | |
76 | }, | |
77 | { | |
78 | iconCls: 'fa fa-check-circle', | |
79 | itemId: 'verifyjobs', | |
80 | xtype: 'pbsVerifyJobView', | |
1a0d3d11 DM |
81 | cbind: { |
82 | datastore: '{datastore}', | |
83 | }, | |
84 | }, | |
b614b29b TL |
85 | { |
86 | xtype: 'pbsDatastoreOptionView', | |
87 | itemId: 'options', | |
88 | title: gettext('Options'), | |
89 | iconCls: 'fa fa-cog', | |
90 | cbind: { | |
91 | datastore: '{datastore}', | |
92 | }, | |
93 | }, | |
c0ac2074 DC |
94 | { |
95 | itemId: 'acl', | |
96 | xtype: 'pbsACLView', | |
028d0a13 | 97 | iconCls: 'fa fa-unlock', |
c0ac2074 DC |
98 | cbind: { |
99 | aclPath: '{aclPath}', | |
33612525 | 100 | datastore: '{datastore}', |
c0ac2074 DC |
101 | }, |
102 | }, | |
103 | ], | |
104 | ||
105 | initComponent: function() { | |
106 | let me = this; | |
58f950c5 | 107 | me.title = `${gettext("Datastore")}: ${me.datastore}`; |
240b2ffb DC |
108 | // remove invalid activeTab settings |
109 | if (me.activeTab && !me.items.some((item) => item.itemId === me.activeTab)) { | |
110 | delete me.activeTab; | |
111 | } | |
c0ac2074 DC |
112 | me.callParent(); |
113 | }, | |
114 | }); |