Moved over cache view and admin tracker features
This commit is contained in:
@@ -93,26 +93,26 @@ const CacheView = (props) => {
|
||||
},
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for apps :O!");
|
||||
return;
|
||||
}
|
||||
.then((response) => {
|
||||
if (response.status !== 200) {
|
||||
console.log("Status not 200 for list cache :O!");
|
||||
return;
|
||||
}
|
||||
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === true) {
|
||||
setListCache(responseJson.keys);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === true) {
|
||||
setListCache(responseJson.keys);
|
||||
}
|
||||
|
||||
if (responseJson.cursor !== undefined && responseJson.cursor !== null && responseJson.cursor !== "") {
|
||||
setCacheCursor(responseJson.cursor);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast(error.toString());
|
||||
});
|
||||
if (responseJson.cursor !== undefined && responseJson.cursor !== null && responseJson.cursor !== "") {
|
||||
setCacheCursor(responseJson.cursor);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast(error.toString());
|
||||
});
|
||||
};
|
||||
|
||||
// const getCacheList = (orgId) => {
|
||||
|
||||
@@ -155,9 +155,21 @@ const { globalUrl, setNotifications, notifications, isLoggedIn, removeCookie, ho
|
||||
.then(() => {
|
||||
// Log out anyway
|
||||
removeCookie("session_token", {path: "/"})
|
||||
removeCookie("__session", {path: "/"})
|
||||
removeCookie("_session", {path: "/"})
|
||||
|
||||
removeCookie("session_token", {path: "/"})
|
||||
removeCookie("__session", {path: "/"})
|
||||
removeCookie("_session", {path: "/"})
|
||||
|
||||
removeCookie("session_token", {path: "/"})
|
||||
removeCookie("__session", {path: "/"})
|
||||
removeCookie("_session", {path: "/"})
|
||||
|
||||
removeCookie("session_token", {path: "/"})
|
||||
removeCookie("__session", {path: "/"})
|
||||
removeCookie("_session", {path: "/"})
|
||||
|
||||
window.location.pathname = "/"
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
@@ -1155,7 +1155,7 @@ const Header = (props) => {
|
||||
userdata.app_execution_usage === undefined ||
|
||||
userdata.app_execution_usage < 1000 ? null : (
|
||||
<Tooltip
|
||||
title={`Amount of executions left: ${userdata.app_execution_usage} / ${userdata.app_execution_limit}. When the limit is reached, you can still use Shuffle normally, but your Workflow triggers may stop working. Reach out to support@shuffler.io to extend this limit.`}
|
||||
title={`Amount of App Runs used: ${userdata.app_execution_usage} / ${userdata.app_execution_limit}. When the limit is reached, you can still use Shuffle normally, but your Workflow triggers will stop workflows from starting. Reach out to support@shuffler.io to extend this limit.`}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
|
||||
@@ -86,6 +86,7 @@ import {
|
||||
AutoFixHigh as AutoFixHighIcon,
|
||||
Circle as CircleIcon,
|
||||
SquareFoot as SquareFootIcon,
|
||||
Storage as StorageIcon,
|
||||
} from '@mui/icons-material';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
@@ -1063,7 +1064,6 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
|
||||
var helperText = ""
|
||||
//console.log("DATA: ", name, value)
|
||||
if (name.includes("url")) {
|
||||
if (value.includes("localhost") || value.includes("127.0.0.1")) {
|
||||
helperText = "Can't use localhost. Please change to your external IP."
|
||||
@@ -1364,6 +1364,13 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var showCacheConfig = false
|
||||
if (data.name === "key" && selectedAction.name.includes("cache") && selectedAction.app_name === "Shuffle Tools") {
|
||||
// Show a key popout button
|
||||
showCacheConfig = true
|
||||
}
|
||||
|
||||
var disabled = false;
|
||||
var rows = "3";
|
||||
var openApiHelperText = "This is an OpenAPI specific field";
|
||||
@@ -1614,10 +1621,14 @@ const ParsedAction = (props) => {
|
||||
setExpansionModalOpen(true)
|
||||
|
||||
//setcodedata(data.value)
|
||||
var parsedvalue = data.value
|
||||
if (parsedvalue === undefined || parsedvalue === null) {
|
||||
parsedvalue = ""
|
||||
}
|
||||
|
||||
setEditorData({
|
||||
"name": data.name,
|
||||
"value": data.value,
|
||||
"value": parsedvalue,
|
||||
"field_number": count,
|
||||
"actionlist": actionlist,
|
||||
"field_id": clickedFieldId,
|
||||
@@ -2484,6 +2495,21 @@ const ParsedAction = (props) => {
|
||||
:
|
||||
null}
|
||||
|
||||
{showCacheConfig === true ?
|
||||
<Tooltip
|
||||
color="primary"
|
||||
title={"Explore your keys in Datastore"}
|
||||
placement="top"
|
||||
>
|
||||
<a href="/admin?tab=cache" target="_blank" style={{textDecoration: "none"}}>
|
||||
<StorageIcon style={{
|
||||
color: "#f85a3e",
|
||||
marginRight: 10,
|
||||
}}/>
|
||||
</a>
|
||||
</Tooltip>
|
||||
: null}
|
||||
|
||||
<div
|
||||
style={{
|
||||
flex: "10",
|
||||
|
||||
@@ -572,8 +572,10 @@ const CodeEditor = (props) => {
|
||||
|
||||
const highlight_variables = (value) => {
|
||||
if (value === undefined || value === null || value.length === 0) {
|
||||
setMarkers([])
|
||||
return
|
||||
}
|
||||
|
||||
// var session = localcodedata.getSession();
|
||||
//var code_lines = localcodedata.split('\n')
|
||||
var code_lines = value.split('\n')
|
||||
@@ -589,11 +591,11 @@ const CodeEditor = (props) => {
|
||||
|
||||
var new_occurences = variable_occurence.filter((occurrence) => occurrence[0]);
|
||||
variable_occurence = new_occurences
|
||||
|
||||
|
||||
var dollar_occurence = [];
|
||||
for (let ch = 0; ch < current_code_line.length; ch++) {
|
||||
if (current_code_line[ch] === '$' && (ch === 0)) {
|
||||
//if (current_code_line[ch] === '$' && (ch === 0)) {
|
||||
if (current_code_line[ch] === '$') {
|
||||
dollar_occurence.push(ch);
|
||||
}
|
||||
}
|
||||
@@ -607,9 +609,6 @@ const CodeEditor = (props) => {
|
||||
console.log("Error in color highlighting list: ", e);
|
||||
}
|
||||
|
||||
//console.log("Variable occurences: ", variable_occurence)
|
||||
//console.log("Dollar occurences: ", dollar_occurence)
|
||||
|
||||
try {
|
||||
if (variable_occurence.length === 0) {
|
||||
//value.markText({line:i, ch:0}, {line:i, ch:code_lines[i].length-1}, {"css": "background-color: #282828; border-radius: 0px; color: #b8bb26"})
|
||||
@@ -619,8 +618,10 @@ const CodeEditor = (props) => {
|
||||
for (let occ = 0; occ < variable_occurence.length; occ++) {
|
||||
const fixedVariable = fixVariable(variable_occurence[occ])
|
||||
var correctVariable = availableVariables.includes(fixedVariable.toLowerCase())
|
||||
|
||||
var startCh = dollar_occurence[occ]
|
||||
var endCh = dollar_occurence[occ] + dollar_occurence_len[occ]
|
||||
|
||||
newMarkers.push({
|
||||
startRow: i,
|
||||
startCol: startCh,
|
||||
@@ -629,13 +630,17 @@ const CodeEditor = (props) => {
|
||||
className: correctVariable ? "good-marker" : "bad-marker",
|
||||
type: "text",
|
||||
})
|
||||
|
||||
setMarkers(newMarkers)
|
||||
}
|
||||
|
||||
setMarkers(newMarkers)
|
||||
|
||||
} catch (e) {
|
||||
console.log("Error in color highlighting: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
setMarkers(newMarkers)
|
||||
};
|
||||
|
||||
const replaceVariables = (swapVariable) => {
|
||||
@@ -927,6 +932,18 @@ const CodeEditor = (props) => {
|
||||
|
||||
|
||||
|
||||
// Define a custom completer for the Ace Editor
|
||||
const customVariables = availableVariables
|
||||
const customCompleter = {
|
||||
getCompletions: function(editor, session, pos, prefix, callback) {
|
||||
callback(null, customVariables.map((variable) => ({
|
||||
caption: variable,
|
||||
value: variable,
|
||||
meta: 'custom',
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
aria-labelledby="draggable-code-modal"
|
||||
@@ -1495,7 +1512,13 @@ const CodeEditor = (props) => {
|
||||
theme="gruvbox"
|
||||
height={isFileEditor ? 450 : 550}
|
||||
width={isFileEditor ? 650 : "100%"}
|
||||
|
||||
markers={markers}
|
||||
highlightActiveLine={false}
|
||||
|
||||
enableBasicAutocompletion={true}
|
||||
completers={[customCompleter]}
|
||||
|
||||
style={{
|
||||
wordBreak: "break-word",
|
||||
marginTop: 0,
|
||||
@@ -1513,7 +1536,7 @@ const CodeEditor = (props) => {
|
||||
setCurrentLine(cursorPosition.row)
|
||||
findIndex(cursorPosition.row, cursorPosition.column)
|
||||
|
||||
//highlight_variables(value)
|
||||
highlight_variables(localcodedata)
|
||||
//console.log("VALUE CURSOR: ", value)
|
||||
}}
|
||||
onChange={(value, editor) => {
|
||||
@@ -1528,7 +1551,12 @@ const CodeEditor = (props) => {
|
||||
enableBasicAutocompletion: true,
|
||||
enableLiveAutocompletion: true,
|
||||
enableSnippets: true,
|
||||
useWorker: false
|
||||
showLineNumbers: true,
|
||||
tabSize: 2,
|
||||
wrap: true,
|
||||
|
||||
useWorker: false,
|
||||
enableBasicAutocompletion: [customCompleter],
|
||||
}}
|
||||
// options={options}
|
||||
/>
|
||||
@@ -1688,6 +1716,7 @@ const CodeEditor = (props) => {
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
|
||||
{executionResult.errors !== undefined && executionResult.errors !== null && executionResult.errors.length > 0 ?
|
||||
<Typography variant="body2" style={{maxHeight: 100, overflow: "auto", color: "#f85a3e",}}>
|
||||
Errors ({executionResult.errors.length}): {executionResult.errors.join("\n")}
|
||||
|
||||
Reference in New Issue
Block a user