From 73e27f0999659dd85beb1a0992c1e553aefb9e78 Mon Sep 17 00:00:00 2001 From: TonyWhiteSMS Date: Mon, 25 Feb 2019 12:02:42 +1000 Subject: [PATCH 1/7] Add option for numeric date format --- objects/SDG_Field__c.object | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/objects/SDG_Field__c.object b/objects/SDG_Field__c.object index 527d802..e7240f7 100644 --- a/objects/SDG_Field__c.object +++ b/objects/SDG_Field__c.object @@ -126,6 +126,11 @@ false + + Numeric Date + false + + From 812a03ad423cd13b35dd288ff59fb0ab2c88ad47 Mon Sep 17 00:00:00 2001 From: TonyWhiteSMS Date: Mon, 25 Feb 2019 12:05:57 +1000 Subject: [PATCH 2/7] Update sdgDatagridCellController.js Add handling of Numeric Date option to the date and datetime field types --- .../sdgDatagridCellController.js | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/aura/sdgDatagridCell/sdgDatagridCellController.js b/aura/sdgDatagridCell/sdgDatagridCellController.js index 13267b9..6fd292e 100644 --- a/aura/sdgDatagridCell/sdgDatagridCellController.js +++ b/aura/sdgDatagridCell/sdgDatagridCellController.js @@ -105,7 +105,19 @@ component, helper.formatDurationDateTime(component, datevalue) ); - } else { + } + } else if (fieldstyle === "Numeric Date") { + helper.CreateCmp( + component, + "lightning:formattedDateTime", + { + value: datevalue, + year: "numeric", + month: "numeric", + day: "numeric" + } + ); + } else { //Render this date WITHOUT a timezone helper.CreateCmp( component, @@ -155,6 +167,18 @@ component, helper.formatDurationDateTime(component, datetimevalue) ); + } else if (fieldstyle === "Numeric Date") { + var timezone = $A.get("$Locale.timezone"); + helper.CreateCmp(component, "lightning:formattedDateTime", { + value: datetimevalue, + timeZone: timezone, + year: "numeric", + month: "numeric", + day: "numeric", + hour: "numeric", + minute: "numeric", + second: "numeric" + }); } else { var timezone = $A.get("$Locale.timezone"); helper.CreateCmp(component, "lightning:formattedDateTime", { From 5dc8cebd4bdf3032c40a3d69b8b615b872a04132 Mon Sep 17 00:00:00 2001 From: TonyWhiteSMS Date: Mon, 25 Feb 2019 12:47:21 +1000 Subject: [PATCH 3/7] Update sdgDatagridCellController.js Remove the extra } --- aura/sdgDatagridCell/sdgDatagridCellController.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aura/sdgDatagridCell/sdgDatagridCellController.js b/aura/sdgDatagridCell/sdgDatagridCellController.js index 6fd292e..22ec9e9 100644 --- a/aura/sdgDatagridCell/sdgDatagridCellController.js +++ b/aura/sdgDatagridCell/sdgDatagridCellController.js @@ -105,8 +105,7 @@ component, helper.formatDurationDateTime(component, datevalue) ); - } - } else if (fieldstyle === "Numeric Date") { + } else if (fieldstyle === "Numeric Date") { helper.CreateCmp( component, "lightning:formattedDateTime", From dbc8c8eacefdd22791904cc564a9e6f50586c2cc Mon Sep 17 00:00:00 2001 From: TonyWhiteSMS Date: Mon, 25 Feb 2019 12:53:04 +1000 Subject: [PATCH 4/7] Update sdgDatagridCellController.js Change to use 2-digit for numeric date format to preserve same style as the standard display of date within Salesforce --- aura/sdgDatagridCell/sdgDatagridCellController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aura/sdgDatagridCell/sdgDatagridCellController.js b/aura/sdgDatagridCell/sdgDatagridCellController.js index 22ec9e9..78297e9 100644 --- a/aura/sdgDatagridCell/sdgDatagridCellController.js +++ b/aura/sdgDatagridCell/sdgDatagridCellController.js @@ -112,7 +112,7 @@ { value: datevalue, year: "numeric", - month: "numeric", + month: "2-digit", day: "numeric" } ); @@ -172,7 +172,7 @@ value: datetimevalue, timeZone: timezone, year: "numeric", - month: "numeric", + month: "2-digit", day: "numeric", hour: "numeric", minute: "numeric", From 8734199cdb88f22207a1398c81bd695d6a1a9ecc Mon Sep 17 00:00:00 2001 From: TonyWhiteSMS Date: Mon, 11 Mar 2019 07:52:08 +1000 Subject: [PATCH 5/7] Add in workspaceAPI to allow setting the tab title Fixes console view tab title being displayed as 'Loading...' --- aura/sdg/sdg.cmp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aura/sdg/sdg.cmp b/aura/sdg/sdg.cmp index 584e32f..dd8b43a 100644 --- a/aura/sdg/sdg.cmp +++ b/aura/sdg/sdg.cmp @@ -76,6 +76,7 @@ + @@ -346,4 +347,4 @@ - \ No newline at end of file + From 02e97bef13cc8e9e0270fb52701662a953e3e836 Mon Sep 17 00:00:00 2001 From: TonyWhiteSMS Date: Mon, 11 Mar 2019 07:59:00 +1000 Subject: [PATCH 6/7] add method to set the tab title of the console New method sets the tab title IF it is a subtab and it is a standard__component --- aura/sdg/sdgHelper.js | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/aura/sdg/sdgHelper.js b/aura/sdg/sdgHelper.js index 09c9de4..5f222c0 100644 --- a/aura/sdg/sdgHelper.js +++ b/aura/sdg/sdgHelper.js @@ -481,5 +481,40 @@ } this.FireEvent(component, actionid, selectedrow); - } + }, + + setTabTitle: function (component, event, helper) { + let workspaceAPI = component.find("workspace"); + workspaceAPI.isConsoleNavigation().then(isConsoleNavigation => { + if (isConsoleNavigation) { + workspaceAPI.getEnclosingTabId().then(tabId => { + if (tabId !== false) { + workspaceAPI.isSubtab({ + tabId: tabId + }).then(isSubTab => { + // Only set the tab label if it is a subtab (otherwise it overwrites the primary object tab name) + if (isSubTab) { + workspaceAPI.getTabInfo({ + tabId: tabId + }).then(info => { + // Only update the tab if it is a standard__component + if (/standard__component/i.test(info.pageReference.type)) { + workspaceAPI.setTabLabel({ + 'tabId': tabId, + 'label': component.get("v.TitleName") + }); + workspaceAPI.setTabIcon({ + 'tabId': tabId, + 'icon': component.get("v.SVGName"), + 'iconAlt': component.get("v.TitleName") + }) + } + }); + } + }) + } + }); + } + }); + } }); From 2a31955868e8f4467aac43e2291e1ba0a81f5fbf Mon Sep 17 00:00:00 2001 From: TonyWhiteSMS Date: Mon, 11 Mar 2019 08:02:52 +1000 Subject: [PATCH 7/7] On Init call setTabTitle Check if the tab title needs to be set every time the component is initialised --- aura/sdg/sdgController.js | 1 + 1 file changed, 1 insertion(+) diff --git a/aura/sdg/sdgController.js b/aura/sdg/sdgController.js index 11abe67..5e92409 100644 --- a/aura/sdg/sdgController.js +++ b/aura/sdg/sdgController.js @@ -35,6 +35,7 @@ helper.getSDG(component); helper.getNamespace(component); + helper.setTabTitle(component, event, helper); }, handleObjectManagerEvent: function(component, event, helper) {}, paging: function(component, event, helper) {