Skip to content

Commit

Permalink
#151 : fix suggestion click and add option to skip technical column f…
Browse files Browse the repository at this point in the history
…rom export view and csv
  • Loading branch information
dufoli committed Jul 29, 2024
1 parent 38cb330 commit 40a903f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion addon/apex-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ class App extends React.Component {
),
h("div", {ref: "autocompleteResultBox", className: "autocomplete-results" + (model.disableSuggestionOverText ? " autocomplete-results-under" : " autocomplete-results-over"), hidden: !model.displaySuggestion, style: model.disableSuggestionOverText ? {} : {top: model.suggestionTop + "px", left: model.suggestionLeft + "px"}},
model.autocompleteResults.results.map((r, ri) =>
h("div", {className: "autocomplete-result" + (ri == model.activeSuggestion ? " active" : ""), key: r.key ? r.key : r.value}, h("a", {tabIndex: 0, title: r.title, onClick: e => { e.preventDefault(); model.autocompleteClick(r); model.didUpdate(); }, href: "#", className: r.autocompleteType + " " + r.dataType}, h("div", {className: "autocomplete-icon"}), r.title), " ")
h("div", {className: "autocomplete-result" + (ri == model.activeSuggestion ? " active" : ""), key: r.key ? r.key : r.value}, h("a", {tabIndex: 0, title: r.title, onMouseDown: e => { e.preventDefault(); model.autocompleteClick(r); model.didUpdate(); }, href: "#", className: r.autocompleteType + " " + r.dataType}, h("div", {className: "autocomplete-icon"}), r.title), " ")
)
),
),
Expand Down
16 changes: 11 additions & 5 deletions addon/data-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,7 @@ class Model {
function RecordTable(vm) {
let columnIdx = new Map();
let header = ["_"];
let skipTechnicalColumns = localStorage.getItem("skipTechnicalColumns") !== "false";
// try to respect the right order of column by matching query column and record column
function discoverQueryColumns(record, fields) {
for (let field of fields) {
Expand Down Expand Up @@ -1677,7 +1678,7 @@ function RecordTable(vm) {
if (fieldName.includes(".")) {
let splittedField = fieldName.split(".");
splittedField.slice(0, splittedField.length - 1).map(col => {
if (!columnIdx.has(col)) {
if (!skipTechnicalColumns && !columnIdx.has(col)) {
let c = header.length;
columnIdx.set(col, c);
for (let row of rt.table) {
Expand All @@ -1697,11 +1698,16 @@ function RecordTable(vm) {
if (field == "attributes") {
continue;
}
let column = prefix + field;
//remove totalsize, done and records column
if (typeof record[field] == "object" && record[field] != null && record[field]["records"] != null) {
record[field] = record[field]["records"];
if (typeof record[field] == "object" && record[field] != null) {
if (record[field]["records"] != null) {
record[field] = record[field]["records"];
} else if (skipTechnicalColumns && record[field] != null) {
discoverColumns(record[field], column + ".", row);
continue;
}
}
let column = prefix + field;
if (Array.isArray(record[field])) {
discoverColumns(record[field], column + ".", row);
continue;
Expand Down Expand Up @@ -2099,7 +2105,7 @@ class App extends React.Component {
),
h("div", {ref: "autocompleteResultBox", className: "autocomplete-results" + (model.disableSuggestionOverText ? " autocomplete-results-under" : " autocomplete-results-over"), hidden: !model.displaySuggestion, style: model.disableSuggestionOverText ? {} : {top: model.suggestionTop + "px", left: model.suggestionLeft + "px"}},
model.autocompleteResults.results.map((r, ri) =>
h("div", {className: "autocomplete-result" + (ri == model.activeSuggestion ? " active" : ""), key: r.value}, h("a", {tabIndex: 0, title: r.title, onClick: e => { e.preventDefault(); model.autocompleteClick(r); model.didUpdate(); }, href: "#", className: r.autocompleteType + " " + r.dataType}, h("div", {className: "autocomplete-icon"}), r.value), " ")
h("div", {className: "autocomplete-result" + (ri == model.activeSuggestion ? " active" : ""), key: r.value}, h("a", {tabIndex: 0, title: r.title, onMouseDown: e => { e.preventDefault(); model.autocompleteClick(r); model.didUpdate(); }, href: "#", className: r.autocompleteType + " " + r.dataType}, h("div", {className: "autocomplete-icon"}), r.value), " ")
)
),
),
Expand Down
3 changes: 2 additions & 1 deletion addon/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class OptionsTabSelector extends React.Component {
content: [
{option: CSVSeparatorOption, props: {key: 1}},
{option: Option, props: {type: "toggle", title: "Display Query Execution Time", key: "displayQueryPerformance", default: true}},
{option: Option, props: {type: "toggle", title: "Use SObject context on Data Export ", key: "useSObjectContextOnDataImportLink", default: true}},
{option: Option, props: {type: "toggle", title: "Use SObject context on Data Export", key: "useSObjectContextOnDataImportLink", default: true}},
{option: Option, props: {type: "toggle", title: "Skip technical comlumns", key: "skipTechnicalColumns", default: true}},
{option: QueryTemplatesOption, props: {title: "Query Templates", key: "queryTemplates", placeholder: "SELECT..."}},
{option: QueryTemplatesOption, props: {title: "Saved Query History", key: "insextSavedQueryHistory", node: "query", withName: true, defaultValue: "{\"useToolingApi\": false}", placeholder: "SELECT..."}}
]
Expand Down

0 comments on commit 40a903f

Please sign in to comment.