]> git.proxmox.com Git - proxmox-widget-toolkit.git/blame - src/node/APTRepositories.js
apt repositories: fix typo for getting the default unknown text
[proxmox-widget-toolkit.git] / src / node / APTRepositories.js
CommitLineData
24313a9d
FE
1Ext.define('apt-repolist', {
2 extend: 'Ext.data.Model',
3 fields: [
4 'Path',
5 'Index',
d91987a5 6 'Origin',
24313a9d
FE
7 'FileType',
8 'Enabled',
9 'Comment',
10 'Types',
11 'URIs',
12 'Suites',
13 'Components',
14 'Options',
15 ],
16});
17
21860ea4
FE
18Ext.define('Proxmox.window.APTRepositoryAdd', {
19 extend: 'Proxmox.window.Edit',
20 alias: 'widget.pmxAPTRepositoryAdd',
21
22 isCreate: true,
23 isAdd: true,
24
25 subject: gettext('Repository'),
5e9eb245 26 width: 600,
21860ea4
FE
27
28 initComponent: function() {
29 let me = this;
30
31 if (!me.repoInfo || me.repoInfo.length === 0) {
32 throw "repository information not initialized";
33 }
34
35 let description = Ext.create('Ext.form.field.Display', {
36 fieldLabel: gettext('Description'),
37 name: 'description',
38 });
39
40 let status = Ext.create('Ext.form.field.Display', {
41 fieldLabel: gettext('Status'),
42 name: 'status',
43 renderer: function(value) {
44 let statusText = gettext('Not yet configured');
45 if (value !== '') {
46 statusText = Ext.String.format(
47 '{0}: {1}',
48 gettext('Configured'),
49 value ? gettext('enabled') : gettext('disabled'),
50 );
51 }
52
53 return statusText;
54 },
55 });
56
57 let repoSelector = Ext.create('Proxmox.form.KVComboBox', {
58 fieldLabel: gettext('Repository'),
59 xtype: 'proxmoxKVComboBox',
60 name: 'handle',
61 allowBlank: false,
62 comboItems: me.repoInfo.map(info => [info.handle, info.name]),
824f9977
TL
63 validator: function(renderedValue) {
64 let handle = this.value;
65 // we cannot use this.callParent in instantiations
66 let valid = Proxmox.form.KVComboBox.prototype.validator.call(this, renderedValue);
21860ea4 67
824f9977 68 if (!valid || !handle) {
21860ea4
FE
69 return false;
70 }
71
72 const info = me.repoInfo.find(elem => elem.handle === handle);
21860ea4
FE
73 if (!info) {
74 return false;
75 }
76
58b71860 77 if (info.status) {
824f9977
TL
78 return Ext.String.format(gettext('{0} is already configured'), renderedValue);
79 }
80 return valid;
21860ea4
FE
81 },
82 listeners: {
83 change: function(f, value) {
84 const info = me.repoInfo.find(elem => elem.handle === value);
85 description.setValue(info.description);
86 status.setValue(info.status);
87 },
88 },
89 });
90
91 repoSelector.setValue(me.repoInfo[0].handle);
92
21860ea4 93 Ext.apply(me, {
5e9eb245
TL
94 items: [
95 repoSelector,
96 description,
97 status,
98 ],
21860ea4
FE
99 repoSelector: repoSelector,
100 });
101
102 me.callParent();
103 },
104});
105
24313a9d
FE
106Ext.define('Proxmox.node.APTRepositoriesErrors', {
107 extend: 'Ext.grid.GridPanel',
108
109 xtype: 'proxmoxNodeAPTRepositoriesErrors',
110
24313a9d
FE
111 store: {},
112
f59d1076 113 scrollable: true,
d8b5cd80 114
24313a9d
FE
115 viewConfig: {
116 stripeRows: false,
5e0cecb7
DC
117 getRowClass: (record) => {
118 switch (record.data.status) {
119 case 'warning': return 'proxmox-warning-row';
120 case 'critical': return 'proxmox-invalid-row';
121 default: return '';
122 }
123 },
24313a9d
FE
124 },
125
5e0cecb7
DC
126 hideHeaders: true,
127
24313a9d
FE
128 columns: [
129 {
5e0cecb7
DC
130 dataIndex: 'status',
131 renderer: (value) => `<i class="fa fa-fw ${Proxmox.Utils.get_health_icon(value, true)}"></i>`,
132 width: 50,
24313a9d
FE
133 },
134 {
5e0cecb7 135 dataIndex: 'message',
24313a9d
FE
136 flex: 1,
137 },
138 ],
139});
140
141Ext.define('Proxmox.node.APTRepositoriesGrid', {
142 extend: 'Ext.grid.GridPanel',
24313a9d 143 xtype: 'proxmoxNodeAPTRepositoriesGrid',
5e76f730 144 mixins: ['Proxmox.Mixin.CBind'],
24313a9d
FE
145
146 title: gettext('APT Repositories'),
147
994fe897
TL
148 cls: 'proxmox-apt-repos', // to allow applying styling to general components with local effect
149
d8b5cd80
DC
150 border: false,
151
24313a9d
FE
152 tbar: [
153 {
154 text: gettext('Reload'),
155 iconCls: 'fa fa-refresh',
156 handler: function() {
157 let me = this;
158 me.up('proxmoxNodeAPTRepositories').reload();
159 },
160 },
d76eedb4
FE
161 {
162 text: gettext('Add'),
faacb77f 163 name: 'addRepo',
21860ea4
FE
164 disabled: true,
165 repoInfo: undefined,
5e76f730
FE
166 cbind: {
167 onlineHelp: '{onlineHelp}',
168 },
21860ea4
FE
169 handler: function(button, event, record) {
170 Proxmox.Utils.checked_command(() => {
171 let me = this;
172 let panel = me.up('proxmoxNodeAPTRepositories');
173
174 let extraParams = {};
175 if (panel.digest !== undefined) {
176 extraParams.digest = panel.digest;
177 }
178
179 Ext.create('Proxmox.window.APTRepositoryAdd', {
180 repoInfo: me.repoInfo,
d7aeb02f 181 url: `/api2/extjs/nodes/${panel.nodename}/apt/repositories`,
21860ea4
FE
182 method: 'PUT',
183 extraRequestParams: extraParams,
5e76f730 184 onlineHelp: me.onlineHelp,
21860ea4
FE
185 listeners: {
186 destroy: function() {
187 panel.reload();
188 },
189 },
190 }).show();
191 });
d76eedb4
FE
192 },
193 },
af48de6b 194 '-',
d76eedb4 195 {
8832b590 196 xtype: 'proxmoxAltTextButton',
bb64cd03
TL
197 defaultText: gettext('Enable'),
198 altText: gettext('Disable'),
faacb77f 199 name: 'repoEnable',
d76eedb4 200 disabled: true,
003c4982
DC
201 bind: {
202 text: '{enableButtonText}',
203 },
d76eedb4
FE
204 handler: function(button, event, record) {
205 let me = this;
206 let panel = me.up('proxmoxNodeAPTRepositories');
207
208 let params = {
209 path: record.data.Path,
210 index: record.data.Index,
211 enabled: record.data.Enabled ? 0 : 1, // invert
212 };
213
214 if (panel.digest !== undefined) {
215 params.digest = panel.digest;
216 }
217
218 Proxmox.Utils.API2Request({
219 url: `/nodes/${panel.nodename}/apt/repositories`,
220 method: 'POST',
221 params: params,
222 failure: function(response, opts) {
223 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
224 panel.reload();
225 },
226 success: function(response, opts) {
227 panel.reload();
228 },
229 });
230 },
231 },
24313a9d
FE
232 ],
233
234 sortableColumns: false,
205d2751
TL
235 viewConfig: {
236 stripeRows: false,
237 getRowClass: (record, index) => record.get('Enabled') ? '' : 'proxmox-disabled-row',
238 },
24313a9d
FE
239
240 columns: [
241 {
24313a9d
FE
242 header: gettext('Enabled'),
243 dataIndex: 'Enabled',
64f65c02
LW
244 align: 'center',
245 renderer: Proxmox.Utils.renderEnabledIcon,
24313a9d
FE
246 width: 90,
247 },
248 {
249 header: gettext('Types'),
250 dataIndex: 'Types',
251 renderer: function(types, cell, record) {
252 return types.join(' ');
253 },
254 width: 100,
255 },
256 {
257 header: gettext('URIs'),
258 dataIndex: 'URIs',
259 renderer: function(uris, cell, record) {
260 return uris.join(' ');
261 },
262 width: 350,
263 },
264 {
265 header: gettext('Suites'),
266 dataIndex: 'Suites',
e71fc6e4
DC
267 renderer: function(suites, metaData, record) {
268 let err = '';
269 if (record.data.warnings && record.data.warnings.length > 0) {
270 let txt = [gettext('Warning')];
271 record.data.warnings.forEach((warning) => {
272 if (warning.property === 'Suites') {
273 txt.push(warning.message);
274 }
275 });
276 metaData.tdAttr = `data-qtip="${Ext.htmlEncode(txt.join('<br>'))}"`;
5a1fddb6
TL
277 if (record.data.Enabled) {
278 metaData.tdCls = 'proxmox-invalid-row';
279 err = '<i class="fa fa-fw critical fa-exclamation-circle"></i> ';
280 } else {
281 metaData.tdCls = 'proxmox-warning-row';
282 err = '<i class="fa fa-fw warning fa-exclamation-circle"></i> ';
283 }
e71fc6e4
DC
284 }
285 return suites.join(' ') + err;
24313a9d
FE
286 },
287 width: 130,
288 },
289 {
290 header: gettext('Components'),
291 dataIndex: 'Components',
06689819 292 renderer: function(components, metaData, record) {
65f4704b
TL
293 if (components === undefined) {
294 return '';
295 }
06689819
TL
296 let err = '';
297 if (components.length === 1) {
298 // FIXME: this should be a flag set to the actual repsotiories, i.e., a tristate
4fc57df4 299 // like production-ready = <yes|no|other> (Option<bool>)
06689819
TL
300 if (components[0].match(/\w+(-no-subscription|test)\s*$/i)) {
301 metaData.tdCls = 'proxmox-warning-row';
302 err = '<i class="fa fa-fw warning fa-exclamation-circle"></i> ';
303
304 let qtip = components[0].match(/no-subscription/)
305 ? gettext('The no-subscription repository is NOT production-ready')
306 : gettext('The test repository may contain unstable updates')
307 ;
308 metaData.tdAttr = `data-qtip="${Ext.htmlEncode(qtip)}"`;
309 }
310 }
311 return components.join(' ') + err;
24313a9d
FE
312 },
313 width: 170,
314 },
315 {
316 header: gettext('Options'),
317 dataIndex: 'Options',
318 renderer: function(options, cell, record) {
319 if (!options) {
320 return '';
321 }
322
323 let filetype = record.data.FileType;
324 let text = '';
325
326 options.forEach(function(option) {
327 let key = option.Key;
328 if (filetype === 'list') {
329 let values = option.Values.join(',');
330 text += `${key}=${values} `;
331 } else if (filetype === 'sources') {
332 let values = option.Values.join(' ');
333 text += `${key}: ${values}<br>`;
334 } else {
017a6376 335 throw "unknown file type";
24313a9d
FE
336 }
337 });
338 return text;
339 },
340 flex: 1,
341 },
03c4c65b 342 {
d91987a5
FE
343 header: gettext('Origin'),
344 dataIndex: 'Origin',
036f48c1 345 width: 120,
3d6b76ee 346 renderer: function(value, meta, rec) {
f0966f29
TL
347 if (typeof value !== 'string' || value.length === 0) {
348 value = gettext('Other');
349 }
036f48c1 350 let cls = 'fa fa-fw fa-question-circle-o';
3d6b76ee
FE
351 let originType = this.up('proxmoxNodeAPTRepositories').classifyOrigin(value);
352 if (originType === 'Proxmox') {
036f48c1 353 cls = 'pmx-itype-icon pmx-itype-icon-proxmox-x';
3d6b76ee 354 } else if (originType === 'Debian') {
036f48c1
TL
355 cls = 'pmx-itype-icon pmx-itype-icon-debian-swirl';
356 }
357 return `<i class='${cls}'></i> ${value}`;
358 },
03c4c65b 359 },
24313a9d
FE
360 {
361 header: gettext('Comment'),
362 dataIndex: 'Comment',
363 flex: 2,
364 },
365 ],
366
7705801f
TL
367 features: [
368 {
369 ftype: 'grouping',
370 groupHeaderTpl: '{[ "File: " + values.name ]} ({rows.length} repositor{[values.rows.length > 1 ? "ies" : "y"]})',
371 enableGroupingMenu: false,
372 },
373 ],
374
eb1fff82
TL
375 store: {
376 model: 'apt-repolist',
377 groupField: 'Path',
378 sorters: [
379 {
380 property: 'Index',
381 direction: 'ASC',
382 },
383 ],
384 },
385
24313a9d
FE
386 initComponent: function() {
387 let me = this;
388
389 if (!me.nodename) {
390 throw "no node name specified";
391 }
392
24313a9d
FE
393 me.callParent();
394 },
395});
396
397Ext.define('Proxmox.node.APTRepositories', {
398 extend: 'Ext.panel.Panel',
24313a9d
FE
399 xtype: 'proxmoxNodeAPTRepositories',
400 mixins: ['Proxmox.Mixin.CBind'],
401
402 digest: undefined,
403
5e76f730
FE
404 onlineHelp: undefined,
405
3fc020f4
TL
406 product: 'Proxmox VE', // default
407
3d6b76ee
FE
408 classifyOrigin: function(origin) {
409 if (origin.match(/^\s*Proxmox\s*$/i)) {
410 return 'Proxmox';
411 } else if (origin.match(/^\s*Debian\s*(:?Backports)?$/i)) {
412 return 'Debian';
413 }
414 return 'Other';
415 },
416
003c4982
DC
417 controller: {
418 xclass: 'Ext.app.ViewController',
419
420 selectionChange: function(grid, selection) {
421 let me = this;
422 if (!selection || selection.length < 1) {
423 return;
424 }
425 let rec = selection[0];
426 let vm = me.getViewModel();
427 vm.set('selectionenabled', rec.get('Enabled'));
f59d1076
DC
428 vm.notify();
429 },
430
431 updateState: function() {
432 let me = this;
433 let vm = me.getViewModel();
434
5e0cecb7
DC
435 let store = vm.get('errorstore');
436 store.removeAll();
437
df7def01
TL
438 let status = 'good'; // start with best, the helper below will downgrade if needed
439 let text = gettext('All OK, you have production-ready repositories configured!');
440
df7def01 441 let addGood = message => store.add({ status: 'good', message });
46231d0d 442 let addWarn = (message, important) => {
fe787c8c 443 if (status !== 'critical') {
df7def01 444 status = 'warning';
46231d0d 445 text = important ? message : gettext('Warning');
df7def01
TL
446 }
447 store.add({ status: 'warning', message });
448 };
6c9af178
TL
449 let addCritical = (message, important) => {
450 status = 'critical';
451 text = important ? message : gettext('Error');
452 store.add({ status: 'critical', message });
453 };
454
455 let errors = vm.get('errors');
456 errors.forEach(error => addCritical(`${error.path} - ${error.error}`));
f59d1076
DC
457
458 let activeSubscription = vm.get('subscriptionActive');
459 let enterprise = vm.get('enterpriseRepo');
460 let nosubscription = vm.get('noSubscriptionRepo');
461 let test = vm.get('testRepo');
462 let wrongSuites = vm.get('suitesWarning');
e6ed4498 463 let mixedSuites = vm.get('mixedSuites');
f59d1076 464
5e0cecb7 465 if (!enterprise && !nosubscription && !test) {
6c9af178
TL
466 addCritical(
467 Ext.String.format(gettext('No {0} repository is enabled, you do not get any updates!'), vm.get('product')),
468 );
6bac17e3
TL
469 } else if (errors.length > 0) {
470 // nothing extra, just avoid that we show "get updates"
5e0cecb7
DC
471 } else if (enterprise && !nosubscription && !test && activeSubscription) {
472 addGood(Ext.String.format(gettext('You get supported updates for {0}'), vm.get('product')));
473 } else if (nosubscription || test) {
474 addGood(Ext.String.format(gettext('You get updates for {0}'), vm.get('product')));
475 }
476
477 if (wrongSuites) {
96ecd62a 478 addWarn(gettext('Some suites are misconfigured'));
5e0cecb7
DC
479 }
480
e6ed4498
FE
481 if (mixedSuites) {
482 addWarn(gettext('Detected mixed suites before upgrade'));
483 }
484
f59d1076 485 if (!activeSubscription && enterprise) {
5e0cecb7
DC
486 addWarn(gettext('The enterprise repository is enabled, but there is no active subscription!'));
487 }
488
489 if (nosubscription) {
490 addWarn(gettext('The no-subscription repository is not recommended for production use!'));
491 }
492
493 if (test) {
96ecd62a 494 addWarn(gettext('The test repository may pull in unstable updates and is not recommended for production use!'));
5e0cecb7
DC
495 }
496
497 if (errors.length > 0) {
4227a557 498 text = gettext('Fatal parsing error for at least one repository');
f59d1076
DC
499 }
500
501 let iconCls = Proxmox.Utils.get_health_icon(status, true);
502
503 vm.set('state', {
504 iconCls,
505 text,
506 });
003c4982
DC
507 },
508 },
509
24313a9d
FE
510 viewModel: {
511 data: {
3fc020f4 512 product: 'Proxmox VE', // default
5e0cecb7 513 errors: [],
f59d1076 514 suitesWarning: false,
e6ed4498 515 mixedSuites: false, // used before major upgrade
24313a9d
FE
516 subscriptionActive: '',
517 noSubscriptionRepo: '',
518 enterpriseRepo: '',
f59d1076 519 testRepo: '',
003c4982 520 selectionenabled: false,
f59d1076 521 state: {},
24313a9d
FE
522 },
523 formulas: {
003c4982
DC
524 enableButtonText: (get) => get('selectionenabled')
525 ? gettext('Disable') : gettext('Enable'),
24313a9d 526 },
5e0cecb7
DC
527 stores: {
528 errorstore: {
529 fields: ['status', 'message'],
530 },
531 },
24313a9d
FE
532 },
533
82071150
DC
534 scrollable: true,
535 layout: {
536 type: 'vbox',
537 align: 'stretch',
538 },
539
24313a9d
FE
540 items: [
541 {
f59d1076
DC
542 xtype: 'panel',
543 border: false,
544 layout: {
545 type: 'hbox',
546 align: 'stretch',
24313a9d 547 },
5e0cecb7 548 height: 200,
f59d1076
DC
549 title: gettext('Status'),
550 items: [
551 {
552 xtype: 'box',
f411afb4 553 flex: 2,
f59d1076
DC
554 margin: 10,
555 data: {
556 iconCls: Proxmox.Utils.get_health_icon(undefined, true),
557 text: '',
558 },
559 bind: {
560 data: '{state}',
561 },
562 tpl: [
f411afb4 563 '<center class="centered-flex-column" style="font-size:15px;line-height: 25px;">',
f59d1076 564 '<i class="fa fa-4x {iconCls}"></i>',
f59d1076
DC
565 '{text}',
566 '</center>',
567 ],
568 },
569 {
570 xtype: 'proxmoxNodeAPTRepositoriesErrors',
571 name: 'repositoriesErrors',
f411afb4 572 flex: 7,
f59d1076
DC
573 margin: 10,
574 bind: {
5e0cecb7 575 store: '{errorstore}',
f59d1076
DC
576 },
577 },
578 ],
24313a9d
FE
579 },
580 {
581 xtype: 'proxmoxNodeAPTRepositoriesGrid',
582 name: 'repositoriesGrid',
f59d1076 583 flex: 1,
24313a9d
FE
584 cbind: {
585 nodename: '{nodename}',
5e76f730 586 onlineHelp: '{onlineHelp}',
24313a9d
FE
587 },
588 majorUpgradeAllowed: false, // TODO get release information from an API call?
003c4982
DC
589 listeners: {
590 selectionchange: 'selectionChange',
bb64cd03 591 },
24313a9d
FE
592 },
593 ],
594
595 check_subscription: function() {
596 let me = this;
597 let vm = me.getViewModel();
598
599 Proxmox.Utils.API2Request({
600 url: `/nodes/${me.nodename}/subscription`,
601 method: 'GET',
af48de6b 602 failure: (response, opts) => Ext.Msg.alert(gettext('Error'), response.htmlStatus),
24313a9d
FE
603 success: function(response, opts) {
604 const res = response.result;
af48de6b 605 const subscription = !(!res || !res.data || res.data.status.toLowerCase() !== 'active');
24313a9d 606 vm.set('subscriptionActive', subscription);
f59d1076 607 me.getController().updateState();
24313a9d
FE
608 },
609 });
610 },
611
612 updateStandardRepos: function(standardRepos) {
613 let me = this;
614 let vm = me.getViewModel();
615
faacb77f 616 let addButton = me.down('button[name=addRepo]');
d76eedb4 617
faacb77f 618 addButton.repoInfo = [];
24313a9d
FE
619 for (const standardRepo of standardRepos) {
620 const handle = standardRepo.handle;
621 const status = standardRepo.status;
622
623 if (handle === "enterprise") {
624 vm.set('enterpriseRepo', status);
625 } else if (handle === "no-subscription") {
626 vm.set('noSubscriptionRepo', status);
f59d1076
DC
627 } else if (handle === 'test') {
628 vm.set('testRepo', status);
24313a9d 629 }
f59d1076 630 me.getController().updateState();
d76eedb4 631
21860ea4
FE
632 addButton.repoInfo.push(standardRepo);
633 addButton.digest = me.digest;
24313a9d 634 }
21860ea4
FE
635
636 addButton.setDisabled(false);
24313a9d
FE
637 },
638
639 reload: function() {
640 let me = this;
641 let vm = me.getViewModel();
642 let repoGrid = me.down('proxmoxNodeAPTRepositoriesGrid');
24313a9d
FE
643
644 me.store.load(function(records, operation, success) {
645 let gridData = [];
646 let errors = [];
647 let digest;
f59d1076 648 let suitesWarning = false;
24313a9d 649
e6ed4498
FE
650 // Usually different suites will give errors anyways, but before a major upgrade the
651 // current and the next suite are allowed, so it makes sense to check for mixed suites.
652 let checkMixedSuites = false;
653 let mixedSuites = false;
654
24313a9d
FE
655 if (success && records.length > 0) {
656 let data = records[0].data;
657 let files = data.files;
658 errors = data.errors;
659 digest = data.digest;
660
e71fc6e4
DC
661 let infos = {};
662 for (const info of data.infos) {
663 let path = info.path;
664 let idx = info.index;
665
666 if (!infos[path]) {
667 infos[path] = {};
668 }
669 if (!infos[path][idx]) {
670 infos[path][idx] = {
671 origin: '',
672 warnings: [],
e6ed4498
FE
673 // Used as a heuristic to detect mixed repositories pre-upgrade. The
674 // warning is set on all repositories that do configure the next suite.
675 gotIgnorePreUpgradeWarning: false,
e71fc6e4
DC
676 };
677 }
678
679 if (info.kind === 'origin') {
680 infos[path][idx].origin = info.message;
fd468868 681 } else if (info.kind === 'warning') {
e71fc6e4 682 infos[path][idx].warnings.push(info);
fd468868 683 } else if (info.kind === 'ignore-pre-upgrade-warning') {
e6ed4498 684 infos[path][idx].gotIgnorePreUpgradeWarning = true;
fd468868
FE
685 if (!repoGrid.majorUpgradeAllowed) {
686 infos[path][idx].warnings.push(info);
e6ed4498
FE
687 } else {
688 checkMixedSuites = true;
fd468868 689 }
e71fc6e4
DC
690 }
691 }
692
693
24313a9d
FE
694 files.forEach(function(file) {
695 for (let n = 0; n < file.repositories.length; n++) {
696 let repo = file.repositories[n];
697 repo.Path = file.path;
698 repo.Index = n;
e71fc6e4 699 if (infos[file.path] && infos[file.path][n]) {
78be60a0 700 repo.Origin = infos[file.path][n].origin || Proxmox.Utils.unknownText;
e71fc6e4 701 repo.warnings = infos[file.path][n].warnings || [];
e455399a 702
e6ed4498
FE
703 if (repo.Enabled) {
704 if (repo.warnings.some(w => w.property === 'Suites')) {
705 suitesWarning = true;
706 }
707
708 let originType = me.classifyOrigin(repo.Origin);
709 // Only Proxmox and Debian repositories checked here, because the
710 // warning can be missing for others for a different reason (e.g.
711 // using 'stable' or non-Debian code names).
712 if (checkMixedSuites && repo.Types.includes('deb') &&
713 (originType === 'Proxmox' || originType === 'Debian') &&
714 !infos[file.path][n].gotIgnorePreUpgradeWarning
715 ) {
716 mixedSuites = true;
717 }
e455399a 718 }
e71fc6e4 719 }
24313a9d
FE
720 gridData.push(repo);
721 }
722 });
723
24313a9d
FE
724 repoGrid.store.loadData(gridData);
725
726 me.updateStandardRepos(data['standard-repos']);
727 }
728
729 me.digest = digest;
730
5e0cecb7 731 vm.set('errors', errors);
f59d1076 732 vm.set('suitesWarning', suitesWarning);
e6ed4498 733 vm.set('mixedSuites', mixedSuites);
f59d1076 734 me.getController().updateState();
24313a9d
FE
735 });
736
737 me.check_subscription();
738 },
739
740 listeners: {
741 activate: function() {
742 let me = this;
743 me.reload();
744 },
745 },
746
747 initComponent: function() {
748 let me = this;
749
750 if (!me.nodename) {
751 throw "no node name specified";
752 }
753
754 let store = Ext.create('Ext.data.Store', {
755 proxy: {
756 type: 'proxmox',
757 url: `/api2/json/nodes/${me.nodename}/apt/repositories`,
758 },
759 });
760
761 Ext.apply(me, { store: store });
762
763 Proxmox.Utils.monStoreErrors(me, me.store, true);
764
765 me.callParent();
3fc020f4
TL
766
767 me.getViewModel().set('product', me.product);
24313a9d
FE
768 },
769});