Skip to content

Commit

Permalink
[data-export] Add custom shortcuts (#654)
Browse files Browse the repository at this point in the history
## Describe your changes
 Add custom shortcuts for loading fields and execute query.
 
## Issue ticket number and link
#653 

## Checklist before requesting a review
- [x] I have read and understand the [Contributions
section](https://github.com/tprouvot/Salesforce-Inspector-reloaded#contributions)
- [x] Target branch is releaseCandidate and not master
- [x] I have performed a self-review of my code
- [ ] I ran the [unit
tests](https://github.com/tprouvot/Salesforce-Inspector-reloaded#unit-tests)
and my PR does not break any tests
- [x] I documented the changes I've made on the
[CHANGES.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/CHANGES.md)
and followed actual conventions
- [x] I added a new section on
[how-to.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/docs/how-to.md)
(optional)
  • Loading branch information
tprouvot authored Nov 20, 2024
1 parent 3169037 commit a563e2a
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ assignees: tprouvot
**Make sure to read the troubleshooting section before creating an issue**

- [ ] I've read the [common issues](https://tprouvot.github.io/Salesforce-Inspector-reloaded/troubleshooting/) and the one I'm about to create is not one of those documented.
- [ ] I've searched in the [existing issues](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues?q=is%3Aissue) and the one I'm about to create is not one of those created.
- [ ] I've read the [release note](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/releaseCandidate/CHANGES.md) and the one I'm about to create is not already fixed.

**Describe the bug**
Expand All @@ -30,7 +31,7 @@ If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, firefox, edge]
- Version [e.g. 1.20]
- Salesforce Inspector Reloaded Version [e.g. 1.25]

**Additional context**
Add any other context about the problem here.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Version 1.26

- Customize Data Export shortcuts (execute query and insert all fields name in query) [feature 653](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/653) in `chrome://extensions/shortcuts`
- Add [clientId](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_calloptions.htm) header param to identify the extension in EventLogFile [feature 504](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/504)
- Add Apex Classes metadata search in Shortcut tab and new option configuration for the search [feature 591](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/591) request by [mpekacki](https://github.com/mpekacki)
- Add `My Personal Information` shortcuts [feature 627](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/627) request by [Alfredo Chissotti](https://github.com/Astisme)
Expand Down
4 changes: 2 additions & 2 deletions addon/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ chrome.action.onClicked.addListener(() => {
});
});
chrome.commands?.onCommand.addListener((command) => {
if (command !== "open-popup"){
if (!command.startsWith("open-")){
chrome.tabs.create({
url: `chrome-extension://${chrome.i18n.getMessage("@@extension_id")}/${command}.html?host=${sfHost}`
});
} else {
chrome.runtime.sendMessage({
msg: "shortcut_pressed", sfHost
msg: "shortcut_pressed", command, sfHost
});
}
});
Expand Down
10 changes: 10 additions & 0 deletions addon/data-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,15 @@ class App extends React.Component {
model.didUpdate();
}
});
addEventListener("message", e => {
if (e.data.command === "open-export-autocomplete") {
model.queryAutocompleteHandler({ctrlSpace: true});
model.didUpdate();
} else if (e.data.command === "open-export-execute"){
model.doExport();
model.didUpdate();
}
});
addEventListener("keydown", e => {
if ((e.ctrlKey && e.key == "Enter") || e.key == "F5") {
e.preventDefault();
Expand Down Expand Up @@ -1453,6 +1462,7 @@ class App extends React.Component {
" query in the box above and press Export."),
h("p", {}, "Press Ctrl+Space to insert all field name autosuggestions or to load suggestions for field values."),
h("p", {}, "Press Ctrl+Enter or F5 to execute the export."),
h("p", {}, "Those shortcuts can be customized in chrome://extensions/shortcuts"),
h("p", {}, "Supports the full SOQL language. The columns in the CSV output depend on the returned data. Using subqueries may cause the output to grow rapidly. Bulk API is not supported. Large data volumes may freeze or crash your browser.")
)
),
Expand Down
6 changes: 6 additions & 0 deletions addon/manifest-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
"open-popup": {
"description": "Open popup"
},
"open-export-autocomplete": {
"description": "Fields suggestion in Data Export"
},
"open-export-execute": {
"description": "Run Query in Data Export"
},
"data-export": {
"description": "Data Export"
},
Expand Down
6 changes: 6 additions & 0 deletions addon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
"open-popup": {
"description": "Open popup"
},
"open-export-autocomplete": {
"description": "Fields suggestion in Data Export"
},
"open-export-execute": {
"description": "Run Query in Data Export"
},
"data-export": {
"description": "Data Export"
},
Expand Down
6 changes: 5 additions & 1 deletion addon/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if (typeof browser === "undefined") {
});
chrome.runtime.onMessage.addListener((request) => {
if (request.msg === "shortcut_pressed") {
parent.postMessage({insextOpenPopup: true}, "*");
if (request.command === "open-popup"){
parent.postMessage({insextOpenPopup: true}, "*");
} else {
parent.postMessage({command: request.command}, "*");
}
}
}
);
Expand Down
8 changes: 7 additions & 1 deletion docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,17 @@ From the option page, enable "Use favicon color on sandbox banner"
## Select all fields in a query

This functionality already exists in the legacy version but since many users don't know about it, I would like to document it.
When on the export page, put the cursor between `SaELECT` and `FROM` and press `Ctrl + space` for inserting all fields (if you don't have the rights for a particular field, it wont' be added).
When on the export page, put the cursor between `SELECT` and `FROM` and press `Ctrl + space` for inserting all fields (if you don't have the rights for a particular field, it wont' be added).
If you want to insert only custom fields, enter `__c` between `SELECT` and `FROM`.

![2024-04-16_08-53-32 (1)](https://github.com/tprouvot/Salesforce-Inspector-reloaded/assets/35368290/ef7ba7a0-c9c4-4573-9aaa-b72e64430f64)

## Customize Select all fields in a query shortcut

If the default `Ctrl + space` shortcut is already used by another extension or app, you can customize it in `chrome://extensions/shortcuts` and choose the one you prefer.

<img width="1133" alt="Customize Select all fields in a query shortcut" src="https://github.com/user-attachments/assets/f0bca12a-7c92-4fbe-9ca4-a8db51b050e9">

## Exclude formula fields from data export autocomplete

You can exclude formula fields to be included in the autocomplete by disable the toogle
Expand Down

0 comments on commit a563e2a

Please sign in to comment.