added remove log manager server connection
parent
ccac69911b
commit
3295194ffc
|
@ -46,6 +46,7 @@ export const ReceivedMessagesCommands = {
|
||||||
OneNotificationDeleted: 43,
|
OneNotificationDeleted: 43,
|
||||||
AdminAreaManageCheckedForAvailableCategories: 44,
|
AdminAreaManageCheckedForAvailableCategories: 44,
|
||||||
AdminAreaManageLogManagerServerConnectionAdded: 45,
|
AdminAreaManageLogManagerServerConnectionAdded: 45,
|
||||||
|
AdminAreaManageLogManagerServerConnectionRemoved: 46,
|
||||||
};
|
};
|
||||||
|
|
||||||
// commands sent to the backend server
|
// commands sent to the backend server
|
||||||
|
@ -76,6 +77,7 @@ export const SentMessagesCommands = {
|
||||||
DeleteOneNotification: 25,
|
DeleteOneNotification: 25,
|
||||||
AdminAreaManageCheckWhichCategoriesAreAvailable: 26,
|
AdminAreaManageCheckWhichCategoriesAreAvailable: 26,
|
||||||
AdminAreaManageAddLogManagerServerConnection: 27,
|
AdminAreaManageAddLogManagerServerConnection: 27,
|
||||||
|
AdminAreaManageDeleteLogManagerServerConnection: 28,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -766,24 +768,9 @@ export function handleWebSocketMessage(
|
||||||
});*/
|
});*/
|
||||||
break;
|
break;
|
||||||
case ReceivedMessagesCommands.DeletedUserApiKey:
|
case ReceivedMessagesCommands.DeletedUserApiKey:
|
||||||
/*userProfileContext.setUserProfile((user) => ({
|
|
||||||
...user,
|
|
||||||
ApiKeys: user.ApiKeys.filter((apiKey) => apiKey.Id !== body),
|
|
||||||
})); */
|
|
||||||
|
|
||||||
userProfileContext.setApiKeys((arr) =>
|
userProfileContext.setApiKeys((arr) =>
|
||||||
arr.filter((apiKey) => apiKey.Id !== body)
|
arr.filter((apiKey) => apiKey.Id !== body)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*setUser((user) => {
|
|
||||||
const updatedUser = { ...user };
|
|
||||||
|
|
||||||
updatedUser.ApiKeys = updatedUser.ApiKeys.filter(
|
|
||||||
(apiKey) => apiKey.Id !== body
|
|
||||||
);
|
|
||||||
|
|
||||||
return updatedUser;
|
|
||||||
}); */
|
|
||||||
break;
|
break;
|
||||||
case ReceivedMessagesCommands.NewApiKeyUsageCount:
|
case ReceivedMessagesCommands.NewApiKeyUsageCount:
|
||||||
userProfileContext.setApiKeys((arr) => {
|
userProfileContext.setApiKeys((arr) => {
|
||||||
|
@ -798,36 +785,6 @@ export function handleWebSocketMessage(
|
||||||
|
|
||||||
return newArr;
|
return newArr;
|
||||||
});
|
});
|
||||||
|
|
||||||
/*userProfileContext.setUserProfile((user) => {
|
|
||||||
const updatedUser = { ...user };
|
|
||||||
|
|
||||||
const arrIndex = updatedUser.ApiKeys.findIndex(
|
|
||||||
(apiKey) => apiKey.Id === body.Id
|
|
||||||
);
|
|
||||||
|
|
||||||
if (arrIndex !== -1) {
|
|
||||||
updatedUser.ApiKeys[arrIndex].UsageCount = body.UsageCount;
|
|
||||||
updatedUser.ApiKeys[arrIndex].LastUsed = body.LastUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
return updatedUser;
|
|
||||||
}); */
|
|
||||||
|
|
||||||
/*setUser((user) => {
|
|
||||||
const updatedUser = { ...user };
|
|
||||||
|
|
||||||
const arrIndex = updatedUser.ApiKeys.findIndex(
|
|
||||||
(apiKey) => apiKey.Id === body.Id
|
|
||||||
);
|
|
||||||
|
|
||||||
if (arrIndex !== -1) {
|
|
||||||
updatedUser.ApiKeys[arrIndex].UsageCount = body.UsageCount;
|
|
||||||
updatedUser.ApiKeys[arrIndex].LastUsed = body.LastUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
return updatedUser;
|
|
||||||
}); */
|
|
||||||
break;
|
break;
|
||||||
case ReceivedMessagesCommands.InstallingPythonPackages:
|
case ReceivedMessagesCommands.InstallingPythonPackages:
|
||||||
notificationApi["info"]({
|
notificationApi["info"]({
|
||||||
|
@ -987,10 +944,14 @@ export function handleWebSocketMessage(
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ReceivedMessagesCommands.AdminAreaManageLogManagerServerConnectionAdded:
|
case ReceivedMessagesCommands.AdminAreaManageLogManagerServerConnectionAdded:
|
||||||
console.log("b", body);
|
|
||||||
|
|
||||||
consolesContext.setConnectedLogManagerServers((arr) => [...arr, body]);
|
consolesContext.setConnectedLogManagerServers((arr) => [...arr, body]);
|
||||||
break;
|
break;
|
||||||
|
case ReceivedMessagesCommands.AdminAreaManageLogManagerServerConnectionRemoved:
|
||||||
|
consolesContext.setConnectedLogManagerServers((arr) =>
|
||||||
|
arr.filter((c) => c.Id !== body)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.error("unknown command", cmd);
|
console.error("unknown command", cmd);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -92,7 +92,7 @@ function LogManagerServersTable({ t, webSocketContext, appContext }) {
|
||||||
cancelText={t("common.button.cancel")}
|
cancelText={t("common.button.cancel")}
|
||||||
onConfirm={() =>
|
onConfirm={() =>
|
||||||
webSocketContext.SendSocketMessage(
|
webSocketContext.SendSocketMessage(
|
||||||
SentMessagesCommands.DeleteUserApiKey,
|
SentMessagesCommands.AdminAreaManageDeleteLogManagerServerConnection,
|
||||||
{ Id: record.key }
|
{ Id: record.key }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -108,10 +108,13 @@ function LogManagerServersTable({ t, webSocketContext, appContext }) {
|
||||||
const getTableItems = () => {
|
const getTableItems = () => {
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
consolesContext.connectedLogManagerServers.forEach((connection, index) => {
|
consolesContext.connectedLogManagerServers.sort(
|
||||||
|
(a, b) => new Date(b.CreatedAt) - new Date(a.CreatedAt)
|
||||||
|
);
|
||||||
|
|
||||||
|
consolesContext.connectedLogManagerServers.forEach((connection) => {
|
||||||
items.push({
|
items.push({
|
||||||
key: index,
|
key: connection.Id,
|
||||||
id: connection.Id,
|
|
||||||
displayName: connection.DisplayName,
|
displayName: connection.DisplayName,
|
||||||
address: connection.Address,
|
address: connection.Address,
|
||||||
createdAt: FormatDatetime(connection.CreatedAt),
|
createdAt: FormatDatetime(connection.CreatedAt),
|
||||||
|
|
|
@ -142,6 +142,8 @@ export const Constants = {
|
||||||
"admin_area.manage.check_which_categories_are_available",
|
"admin_area.manage.check_which_categories_are_available",
|
||||||
ADD_LOG_MANAGER_SERVER_CONNECTION:
|
ADD_LOG_MANAGER_SERVER_CONNECTION:
|
||||||
"admin_area.manage.add_log_manager_server_connection",
|
"admin_area.manage.add_log_manager_server_connection",
|
||||||
|
REMOVE_LOG_MANAGER_SERVER_CONNECTION:
|
||||||
|
"admin_area.manage.remove_log_manager_server_connection",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
USER_PROFILE: {
|
USER_PROFILE: {
|
||||||
|
|
Loading…
Reference in New Issue