mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add admin UI control for chat auto-archive days (#24704)
Relates to #24642 Adds admin UI controls for managing chat auto-archive (days) under "Lifecycle". Also adds a "Days" label to the right of the pre-existing unitless numeric input for consistency. Exemplary screenshot below. More screens available in Storybook. <img width="847" height="585" alt="Screenshot 2026-04-24 at 16 48 59" src="https://github.com/user-attachments/assets/d38de5f8-d379-4b06-b175-ac399f31e578" />
This commit is contained in:
@@ -3379,6 +3379,24 @@ class ExperimentalApiMethods {
|
||||
await this.axios.put("/api/experimental/chats/config/retention-days", req);
|
||||
};
|
||||
|
||||
getChatAutoArchiveDays =
|
||||
async (): Promise<TypesGen.ChatAutoArchiveDaysResponse> => {
|
||||
const response =
|
||||
await this.axios.get<TypesGen.ChatAutoArchiveDaysResponse>(
|
||||
"/api/experimental/chats/config/auto-archive-days",
|
||||
);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
updateChatAutoArchiveDays = async (
|
||||
req: TypesGen.UpdateChatAutoArchiveDaysRequest,
|
||||
): Promise<void> => {
|
||||
await this.axios.put(
|
||||
"/api/experimental/chats/config/auto-archive-days",
|
||||
req,
|
||||
);
|
||||
};
|
||||
|
||||
updateChatTemplateAllowlist = async (
|
||||
req: TypesGen.ChatTemplateAllowlist,
|
||||
): Promise<void> => {
|
||||
|
||||
@@ -1351,6 +1351,22 @@ export const updateChatRetentionDays = (queryClient: QueryClient) => ({
|
||||
},
|
||||
});
|
||||
|
||||
const chatAutoArchiveDaysKey = ["chat-auto-archive-days"] as const;
|
||||
|
||||
export const chatAutoArchiveDays = () => ({
|
||||
queryKey: chatAutoArchiveDaysKey,
|
||||
queryFn: () => API.experimental.getChatAutoArchiveDays(),
|
||||
});
|
||||
|
||||
export const updateChatAutoArchiveDays = (queryClient: QueryClient) => ({
|
||||
mutationFn: API.experimental.updateChatAutoArchiveDays,
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: chatAutoArchiveDaysKey,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const chatTemplateAllowlistKey = ["chat-template-allowlist"] as const;
|
||||
|
||||
export const chatTemplateAllowlist = () => ({
|
||||
|
||||
Reference in New Issue
Block a user