]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/sdn/ZoneContentView.js
ui: eslint: fix various spacing related issues
[pve-manager.git] / www / manager6 / sdn / ZoneContentView.js
1 Ext.define('PVE.sdn.ZoneContentView', {
2 extend: 'Ext.grid.GridPanel',
3 alias: 'widget.pveSDNZoneContentView',
4
5 stateful: true,
6 stateId: 'grid-sdnzone-content',
7 viewConfig: {
8 trackOver: false,
9 loadMask: false,
10 },
11 features: [
12 {
13 ftype: 'grouping',
14 groupHeaderTpl: '{name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})',
15 },
16 ],
17 initComponent: function() {
18 var me = this;
19
20 var nodename = me.pveSelNode.data.node;
21 if (!nodename) {
22 throw "no node name specified";
23 }
24
25 var zone = me.pveSelNode.data.sdn;
26 if (!zone) {
27 throw "no zone ID specified";
28 }
29
30 var baseurl = "/nodes/" + nodename + "/sdn/zones/" + zone + "/content";
31 var store = Ext.create('Ext.data.Store', {
32 model: 'pve-sdnzone-content',
33 groupField: 'content',
34 proxy: {
35 type: 'proxmox',
36 url: '/api2/json' + baseurl,
37 },
38 sorters: {
39 property: 'vnet',
40 order: 'DESC',
41 },
42 });
43
44 var sm = Ext.create('Ext.selection.RowModel', {});
45
46 var reload = function() {
47 store.load();
48 };
49
50 Proxmox.Utils.monStoreErrors(me, store);
51
52 Ext.apply(me, {
53 store: store,
54 selModel: sm,
55 tbar: [
56 ],
57 columns: [
58 {
59 header: 'VNet',
60 flex: 1,
61 sortable: true,
62 dataIndex: 'vnet',
63 },
64 {
65 header: gettext('Status'),
66 width: 20,
67 dataIndex: 'status',
68 },
69 {
70 header: gettext('Details'),
71 width: 20,
72 dataIndex: 'statusmsg',
73 },
74 ],
75 listeners: {
76 activate: reload,
77 },
78 });
79
80 me.callParent();
81 },
82 }, function() {
83 Ext.define('pve-sdnzone-content', {
84 extend: 'Ext.data.Model',
85 fields: [
86 'vnet', 'status', 'statusmsg',
87 {
88 name: 'text',
89 convert: function(value, record) {
90 // check for volid, because if you click on a grouping header,
91 // it calls convert (but with an empty volid)
92 if (value || record.data.vnet === null) {
93 return value;
94 }
95 return PVE.Utils.format_sdnvnet_type(value, {}, record);
96 },
97 },
98 ],
99 idProperty: 'vnet',
100 });
101 });