]>
Commit | Line | Data |
---|---|---|
6ac46211 DC |
1 | Ext.define('PVE.node.CreateDirectory', { |
2 | extend: 'Proxmox.window.Edit', | |
3 | xtype: 'pveCreateDirectory', | |
4 | ||
5 | subject: Proxmox.Utils.directoryText, | |
6 | ||
7 | showProgress: true, | |
8 | ||
9 | onlineHelp: 'chapter_storage', | |
10 | ||
8058410f | 11 | initComponent: function() { |
6ac46211 DC |
12 | var me = this; |
13 | ||
14 | if (!me.nodename) { | |
15 | throw "no node name specified"; | |
16 | } | |
17 | ||
18 | me.isCreate = true; | |
19 | ||
20 | Ext.applyIf(me, { | |
21 | url: "/nodes/" + me.nodename + "/disks/directory", | |
22 | method: 'POST', | |
23 | items: [ | |
24 | { | |
d0cfe2ea | 25 | xtype: 'pmxDiskSelector', |
6ac46211 DC |
26 | name: 'device', |
27 | nodename: me.nodename, | |
28 | diskType: 'unused', | |
29 | fieldLabel: gettext('Disk'), | |
f6710aac | 30 | allowBlank: false, |
6ac46211 DC |
31 | }, |
32 | { | |
33 | xtype: 'proxmoxKVComboBox', | |
34 | comboItems: [ | |
35 | ['ext4', 'ext4'], | |
f6710aac | 36 | ['xfs', 'xfs'], |
6ac46211 DC |
37 | ], |
38 | fieldLabel: gettext('Filesystem'), | |
39 | name: 'filesystem', | |
40 | value: '', | |
f6710aac | 41 | allowBlank: false, |
6ac46211 DC |
42 | }, |
43 | { | |
44 | xtype: 'proxmoxtextfield', | |
45 | name: 'name', | |
46 | fieldLabel: gettext('Name'), | |
f6710aac | 47 | allowBlank: false, |
6ac46211 DC |
48 | }, |
49 | { | |
50 | xtype: 'proxmoxcheckbox', | |
51 | name: 'add_storage', | |
52 | fieldLabel: gettext('Add Storage'), | |
f6710aac TL |
53 | value: '1', |
54 | }, | |
55 | ], | |
6ac46211 DC |
56 | }); |
57 | ||
58 | me.callParent(); | |
f6710aac | 59 | }, |
6ac46211 DC |
60 | }); |
61 | ||
62 | Ext.define('PVE.node.Directorylist', { | |
63 | extend: 'Ext.grid.Panel', | |
64 | xtype: 'pveDirectoryList', | |
65 | ||
66 | stateful: true, | |
67 | stateId: 'grid-node-directory', | |
68 | columns: [ | |
69 | { | |
70 | text: gettext('Path'), | |
71 | dataIndex: 'path', | |
f6710aac | 72 | flex: 1, |
6ac46211 DC |
73 | }, |
74 | { | |
75 | header: gettext('Device'), | |
76 | flex: 1, | |
f6710aac | 77 | dataIndex: 'device', |
6ac46211 DC |
78 | }, |
79 | { | |
80 | header: gettext('Type'), | |
81 | width: 100, | |
f6710aac | 82 | dataIndex: 'type', |
6ac46211 DC |
83 | }, |
84 | { | |
85 | header: gettext('Options'), | |
86 | width: 100, | |
f6710aac | 87 | dataIndex: 'options', |
6ac46211 DC |
88 | }, |
89 | { | |
90 | header: gettext('Unit File'), | |
91 | hidden: true, | |
f6710aac TL |
92 | dataIndex: 'unitfile', |
93 | }, | |
6ac46211 DC |
94 | ], |
95 | ||
96 | rootVisible: false, | |
97 | useArrows: true, | |
98 | ||
99 | tbar: [ | |
100 | { | |
101 | text: gettext('Reload'), | |
102 | iconCls: 'fa fa-refresh', | |
103 | handler: function() { | |
76509256 | 104 | this.up('panel').reload(); |
f6710aac | 105 | }, |
6ac46211 DC |
106 | }, |
107 | { | |
978e2aeb | 108 | text: `${gettext('Create')}: ${gettext('Directory')}`, |
6ac46211 | 109 | handler: function() { |
76509256 TL |
110 | let view = this.up('panel'); |
111 | Ext.create('PVE.node.CreateDirectory', { | |
112 | nodename: view.nodename, | |
113 | listeners: { | |
114 | destroy: () => view.reload(), | |
115 | }, | |
116 | autoShow: true, | |
117 | }); | |
f6710aac TL |
118 | }, |
119 | }, | |
6ac46211 DC |
120 | ], |
121 | ||
122 | reload: function() { | |
76509256 | 123 | let me = this; |
6ac46211 DC |
124 | me.store.load(); |
125 | me.store.sort(); | |
126 | }, | |
127 | ||
128 | listeners: { | |
129 | activate: function() { | |
76509256 | 130 | this.reload(); |
f6710aac | 131 | }, |
6ac46211 DC |
132 | }, |
133 | ||
134 | initComponent: function() { | |
76509256 | 135 | let me = this; |
6ac46211 DC |
136 | |
137 | me.nodename = me.pveSelNode.data.node; | |
138 | if (!me.nodename) { | |
139 | throw "no node name specified"; | |
140 | } | |
141 | ||
142 | Ext.apply(me, { | |
143 | store: { | |
8058410f | 144 | fields: ['path', 'device', 'type', 'options', 'unitfile'], |
6ac46211 DC |
145 | proxy: { |
146 | type: 'proxmox', | |
76509256 | 147 | url: `/api2/json/nodes/${me.nodename}/disks/directory`, |
6ac46211 | 148 | }, |
f6710aac TL |
149 | sorters: 'path', |
150 | }, | |
6ac46211 DC |
151 | }); |
152 | ||
153 | me.callParent(); | |
154 | ||
155 | Proxmox.Utils.monStoreErrors(me, me.getStore(), true); | |
156 | me.reload(); | |
f6710aac | 157 | }, |
6ac46211 DC |
158 | }); |
159 |