From 1e26e2c4ef754967a5df8dadb80f6ec1881856ef Mon Sep 17 00:00:00 2001 From: Joseph White Date: Thu, 18 Jul 2019 22:01:28 -0400 Subject: [PATCH] Added reset summary page layout UI --- html/gui/js/modules/NoviceUser.js | 11 ++- html/gui/js/profile_editor/ProfileEditor.js | 78 +++++++++++++++------ 2 files changed, 67 insertions(+), 22 deletions(-) diff --git a/html/gui/js/modules/NoviceUser.js b/html/gui/js/modules/NoviceUser.js index e8df432230..de86c92717 100644 --- a/html/gui/js/modules/NoviceUser.js +++ b/html/gui/js/modules/NoviceUser.js @@ -188,7 +188,16 @@ Ext.extend(XDMoD.Module.Summary, XDMoD.PortalModule, { } }, request_refresh: function () { - this.needsRefresh = true; + var tabPanel = Ext.getCmp('main_tab_panel'); + if (this === tabPanel.getActiveTab()) { + // This is the case where the 'Reset to defaults' button is + // clicked in the Profile dialog and the user is already on the + // summary page + portletStore.load(); + } else { + // The refresh will happen the next time the tab is activated + this.needsRefresh = true; + } } } }); diff --git a/html/gui/js/profile_editor/ProfileEditor.js b/html/gui/js/profile_editor/ProfileEditor.js index 78b0270f80..ed2686764e 100644 --- a/html/gui/js/profile_editor/ProfileEditor.js +++ b/html/gui/js/profile_editor/ProfileEditor.js @@ -83,7 +83,6 @@ XDMoD.ProfileEditor = Ext.extend(Ext.Window, { var self = this; this.general_settings = new XDMoD.ProfileGeneralSettings({parentWindow: self}); - this.role_delegation = new XDMoD.ProfileRoleDelegation({parentWindow: self, id: 'tab_role_delegation' }); // ------------------------------------------------ @@ -91,6 +90,62 @@ XDMoD.ProfileEditor = Ext.extend(Ext.Window, { // ------------------------------------------------ + var tabItems = [ + this.general_settings + ]; + + if (CCR.xdmod.ui.isCenterDirector) { + tabItems.push(new XDMoD.ProfileRoleDelegation({ + parentWindow: self + })); + } + + if (!CCR.xdmod.ui.tgSummaryViewer.usesToolbar) { + tabItems.push({ + title: 'Settings', + height: 320, + layout: 'fit', + border: false, + frame: true, + items: [{ + items: [{ + title: 'User Interface', + xtype: 'form', + bodyStyle: 'padding:5px', + labelWidth: 230, + frame: true, + items: [{ + xtype: 'compositefield', + items: [{ + xtype: 'button', + fieldLabel: 'Summary Tab Panel Layout', + text: 'Reset to Default', + handler: function (button) { + Ext.Ajax.request({ + url: XDMoD.REST.url + '/summary/layout', + method: 'DELETE', + success: function () { + button.setDisabled(true); + CCR.xdmod.ui.tgSummaryViewer.fireEvent('request_refresh'); + }, + failure: function (response, opts) { + Ext.MessageBox.alert('Error', response.message); + } + }); + } + }] + }] + }] + }], + bbar: { + items: [ + '->', + self.getCloseButton() + ] + } + }); + } + var tabPanel = new Ext.TabPanel({ frame: false, @@ -101,10 +156,7 @@ XDMoD.ProfileEditor = Ext.extend(Ext.Window, { tabCls: 'tab-strip' }, - items: [ - this.general_settings, - this.role_delegation - ], + items: tabItems, listeners: { tabchange: function (thisTabPanel, tab) { @@ -131,22 +183,6 @@ XDMoD.ProfileEditor = Ext.extend(Ext.Window, { // ------------------------------------------------ - if (CCR.xdmod.ui.isCenterDirector == false) { - - tabPanel.on('afterrender', function(tp) { - - var role_delegation_tab = tp.id + '__tab_role_delegation'; - - var tab = document.getElementById(role_delegation_tab); - - tab.style.display = 'none'; - - });//afterrender - - }//if (CCR.xdmod.ui.isCenterDirector == false) - - // ------------------------------------------------ - Ext.apply(this, { items:[