Filesync w 2.0.0-rc3
This commit is contained in:
@@ -11,29 +11,8 @@ const Admin2 = (props) => {
|
||||
const [organizationFeatures, setOrganizationFeatures] = useState({});
|
||||
const [orgRequest, setOrgRequest] = React.useState(true);
|
||||
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
|
||||
|
||||
const handleGetOrg = (orgId) => {
|
||||
// if (
|
||||
// serverside !== true &&
|
||||
// window.location.search !== undefined &&
|
||||
// window.location.search !== null
|
||||
// ) {
|
||||
// const urlSearchParams = new URLSearchParams(window.location.search);
|
||||
// const params = Object.fromEntries(urlSearchParams.entries());
|
||||
// const foundorgid = params["org_id"];
|
||||
// if (foundorgid !== undefined && foundorgid !== null) {
|
||||
// orgId = foundorgid;
|
||||
// }
|
||||
// }
|
||||
console.log("getting organization details for: ", orgId);
|
||||
|
||||
// if (orgId === undefined) {
|
||||
// toast(
|
||||
// "Organization ID not defined. Please contact us on https://shuffler.io if this persists logout.",
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Just use this one?
|
||||
|
||||
fetch(`${globalUrl}/api/v1/orgs/${orgId}`, {
|
||||
method: "GET",
|
||||
|
||||
@@ -568,6 +568,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
}, [editWorkflowModalOpen])
|
||||
|
||||
const dragRef = React.useRef(false);
|
||||
|
||||
|
||||
// New for generated stuff
|
||||
const releaseToConnectLabel = "Release to Connect"
|
||||
const integrationApps = [{
|
||||
@@ -696,11 +699,32 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
|
||||
if (loadedApps.includes(appId)) {
|
||||
return
|
||||
console.log("App already loaded: ", appId)
|
||||
|
||||
// 1. Find the app and check if it has actions
|
||||
// 2. If it doesn't have actions, reload once again
|
||||
var should_reload = false
|
||||
for (var i = 0; i < apps.length; i++) {
|
||||
const curapp = apps[i]
|
||||
if (curapp.id !== appId) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (curapp.actions === undefined || curapp.actions === null || curapp.actions.length === 0 || curapp.actions.length === 1) {
|
||||
should_reload = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!should_reload) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
loadedApps.push(appId)
|
||||
setLoadedApps(loadedApps)
|
||||
if (!loadedApps.includes(appId)) {
|
||||
loadedApps.push(appId)
|
||||
setLoadedApps(loadedApps)
|
||||
}
|
||||
|
||||
const appUrl = `${globalUrl}/api/v1/apps/${appId}/config?openapi=false`
|
||||
fetch(appUrl, {
|
||||
@@ -2331,6 +2355,35 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
return success
|
||||
};
|
||||
|
||||
const fixExample = (input, required) => {
|
||||
if (input === undefined || input === null || input.length === 0) {
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
// 1. Find anything matching ${variable}
|
||||
// 2. If it is required, replace it with REQUIRED
|
||||
// 3. If it is not required, replace it with empty
|
||||
|
||||
// Check if it is a string or not
|
||||
var newExample = input
|
||||
if (typeof newExample !== "string") {
|
||||
return newExample
|
||||
}
|
||||
|
||||
const found = newExample.match(/\${(.*?)}/g)
|
||||
if (found === null || found === undefined || found.length === 0) {
|
||||
return newExample
|
||||
}
|
||||
|
||||
for (var i = 0; i < found.length; i++) {
|
||||
//newExample = newExample.replace(found[i], "REQUIRED")
|
||||
newExample = newExample.replace(found[i], "REPLACE_ME")
|
||||
}
|
||||
|
||||
return newExample
|
||||
}
|
||||
|
||||
const monitorUpdates = () => {
|
||||
var firstnode = cy.getElementById(workflow.start);
|
||||
if (firstnode.length === 0) {
|
||||
@@ -3656,7 +3709,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
setWorkflows([responseJson])
|
||||
} else {
|
||||
getAppAuthentication();
|
||||
getEnvironments();
|
||||
getEnvironments(responseJson.org_id)
|
||||
|
||||
getSettings();
|
||||
getFiles()
|
||||
@@ -6864,7 +6917,9 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
}
|
||||
|
||||
if (showEnvCnt > 1) {
|
||||
// Always showing for now
|
||||
//if (showEnvCnt > 1) {
|
||||
if (showEnvCnt > 0) {
|
||||
setShowEnvironment(true)
|
||||
}
|
||||
|
||||
@@ -10018,15 +10073,37 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
|
||||
const ParsedAppPaper = (props) => {
|
||||
const app = props.app
|
||||
const small = props.small
|
||||
const actionString = props.action
|
||||
const small = props.small
|
||||
const actionString = props.action
|
||||
|
||||
const [hover, setHover] = React.useState(false);
|
||||
React.useEffect(() => {
|
||||
if(app.name === "Shuffle Tools"){
|
||||
if (app.actions !== undefined && (app.actions === null || app.actions.length === 1)) {
|
||||
loadAppConfig(app.id, false)
|
||||
|
||||
// Prevent hover effects during drag
|
||||
const handleMouseMove = React.useCallback((e) => {
|
||||
if (dragRef.current) {
|
||||
setHover(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
// Add mousemove listener to track dragging
|
||||
document.addEventListener('mousemove', handleMouseMove);
|
||||
return () => {
|
||||
document.removeEventListener('mousemove', handleMouseMove);
|
||||
};
|
||||
}, [handleMouseMove]);
|
||||
|
||||
|
||||
React.useEffect(() => {
|
||||
if (props.skip_load === true) {
|
||||
return
|
||||
}
|
||||
|
||||
if (app.name === "Shuffle Tools"){
|
||||
if (app.actions !== undefined && (app.actions === null || app.actions.length === 1)) {
|
||||
loadAppConfig(app.id, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [])
|
||||
|
||||
if (app === undefined || app === null) {
|
||||
@@ -10115,13 +10192,20 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
|
||||
newAppStyle.backgroundColor = theme.palette.backgroundColor
|
||||
|
||||
return (
|
||||
<Draggable
|
||||
onStart={() => {
|
||||
dragRef.current = true;
|
||||
newAppStyle.zIndex = 9999
|
||||
|
||||
}}
|
||||
onDrag={(e) => {
|
||||
newAppStyle.zIndex = 9999
|
||||
handleAppDrag(e, app)
|
||||
}}
|
||||
onStop={(e) => {
|
||||
dragRef.current = false;
|
||||
newAppStyle.zIndex = "none"
|
||||
handleDragStop(e, app)
|
||||
}}
|
||||
key={app.id}
|
||||
@@ -10132,18 +10216,18 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
<Paper
|
||||
square
|
||||
style={newAppStyle}
|
||||
onMouseOver={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
setHover(true)
|
||||
|
||||
if (app.actions !== undefined && (app.actions === null || app.actions.length === 1)) {
|
||||
loadAppConfig(app.id, false)
|
||||
}
|
||||
|
||||
onMouseEnter={(e) => {
|
||||
if (!dragRef.current) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setHover(true);
|
||||
|
||||
if (app.actions !== undefined && (app.actions === null || app.actions.length === 1)) {
|
||||
loadAppConfig(app.id, false);
|
||||
}
|
||||
}
|
||||
}}
|
||||
onMouseOut={() => {
|
||||
onMouseLeave={() => {
|
||||
setHover(false);
|
||||
}}
|
||||
onClick={() => {
|
||||
@@ -10586,6 +10670,27 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
|
||||
var viewedApps = []
|
||||
|
||||
const QuickAccessSection = ({title, items, renderItem}) => (
|
||||
<div style={{marginBottom: 25}}>
|
||||
<Typography
|
||||
variant="body1"
|
||||
color="textSecondary"
|
||||
style={{marginTop: 20, marginLeft: 5}}
|
||||
>
|
||||
{title}
|
||||
</Typography>
|
||||
<div style={{display: "flex", flexWrap: "wrap", gap: 5}}>
|
||||
{items.map((item, index) => renderItem(item, index))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
// Popular Shuffle Tools actions
|
||||
const popularActions = [
|
||||
["repeat_back_to_me", "filter_list", "execute_python", "parse_ioc"],
|
||||
["set_cache_value", "get_file_meta", "merge_lists", "send_sms_shuffle"]
|
||||
];
|
||||
return (
|
||||
<div style={appViewStyle}>
|
||||
<div style={{ flex: "1", zoom: 0.9, }}>
|
||||
@@ -10628,59 +10733,37 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}}
|
||||
/>
|
||||
|
||||
{shuffleToolsApp !== undefined && shuffleToolsApp !== null && document?.getElementById("appsearch")?.value?.length === 0 ?
|
||||
<div style={{marginBottom: 25, }}>
|
||||
<Typography variant="body1" color="textSecondary" style={{marginTop: 20, marginLeft: 5, }}>
|
||||
Popular Actions
|
||||
</Typography>
|
||||
<div style={{
|
||||
display: "flex",
|
||||
}}>
|
||||
<ParsedAppPaper small={true} action={"repeat_back_to_me"} app={shuffleToolsApp} />
|
||||
<div style={{marginLeft: 5, }}/>
|
||||
<ParsedAppPaper small={true} action={"filter_list"} app={shuffleToolsApp} />
|
||||
<div style={{marginLeft: 5, }}/>
|
||||
<ParsedAppPaper small={true} action={"execute_python"} app={shuffleToolsApp} />
|
||||
<div style={{marginLeft: 5, }}/>
|
||||
<ParsedAppPaper small={true} action={"parse_ioc"} app={shuffleToolsApp} />
|
||||
</div>
|
||||
<div style={{
|
||||
display: "flex",
|
||||
}}>
|
||||
<ParsedAppPaper small={true} action={"set_cache_value"} app={shuffleToolsApp} />
|
||||
<div style={{marginLeft: 5, }}/>
|
||||
<ParsedAppPaper small={true} action={"get_file_meta"} app={shuffleToolsApp} />
|
||||
<div style={{marginLeft: 5, }}/>
|
||||
<ParsedAppPaper small={true} action={"merge_lists"} app={shuffleToolsApp} />
|
||||
<div style={{marginLeft: 5, }}/>
|
||||
<ParsedAppPaper small={true} action={"send_sms_shuffle"} app={shuffleToolsApp} />
|
||||
</div>
|
||||
</div>
|
||||
: null}
|
||||
|
||||
{document?.getElementById("appsearch")?.value?.length === 0 ?
|
||||
<div style={{marginBottom: 25, }}>
|
||||
<Typography variant="body1" color="textSecondary" style={{marginTop: 20, marginLeft: 5, }}>
|
||||
Triggers
|
||||
</Typography>
|
||||
<div style={{
|
||||
display: "flex",
|
||||
}}>
|
||||
{triggers.map((trigger, index) => {
|
||||
if (trigger.trigger_type === "PIPELINE") {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
return(
|
||||
<div key={index} style={{marginLeft: index !== 0 ? 5 : 0, }}>
|
||||
<ParsedAppPaper small={true} action={trigger.name} app={JSON.parse(JSON.stringify(trigger))} />
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
: null}
|
||||
{shuffleToolsApp && !document?.getElementById("appsearch")?.value?.length && (
|
||||
<QuickAccessSection
|
||||
title="Popular Actions"
|
||||
items={popularActions.flat()}
|
||||
renderItem={(action) => (
|
||||
<ParsedAppPaper
|
||||
key={action}
|
||||
small={true}
|
||||
action={action}
|
||||
app={shuffleToolsApp}
|
||||
skip_load={true}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!document?.getElementById("appsearch")?.value?.length && (
|
||||
<QuickAccessSection
|
||||
title="Triggers"
|
||||
items={triggers.filter(t => t.trigger_type !== "PIPELINE")}
|
||||
renderItem={(trigger, index) => (
|
||||
<ParsedAppPaper
|
||||
key={index}
|
||||
small={true}
|
||||
action={trigger.name}
|
||||
app={JSON.parse(JSON.stringify(trigger))}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Typography variant="body1" color="textSecondary" style={{marginTop: 20, marginLeft: 5, }}>
|
||||
Your Apps
|
||||
@@ -13942,8 +14025,23 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
};
|
||||
|
||||
var parsedPaths = [];
|
||||
console.log("Found example data: ", innerdata.example)
|
||||
if (typeof innerdata.example === "object") {
|
||||
|
||||
if (innerdata.type === "workflow_variable") {
|
||||
// Try to parse the value if it's a string that could be JSON
|
||||
if (typeof innerdata.value === "string") {
|
||||
try {
|
||||
const parsedValue = JSON.parse(innerdata.value)
|
||||
if (typeof parsedValue === "object") {
|
||||
parsedPaths = GetParsedPaths(parsedValue, "");
|
||||
}
|
||||
} catch (e) {
|
||||
// Not valid JSON, use the value directly
|
||||
parsedPaths = GetParsedPaths(innerdata.value, "");
|
||||
}
|
||||
} else if (typeof innerdata.value === "object") {
|
||||
parsedPaths = GetParsedPaths(innerdata.value, "");
|
||||
}
|
||||
} else if (typeof innerdata.example === "object") {
|
||||
parsedPaths = GetParsedPaths(innerdata.example, "");
|
||||
}
|
||||
|
||||
@@ -16531,7 +16629,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
</div>
|
||||
|
||||
{showEnvironment === true && environments.length > 1 && selectedActionEnvironment !== undefined && selectedActionEnvironment !== null && selectedActionEnvironment.Name !== undefined && selectedActionEnvironment.Name !== null ?
|
||||
{showEnvironment === true && environments.length > 0 && selectedActionEnvironment !== undefined && selectedActionEnvironment !== null && selectedActionEnvironment.Name !== undefined && selectedActionEnvironment.Name !== null ?
|
||||
<FormControl fullWidth style={{marginTop: 15, pointerEvents: "auto", maxWidth: 250, }}>
|
||||
|
||||
<InputLabel
|
||||
@@ -16556,6 +16654,10 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
height: 40,
|
||||
}
|
||||
}}
|
||||
onClick={(e) => {
|
||||
console.log("CLICK!")
|
||||
getEnvironments(workflow.org_id)
|
||||
}}
|
||||
onChange={(e) => {
|
||||
setLastSaved(false)
|
||||
const env = environments.find((a) => a.Name === e.target.value);
|
||||
@@ -16600,8 +16702,9 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
>
|
||||
|
||||
{data.Name === "cloud" || data.Name === "Cloud" ? null : !isRunning ?
|
||||
|
||||
<a href={`/admin?tab=locations&env=${data.Name}`} target="_blank" style={{textDecoration: "none",}}>
|
||||
<Tooltip title={"Click to configure this location"} placement="top">
|
||||
<Tooltip title={"Click to configure this runtime location"} placement="top">
|
||||
<Chip
|
||||
style={{marginLeft: 0, padding: 0, marginRight: 10, cursor: "pointer", backgroundColor: red, }}
|
||||
label={"Stopped"}
|
||||
@@ -16610,6 +16713,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
window.open(`/admin?tab=locations&env=${data.Name}`, "_blank", "noopener,noreferrer")
|
||||
}}
|
||||
|
||||
@@ -16617,7 +16721,21 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
/>
|
||||
</Tooltip>
|
||||
</a>
|
||||
: null}
|
||||
:
|
||||
<Chip
|
||||
key={index}
|
||||
style={{
|
||||
color: green,
|
||||
borderColor: green,
|
||||
}}
|
||||
label={"Running"}
|
||||
onClick={() => {
|
||||
//handleChipClick
|
||||
}}
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
/>
|
||||
}
|
||||
|
||||
{data.default === true ?
|
||||
<Chip
|
||||
@@ -18000,7 +18118,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
setWorkflow(workflow)
|
||||
|
||||
getAppAuthentication();
|
||||
getEnvironments();
|
||||
getEnvironments(workflow.org_id)
|
||||
getWorkflowExecution(props.match.params.key, "");
|
||||
getAvailableWorkflows(-1);
|
||||
getSettings();
|
||||
@@ -19020,7 +19138,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
window.open(`/admin?admin_tab=priorities&workflow=${data.workflow.id}&execution_id=${data.execution_id}`, "_blank")
|
||||
window.open(`/admin?admin_tab=notifications&workflow=${data.workflow.id}&execution_id=${data.execution_id}`, "_blank")
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
@@ -19075,7 +19193,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ padding: isMobile ? "0px 10px 25px 10px" : "25px 15px 25px 15px", maxWidth: isMobile ? "100%" : "100%", overflowX: "hidden" }}>
|
||||
<div style={{ padding: isMobile ? "0px 10px 50px 10px" : "25px 15px 150px 15px", maxWidth: isMobile ? "100%" : "100%", overflowX: "hidden", }}>
|
||||
|
||||
|
||||
<Breadcrumbs
|
||||
@@ -19129,7 +19247,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
marginBottom: 10,
|
||||
}}
|
||||
/>
|
||||
<div style={{ display: "flex", marginLeft: 10, }}>
|
||||
<div style={{ display: "flex", paddingLeft: 10, paddingRight: 10, position: "sticky", top: 0, zIndex: 12500, backgroundColor: theme.palette.platformColor, borderRadius: theme.palette.borderRadius, border: "2px solid rgba(255,255,255,0.3)", marginBottom: 10, }}>
|
||||
<h2>Details</h2>
|
||||
<Tooltip
|
||||
color="primary"
|
||||
@@ -19269,7 +19387,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
window.open(`/admin?admin_tab=priorities&workflow=${executionData.workflow.id}&execution_id=${executionData.execution_id}`, "_blank")
|
||||
window.open(`/admin?admin_tab=notifications&workflow=${executionData.workflow.id}&execution_id=${executionData.execution_id}`, "_blank")
|
||||
}}
|
||||
/>
|
||||
</Button>
|
||||
@@ -20190,7 +20308,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
|
||||
if (stringjson.includes("kms/")) {
|
||||
return "KMS authentication most likely failed. Check your notifications for more details on this page: /admin?admin_tab=priorities. If you need help with KMS, please contact support@shuffler.io"
|
||||
return "KMS authentication most likely failed. Check your notifications for more details on this page: /admin?admin_tab=notifications. If you need help with KMS, please contact support@shuffler.io"
|
||||
}
|
||||
|
||||
if (stringjson.includes("invalidurl")) {
|
||||
@@ -20208,7 +20326,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
|
||||
if (isCloud && stringjson.toLowerCase().includes("timeout error")) {
|
||||
return "Run this workflow in a local environment to increase the timeout. Go to https://shuffler.io/admin?tab=locationsto create an environment to connect to"
|
||||
return "Run this workflow in a local environment to increase the timeout. Go to https://shuffler.io/admin?tab=locations to create an environment to connect to"
|
||||
}
|
||||
|
||||
if (stringjson.toLowerCase().includes("invalid header")) {
|
||||
@@ -20218,7 +20336,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
|
||||
if (stringjson.includes("connectionerror")) {
|
||||
if (stringjson.includes("kms")) {
|
||||
return "KMS authentication most likely failed (2). Check your notifications for more details on this page: /admin?admin_tab=priorities&kms=true. If you need help with KMS, please contact support@shuffler.io"
|
||||
return "KMS authentication most likely failed (2). Check your notifications for more details on this page: /admin?admin_tab=notifications&kms=true. If you need help with KMS, please contact support@shuffler.io"
|
||||
}
|
||||
|
||||
return "The URL is incorrect, or Shuffle can't reach it. Set up a Shuffle Environment in the same VLAN, or whitelist Shuffle's IPs."
|
||||
@@ -20696,6 +20814,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
setExpansionModalOpen={setCodeEditorModalOpen}
|
||||
setEditorData={setEditorData}
|
||||
setAiQueryModalOpen={setAiQueryModalOpen}
|
||||
fixExample={fixExample}
|
||||
/>
|
||||
</div>
|
||||
</Fade>
|
||||
@@ -22583,6 +22702,8 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
changeActionParameterCodeMirror={changeActionParameterCodeMirror}
|
||||
activeDialog={activeDialog}
|
||||
setActiveDialog={setActiveDialog}
|
||||
environment={selectedActionEnvironment}
|
||||
|
||||
|
||||
setAiQueryModalOpen={setAiQueryModalOpen}
|
||||
/>
|
||||
|
||||
@@ -101,8 +101,8 @@ const ApiExplorerWrapper = (props) => {
|
||||
}, [selectedAppData, openapi])
|
||||
|
||||
useEffect(() => {
|
||||
getAppData(appid)
|
||||
if (appid !== undefined && appid !== null && appid.length !== 0) {
|
||||
getAppData(appid)
|
||||
HandleGetLocations()
|
||||
}
|
||||
|
||||
@@ -157,13 +157,17 @@ const ApiExplorerWrapper = (props) => {
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
toast.error("Failed to get app data or App doesn't exist (1). Redirecting..");
|
||||
toast.error(`Failed to get API data for '${appname}' (1). Contact support@shuffler.io if this persists.`, {
|
||||
"autoClose": 10000,
|
||||
})
|
||||
setTimeout(()=>{
|
||||
navigate("/search?tab=apps");
|
||||
},3000)
|
||||
}
|
||||
} else {
|
||||
toast.error("Failed to get app data or App doesn't exist (2). Redirecting..");
|
||||
toast.error(`Failed to get API data for '${appname}' (2). Contact support@shuffler.io if this persists.`, {
|
||||
"autoClose": 10000,
|
||||
})
|
||||
setTimeout(()=>{
|
||||
navigate("/search?tab=apps");
|
||||
},3000)
|
||||
@@ -177,6 +181,11 @@ const ApiExplorerWrapper = (props) => {
|
||||
// Fetch data when appid is available
|
||||
const getAppData = useCallback((appid) => {
|
||||
if (appid === undefined || appid === null || appid.length === 0) {
|
||||
toast.error("No API data to load (4). Please contact support@shuffler.io if this persists.")
|
||||
|
||||
setTimeout(() => {
|
||||
navigate("/search?tab=apps")
|
||||
}, 3000)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -197,9 +206,9 @@ const ApiExplorerWrapper = (props) => {
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
toast.error("Failed to get app data or App doesn't exist (3). Redirecting..");
|
||||
setTimeout(()=>{
|
||||
navigate("/search?tab=apps");
|
||||
},3000)
|
||||
setTimeout(() => {
|
||||
navigate("/search?tab=apps")
|
||||
}, 3000)
|
||||
return;
|
||||
}
|
||||
return response.json();
|
||||
@@ -1790,7 +1799,7 @@ const Wrapper = ({children, isLoaded,isLoggedIn})=>{
|
||||
|
||||
return(
|
||||
|
||||
<div className="api-explorer-wrapper" style={{ paddingLeft: (isLoggedIn && isLoaded) ? leftSideBarOpenByClick ? 280 : 100 : 0, transition: 'padding-left 0.3s ease' }}>
|
||||
<div className="api-explorer-wrapper" style={{ zoom: 0.8, paddingLeft: (isLoggedIn && isLoaded) ? leftSideBarOpenByClick ? 280 : 100 : 0, transition: 'padding-left 0.3s ease' }}>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
|
||||
+13
-94
@@ -383,6 +383,7 @@ const Docs = (defaultprops) => {
|
||||
if (hash.includes('?')) {
|
||||
hash = hash.split('?')[0]
|
||||
}
|
||||
|
||||
if (hash) {
|
||||
const element = document.getElementById(hash.toLowerCase())
|
||||
if (element) {
|
||||
@@ -526,7 +527,7 @@ const Docs = (defaultprops) => {
|
||||
backgroundColor: theme.palette.inputColor,
|
||||
padding: 15,
|
||||
borderRadius: theme.palette?.borderRadius,
|
||||
marginBottom: 30,
|
||||
marginBottom: 25,
|
||||
display: "flex",
|
||||
}}
|
||||
>
|
||||
@@ -618,7 +619,8 @@ const Docs = (defaultprops) => {
|
||||
<Divider
|
||||
style={{
|
||||
width: "90%",
|
||||
marginTop: 40,
|
||||
marginTop: 60,
|
||||
marginBottom: 20,
|
||||
backgroundColor: theme.palette.inputColor,
|
||||
}}
|
||||
/>
|
||||
@@ -664,6 +666,8 @@ const Docs = (defaultprops) => {
|
||||
minHeight: "93vh",
|
||||
maxHeight: "93vh",
|
||||
marginTop: 70,
|
||||
maxWidth: 250,
|
||||
overflow: "hidden",
|
||||
}
|
||||
|
||||
const fetchDocList = () => {
|
||||
@@ -705,8 +709,7 @@ const Docs = (defaultprops) => {
|
||||
// Find <img> tags and translate them into ![]() format
|
||||
const imgRegex = /<img.*?src="(.*?)"/g;
|
||||
const tocRegex = /^## Table of contents[\s\S]*?(?=^## )|^## Table of contents[\s\S]*$/gm;
|
||||
const newdata = responseJson.reason.replace(imgRegex, '')
|
||||
.replace(tocRegex, "");
|
||||
const newdata = responseJson.reason.replace(imgRegex, '').replace(tocRegex, "");
|
||||
setData(newdata);
|
||||
if (docId === undefined) {
|
||||
document.title = "Shuffle documentation introduction";
|
||||
@@ -782,88 +785,6 @@ const Docs = (defaultprops) => {
|
||||
fetchDocs(props.match.params.key);
|
||||
}
|
||||
|
||||
// const parseElementScroll = () => {
|
||||
// const offset = 45;
|
||||
// var parent = document.getElementById("markdown_wrapper_outer");
|
||||
// if (parent !== null) {
|
||||
// //console.log("IN PARENT")
|
||||
// var elements = parent.getElementsByTagName("h2");
|
||||
//
|
||||
// const name = window.location.hash
|
||||
// .slice(1, window.location.hash.length)
|
||||
// .toLowerCase()
|
||||
// .split("%20")
|
||||
// .join(" ")
|
||||
// .split("_")
|
||||
// .join(" ")
|
||||
// .split("-")
|
||||
// .join(" ")
|
||||
// .split("?")[0]
|
||||
//
|
||||
// //console.log(name)
|
||||
// var found = false;
|
||||
// for (var key in elements) {
|
||||
// const element = elements[key];
|
||||
// if (element.innerHTML === undefined) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// // Fix location..
|
||||
// if (element.innerHTML.toLowerCase() === name) {
|
||||
// //console.log(element.offsetTop)
|
||||
// element.scrollIntoView({ behavior: "smooth" });
|
||||
// //element.scrollTo({
|
||||
// // top: element.offsetTop+offset,
|
||||
// // behavior: "smooth"
|
||||
// //})
|
||||
// found = true;
|
||||
// //element.scrollTo({
|
||||
// // top: element.offsetTop-100,
|
||||
// // behavior: "smooth"
|
||||
// //})
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // H#
|
||||
// if (!found) {
|
||||
// elements = parent.getElementsByTagName("h3");
|
||||
// //console.log("NAMe: ", name)
|
||||
// found = false;
|
||||
// for (key in elements) {
|
||||
// const element = elements[key];
|
||||
// if (element.innerHTML === undefined) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// // Fix location..
|
||||
// if (element.innerHTML.toLowerCase() === name) {
|
||||
// element.scrollIntoView({ behavior: "smooth" });
|
||||
// //element.scrollTo({
|
||||
// // top: element.offsetTop-offset,
|
||||
// // behavior: "smooth"
|
||||
// //})
|
||||
// found = true;
|
||||
// //element.scrollTo({
|
||||
// // top: element.offsetTop-100,
|
||||
// // behavior: "smooth"
|
||||
// //})
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //console.log(element)
|
||||
//
|
||||
// //console.log("NAME: ", name)
|
||||
// //console.log(document.body.innerHTML)
|
||||
// // parent = document.getElementById(parent);
|
||||
//
|
||||
// //var descendants = parent.getElementsByTagName(tagname);
|
||||
//
|
||||
// // this.scrollDiv.current.scrollIntoView({ behavior: 'smooth' });
|
||||
//
|
||||
// //$(".parent").find("h2:contains('Statistics')").parent();
|
||||
// };
|
||||
|
||||
const markdownStyle = {
|
||||
color: "rgba(255, 255, 255, 0.90)",
|
||||
overflow: "hidden",
|
||||
@@ -872,7 +793,7 @@ const Docs = (defaultprops) => {
|
||||
maxWidth: "100%",
|
||||
minWidth: "100%",
|
||||
overflow: "hidden",
|
||||
fontSize: isMobile ? "1.3rem" : "1.1rem",
|
||||
fontSize: isMobile ? "1.3rem" : "0.8rem",
|
||||
};
|
||||
|
||||
const alertNote = {
|
||||
@@ -1084,25 +1005,23 @@ const Docs = (defaultprops) => {
|
||||
<div style={IndexBar}>
|
||||
{tocLines.length > 0 ?
|
||||
(
|
||||
<h4 style={{ fontWeight: 600, margin: 0, fontSize: "16px", marginBottom: "8px" }}>Table Of Content</h4>
|
||||
<h4 style={{ fontWeight: 600, margin: 0, fontSize: "16px", marginBottom: "8px" }}>Table of Content</h4>
|
||||
|
||||
) : null}
|
||||
<nav>
|
||||
{tocLines.map((data, index) => {
|
||||
return (
|
||||
<div className="toc">
|
||||
<div className="toc"
|
||||
>
|
||||
<ListItemButton
|
||||
key={data.text}
|
||||
href={`#${data.id}`}
|
||||
style={{
|
||||
color: activeId === data.id ? "#f86a3e" : "inherit",
|
||||
textDecoration: "none",
|
||||
fontSize: "14px",
|
||||
fontWeight: 400,
|
||||
padding: "4px 0",
|
||||
paddingLeft: "8px",
|
||||
paddingRight: "8px",
|
||||
padding: "4px 8px 4px 8px",
|
||||
lineHeight: "20px",
|
||||
color: activeId === data.id ? "#f86a3e" : "rgba(255,255,255,0.6)",
|
||||
}}
|
||||
onClick={(e) => {
|
||||
handleCollapse(index)
|
||||
|
||||
@@ -80,25 +80,15 @@ const useStyles = makeStyles((theme) => ({
|
||||
datagrid: {
|
||||
border: 0,
|
||||
"& .MuiDataGrid-columnsContainer": {
|
||||
backgroundColor:
|
||||
theme.palette.type === "light" ? "#fafafa" : theme.palette.inputColor,
|
||||
},
|
||||
"& .MuiDataGrid-iconSeparator": {
|
||||
display: "none",
|
||||
},
|
||||
"& .MuiDataGrid-colCell, .MuiDataGrid-cell": {
|
||||
borderRight: `1px solid ${
|
||||
theme.palette.type === "light" ? "white" : "#303030"
|
||||
}`,
|
||||
},
|
||||
"& .MuiDataGrid-columnsContainer, .MuiDataGrid-cell": {
|
||||
borderBottom: `1px solid ${
|
||||
theme.palette.type === "light" ? "#f0f0f0" : "#303030"
|
||||
}`,
|
||||
},
|
||||
"& .MuiDataGrid-cell": {
|
||||
color:
|
||||
theme.palette.type === "light" ? "white" : "rgba(255,255,255,0.65)",
|
||||
},
|
||||
"& .MuiPaginationItem-root, .MuiTablePagination-actions, .MuiTablePagination-caption":
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user