From 188ac03b8c61feb11b11c3b727ac12303aa19f18 Mon Sep 17 00:00:00 2001 From: Thomas Prouvot Date: Fri, 13 Oct 2023 10:30:11 +0200 Subject: [PATCH] Add view pset summary option --- CHANGES.md | 3 ++- addon/popup.js | 49 +++++++++++++++++++++++++++++-------------------- docs/how-to.md | 12 ++++++++++++ 3 files changed, 43 insertions(+), 21 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index cb47bee9..ece87f3c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,6 @@ ## Version 1.20 +- Add a parameter to activate summary view of pset / psetGroup from shortcut tab [feature 175](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/175) - Display record name (and link) in popup [feature 165](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/165) - Add documentation link to popup - Add option to open extension pages in a new tab using keyboard shortcuts (contribution by [Joshua Yarmak](https://github.com/toly11)) @@ -14,7 +15,7 @@ - Add 'LIMIT 200' when selecting 'FIELDS(' in autocomplete [feature 146](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/146) ) - Change method to get extension id to be compatible with firefox [issue 137](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/137) (issue by [kkorynta](https://github.com/kkorynta)) - Fix hardcoded browser in Generate Token url [issue 137](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/137) (issue by [kkorynta](https://github.com/kkorynta)) -- Add "Create New Flow" and "Recycle Bin" shortcuts +- Add "Create New Flow", "Create New Custom Object", "Create New Permission Set", "Create New Custom Permission" and "Recycle Bin" shortcuts - Update pop-up release note link to github pages - Detect SObject on listview page [feature 121](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/121) (idea by [Mehdi Cherfaoui](https://github.com/mehdisfdc)) - Automate test setup manual step of contact to multiple accounts [Aidan Majewski](https://github.com/aimaj) diff --git a/addon/popup.js b/addon/popup.js index b2efe1ae..03534050 100644 --- a/addon/popup.js +++ b/addon/popup.js @@ -884,28 +884,37 @@ class AllDataBoxShortcut extends React.PureComponent { const searchResult = await sfConn.rest("/services/data/v" + apiVersion + "/composite", {method: "POST", body: compositeQuery}); let results = searchResult.compositeResponse.filter((elm) => elm.httpStatusCode == 200 && elm.body.records.length > 0); + let enablePermSetSummary = localStorage.getItem("enablePermSetSummary") === "true"; + results.forEach(element => { element.body.records.forEach(rec => { - switch (rec.attributes.type) { - case "FlowDefinitionView": - rec.link = "/builder_platform_interaction/flowBuilder.app?flowId=" + rec.LatestVersionId; - rec.label = rec.Label; - rec.name = rec.ApiName; - rec.detail = rec.attributes.type + " • " + rec.ProcessType; - break; - case "Profile": - rec.link = "/lightning/setup/EnhancedProfiles/page?address=%2F" + rec.Id; - rec.label = rec.Name; - rec.name = rec.Id; - rec.detail = rec.attributes.type + " • " + rec.UserLicense.Name; - break; - case "PermissionSet": - rec.link = rec.Type === "Group" ? "/lightning/setup/PermSetGroups/page?address=%2F" + rec.PermissionSetGroupId : "/lightning/setup/PermSets/page?address=%2F" + rec.Id; - rec.label = rec.Label; - rec.name = rec.Name; - rec.detail = rec.attributes.type + " • " + rec.Type; - rec.detail += rec.License?.Name != null ? " • " + rec.License?.Name : ""; - break; + if (rec.attributes.type === "FlowDefinitionView"){ + rec.link = "/builder_platform_interaction/flowBuilder.app?flowId=" + rec.LatestVersionId; + rec.label = rec.Label; + rec.name = rec.ApiName; + rec.detail = rec.attributes.type + " • " + rec.ProcessType; + } else if (rec.attributes.type === "Profile"){ + rec.link = "/lightning/setup/EnhancedProfiles/page?address=%2F" + rec.Id; + rec.label = rec.Name; + rec.name = rec.Id; + rec.detail = rec.attributes.type + " • " + rec.UserLicense.Name; + } else if (rec.attributes.type === "PermissionSet"){ + rec.label = rec.Label; + rec.name = rec.Name; + rec.detail = rec.attributes.type + " • " + rec.Type; + rec.detail += rec.License?.Name != null ? " • " + rec.License?.Name : ""; + + let psetOrGroupId; + let type; + if (rec.Type === "Group"){ + psetOrGroupId = rec.PermissionSetGroupId; + type = "PermSetGroups"; + } else { + psetOrGroupId = rec.Id; + type = "PermSets"; + } + let endLink = enablePermSetSummary ? psetOrGroupId + "/summary" : "page?address=%2F" + psetOrGroupId; + rec.link = "/lightning/setup/" + type + "/" + endLink; } result.push(rec); }); diff --git a/docs/how-to.md b/docs/how-to.md index 5ced31c6..0218aeb0 100644 --- a/docs/how-to.md +++ b/docs/how-to.md @@ -134,3 +134,15 @@ Now you can enter the custom links following this convention: ET VOILA ! image + +## Enable summary view of PermissionSet / PermissionSetGroups from shortcut tab + +Since Winter 24, there is a beta functionality to view a summary of the PermissionSet / PermissionSetGroups + +image + +You can enable this view for the Shortcut search by creating a new localVariable as shown below. + +![image](https://github.com/tprouvot/Salesforce-Inspector-reloaded/assets/35368290/f3093e4b-438c-4795-b64a-8d37651906a5) + +Then when you click on a PermissionSet / PermissionSetGroups search result, you'll be redirected to the summary.