patch UI exception with invalid return value from failed parse
resolves #1692
This commit is contained in:
timothycarambat 2024-06-17 13:55:10 -07:00
parent 38441f4b21
commit 0d5cc558c9
3 changed files with 39 additions and 27 deletions

View File

@ -66,7 +66,7 @@ export function Chartable({ props, workspace }) {
const chartType = content?.type?.toLowerCase();
const data =
typeof content.dataset === "string"
? safeJsonParse(content.dataset, null)
? safeJsonParse(content.dataset, [])
: content.dataset;
const value = data.length > 0 ? Object.keys(data[0])[1] : "value";
const title = content?.title;

View File

@ -479,7 +479,8 @@ function apiAdminEndpoints(app) {
console.error(e);
response.sendStatus(500).end();
}
});
}
);
app.post(
"/v1/admin/workspaces/:workspaceId/update-users",
[validApiKey],

View File

@ -502,10 +502,12 @@
}
}
},
"/v1/admin/workspaces/:workspaceId/users": {
"/v1/admin/workspaces/{workspaceId}/users": {
"get": {
"tags": ["Admin"],
"description": "Retrieve a list of users for the given workspace.",
"tags": [
"Admin"
],
"description": "Retrieve a list of users with permissions to access the specified workspace.",
"parameters": [
{
"name": "workspaceId",
@ -514,43 +516,52 @@
"schema": {
"type": "string"
},
"description": "The ID of the workspace whose users are to be retrieved."
"description": "id of the workspace."
}
],
"responses": {
"200": {
"description": "OK, successful operation. Returns a list of user IDs for the given workspace.",
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {"type": "string"}
"type": "object",
"example": {
"users": [
{
"userId": 1,
"role": "admin"
},
{
"userId": 2,
"role": "member"
}
]
}
}
}
}
},
"401": {
"description": "Unauthorized, not authorized to access resources in multi-user mode.",
"description": "Instance is not in Multi-User mode. Method denied"
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InvalidAPIKey"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/InvalidAPIKey"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {"type": "string"}
}
}
}
}
"description": "Internal Server Error"
}
}
}