* [pbs-devel] [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus @ 2021-07-22 13:27 Fabian Ebner 2021-07-22 13:27 ` [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner 2021-07-27 14:36 ` [pbs-devel] applied: [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus Thomas Lamprecht 0 siblings, 2 replies; 4+ messages in thread From: Fabian Ebner @ 2021-07-22 13:27 UTC (permalink / raw) To: pbs-devel adapted from PMG, because it has an additional fix to avoid setting undefined in the view model, which still affects PBS (see pmg-gui commit 774418f08b10c651357d11ccb161ac075e1ae905). Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> --- src/Makefile | 1 + src/panel/NodeInfoRepoStatus.js | 102 ++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/panel/NodeInfoRepoStatus.js diff --git a/src/Makefile b/src/Makefile index 36f316c..a490ccd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -51,6 +51,7 @@ JSSRC= \ panel/InputPanel.js \ panel/InfoWidget.js \ panel/LogView.js \ + panel/NodeInfoRepoStatus.js \ panel/JournalView.js \ panel/PermissionView.js \ panel/PruneKeepPanel.js \ diff --git a/src/panel/NodeInfoRepoStatus.js b/src/panel/NodeInfoRepoStatus.js new file mode 100644 index 0000000..df1ca9f --- /dev/null +++ b/src/panel/NodeInfoRepoStatus.js @@ -0,0 +1,102 @@ +Ext.define('Proxmox.widget.NodeInfoRepoStatus', { + extend: 'Proxmox.widget.Info', + alias: 'widget.pmxNodeInfoRepoStatus', + + title: gettext('Repository Status'), + + colspan: 2, + + printBar: false, + + product: undefined, + repoLink: undefined, + + viewModel: { + data: { + subscriptionActive: '', + noSubscriptionRepo: '', + enterpriseRepo: '', + testRepo: '', + }, + + formulas: { + repoStatus: function(get) { + if (get('subscriptionActive') === '' || get('enterpriseRepo') === '') { + return ''; + } + + if (get('noSubscriptionRepo') || get('testRepo')) { + return 'non-production'; + } else if (get('subscriptionActive') && get('enterpriseRepo')) { + return 'ok'; + } else if (!get('subscriptionActive') && get('enterpriseRepo')) { + return 'no-sub'; + } else if (!get('enterpriseRepo') || !get('noSubscriptionRepo') || !get('testRepo')) { + return 'no-repo'; + } + return 'unknown'; + }, + + repoStatusMessage: function(get) { + let me = this; + let view = me.getView(); + + const status = get('repoStatus'); + + let repoLink = ` <a data-qtip="${gettext("Open Repositories Panel")}" + href="${view.repoLink}"> + <i class="fa black fa-chevron-right txt-shadow-hover"></i> + </a>`; + + return Proxmox.Utils.formatNodeRepoStatus(status, view.product) + repoLink; + }, + }, + }, + + setValue: function(value) { // for binding below + this.updateValue(value); + }, + + bind: { + value: '{repoStatusMessage}', + }, + + setRepositoryInfo: function(standardRepos) { + let me = this; + let vm = me.getViewModel(); + + for (const standardRepo of standardRepos) { + const handle = standardRepo.handle; + const status = standardRepo.status || 0; + + if (handle === "enterprise") { + vm.set('enterpriseRepo', status); + } else if (handle === "no-subscription") { + vm.set('noSubscriptionRepo', status); + } else if (handle === "test") { + vm.set('testRepo', status); + } + } + }, + + setSubscriptionStatus: function(status) { + let me = this; + let vm = me.getViewModel(); + + vm.set('subscriptionActive', status); + }, + + initComponent: function() { + let me = this; + + if (me.product === undefined) { + throw "no product name provided"; + } + + if (me.repoLink === undefined) { + throw "no repo link href provided"; + } + + me.callParent(); + }, +}); -- 2.30.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit 2021-07-22 13:27 [pbs-devel] [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus Fabian Ebner @ 2021-07-22 13:27 ` Fabian Ebner 2021-11-30 9:21 ` Fabian Ebner 2021-07-27 14:36 ` [pbs-devel] applied: [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus Thomas Lamprecht 1 sibling, 1 reply; 4+ messages in thread From: Fabian Ebner @ 2021-07-22 13:27 UTC (permalink / raw) To: pbs-devel Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> --- www/Dashboard.js | 7 +++-- www/panel/NodeInfo.js | 68 ++----------------------------------------- 2 files changed, 8 insertions(+), 67 deletions(-) diff --git a/www/Dashboard.js b/www/Dashboard.js index 70c2305b..7d3244fd 100644 --- a/www/Dashboard.js +++ b/www/Dashboard.js @@ -62,7 +62,8 @@ Ext.define('PBS.Dashboard', { updateRepositoryStatus: function(store, records, success) { if (!success) { return; } let me = this; - me.lookup('nodeInfo').setRepositoryInfo(records[0].data['standard-repos']); + let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus'); + repoStatus.setRepositoryInfo(records[0].data['standard-repos']); }, updateSubscription: function(store, records, success) { @@ -72,7 +73,9 @@ Ext.define('PBS.Dashboard', { // 2 = all good, 1 = different leves, 0 = none let subStatus = status.toLowerCase() === 'active' ? 2 : 0; me.lookup('subscription').setSubStatus(subStatus); - me.lookup('nodeInfo').setSubscriptionStatus(subStatus); + + let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus'); + repoStatus.setSubscriptionStatus(subStatus); }, updateTasks: function(store, records, success) { diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js index ff96e8fc..f41eb3a3 100644 --- a/www/panel/NodeInfo.js +++ b/www/panel/NodeInfo.js @@ -20,37 +20,6 @@ Ext.define('PBS.NodeInfoPanel', { padding: '0 10 5 10', }, - viewModel: { - data: { - subscriptionActive: '', - noSubscriptionRepo: '', - enterpriseRepo: '', - testRepo: '', - }, - formulas: { - repoStatus: function(get) { - if (get('subscriptionActive') === '' || get('enterpriseRepo') === '') { - return ''; - } - - if (get('noSubscriptionRepo') || get('testRepo')) { - return 'non-production'; - } else if (get('subscriptionActive') && get('enterpriseRepo')) { - return 'ok'; - } else if (!get('subscriptionActive') && get('enterpriseRepo')) { - return 'no-sub'; - } else if (!get('enterpriseRepo') || !get('noSubscriptionRepo') || !get('testRepo')) { - return 'no-repo'; - } - return 'unknown'; - }, - repoStatusMessage: function(get) { - const status = get('repoStatus'); - return Proxmox.Utils.formatNodeRepoStatus(status, 'Proxmox Backup Server'); - }, - }, - }, - controller: { xclass: 'Ext.app.ViewController', @@ -179,16 +148,10 @@ Ext.define('PBS.NodeInfoPanel', { value: '', }, { + xtype: 'pmxNodeInfoRepoStatus', itemId: 'repositoryStatus', - colspan: 2, - printBar: false, - title: gettext('Repository Status'), - setValue: function(value) { // for binding below - this.updateValue(value); - }, - bind: { - value: '{repoStatusMessage}', - }, + product: 'Proxmox Backup Server', + repoLink: '#pbsServerAdministration:aptrepositories', }, ], @@ -198,31 +161,6 @@ Ext.define('PBS.NodeInfoPanel', { me.setTitle(Proxmox.NodeName + ' (' + gettext('Uptime') + ': ' + uptime + ')'); }, - setRepositoryInfo: function(standardRepos) { - let me = this; - let vm = me.getViewModel(); - - for (const standardRepo of standardRepos) { - const handle = standardRepo.handle; - const status = standardRepo.status; - - if (handle === "enterprise") { - vm.set('enterpriseRepo', status); - } else if (handle === "no-subscription") { - vm.set('noSubscriptionRepo', status); - } else if (handle === "test") { - vm.set('testRepo', status); - } - } - }, - - setSubscriptionStatus: function(status) { - let me = this; - let vm = me.getViewModel(); - - vm.set('subscriptionActive', status); - }, - initComponent: function() { let me = this; -- 2.30.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit 2021-07-22 13:27 ` [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner @ 2021-11-30 9:21 ` Fabian Ebner 0 siblings, 0 replies; 4+ messages in thread From: Fabian Ebner @ 2021-11-30 9:21 UTC (permalink / raw) To: pbs-devel Ping. Still applies and a quick re-test seemed fine. Am 22.07.21 um 15:27 schrieb Fabian Ebner: > Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> > --- > www/Dashboard.js | 7 +++-- > www/panel/NodeInfo.js | 68 ++----------------------------------------- > 2 files changed, 8 insertions(+), 67 deletions(-) > > diff --git a/www/Dashboard.js b/www/Dashboard.js > index 70c2305b..7d3244fd 100644 > --- a/www/Dashboard.js > +++ b/www/Dashboard.js > @@ -62,7 +62,8 @@ Ext.define('PBS.Dashboard', { > updateRepositoryStatus: function(store, records, success) { > if (!success) { return; } > let me = this; > - me.lookup('nodeInfo').setRepositoryInfo(records[0].data['standard-repos']); > + let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus'); > + repoStatus.setRepositoryInfo(records[0].data['standard-repos']); > }, > > updateSubscription: function(store, records, success) { > @@ -72,7 +73,9 @@ Ext.define('PBS.Dashboard', { > // 2 = all good, 1 = different leves, 0 = none > let subStatus = status.toLowerCase() === 'active' ? 2 : 0; > me.lookup('subscription').setSubStatus(subStatus); > - me.lookup('nodeInfo').setSubscriptionStatus(subStatus); > + > + let repoStatus = me.lookup('nodeInfo').down('#repositoryStatus'); > + repoStatus.setSubscriptionStatus(subStatus); > }, > > updateTasks: function(store, records, success) { > diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js > index ff96e8fc..f41eb3a3 100644 > --- a/www/panel/NodeInfo.js > +++ b/www/panel/NodeInfo.js > @@ -20,37 +20,6 @@ Ext.define('PBS.NodeInfoPanel', { > padding: '0 10 5 10', > }, > > - viewModel: { > - data: { > - subscriptionActive: '', > - noSubscriptionRepo: '', > - enterpriseRepo: '', > - testRepo: '', > - }, > - formulas: { > - repoStatus: function(get) { > - if (get('subscriptionActive') === '' || get('enterpriseRepo') === '') { > - return ''; > - } > - > - if (get('noSubscriptionRepo') || get('testRepo')) { > - return 'non-production'; > - } else if (get('subscriptionActive') && get('enterpriseRepo')) { > - return 'ok'; > - } else if (!get('subscriptionActive') && get('enterpriseRepo')) { > - return 'no-sub'; > - } else if (!get('enterpriseRepo') || !get('noSubscriptionRepo') || !get('testRepo')) { > - return 'no-repo'; > - } > - return 'unknown'; > - }, > - repoStatusMessage: function(get) { > - const status = get('repoStatus'); > - return Proxmox.Utils.formatNodeRepoStatus(status, 'Proxmox Backup Server'); > - }, > - }, > - }, > - > controller: { > xclass: 'Ext.app.ViewController', > > @@ -179,16 +148,10 @@ Ext.define('PBS.NodeInfoPanel', { > value: '', > }, > { > + xtype: 'pmxNodeInfoRepoStatus', > itemId: 'repositoryStatus', > - colspan: 2, > - printBar: false, > - title: gettext('Repository Status'), > - setValue: function(value) { // for binding below > - this.updateValue(value); > - }, > - bind: { > - value: '{repoStatusMessage}', > - }, > + product: 'Proxmox Backup Server', > + repoLink: '#pbsServerAdministration:aptrepositories', > }, > ], > > @@ -198,31 +161,6 @@ Ext.define('PBS.NodeInfoPanel', { > me.setTitle(Proxmox.NodeName + ' (' + gettext('Uptime') + ': ' + uptime + ')'); > }, > > - setRepositoryInfo: function(standardRepos) { > - let me = this; > - let vm = me.getViewModel(); > - > - for (const standardRepo of standardRepos) { > - const handle = standardRepo.handle; > - const status = standardRepo.status; > - > - if (handle === "enterprise") { > - vm.set('enterpriseRepo', status); > - } else if (handle === "no-subscription") { > - vm.set('noSubscriptionRepo', status); > - } else if (handle === "test") { > - vm.set('testRepo', status); > - } > - } > - }, > - > - setSubscriptionStatus: function(status) { > - let me = this; > - let vm = me.getViewModel(); > - > - vm.set('subscriptionActive', status); > - }, > - > initComponent: function() { > let me = this; > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] applied: [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus 2021-07-22 13:27 [pbs-devel] [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus Fabian Ebner 2021-07-22 13:27 ` [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner @ 2021-07-27 14:36 ` Thomas Lamprecht 1 sibling, 0 replies; 4+ messages in thread From: Thomas Lamprecht @ 2021-07-27 14:36 UTC (permalink / raw) To: Proxmox Backup Server development discussion, Fabian Ebner On 22.07.21 15:27, Fabian Ebner wrote: > adapted from PMG, because it has an additional fix to avoid setting > undefined in the view model, which still affects PBS (see pmg-gui > commit 774418f08b10c651357d11ccb161ac075e1ae905). > > Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> > --- > src/Makefile | 1 + > src/panel/NodeInfoRepoStatus.js | 102 ++++++++++++++++++++++++++++++++ > 2 files changed, 103 insertions(+) > create mode 100644 src/panel/NodeInfoRepoStatus.js > > applied, thanks! ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-30 9:21 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-07-22 13:27 [pbs-devel] [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus Fabian Ebner 2021-07-22 13:27 ` [pbs-devel] [PATCH proxmox-backup 1/1] ui: dashboard: node status: use repo status widget from widget-toolkit Fabian Ebner 2021-11-30 9:21 ` Fabian Ebner 2021-07-27 14:36 ` [pbs-devel] applied: [PATCH proxmox-widget-toolkit 1/1] add NodeInfoRepoStatus Thomas Lamprecht
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox