force installing python libs over dashboard

main
alex 2023-08-18 09:34:10 +00:00
parent 2f6f4c9037
commit 2319023ef5
5 changed files with 177 additions and 54 deletions

View File

@ -141,7 +141,8 @@
"popover": {
"groupTaskId.title": "Gruppenaufgabe",
"groupTaskStep.title": "Gruppenaufgabe Schritt",
"role.title": "Rolle"
"role.title": "Rolle",
"groupId.title": "Gruppen ID"
},
"card": { "checkbox.info": "INFO", "checkbox.error": "FEHLER" },
"tooltip": {
@ -164,33 +165,31 @@
"action": {
"title": "Maßnahme",
"roleChange": {
"popconfirm.title": "Rolle ändern in",
"roleChange.popconfirm.okText": "Ändern"
"popconfirm": {
"title": "Rolle ändern in",
"okText": "Ändern"
}
},
"changeRole": "Rolle ändern",
"delete": {
"link": "Löschen",
"popconfirm": { "okText": "User löschen" },
"delete": {
"popconfirm": {
"title": "Sind Sie sicher, dass Sie den Benutzer löschen wollen?"
}
"popconfirm": {
"title": "Sind Sie sicher, dass Sie den Benutzer löschen wollen?",
"okText": "User löschen"
}
},
"deactivate": {
"link": "Deaktivieren",
"popconfirm": {
"okText": "Benutzer deaktivieren",
"title": "Sind Sie sicher, dass Sie den Benutzer deaktivieren wollen?"
"title": "Sind Sie sicher, dass Sie den Benutzer deaktivieren wollen?",
"okText": "Benutzer deaktivieren"
}
},
"activate": {
"link": "Aktivieren",
"popconfirm": { "okText": "Benutzer aktivieren" },
"activate": {
"popconfirm": {
"title": "Sind Sie sicher, dass Sie den Benutzer aktivieren wollen?"
}
"popconfirm": {
"title": "Sind Sie sicher, dass Sie den Benutzer aktivieren wollen?",
"okText": "Benutzer aktivieren"
}
}
}

View File

@ -141,7 +141,8 @@
"popover": {
"groupTaskId.title": "Group Task",
"groupTaskStep.title": "Group Task Step",
"role.title": "Role"
"role.title": "Role",
"groupId.title": "Group ID"
},
"card": { "checkbox.info": "INFO", "checkbox.error": "ERROR" },
"tooltip": {
@ -164,33 +165,31 @@
"action": {
"title": "Action",
"roleChange": {
"popconfirm.title": "Change role to",
"roleChange.popconfirm.okText": "Change"
"popconfirm": {
"title": "Change role to",
"okText": "Change"
}
},
"changeRole": "Change Role",
"delete": {
"link": "Delete",
"popconfirm": { "okText": "Delete User" },
"delete": {
"popconfirm": {
"title": "Are you sure you want to delete the user?"
}
"popconfirm": {
"title": "Are you sure you want to delete the user?",
"okText": "Delete User"
}
},
"deactivate": {
"link": "Deactivate",
"popconfirm": {
"okText": "Deactivate User",
"title": "Are you sure you want to deactivate the user?"
"title": "Are you sure you want to deactivate the user?",
"okText": "Deactivate User"
}
},
"activate": {
"link": "Activate",
"popconfirm": { "okText": "Activate User" },
"activate": {
"popconfirm": {
"title": "Are you sure you want to activate the user?"
}
"popconfirm": {
"title": "Are you sure you want to activate the user?",
"okText": "Activate User"
}
}
}

View File

@ -297,6 +297,61 @@ export default function LogCard({ type }) {
/>
);
}
} else if (splittedMessage[s] === "%groupId%") {
const foundDataCategory = data.Logs[i].LogData.find(
(data) => data.Type === "category"
);
const foundDataGroupId = data.Logs[i].LogData.find(
(data) => data.Type === "groupId"
);
if (
foundDataCategory !== undefined &&
foundDataGroupId !== undefined
) {
const foundGroup = webSocketContext.CategoryGroups.find(
(categoryGroup) =>
categoryGroup.category === foundDataCategory.Value
).groups.find(
(group) => group.id === foundDataGroupId.Value
);
items.push(
<ColoredSpanItem
key={s}
dataLogs={data.Logs[i]}
splittedMessage={splittedMessage[s]}
children={
<Popover
content={
<div>
<span style={{ fontWeight: "bold" }}>ID: </span>
<span>{foundDataGroupId.Value}</span>
</div>
}
title={t("logCard.popover.groupId.title")}
trigger="click"
>
{" "}
<span style={{ cursor: "pointer" }}>
{foundGroup !== undefined
? foundGroup.name
: foundDataGroupId.Value}
</span>
</Popover>
}
/>
);
} else {
items.push(
<ColoredSpanItem
key={s}
dataLogs={data.Logs[i]}
splittedMessage={splittedMessage[s]}
/>
);
}
} else {
items.push(
<ColoredSpanItem
@ -412,14 +467,14 @@ export default function LogCard({ type }) {
</Space>
}
style={{
height: "97vh",
height: "90vh",
overflow: "hidden",
overflowWrap: "break-word",
width: "100%",
}}
>
{!loadingSpinner ? (
<div style={{ height: "86vh", overflowY: "scroll", paddingRight: 6 }}>
<div style={{ height: "80vh", overflowY: "scroll", paddingRight: 6 }}>
{logData.Logs.filter((log) => {
return (
(log.Type === 0 && checkboxInfoChecked) ||

View File

@ -1,12 +1,9 @@
import {
DownloadOutlined,
PlusOutlined,
ReloadOutlined,
} from "@ant-design/icons";
import { DownOutlined, PlusOutlined, ReloadOutlined } from "@ant-design/icons";
import {
Badge,
Button,
Divider,
Dropdown,
Popconfirm,
Popover,
Space,
@ -196,12 +193,34 @@ export default function GroupTaskTableList({
return items;
};
const handleOnConfirm = (category) => {
const handleOnReloadGroupTasksConfirm = (category) => {
webSocketContext.SendSocketMessage(SentMessagesCommands.ReloadGroupTasks, {
category: category,
});
};
const handleOnInstallPythonDependenciesConfirm = (category, groupId) => {
webSocketContext.SendSocketMessage(
SentMessagesCommands.GroupTasksInstallPythonDependencies,
{
category: category,
groupId: groupId,
}
);
};
const dropDownItems =
categoryGroup.groups !== undefined
? categoryGroup.groups.map((group, index) => {
return {
key: index,
label: group.name,
category: group.category,
groupid: group.id,
};
})
: [];
return (
<>
<Divider orientation="left">{categoryGroup.category}</Divider>
@ -246,21 +265,27 @@ export default function GroupTaskTableList({
.XYInstallPythonDependencies,
categoryGroup.category
) && (
<Popconfirm
placement="left"
title={t(
"groupTasks.groupTasksTableList.popover.installPythonDependencies.title"
)}
cancelText={t("common.button.cancel")}
okText={t("common.button.confirm")}
onConfirm={() => handleOnConfirm(categoryGroup.category)}
<Dropdown
menu={{
items: dropDownItems,
onClick: ({ key }) =>
handleOnInstallPythonDependenciesConfirm(
dropDownItems[key].category,
dropDownItems[key].groupid
),
}}
arrow
trigger="click"
>
<Button icon={<DownloadOutlined />}>
{t(
"groupTasks.groupTasksTableList.button.installPythonDependencies"
)}
<Button>
<Space>
{t(
"groupTasks.groupTasksTableList.button.installPythonDependencies"
)}
<DownOutlined />
</Space>
</Button>
</Popconfirm>
</Dropdown>
)}
{hasXYPermission(
@ -273,7 +298,9 @@ export default function GroupTaskTableList({
title={t("groupTasks.groupTasksTableList.popover.reload.title")}
cancelText={t("common.button.cancel")}
okText={t("common.button.confirm")}
onConfirm={() => handleOnConfirm(categoryGroup.category)}
onConfirm={() =>
handleOnReloadGroupTasksConfirm(categoryGroup.category)
}
>
<Button icon={<ReloadOutlined />}>
{t("common.button.reload")}
@ -292,3 +319,25 @@ export default function GroupTaskTableList({
</>
);
}
/*
<Popconfirm
placement="left"
title={t(
"groupTasks.groupTasksTableList.popover.installPythonDependencies.title"
)}
cancelText={t("common.button.cancel")}
okText={t("common.button.confirm")}
onConfirm={() =>
handleOnInstallPythonDependenciesConfirm(
categoryGroup.category
)
}
>
<Button icon={<DownloadOutlined />}>
{t(
"groupTasks.groupTasksTableList.button.installPythonDependencies"
)}
</Button>
</Popconfirm>
*/

View File

@ -212,6 +212,9 @@ const ReceivedMessagesCommands = {
NewUserApiKeyCreated: 30,
DeletedUserApiKey: 31,
NewApiKeyUsageCount: 32,
InstallingPythonDependencies: 33,
InstallingPythonDependenciesFailed: 34,
InstallingPythonDependenciesFinished: 35,
};
// commands sent to the backend server
@ -236,6 +239,7 @@ export const SentMessagesCommands = {
HandleUserActionTaskStep: 18,
CreateNewUserApiKey: 19,
DeleteUserApiKey: 20,
GroupTasksInstallPythonDependencies: 21,
};
export function WebSocketProvider({
@ -1011,8 +1015,25 @@ export function WebSocketProvider({
return updatedUser;
});
break;
default:
case ReceivedMessagesCommands.InstallingPythonDependencies:
notificationApi["info"]({
message: `Installing python dependencies for ${body.GroupId} of ${body.Category}`,
description: `This may take a while`,
});
break;
case ReceivedMessagesCommands.InstallingPythonDependenciesFailed:
notificationApi["error"]({
message: `Installing python dependencies for ${body.GroupId} of ${body.Category} failed`,
description: `Please check the logs`,
});
break;
case ReceivedMessagesCommands.InstallingPythonDependenciesFinished:
notificationApi["success"]({
message: `Installing python dependencies for ${body.GroupId} of ${body.Category} finished`,
description: `You can now start the group task`,
});
break;
case ReceivedMessagesCommands.default:
console.error("unknown command", cmd);
break;
}