From d85facd1d2daf7f73c931e6d00c7ca2779837dde Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 25 Jan 2019 13:04:10 +0100 Subject: [PATCH] DataStoreConfig.js: new widget --- www/DataStoreConfig.js | 81 ++++++++++++++++++++++++++++++++++++++++++ www/Makefile | 1 + www/NavigationTree.js | 2 +- 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 www/DataStoreConfig.js diff --git a/www/DataStoreConfig.js b/www/DataStoreConfig.js new file mode 100644 index 00000000..b41af5e0 --- /dev/null +++ b/www/DataStoreConfig.js @@ -0,0 +1,81 @@ +Ext.define('pbs-data-store-config', { + extend: 'Ext.data.Model', + fields: [ 'name', 'path', 'comment' ], + proxy: { + type: 'proxmox', + url: "/api2/json/config/datastore" + }, + idProperty: 'name' +}); + +Ext.define('PBS.DataStoreConfig', { + extend: 'Ext.grid.GridPanel', + alias: 'widget.pbsDataStoreConfig', + + initComponent : function() { + var me = this; + + var store = new Ext.data.Store({ + model: 'pbs-data-store-config', + sorters: 'name', + }); + + var reload = function() { + store.load(); + }; + + var tbar = [ + { + text: gettext('Create'), + handler: function() { + alert("not implemented"); + //var win = Ext.create('PVE.dc.PoolEdit', {}); + //win.on('destroy', reload); + //win.show(); + } + } + //edit_btn, remove_btn + ]; + + var sm = Ext.create('Ext.selection.RowModel', {}); + + Proxmox.Utils.monStoreErrors(me, store); + + Ext.apply(me, { + store: store, + selModel: sm, + tbar: tbar, + viewConfig: { + trackOver: false + }, + columns: [ + { + header: gettext('Name'), + sortable: true, + dataIndex: 'name', + flex: 1 + }, + { + header: gettext('Path'), + sortable: true, + dataIndex: 'path', + flex: 1 + }, + { + header: gettext('Comment'), + sortable: false, + dataIndex: 'comment', + renderer: Ext.String.htmlEncode, + flex: 2 + } + ], + listeners: { + activate: reload + } + }); + + me.callParent(); + + store.load(); + } +}); diff --git a/www/Makefile b/www/Makefile index e57302df..fdd93c26 100644 --- a/www/Makefile +++ b/www/Makefile @@ -4,6 +4,7 @@ JSSRC= \ VersionInfo.js \ SystemConfiguration.js \ Subscription.js \ + DataStoreConfig.js \ NavigationTree.js \ Application.js \ MainView.js diff --git a/www/NavigationTree.js b/www/NavigationTree.js index b3e62cf0..8903f214 100644 --- a/www/NavigationTree.js +++ b/www/NavigationTree.js @@ -15,7 +15,7 @@ Ext.define('PBS.store.NavigationStore', { { text: gettext('Data Store'), iconCls: 'fa fa-envelope-o', - path: 'pbsDataStoreConfiguration', + path: 'pbsDataStoreConfig', leaf: true }, { -- 2.39.5