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

@ -427,10 +427,10 @@ function apiAdminEndpoints(app) {
}
);
app.get(
"/v1/admin/workspaces/:workspaceId/users",
[validApiKey],
"/v1/admin/workspaces/:workspaceId/users",
[validApiKey],
async (request, response) => {
/*
/*
#swagger.tags = ['Admin']
#swagger.path = '/v1/admin/workspaces/{workspaceId}/users'
#swagger.parameters['workspaceId'] = {
@ -464,7 +464,7 @@ function apiAdminEndpoints(app) {
description: "Instance is not in Multi-User mode. Method denied",
}
*/
try {
if (!multiUserMode(response)) {
response.sendStatus(401).end();
@ -473,13 +473,14 @@ function apiAdminEndpoints(app) {
const workspaceId = request.params.workspaceId;
const users = await Workspace.workspaceUsers(workspaceId);
response.status(200).json({ users });
} catch (e) {
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"
}
}
}
@ -2389,4 +2400,4 @@
"BearerAuth": []
}
]
}
}