mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 13:20:43 +00:00
WIP on record scripts
This commit is contained in:
@ -38,6 +38,7 @@ import DividerWidget from "qqq/components/widgets/misc/Divider";
|
||||
import FieldValueListWidget from "qqq/components/widgets/misc/FieldValueListWidget";
|
||||
import QuickSightChart from "qqq/components/widgets/misc/QuickSightChart";
|
||||
import RecordGridWidget from "qqq/components/widgets/misc/RecordGridWidget";
|
||||
import ScriptViewer from "qqq/components/widgets/misc/ScriptViewer";
|
||||
import StepperCard from "qqq/components/widgets/misc/StepperCard";
|
||||
import USMapWidget from "qqq/components/widgets/misc/USMapWidget";
|
||||
import ParentWidget from "qqq/components/widgets/ParentWidget";
|
||||
@ -389,6 +390,14 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, omit
|
||||
</Widget>
|
||||
)
|
||||
}
|
||||
{
|
||||
widgetMetaData.type === "scriptViewer" && (
|
||||
widgetData && widgetData[i] && widgetData[i].queryParams &&
|
||||
<Widget widgetMetaData={widgetMetaData}>
|
||||
<ScriptViewer scriptId={widgetData[i].queryParams.id} />
|
||||
</Widget>
|
||||
)
|
||||
}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ import ScriptDocsForm from "qqq/components/scripts/ScriptDocsForm";
|
||||
import ScriptLogsView from "qqq/components/scripts/ScriptLogsView";
|
||||
import ScriptTestForm from "qqq/components/scripts/ScriptTestForm";
|
||||
import CustomWidthTooltip from "qqq/components/tooltips/CustomWidthTooltip";
|
||||
import ScriptViewer from "qqq/components/widgets/misc/ScriptViewer";
|
||||
import BaseLayout from "qqq/layouts/BaseLayout";
|
||||
import DeveloperModeUtils from "qqq/utils/DeveloperModeUtils";
|
||||
import Client from "qqq/utils/qqq/Client";
|
||||
@ -79,7 +80,8 @@ function RecordDeveloperView({table}: Props): JSX.Element
|
||||
const [tableMetaData, setTableMetaData] = useState(null);
|
||||
|
||||
const [record, setRecord] = useState(null as QRecord);
|
||||
const [recordJSON, setRecordJSON] = useState("");
|
||||
const [recordJSONObject, setRecordJSONObject] = useState({} as any);
|
||||
const [recordJSONString, setRecordJSONString] = useState("");
|
||||
const [associatedScripts, setAssociatedScripts] = useState([] as any[]);
|
||||
const [notFoundMessage, setNotFoundMessage] = useState(null);
|
||||
|
||||
@ -129,7 +131,8 @@ function RecordDeveloperView({table}: Props): JSX.Element
|
||||
{
|
||||
recordJSONObject[key] = record.values.get(key);
|
||||
}
|
||||
setRecordJSON(JSON.stringify(recordJSONObject, null, 3));
|
||||
setRecordJSONObject(recordJSONObject);
|
||||
setRecordJSONString(JSON.stringify(recordJSONObject, null, 3));
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
@ -309,7 +312,7 @@ function RecordDeveloperView({table}: Props): JSX.Element
|
||||
theme="github"
|
||||
name="recordJSON"
|
||||
editorProps={{$blockScrolling: true}}
|
||||
value={recordJSON}
|
||||
value={recordJSONString}
|
||||
readOnly
|
||||
width="100%"
|
||||
showPrintMargin={false}
|
||||
@ -318,6 +321,29 @@ function RecordDeveloperView({table}: Props): JSX.Element
|
||||
</Card>
|
||||
|
||||
{
|
||||
associatedScripts && associatedScripts.map((object) =>
|
||||
{
|
||||
let fieldName = object.associatedScript?.fieldName;
|
||||
let field = tableMetaData.fields.get(fieldName);
|
||||
let scriptId = recordJSONString ? recordJSONObject[fieldName] : null;
|
||||
return (
|
||||
<div key={fieldName}>
|
||||
<Card sx={{mb: 3}}>
|
||||
<Typography variant="h5" p={2}>{field?.label}</Typography>
|
||||
|
||||
<Box display="flex" alignItems="center" justifyContent="space-between" gap={2}>
|
||||
{scriptId ?
|
||||
<ScriptViewer scriptId={scriptId}></ScriptViewer>
|
||||
: <>No script here yet. {/* todo! */}</>
|
||||
}
|
||||
</Box>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
{/*
|
||||
associatedScripts && associatedScripts.map((object) =>
|
||||
{
|
||||
let fieldName = object.associatedScript?.fieldName;
|
||||
@ -460,7 +486,7 @@ function RecordDeveloperView({table}: Props): JSX.Element
|
||||
</Card>
|
||||
);
|
||||
})
|
||||
}
|
||||
*/}
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
@ -59,7 +59,6 @@ public class ScriptTableTest extends QBaseSeleniumTest
|
||||
|
||||
qSeleniumLib.waitForSelectorContaining("span", "uh, script");
|
||||
|
||||
qSeleniumLib.takeScreenshotToFile();
|
||||
// qSeleniumLib.waitForever();
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,126 @@
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY"
|
||||
]
|
||||
},
|
||||
"script": {
|
||||
"name": "script",
|
||||
"label": "Script",
|
||||
"isHidden": false,
|
||||
"iconName": "data_object",
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY",
|
||||
"TABLE_INSERT",
|
||||
"TABLE_DELETE",
|
||||
"TABLE_UPDATE"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
},
|
||||
"scriptLog": {
|
||||
"name": "scriptLog",
|
||||
"label": "Script Log",
|
||||
"isHidden": false,
|
||||
"iconName": "receipt_long",
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY",
|
||||
"TABLE_INSERT",
|
||||
"TABLE_DELETE",
|
||||
"TABLE_UPDATE"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
},
|
||||
"scriptType": {
|
||||
"name": "scriptType",
|
||||
"label": "Script Type",
|
||||
"isHidden": false,
|
||||
"iconName": "tune",
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY",
|
||||
"TABLE_INSERT",
|
||||
"TABLE_DELETE",
|
||||
"TABLE_UPDATE"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
},
|
||||
"scriptRevision": {
|
||||
"name": "scriptRevision",
|
||||
"label": "Script Revision",
|
||||
"isHidden": false,
|
||||
"iconName": "history_edu",
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
},
|
||||
"scriptLogLine": {
|
||||
"name": "scriptLogLine",
|
||||
"label": "Script Log Line",
|
||||
"isHidden": false,
|
||||
"iconName": "reorder",
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY",
|
||||
"TABLE_INSERT",
|
||||
"TABLE_DELETE",
|
||||
"TABLE_UPDATE"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
},
|
||||
"dataBag": {
|
||||
"name": "dataBag",
|
||||
"label": "Data Bag",
|
||||
"isHidden": false,
|
||||
"iconName": "local_mall",
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY",
|
||||
"TABLE_INSERT",
|
||||
"TABLE_DELETE",
|
||||
"TABLE_UPDATE"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
},
|
||||
"dataBagVersion": {
|
||||
"name": "dataBagVersion",
|
||||
"label": "Data Bag Version",
|
||||
"isHidden": false,
|
||||
"iconName": "work_history",
|
||||
"capabilities": [
|
||||
"TABLE_COUNT",
|
||||
"TABLE_GET",
|
||||
"TABLE_QUERY"
|
||||
],
|
||||
"readPermission": true,
|
||||
"insertPermission": true,
|
||||
"editPermission": true,
|
||||
"deletePermission": true
|
||||
}
|
||||
},
|
||||
"processes": {
|
||||
@ -368,6 +488,121 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"developer": {
|
||||
"name": "developer",
|
||||
"label": "Developer",
|
||||
"iconName": "data_object",
|
||||
"widgets": [],
|
||||
"children": [
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptType",
|
||||
"label": "Script Type",
|
||||
"iconName": "tune"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "script",
|
||||
"label": "Script",
|
||||
"iconName": "data_object"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptRevision",
|
||||
"label": "Script Revision",
|
||||
"iconName": "history_edu"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptLog",
|
||||
"label": "Script Log",
|
||||
"iconName": "receipt_long"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptLogLine",
|
||||
"label": "Script Log Line",
|
||||
"iconName": "reorder"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "dataBag",
|
||||
"label": "Data Bag",
|
||||
"iconName": "local_mall"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "dataBagVersion",
|
||||
"label": "Data Bag Version",
|
||||
"iconName": "work_history"
|
||||
}
|
||||
],
|
||||
"childMap": {
|
||||
"scriptType": {
|
||||
"type": "TABLE",
|
||||
"name": "scriptType",
|
||||
"label": "Script Type",
|
||||
"iconName": "tune"
|
||||
},
|
||||
"dataBagVersion": {
|
||||
"type": "TABLE",
|
||||
"name": "dataBagVersion",
|
||||
"label": "Data Bag Version",
|
||||
"iconName": "work_history"
|
||||
},
|
||||
"dataBag": {
|
||||
"type": "TABLE",
|
||||
"name": "dataBag",
|
||||
"label": "Data Bag",
|
||||
"iconName": "local_mall"
|
||||
},
|
||||
"scriptLog": {
|
||||
"type": "TABLE",
|
||||
"name": "scriptLog",
|
||||
"label": "Script Log",
|
||||
"iconName": "receipt_long"
|
||||
},
|
||||
"scriptLogLine": {
|
||||
"type": "TABLE",
|
||||
"name": "scriptLogLine",
|
||||
"label": "Script Log Line",
|
||||
"iconName": "reorder"
|
||||
},
|
||||
"script": {
|
||||
"type": "TABLE",
|
||||
"name": "script",
|
||||
"label": "Script",
|
||||
"iconName": "data_object"
|
||||
},
|
||||
"scriptRevision": {
|
||||
"type": "TABLE",
|
||||
"name": "scriptRevision",
|
||||
"label": "Script Revision",
|
||||
"iconName": "history_edu"
|
||||
}
|
||||
},
|
||||
"sections": [
|
||||
{
|
||||
"name": "scripts",
|
||||
"label": "Scripts",
|
||||
"tables": [
|
||||
"scriptType",
|
||||
"script",
|
||||
"scriptRevision",
|
||||
"scriptLog",
|
||||
"scriptLogLine"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dataBags",
|
||||
"label": "Data Bags",
|
||||
"tables": [
|
||||
"dataBag",
|
||||
"dataBagVersion"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"appTree": [
|
||||
@ -445,6 +680,56 @@
|
||||
}
|
||||
],
|
||||
"iconName": "stars"
|
||||
},
|
||||
{
|
||||
"type": "APP",
|
||||
"name": "developer",
|
||||
"label": "Developer",
|
||||
"children": [
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptType",
|
||||
"label": "Script Type",
|
||||
"iconName": "tune"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "script",
|
||||
"label": "Script",
|
||||
"iconName": "data_object"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptRevision",
|
||||
"label": "Script Revision",
|
||||
"iconName": "history_edu"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptLog",
|
||||
"label": "Script Log",
|
||||
"iconName": "receipt_long"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "scriptLogLine",
|
||||
"label": "Script Log Line",
|
||||
"iconName": "reorder"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "dataBag",
|
||||
"label": "Data Bag",
|
||||
"iconName": "local_mall"
|
||||
},
|
||||
{
|
||||
"type": "TABLE",
|
||||
"name": "dataBagVersion",
|
||||
"label": "Data Bag Version",
|
||||
"iconName": "work_history"
|
||||
}
|
||||
],
|
||||
"iconName": "data_object"
|
||||
}
|
||||
],
|
||||
"branding": {
|
||||
@ -585,6 +870,14 @@
|
||||
"name": "QuickSightChartRenderer",
|
||||
"label": "Quick Sight",
|
||||
"type": "quickSightChart"
|
||||
},
|
||||
"scriptViewer": {
|
||||
"name": "scriptViewer",
|
||||
"label": "Contents",
|
||||
"type": "scriptViewer",
|
||||
"isCard": true,
|
||||
"storeDropdownSelections": false,
|
||||
"hasPermission": true
|
||||
}
|
||||
},
|
||||
"environmentValues": {
|
||||
|
Reference in New Issue
Block a user