]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/ACMEClusterView.js
ui: realm: clarify that the sync jobs really are for the realm
[pve-manager.git] / www / manager6 / dc / ACMEClusterView.js
1 Ext.define('pve-acme-accounts', {
2 extend: 'Ext.data.Model',
3 fields: ['name'],
4 proxy: {
5 type: 'proxmox',
6 url: "/api2/json/cluster/acme/account",
7 },
8 idProperty: 'name',
9 });
10
11 Ext.define('pve-acme-plugins', {
12 extend: 'Ext.data.Model',
13 fields: ['type', 'plugin', 'api'],
14 proxy: {
15 type: 'proxmox',
16 url: "/api2/json/cluster/acme/plugins",
17 },
18 idProperty: 'plugin',
19 });
20
21 Ext.define('PVE.dc.ACMEAccountView', {
22 extend: 'Ext.grid.Panel',
23 alias: 'widget.pveACMEAccountView',
24
25 title: gettext('Accounts'),
26
27 controller: {
28 xclass: 'Ext.app.ViewController',
29
30 addAccount: function() {
31 let me = this;
32 let view = me.getView();
33 let defaultExists = view.getStore().findExact('name', 'default') !== -1;
34 Ext.create('PVE.node.ACMEAccountCreate', {
35 defaultExists,
36 taskDone: function() {
37 me.reload();
38 },
39 }).show();
40 },
41
42 viewAccount: function() {
43 let me = this;
44 let view = me.getView();
45 let selection = view.getSelection();
46 if (selection.length < 1) return;
47 Ext.create('PVE.node.ACMEAccountView', {
48 accountname: selection[0].data.name,
49 }).show();
50 },
51
52 reload: function() {
53 let me = this;
54 let view = me.getView();
55 view.getStore().rstore.load();
56 },
57
58 showTaskAndReload: function(options, success, response) {
59 let me = this;
60 if (!success) return;
61
62 let upid = response.result.data;
63 Ext.create('Proxmox.window.TaskProgress', {
64 upid,
65 taskDone: function() {
66 me.reload();
67 },
68 }).show();
69 },
70 },
71
72 minHeight: 150,
73 emptyText: gettext('No Accounts configured'),
74
75 columns: [
76 {
77 dataIndex: 'name',
78 text: gettext('Name'),
79 renderer: Ext.String.htmlEncode,
80 flex: 1,
81 },
82 ],
83
84 tbar: [
85 {
86 xtype: 'proxmoxButton',
87 text: gettext('Add'),
88 selModel: false,
89 handler: 'addAccount',
90 },
91 {
92 xtype: 'proxmoxButton',
93 text: gettext('View'),
94 handler: 'viewAccount',
95 disabled: true,
96 },
97 {
98 xtype: 'proxmoxStdRemoveButton',
99 baseurl: '/cluster/acme/account',
100 callback: 'showTaskAndReload',
101 },
102 ],
103
104 listeners: {
105 itemdblclick: 'viewAccount',
106 },
107
108 store: {
109 type: 'diff',
110 autoDestroy: true,
111 autoDestroyRstore: true,
112 rstore: {
113 type: 'update',
114 storeid: 'pve-acme-accounts',
115 model: 'pve-acme-accounts',
116 autoStart: true,
117 },
118 sorters: 'name',
119 },
120 });
121
122 Ext.define('PVE.dc.ACMEPluginView', {
123 extend: 'Ext.grid.Panel',
124 alias: 'widget.pveACMEPluginView',
125
126 title: gettext('Challenge Plugins'),
127
128 controller: {
129 xclass: 'Ext.app.ViewController',
130
131 addPlugin: function() {
132 let me = this;
133 Ext.create('PVE.dc.ACMEPluginEditor', {
134 isCreate: true,
135 apiCallDone: function() {
136 me.reload();
137 },
138 }).show();
139 },
140
141 editPlugin: function() {
142 let me = this;
143 let view = me.getView();
144 let selection = view.getSelection();
145 if (selection.length < 1) return;
146 let plugin = selection[0].data.plugin;
147 Ext.create('PVE.dc.ACMEPluginEditor', {
148 url: `/cluster/acme/plugins/${plugin}`,
149 apiCallDone: function() {
150 me.reload();
151 },
152 }).show();
153 },
154
155 reload: function() {
156 let me = this;
157 let view = me.getView();
158 view.getStore().rstore.load();
159 },
160 },
161
162 minHeight: 150,
163 emptyText: gettext('No Plugins configured'),
164
165 columns: [
166 {
167 dataIndex: 'plugin',
168 text: gettext('Plugin'),
169 renderer: Ext.String.htmlEncode,
170 flex: 1,
171 },
172 {
173 dataIndex: 'api',
174 text: 'API',
175 renderer: Ext.String.htmlEncode,
176 flex: 1,
177 },
178 ],
179
180 tbar: [
181 {
182 xtype: 'proxmoxButton',
183 text: gettext('Add'),
184 handler: 'addPlugin',
185 selModel: false,
186 },
187 {
188 xtype: 'proxmoxButton',
189 text: gettext('Edit'),
190 handler: 'editPlugin',
191 disabled: true,
192 },
193 {
194 xtype: 'proxmoxStdRemoveButton',
195 baseurl: '/cluster/acme/plugins',
196 callback: 'reload',
197 },
198 ],
199
200 listeners: {
201 itemdblclick: 'editPlugin',
202 },
203
204 store: {
205 type: 'diff',
206 autoDestroy: true,
207 autoDestroyRstore: true,
208 rstore: {
209 type: 'update',
210 storeid: 'pve-acme-plugins',
211 model: 'pve-acme-plugins',
212 autoStart: true,
213 filters: item => !!item.data.api,
214 },
215 sorters: 'plugin',
216 },
217 });
218
219 Ext.define('PVE.dc.ACMEClusterView', {
220 extend: 'Ext.panel.Panel',
221 alias: 'widget.pveACMEClusterView',
222
223 onlineHelp: 'sysadmin_certificate_management',
224
225 items: [
226 {
227 region: 'north',
228 border: false,
229 xtype: 'pveACMEAccountView',
230 },
231 {
232 region: 'center',
233 border: false,
234 xtype: 'pveACMEPluginView',
235 },
236 ],
237 });