Skip to content

Commit

Permalink
#152 : option link from page
Browse files Browse the repository at this point in the history
  • Loading branch information
dufoli committed Jul 29, 2024
1 parent 8fbf5f0 commit 788d34f
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 18 deletions.
8 changes: 7 additions & 1 deletion addon/apex-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,9 @@ class App extends React.Component {

render() {
let {model} = this.props;
let hostArg = new URLSearchParams();
hostArg.set("host", model.sfHost);
hostArg.set("tab", 5);
let suggestionHelper = "";
if (!model.disableSuggestionOverText) {
if (model.displaySuggestion) {
Expand Down Expand Up @@ -1271,7 +1274,10 @@ class App extends React.Component {
h("div", {className: "slds-spinner__dot-a"}),
h("div", {className: "slds-spinner__dot-b"}),
),
h("a", {href: "#", id: "help-btn", title: "Execute Help", onClick: this.onToggleHelp},
h("a", {href: "options.html?" + hostArg, className: "top-btn", id: "options-btn", title: "Option", target: "_blank"},
h("div", {className: "icon"})
),
h("a", {href: "#", className: "top-btn", id: "help-btn", title: "Execute Help", onClick: this.onToggleHelp},
h("div", {className: "icon"})
),
),
Expand Down
15 changes: 11 additions & 4 deletions addon/data-export.css
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ textarea[readonly] {
border-top: 1px solid #DDDBDA;
}

#help-btn {
.top-btn {
margin-left: auto;
text-decoration: none;
font-size: 1.5rem;
Expand All @@ -338,23 +338,30 @@ textarea[readonly] {
align-items: center;
}

#help-btn:hover .icon {
.top-btn:hover .icon {
background-color: #818181;
}

#help-btn .icon {
.top-btn .icon {
display: inline-block;
width: 1.4rem;
height: 1.4rem;
;
-webkit-mask-repeat: no-repeat;
-webkit-mask-size: 1.4rem;
;
-webkit-mask-image: url('chrome-extension://__MSG_@@extension_id__/images/help.svg');
-webkit-mask-position: center;
background-color: #919191;
}

#help-btn .icon {
-webkit-mask-image: url('chrome-extension://__MSG_@@extension_id__/images/help.svg');
}
#options-btn .icon {
-webkit-mask-image: url('chrome-extension://__MSG_@@extension_id__/images/settings.svg');
}


#spinner {
left: -15px;
top: 9px;
Expand Down
9 changes: 8 additions & 1 deletion addon/data-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,10 @@ class App extends React.Component {
}
render() {
let {model} = this.props;
let hostArg = new URLSearchParams();
hostArg.set("host", model.sfHost);
hostArg.set("tab", 3);

let suggestionHelper = "";
if (!model.disableSuggestionOverText) {
if (model.displaySuggestion) {
Expand Down Expand Up @@ -2116,7 +2120,10 @@ class App extends React.Component {
h("div", {className: "slds-spinner__dot-a"}),
h("div", {className: "slds-spinner__dot-b"}),
),
h("a", {href: "#", id: "help-btn", title: "Export Help", onClick: this.onToggleHelp},
h("a", {href: "options.html?" + hostArg, className: "top-btn", id: "options-btn", title: "Option", target: "_blank"},
h("div", {className: "icon"})
),
h("a", {href: "#", className: "top-btn", id: "help-btn", title: "Export Help", onClick: this.onToggleHelp},
h("div", {className: "icon"})
),
),
Expand Down
23 changes: 17 additions & 6 deletions addon/data-import.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ body {
border-radius: 2px;
fill: white;
}
#help-btn {

.top-btn {
margin-left: auto;
text-decoration: none;
font-size: 1.5rem;
Expand All @@ -113,19 +114,29 @@ body {
display: flex;
align-items: center;
}
#help-btn:hover .icon{

.top-btn:hover .icon {
background-color: #818181;
}
#help-btn .icon {

.top-btn .icon {
display: inline-block;
width: 1.4rem;
height: 1.4rem;;
height: 1.4rem;
;
-webkit-mask-repeat: no-repeat;
-webkit-mask-size: 1.4rem;;
-webkit-mask-image: url('chrome-extension://__MSG_@@extension_id__/images/help.svg');
-webkit-mask-size: 1.4rem;
;
-webkit-mask-position: center;
background-color: #919191;
}

#help-btn .icon {
-webkit-mask-image: url('chrome-extension://__MSG_@@extension_id__/images/help.svg');
}
#options-btn .icon {
-webkit-mask-image: url('chrome-extension://__MSG_@@extension_id__/images/settings.svg');
}
#spinner {
left: -15px;
top: 9px;
Expand Down
8 changes: 7 additions & 1 deletion addon/data-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,9 @@ class App extends React.Component {
}
render() {
let {model} = this.props;
let hostArg = new URLSearchParams();
hostArg.set("host", model.sfHost);
hostArg.set("tab", 4);
return h("div", {onClick: this.onClick},
h("div", {id: "user-info"},
h("a", {href: model.sfLink, className: "sf-link"},
Expand All @@ -1283,7 +1286,10 @@ class App extends React.Component {
h("div", {className: "slds-spinner__dot-a"}),
h("div", {className: "slds-spinner__dot-b"}),
),
h("a", {href: "#", id: "help-btn", title: "Import Help", onClick: this.onToggleHelpClick},
h("a", {href: "options.html?" + hostArg, className: "top-btn", id: "options-btn", title: "Option", target: "_blank"},
h("div", {className: "icon"})
),
h("a", {href: "#", className: "top-btn", id: "help-btn", title: "Import Help", onClick: this.onToggleHelpClick},
h("div", {className: "icon"})
),
),
Expand Down
31 changes: 30 additions & 1 deletion addon/log.css
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,33 @@
position: sticky;
top: 0;
}*/


.top-btn {
margin-left: auto;
text-decoration: none;
font-size: 1.5rem;
font-weight: 700;
color: #919191;
display: flex;
align-items: center;
}

.top-btn:hover .icon {
background-color: #818181;
}

.top-btn .icon {
display: inline-block;
width: 1.4rem;
height: 1.4rem;
;
-webkit-mask-repeat: no-repeat;
-webkit-mask-size: 1.4rem;
;
-webkit-mask-position: center;
background-color: #919191;
}

#options-btn .icon {
-webkit-mask-image: url('chrome-extension://__MSG_@@extension_id__/images/settings.svg');
}
6 changes: 6 additions & 0 deletions addon/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,9 @@ class App extends React.Component {

render() {
let {model} = this.props;
let hostArg = new URLSearchParams();
hostArg.set("host", model.sfHost);
hostArg.set("tab", 5);
return h("div", {},
h("div", {id: "user-info"},
h("a", {href: model.sfLink, className: "sf-link"},
Expand All @@ -894,6 +897,9 @@ class App extends React.Component {
h("div", {className: "slds-spinner__dot-a"}),
h("div", {className: "slds-spinner__dot-b"}),
),
h("a", {href: "options.html?" + hostArg, className: "top-btn", id: "options-btn", title: "Option", target: "_blank"},
h("div", {className: "icon"})
),
),
),
h("div", {className: "area"},
Expand Down
10 changes: 6 additions & 4 deletions addon/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ function cleanInputValue(value) {

class Model {

constructor(sfHost) {
constructor(sfHost, tab) {
this.sfHost = sfHost;

this.tab = tab;
this.sfLink = "https://" + this.sfHost;
this.userInfo = "...";
if (localStorage.getItem(sfHost + "_isSandbox") != "true") {
Expand Down Expand Up @@ -68,8 +68,9 @@ class OptionsTabSelector extends React.Component {
super(props);
this.model = props.model;
this.sfHost = this.model.sfHost;
let tab = props.model.tab || 1;
this.state = {
selectedTabId: 1
selectedTabId: tab
};
this.tabs = [
{
Expand Down Expand Up @@ -692,11 +693,12 @@ class App extends React.Component {

let args = new URLSearchParams(location.search.slice(1));
let sfHost = args.get("host");
let tab = args.get("tab") ? parseInt(args.get("tab")) : 1;
initButton(sfHost, true);
sfConn.getSession(sfHost).then(() => {

let root = document.getElementById("root");
let model = new Model(sfHost);
let model = new Model(sfHost, tab);
model.reactCallback = cb => {
ReactDOM.render(h(App, {model}), root, cb);
};
Expand Down

0 comments on commit 788d34f

Please sign in to comment.