-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d88a28e
commit 3b9d484
Showing
19 changed files
with
201 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@opendoc/frontend": minor | ||
"@opendoc/backend": minor | ||
--- | ||
|
||
增加清理缓存功能 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Controller, Delete } from '@nestjs/common' | ||
import { CacheService } from './cache.service' | ||
import { ApiInternalServerErrorResponse, ApiOperation, ApiTags } from '@nestjs/swagger' | ||
|
||
|
||
@ApiTags('Storage', '存储') | ||
@Controller('storage') | ||
@ApiInternalServerErrorResponse({ description: '系统异常' }) | ||
export class StorageController { | ||
constructor( | ||
private readonly cacheService: CacheService, | ||
) {} | ||
|
||
@ApiOperation({ summary: '清空缓存' }) | ||
@Delete('cache') | ||
async clearStorageCache(): Promise<void> { | ||
await this.cacheService.clear() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Keq } from 'keq' | ||
import { request } from 'keq' | ||
import type { RequestParameters, ResponseMap, Operation } from "./types/clear_storage_cache" | ||
|
||
|
||
|
||
export function clearStorageCache<STATUS extends keyof ResponseMap>(arg?: RequestParameters): Keq<ResponseMap[STATUS], Operation<STATUS>> { | ||
const req = request.delete<ResponseMap[STATUS]>("/api/storage/cache") | ||
.option('module', { | ||
name: "backend", | ||
pathname: "/api/storage/cache", | ||
}) | ||
|
||
|
||
return req as unknown as Keq<ResponseMap[STATUS], Operation<STATUS>> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* @interface PluginLogs | ||
* @export | ||
*/ | ||
export interface PluginLogs { | ||
"message": string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { KeqOperation } from 'keq' | ||
|
||
|
||
export interface ResponseMap { | ||
"200": unknown | ||
"500": unknown | ||
} | ||
|
||
|
||
export type QueryParameters = { | ||
} | ||
|
||
export type RouteParameters = { | ||
} | ||
|
||
export type HeaderParameters = { | ||
} | ||
|
||
export type BodyParameters ={} | ||
export type RequestParameters = QueryParameters & RouteParameters & HeaderParameters & BodyParameters | ||
|
||
|
||
export interface Operation<STATUS extends keyof ResponseMap> extends KeqOperation { | ||
requestParams: RouteParameters | ||
requestQuery: QueryParameters | ||
requestHeaders: HeaderParameters | ||
requestBody: BodyParameters | ||
responseBody: ResponseMap[STATUS] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
loading: boolean | ||
}>() | ||
defineEmits<{ | ||
click: [MouseEvent] | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<button | ||
class="d-btn" | ||
:disabled="loading" | ||
@click="$emit('click', $event)" | ||
> | ||
<span | ||
v-if="loading" | ||
class="d-loading d-loading-sm d-loading-spinner" | ||
/> | ||
|
||
<slot /> | ||
</button> | ||
</template> | ||
|
||
<style scoped lang="postcss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
pending: boolean | ||
}>() | ||
defineEmits<{ | ||
click: [] | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<div class="flex justify-between my-8 hover:bg-ctp-overlay0/10 rounded-sm py-2 px-3"> | ||
<div class="flex flex-col justify-center"> | ||
<span class="font-bold"> | ||
<slot name="title" /> | ||
</span> | ||
<span class="text-sm text-base-content/70"> | ||
<slot name="description" /> | ||
</span> | ||
</div> | ||
|
||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="postcss"> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup lang="ts"> | ||
import { clearStorageCache } from '~/api/backend' | ||
const alert = useAlert() | ||
const { pending: clearing, execute: clearCache } = useAsyncFn(async () => { | ||
await clearStorageCache() | ||
alert.success('缓存已清除') | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<form-operation> | ||
<template #title> | ||
清除缓存 | ||
</template> | ||
|
||
<template #description> | ||
清除应用、页签、文档的缓存数据 | ||
</template> | ||
|
||
<basic-button | ||
:loading="clearing" | ||
@click="clearCache" | ||
> | ||
清除 | ||
</basic-button> | ||
</form-operation> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="postcss"> | ||
</style> |