Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.1.10 Release #246

Merged
merged 13 commits into from
Oct 28, 2022
Merged
Prev Previous commit
Next Next commit
Share from self (#232)
* Share from self

* Workaround desktop

* Hide button too
  • Loading branch information
BennuFire authored Oct 15, 2022
commit f5734d34e0e25deb2faed29d7ad3bf1ffb652c51
19 changes: 18 additions & 1 deletion src/modal/ShareModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { applicationGetConnection } from '../application/ApplicationSelectors';

// const shareBaseURL = "http://localhost:3000";
const shareBaseURL = "http://neodash.graphapp.io";
const shareLocalURL = window.location.origin.startsWith("file")? shareBaseURL : window.location.origin;
const styles = {

};
Expand All @@ -42,6 +43,8 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
const [shareFileURL, setShareFileURL] = React.useState("");
const [shareConnectionDetails, setShareConnectionDetails] = React.useState("No");
const [shareStandalone, setShareStandalone] = React.useState("No");
const [selfHosted, setSelfHosted] = React.useState("No");

const [shareLink, setShareLink] = React.useState(null);


Expand Down Expand Up @@ -164,6 +167,7 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
setShareConnectionDetails(e)
}}
/>
{shareLocalURL != shareBaseURL ?
<NeoSetting key={"standalone"} name={"standalone"}
value={shareStandalone}
style={{ marginLeft: "0px", width: "100%", marginBottom: "10px" }}
Expand All @@ -179,11 +183,24 @@ export const NeoShareModal = ({ connection, loadDashboardListFromNeo4j, loadData
setShareConnectionDetails("Yes")
}
}}
/> : <></>}
<NeoSetting key={"selfHosted"} name={"selfHosted"}
value={selfHosted}
style={{ marginLeft: "0px", width: "100%", marginBottom: "10px" }}
type={SELECTION_TYPES.LIST}
helperText={"Share the dashboard using self Hosted Neodash, otherwise neodash.graphapp.io will be used"}
label={"Self Hosted Dashboard"}
defaultValue={"No"}
choices={["Yes", "No"]}
onChange={(e) => {
setShareLink(null);
setSelfHosted(e);
}}
/>
<Button
component="label"
onClick={(e) => {
setShareLink((shareBaseURL + "/?share&type=" + shareType + "&id=" + encodeURIComponent(shareID) + "&dashboardDatabase=" + encodeURIComponent(dashboardDatabase) +
setShareLink((( selfHosted == "Yes" ? shareLocalURL :shareBaseURL ) + "/?share&type=" + shareType + "&id=" + encodeURIComponent(shareID) + "&dashboardDatabase=" + encodeURIComponent(dashboardDatabase) +
(shareConnectionDetails == "Yes" ? "&credentials=" + encodeURIComponent(connection.protocol + "://"
+ connection.username + ":" + connection.password + "@" + connection.database + ":" + connection.url + ":" + connection.port) : "")
+ (shareStandalone == "Yes" ? "&standalone=" + shareStandalone : "")));
Expand Down