Skip to content

Commit

Permalink
refactor: place the entry for the S3 link page in the side menu
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <i@ryanc.cc>
  • Loading branch information
ruibaby committed Jan 28, 2024
1 parent 8ff4acb commit 4bfaf6a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 38 deletions.
6 changes: 3 additions & 3 deletions console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@halo-dev/api-client": "^2.10.0",
"@halo-dev/components": "^1.9.0",
"@halo-dev/console-shared": "^2.10.0",
"@halo-dev/api-client": "^2.11.0",
"@halo-dev/components": "^1.10.0",
"@halo-dev/console-shared": "^2.11.0",
"@tanstack/vue-query": "4.29.1",
"axios": "^1.4.0",
"canvas-confetti": "^1.6.0",
Expand Down
26 changes: 13 additions & 13 deletions console/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 33 additions & 21 deletions console/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
import type {Attachment} from "@halo-dev/api-client";
import type {PluginTab} from "@halo-dev/console-shared";
import {definePlugin} from "@halo-dev/console-shared";
import type { Attachment } from "@halo-dev/api-client";
import { definePlugin } from "@halo-dev/console-shared";
import S3Link from "./views/S3Link.vue";
import S3Unlink from "./views/S3Unlink.vue"
import type {Ref} from "vue";
import {markRaw} from "vue";
import S3Unlink from "./views/S3Unlink.vue";
import type { Ref } from "vue";
import { markRaw } from "vue";
import CarbonFolderDetailsReference from "~icons/carbon/folder-details-reference";

export default definePlugin({
components: {},
routes: [],
extensionPoints: {
"plugin:self:tabs:create": (): PluginTab[] => {
return [
{
id: "s3-link",
label: "关联S3文件",
// @ts-ignore
component: markRaw(S3Link),
permissions: ["plugin:s3os:link"]
routes: [
{
parentName: "ToolsRoot",
route: {
path: "s3-link",
name: "S3Link",
component: S3Link,
meta: {
title: "S3 关联",
description: "提供将 S3 存储桶中的文件关联到 Halo 中的功能。",
searchable: true,
permissions: ["plugin:s3os:link"],
menu: {
name: "S3 关联",
icon: markRaw(CarbonFolderDetailsReference),
priority: 0,
},
},
];
},
},
// @ts-ignore
],
extensionPoints: {
"attachment:list-item:operation:create": (attachment: Ref<Attachment>) => {
return [
{
priority: 21,
component: markRaw(S3Unlink),
permissions: ["plugin:s3os:unlink"],
props: {
"attachment": attachment,
attachment: attachment,
},
hidden: !(attachment.value.metadata.annotations
&& attachment.value.metadata.annotations["s3os.plugin.halo.run/object-key"])
hidden: !(
attachment.value.metadata.annotations &&
attachment.value.metadata.annotations[
"s3os.plugin.halo.run/object-key"
]
),
},
];
},
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: PluginS3ObjectStorage
spec:
enabled: true
requires: ">=2.10.0"
requires: ">=2.12.0"
author:
name: Halo OSS Team
website: https://github.com/halo-dev
Expand Down

0 comments on commit 4bfaf6a

Please sign in to comment.