mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
chore: Remove Server Tasks (#3592)
This commit is contained in:
parent
78d2a3b8aa
commit
61becdbec7
19 changed files with 12 additions and 341 deletions
|
@ -85,12 +85,6 @@ export default defineComponent({
|
|||
title: i18n.tc("sidebar.maintenance"),
|
||||
restricted: true,
|
||||
},
|
||||
{
|
||||
icon: $globals.icons.check,
|
||||
to: "/admin/background-tasks",
|
||||
title: i18n.tc("sidebar.background-tasks"),
|
||||
restricted: true,
|
||||
},
|
||||
{
|
||||
icon: $globals.icons.slotMachine,
|
||||
to: "/admin/parser",
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { ServerTask } from "~/lib/api/types/server";
|
||||
import { PaginationData } from "~/lib/api/types/non-generated";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
base: `${prefix}/admin/server-tasks`,
|
||||
};
|
||||
|
||||
export class AdminTaskAPI extends BaseAPI {
|
||||
async testTask() {
|
||||
return await this.requests.post<ServerTask>(`${routes.base}`, {});
|
||||
}
|
||||
|
||||
async getAll() {
|
||||
return await this.requests.get<PaginationData<ServerTask>>(routes.base);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import { AdminAboutAPI } from "./admin/admin-about";
|
||||
import { AdminTaskAPI } from "./admin/admin-tasks";
|
||||
import { AdminUsersApi } from "./admin/admin-users";
|
||||
import { AdminGroupsApi } from "./admin/admin-groups";
|
||||
import { AdminBackupsApi } from "./admin/admin-backups";
|
||||
|
@ -9,7 +8,6 @@ import { ApiRequestInstance } from "~/lib/api/types/non-generated";
|
|||
|
||||
export class AdminAPI {
|
||||
public about: AdminAboutAPI;
|
||||
public serverTasks: AdminTaskAPI;
|
||||
public users: AdminUsersApi;
|
||||
public groups: AdminGroupsApi;
|
||||
public backups: AdminBackupsApi;
|
||||
|
@ -18,7 +16,6 @@ export class AdminAPI {
|
|||
|
||||
constructor(requests: ApiRequestInstance) {
|
||||
this.about = new AdminAboutAPI(requests);
|
||||
this.serverTasks = new AdminTaskAPI(requests);
|
||||
this.users = new AdminUsersApi(requests);
|
||||
this.groups = new AdminGroupsApi(requests);
|
||||
this.backups = new AdminBackupsApi(requests);
|
||||
|
|
|
@ -15,7 +15,6 @@ import { RegisterAPI } from "./user/user-registration";
|
|||
import { MealPlanAPI } from "./user/group-mealplan";
|
||||
import { EmailAPI } from "./user/email";
|
||||
import { BulkActionsAPI } from "./user/recipe-bulk-actions";
|
||||
import { GroupServerTaskAPI } from "./user/group-tasks";
|
||||
import { ToolsApi } from "./user/organizer-tools";
|
||||
import { GroupMigrationApi } from "./user/group-migrations";
|
||||
import { GroupReportsApi } from "./user/group-reports";
|
||||
|
@ -46,7 +45,6 @@ export class UserApiClient {
|
|||
public bulk: BulkActionsAPI;
|
||||
public groupMigration: GroupMigrationApi;
|
||||
public groupReports: GroupReportsApi;
|
||||
public grouperServerTasks: GroupServerTaskAPI;
|
||||
public tools: ToolsApi;
|
||||
public shopping: ShoppingApi;
|
||||
public multiPurposeLabels: MultiPurposeLabelsApi;
|
||||
|
@ -72,7 +70,6 @@ export class UserApiClient {
|
|||
this.register = new RegisterAPI(requests);
|
||||
this.mealplans = new MealPlanAPI(requests);
|
||||
this.mealplanRules = new MealPlanRulesApi(requests);
|
||||
this.grouperServerTasks = new GroupServerTaskAPI(requests);
|
||||
|
||||
// Group
|
||||
this.groupMigration = new GroupMigrationApi(requests);
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
/* This file was automatically generated from pydantic models by running pydantic2ts.
|
||||
/* Do not modify it by hand - just update the pydantic models and then re-run the script
|
||||
*/
|
||||
|
||||
export type ServerTaskNames = "Background Task" | "Database Backup" | "Bulk Recipe Import";
|
||||
export type ServerTaskStatus = "running" | "finished" | "failed";
|
||||
|
||||
export interface ServerTask {
|
||||
groupId: string;
|
||||
name?: ServerTaskNames & string;
|
||||
createdAt?: string;
|
||||
status?: ServerTaskStatus & string;
|
||||
log?: string;
|
||||
id: number;
|
||||
}
|
||||
export interface ServerTaskCreate {
|
||||
groupId: string;
|
||||
name?: ServerTaskNames & string;
|
||||
createdAt?: string;
|
||||
status?: ServerTaskStatus & string;
|
||||
log?: string;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
import { BaseAPI } from "../base/base-clients";
|
||||
import { ServerTask } from "~/lib/api/types/server";
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
base: `${prefix}/groups/server-tasks`,
|
||||
};
|
||||
|
||||
export class GroupServerTaskAPI extends BaseAPI {
|
||||
async getAll() {
|
||||
return await this.requests.get<ServerTask[]>(routes.base);
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
<template>
|
||||
<v-container class="narrow-container">
|
||||
<BasePageTitle divider>
|
||||
<template #header>
|
||||
<v-img max-height="125" max-width="125" :src="require('~/static/svgs/manage-tasks.svg')"></v-img>
|
||||
</template>
|
||||
<template #title> {{ $t('admin.background-tasks') }} </template>
|
||||
{{ $t('admin.background-tasks-description') }}
|
||||
</BasePageTitle>
|
||||
<v-card-actions>
|
||||
<BaseButton color="info" :loading="loading" @click="refreshTasks">
|
||||
<template #icon> {{ $globals.icons.refresh }} </template>
|
||||
{{ $t('general.refresh') }}
|
||||
</BaseButton>
|
||||
<BaseButton color="info" @click="testTask">
|
||||
<template #icon> {{ $globals.icons.testTube }} </template>
|
||||
{{ $t('general.test') }}
|
||||
</BaseButton>
|
||||
</v-card-actions>
|
||||
<v-expansion-panels class="mt-2">
|
||||
<v-expansion-panel v-for="(task, i) in tasks" :key="i">
|
||||
<v-expansion-panel-header>
|
||||
<span>
|
||||
<v-progress-circular v-if="task.status === 'running'" indeterminate color="info"></v-progress-circular>
|
||||
<v-icon v-else-if="task.status === 'finished'" large color="success"> {{ $globals.icons.check }}</v-icon>
|
||||
<v-icon v-else-if="task.status === 'failed'" large color="error"> {{ $globals.icons.close }}</v-icon>
|
||||
<v-icon v-else-if="task.status === 'pending'" large color="gray"> {{ $globals.icons.pending }}</v-icon>
|
||||
<span class="ml-2">
|
||||
{{ task.name }}
|
||||
</span>
|
||||
</span>
|
||||
{{ $d(Date.parse(task.createdAt), "short") }}
|
||||
</v-expansion-panel-header>
|
||||
<v-expansion-panel-content style="white-space: pre-line">
|
||||
{{ task.log === "" ? $t('admin.no-logs-found') : task.log }}
|
||||
</v-expansion-panel-content>
|
||||
</v-expansion-panel>
|
||||
</v-expansion-panels>
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref } from "@nuxtjs/composition-api";
|
||||
import { ServerTask } from "~/lib/api/types/server";
|
||||
import { useAdminApi } from "~/composables/api";
|
||||
|
||||
export default defineComponent({
|
||||
layout: "admin",
|
||||
setup() {
|
||||
const api = useAdminApi();
|
||||
|
||||
const tasks = ref<ServerTask[]>([]);
|
||||
const loading = ref(false);
|
||||
|
||||
async function refreshTasks() {
|
||||
loading.value = true;
|
||||
const { data } = await api.serverTasks.getAll();
|
||||
|
||||
if (data) {
|
||||
tasks.value = data.items;
|
||||
}
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function testTask() {
|
||||
await api.serverTasks.testTask();
|
||||
refreshTasks();
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await refreshTasks();
|
||||
});
|
||||
|
||||
return {
|
||||
loading,
|
||||
refreshTasks,
|
||||
testTask,
|
||||
tasks,
|
||||
};
|
||||
},
|
||||
head() {
|
||||
return {
|
||||
title: this.$t("admin.tasks"),
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue