mirror of
https://github.com/halo-dev/plugin-s3.git
synced 2025-10-14 22:27:11 +00:00
Compare commits
5 Commits
v1.12.0
...
v1.13.0-rc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
42e27da86b | ||
![]() |
19469d0537 | ||
![]() |
545b7ac4ea | ||
![]() |
26038491f2 | ||
![]() |
538c5f3ef9 |
8
.github/workflows/cd.yaml
vendored
8
.github/workflows/cd.yaml
vendored
@@ -7,11 +7,13 @@ on:
|
||||
|
||||
jobs:
|
||||
cd:
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v1
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v3
|
||||
secrets:
|
||||
halo-username: ${{ secrets.HALO_USERNAME }}
|
||||
halo-password: ${{ secrets.HALO_PASSWORD }}
|
||||
halo-pat: ${{ secrets.HALO_PAT }}
|
||||
permissions:
|
||||
contents: write
|
||||
with:
|
||||
app-id: app-Qxhpp
|
||||
pnpm-version: 9
|
||||
node-version: 22
|
||||
java-version: 21
|
||||
|
6
.github/workflows/ci.yaml
vendored
6
.github/workflows/ci.yaml
vendored
@@ -10,4 +10,8 @@ on:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v1
|
||||
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-ci.yaml@v3
|
||||
with:
|
||||
pnpm-version: 9
|
||||
node-version: 22
|
||||
java-version: 21
|
||||
|
51
build.gradle
51
build.gradle
@@ -1,30 +1,35 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id "com.github.node-gradle.node" version "5.0.0"
|
||||
id "io.freefair.lombok" version "8.0.1"
|
||||
id "run.halo.plugin.devtools" version "0.0.9"
|
||||
id 'org.openapi.generator' version '7.7.0'
|
||||
id "com.github.node-gradle.node" version "7.1.0"
|
||||
id "io.freefair.lombok" version "8.13.1"
|
||||
id "run.halo.plugin.devtools" version "0.6.0"
|
||||
id 'org.openapi.generator' version '7.12.0'
|
||||
}
|
||||
|
||||
group 'run.halo.s3os'
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
options.release = 21
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases' }
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
|
||||
maven { url 'https://repo.spring.io/milestone' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform('run.halo.tools.platform:plugin:2.19.0-SNAPSHOT')
|
||||
implementation platform('run.halo.tools.platform:plugin:2.21.0-alpha.1')
|
||||
compileOnly 'run.halo.app:api'
|
||||
|
||||
implementation platform('software.amazon.awssdk:bom:2.19.8')
|
||||
implementation ('software.amazon.awssdk:s3') {
|
||||
implementation platform('software.amazon.awssdk:bom:2.31.58')
|
||||
implementation('software.amazon.awssdk:s3') {
|
||||
exclude group: 'org.slf4j'
|
||||
exclude group: 'commons-logging'
|
||||
}
|
||||
@@ -32,6 +37,7 @@ dependencies {
|
||||
testImplementation 'run.halo.app:api'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'io.projectreactor:reactor-test'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
configurations.runtimeClasspath {
|
||||
@@ -40,7 +46,7 @@ configurations.runtimeClasspath {
|
||||
|
||||
|
||||
halo {
|
||||
version = '2.19'
|
||||
version = '2.21.0-alpha.2'
|
||||
}
|
||||
|
||||
haloPlugin {
|
||||
@@ -59,21 +65,16 @@ node {
|
||||
nodeProjectDir = file("${project.projectDir}/console")
|
||||
}
|
||||
|
||||
task buildFrontend(type: PnpmTask) {
|
||||
tasks.register('buildFrontend', PnpmTask) {
|
||||
args = ['build']
|
||||
dependsOn(tasks.named('pnpmInstall'))
|
||||
}
|
||||
|
||||
tasks.named('buildFrontend') {
|
||||
dependsOn 'pnpmInstall'
|
||||
tasks.named('processResources') {
|
||||
dependsOn(tasks.named('buildFrontend'))
|
||||
}
|
||||
|
||||
build {
|
||||
// build frontend before build
|
||||
tasks.getByName('compileJava').dependsOn('buildFrontend')
|
||||
}
|
||||
|
||||
|
||||
task downloadOpenApiSpec {
|
||||
tasks.register('downloadOpenApiSpec') {
|
||||
doLast {
|
||||
def url = 'http://localhost:8090/v3/api-docs/plugin-s3'
|
||||
def file = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile
|
||||
@@ -87,11 +88,11 @@ openApiGenerate {
|
||||
inputSpec = layout.buildDirectory.dir("apidocs/openapi.json").get().asFile.getAbsolutePath()
|
||||
outputDir = "${projectDir}/console/src/api"
|
||||
additionalProperties = [
|
||||
useES6: true,
|
||||
useES6 : true,
|
||||
useSingleRequestParameter: true,
|
||||
withSeparateModelsAndApi: true,
|
||||
apiPackage: "api",
|
||||
modelPackage: "models"
|
||||
withSeparateModelsAndApi : true,
|
||||
apiPackage : "api",
|
||||
modelPackage : "models"
|
||||
]
|
||||
typeMappings = [
|
||||
set: "Array"
|
||||
|
@@ -12,7 +12,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@halo-dev/api-client": "^2.17.0",
|
||||
"@halo-dev/components": "^2.17.0",
|
||||
"@halo-dev/components": "https://pkg.pr.new/@halo-dev/components@7383",
|
||||
"@halo-dev/console-shared": "^2.17.0",
|
||||
"@tanstack/vue-query": "4.29.1",
|
||||
"axios": "^1.7.2",
|
||||
@@ -46,5 +46,6 @@
|
||||
"vitest": "^0.34.1",
|
||||
"vue-router": "^4.4.0",
|
||||
"vue-tsc": "^1.8.27"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c"
|
||||
}
|
||||
|
22
console/pnpm-lock.yaml
generated
22
console/pnpm-lock.yaml
generated
@@ -12,8 +12,8 @@ importers:
|
||||
specifier: ^2.17.0
|
||||
version: 2.17.0(axios@1.7.2)
|
||||
'@halo-dev/components':
|
||||
specifier: ^2.17.0
|
||||
version: 2.17.0(vue-router@4.4.0(vue@3.4.31(typescript@5.3.3)))(vue@3.4.31(typescript@5.3.3))
|
||||
specifier: https://pkg.pr.new/@halo-dev/components@7383
|
||||
version: https://pkg.pr.new/@halo-dev/components@7383(vue-router@4.4.0(vue@3.4.31(typescript@5.3.3)))(vue@3.4.31(typescript@5.3.3))
|
||||
'@halo-dev/console-shared':
|
||||
specifier: ^2.17.0
|
||||
version: 2.17.0(axios@1.7.2)(vue-router@4.4.0(vue@3.4.31(typescript@5.3.3)))(vue@3.4.31(typescript@5.3.3))
|
||||
@@ -449,10 +449,11 @@ packages:
|
||||
peerDependencies:
|
||||
axios: ^1.7.x
|
||||
|
||||
'@halo-dev/components@2.17.0':
|
||||
resolution: {integrity: sha512-yujCVNfpZA1HjpilxD1Dzkh5Ge54u9hcIyuGj7Mr8hNHAY1xgiVo0uvuYwm8ik5/njI9HED4GXR2JIreSu/PeA==}
|
||||
'@halo-dev/components@https://pkg.pr.new/@halo-dev/components@7383':
|
||||
resolution: {tarball: https://pkg.pr.new/@halo-dev/components@7383}
|
||||
version: 2.21.0
|
||||
peerDependencies:
|
||||
vue: ^3.4.27
|
||||
vue: ^3.5.13
|
||||
vue-router: ^4.3.2
|
||||
|
||||
'@halo-dev/console-shared@2.17.0':
|
||||
@@ -573,55 +574,46 @@ packages:
|
||||
resolution: {integrity: sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.18.0':
|
||||
resolution: {integrity: sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.18.0':
|
||||
resolution: {integrity: sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.18.0':
|
||||
resolution: {integrity: sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-linux-powerpc64le-gnu@4.18.0':
|
||||
resolution: {integrity: sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.18.0':
|
||||
resolution: {integrity: sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.18.0':
|
||||
resolution: {integrity: sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.18.0':
|
||||
resolution: {integrity: sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.18.0':
|
||||
resolution: {integrity: sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@rollup/rollup-win32-arm64-msvc@4.18.0':
|
||||
resolution: {integrity: sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==}
|
||||
@@ -2817,7 +2809,7 @@ snapshots:
|
||||
dependencies:
|
||||
axios: 1.7.2
|
||||
|
||||
'@halo-dev/components@2.17.0(vue-router@4.4.0(vue@3.4.31(typescript@5.3.3)))(vue@3.4.31(typescript@5.3.3))':
|
||||
'@halo-dev/components@https://pkg.pr.new/@halo-dev/components@7383(vue-router@4.4.0(vue@3.4.31(typescript@5.3.3)))(vue@3.4.31(typescript@5.3.3))':
|
||||
dependencies:
|
||||
floating-vue: 5.2.2(vue@3.4.31(typescript@5.3.3))
|
||||
vue: 3.4.31(typescript@5.3.3)
|
||||
|
@@ -8,6 +8,7 @@ import {
|
||||
VCard,
|
||||
VEmpty,
|
||||
VEntity,
|
||||
VEntityContainer,
|
||||
VEntityField,
|
||||
VLoading,
|
||||
VModal,
|
||||
@@ -22,12 +23,16 @@ import { axiosInstance, coreApiClient, type Group } from "@halo-dev/api-client";
|
||||
import { S3LinkControllerApi } from "@/api";
|
||||
import type { S3ListResult, LinkResultItem, Policy, ObjectVo } from "@/api";
|
||||
|
||||
const s3LinkControllerApi = new S3LinkControllerApi(undefined, axiosInstance.defaults.baseURL, axiosInstance);
|
||||
const s3LinkControllerApi = new S3LinkControllerApi(
|
||||
undefined,
|
||||
axiosInstance.defaults.baseURL,
|
||||
axiosInstance
|
||||
);
|
||||
|
||||
const componentInstance = getCurrentInstance();
|
||||
const t = (key: string) => {
|
||||
// @ts-ignore
|
||||
if (typeof componentInstance?.proxy?.$t === 'function') {
|
||||
if (typeof componentInstance?.proxy?.$t === "function") {
|
||||
// @ts-ignore
|
||||
return componentInstance.proxy.$t(key);
|
||||
}
|
||||
@@ -38,12 +43,14 @@ const selectedFiles = ref<string[]>([]);
|
||||
const policyName = ref<string>("");
|
||||
const page = ref(1);
|
||||
const size = ref(50);
|
||||
const selectedGroup = ref("")
|
||||
const policyOptions = ref<{ label: string; value: string; attrs: any }[]>([{
|
||||
label: "请选择存储策略",
|
||||
value: "",
|
||||
attrs: {disabled: true}
|
||||
}]);
|
||||
const selectedGroup = ref("");
|
||||
const policyOptions = ref<{ label: string; value: string; attrs: any }[]>([
|
||||
{
|
||||
label: "请选择存储策略",
|
||||
value: "",
|
||||
attrs: { disabled: true },
|
||||
},
|
||||
]);
|
||||
const defaultGroup = ref<Group>({
|
||||
apiVersion: "",
|
||||
kind: "",
|
||||
@@ -76,13 +83,15 @@ const isFetchingPolicies = ref(true);
|
||||
const linkTips = ref("");
|
||||
const linkFailedTable = ref<LinkResultItem[]>([]);
|
||||
const linkedStatusItems: { label: string; value?: boolean }[] = [
|
||||
{label: "全部"},
|
||||
{label: "未关联", value: true},
|
||||
{ label: "全部" },
|
||||
{ label: "未关联", value: true },
|
||||
];
|
||||
|
||||
// action state
|
||||
const checkedAll = ref(false);
|
||||
const selectedLinkedStatusItem = ref<boolean | undefined>(linkedStatusItems[0].value);
|
||||
const selectedLinkedStatusItem = ref<boolean | undefined>(
|
||||
linkedStatusItems[0].value
|
||||
);
|
||||
|
||||
const emptyTips = computed(() => {
|
||||
if (isFetchingPolicies.value) {
|
||||
@@ -98,34 +107,37 @@ const emptyTips = computed(() => {
|
||||
});
|
||||
|
||||
const handleCheckAllChange = (e: Event) => {
|
||||
const {checked} = e.target as HTMLInputElement;
|
||||
const { checked } = e.target as HTMLInputElement;
|
||||
|
||||
if (checked) {
|
||||
selectedFiles.value =
|
||||
s3Objects.value.objects?.filter(file => !file.isLinked).map((file) => {
|
||||
return file.key || "";
|
||||
}) || [];
|
||||
s3Objects.value.objects
|
||||
?.filter((file) => !file.isLinked)
|
||||
.map((file) => {
|
||||
return file.key || "";
|
||||
}) || [];
|
||||
} else {
|
||||
selectedFiles.value.length = 0;
|
||||
checkedAll.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const fetchPolicies = async () => {
|
||||
try {
|
||||
const {status, data} = await s3LinkControllerApi.listS3Policies();
|
||||
const { status, data } = await s3LinkControllerApi.listS3Policies();
|
||||
if (status === 200) {
|
||||
policyOptions.value = [{
|
||||
label: "请选择存储策略",
|
||||
value: "",
|
||||
attrs: {disabled: true}
|
||||
}];
|
||||
policyOptions.value = [
|
||||
{
|
||||
label: "请选择存储策略",
|
||||
value: "",
|
||||
attrs: { disabled: true },
|
||||
},
|
||||
];
|
||||
data.forEach((policy: Policy) => {
|
||||
policyOptions.value.push({
|
||||
label: policy.spec.displayName,
|
||||
value: policy.metadata.name,
|
||||
attrs: {}
|
||||
attrs: {},
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -137,7 +149,8 @@ const fetchPolicies = async () => {
|
||||
|
||||
const changeNextTokenAndObject = () => {
|
||||
s3Objects.value.currentToken = s3Objects.value.nextToken;
|
||||
s3Objects.value.currentContinuationObject = s3Objects.value.nextContinuationObject;
|
||||
s3Objects.value.currentContinuationObject =
|
||||
s3Objects.value.nextContinuationObject;
|
||||
s3Objects.value.nextToken = "";
|
||||
s3Objects.value.nextContinuationObject = "";
|
||||
};
|
||||
@@ -158,20 +171,28 @@ const fetchObjects = async () => {
|
||||
isFetching.value = true;
|
||||
s3Objects.value.objects = [];
|
||||
try {
|
||||
const {status, data} = await s3LinkControllerApi.listObjects({
|
||||
const { status, data } = await s3LinkControllerApi.listObjects({
|
||||
policyName: policyName.value,
|
||||
pageSize: size.value,
|
||||
continuationToken: s3Objects.value.currentToken,
|
||||
continuationObject: s3Objects.value.currentContinuationObject,
|
||||
unlinked: selectedLinkedStatusItem.value,
|
||||
filePrefix: filePrefix.value
|
||||
filePrefix: filePrefix.value,
|
||||
});
|
||||
if (status === 200) {
|
||||
s3Objects.value = data;
|
||||
if (s3Objects.value.objects?.length === 0 && s3Objects.value.hasMore && s3Objects.value.nextToken) {
|
||||
if (
|
||||
s3Objects.value.objects?.length === 0 &&
|
||||
s3Objects.value.hasMore &&
|
||||
s3Objects.value.nextToken
|
||||
) {
|
||||
changeNextTokenAndObject();
|
||||
await fetchObjects();
|
||||
} else if (s3Objects.value.objects?.length === 0 && !s3Objects.value.hasMore && page.value > 1) {
|
||||
} else if (
|
||||
s3Objects.value.objects?.length === 0 &&
|
||||
!s3Objects.value.hasMore &&
|
||||
page.value > 1
|
||||
) {
|
||||
page.value = 1;
|
||||
clearTokenAndObject();
|
||||
await fetchObjects();
|
||||
@@ -200,15 +221,15 @@ const handleLink = async () => {
|
||||
policyName: policyName.value,
|
||||
objectKeys: selectedFiles.value,
|
||||
groupName: selectedGroup.value,
|
||||
}
|
||||
},
|
||||
});
|
||||
const items = linkResult.data.items || [];
|
||||
const successCount = items.filter(item => item.success).length;
|
||||
const failedCount = items.filter(item => !item.success).length;
|
||||
const successCount = items.filter((item) => item.success).length;
|
||||
const failedCount = items.filter((item) => !item.success).length;
|
||||
linkTips.value = `关联成功${successCount}个文件,关联失败${failedCount}个文件`;
|
||||
|
||||
if (failedCount > 0) {
|
||||
linkFailedTable.value = items.filter(item => !item.success);
|
||||
linkFailedTable.value = items.filter((item) => !item.success);
|
||||
}
|
||||
isLinking.value = false;
|
||||
};
|
||||
@@ -245,7 +266,7 @@ const handleModalClose = () => {
|
||||
};
|
||||
|
||||
const fetchCustomGroups = async () => {
|
||||
const {status, data} = await coreApiClient.storage.group.listGroup({
|
||||
const { status, data } = await coreApiClient.storage.group.listGroup({
|
||||
labelSelector: ["!halo.run/hidden"],
|
||||
sort: ["metadata.creationTimestamp,asc"],
|
||||
});
|
||||
@@ -260,19 +281,20 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
watch(selectedFiles, (newValue) => {
|
||||
checkedAll.value = s3Objects.value.objects?.filter(file => !file.isLinked)
|
||||
.filter(file => !newValue.includes(file.key || "")).length === 0
|
||||
&& s3Objects.value.objects?.length !== 0;
|
||||
checkedAll.value =
|
||||
s3Objects.value.objects
|
||||
?.filter((file) => !file.isLinked)
|
||||
.filter((file) => !newValue.includes(file.key || "")).length === 0 &&
|
||||
s3Objects.value.objects?.length !== 0;
|
||||
});
|
||||
|
||||
watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VPageHeader title="关联S3文件">
|
||||
<template #icon>
|
||||
<CarbonFolderDetailsReference class="mr-2 self-center"/>
|
||||
<CarbonFolderDetailsReference class="mr-2 self-center" />
|
||||
</template>
|
||||
</VPageHeader>
|
||||
<div class="m-0 md:m-4">
|
||||
@@ -285,7 +307,6 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
<div class="hidden items-center sm:flex">
|
||||
<input
|
||||
v-model="checkedAll"
|
||||
class="h-4 w-4 rounded border-gray-300 text-indigo-600"
|
||||
type="checkbox"
|
||||
@change="handleCheckAllChange"
|
||||
/>
|
||||
@@ -299,14 +320,14 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
<FormKit
|
||||
id="policyChoose"
|
||||
outer-class="!p-0"
|
||||
style="min-width: 10rem;"
|
||||
style="min-width: 10rem"
|
||||
v-model="policyName"
|
||||
name="policyName"
|
||||
type="select"
|
||||
:options="policyOptions"
|
||||
@change="handleFirstPage"
|
||||
></FormKit>
|
||||
<icon-error-warning v-if="!policyName" class="text-red-500"/>
|
||||
<icon-error-warning v-if="!policyName" class="text-red-500" />
|
||||
<SearchInput
|
||||
v-model="filePrefixBind"
|
||||
v-if="policyName"
|
||||
@@ -315,9 +336,7 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
></SearchInput>
|
||||
</div>
|
||||
<VSpace v-else>
|
||||
<VButton type="primary" @click="handleLink">
|
||||
关联
|
||||
</VButton>
|
||||
<VButton type="primary" @click="handleLink"> 关联 </VButton>
|
||||
</VSpace>
|
||||
</div>
|
||||
<VSpace spacing="lg" class="flex-wrap">
|
||||
@@ -339,8 +358,8 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
<IconRefreshLine
|
||||
v-tooltip="$t('core.common.buttons.refresh')"
|
||||
:class="{
|
||||
'animate-spin text-gray-900': isFetching,
|
||||
}"
|
||||
'animate-spin text-gray-900': isFetching,
|
||||
}"
|
||||
class="h-4 w-4 text-gray-600 group-hover:text-gray-900"
|
||||
/>
|
||||
</div>
|
||||
@@ -350,33 +369,35 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<VLoading v-if="isFetching"/>
|
||||
<VLoading v-if="isFetching" />
|
||||
|
||||
<Transition v-else-if="!s3Objects.objects?.length" appear name="fade">
|
||||
<VEmpty
|
||||
message="空空如也"
|
||||
:title="emptyTips"
|
||||
>
|
||||
</VEmpty>
|
||||
<VEmpty message="空空如也" :title="emptyTips"> </VEmpty>
|
||||
</Transition>
|
||||
|
||||
<Transition v-else appear name="fade">
|
||||
<ul
|
||||
class="box-border h-full w-full divide-y divide-gray-100"
|
||||
role="list"
|
||||
>
|
||||
<li style="padding: 0.5rem 1rem 0">
|
||||
<span class="ml-1 mb-1 block text-sm text-gray-500">关联后所加入的分组</span>
|
||||
<div class="mb-5 grid grid-cols-2 gap-x-2 gap-y-3 md:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-6">
|
||||
<div class="box-border h-full w-full">
|
||||
<div style="padding: 0.5rem 1rem 0">
|
||||
<span class="ml-1 mb-1 block text-sm text-gray-500">
|
||||
关联后所加入的分组
|
||||
</span>
|
||||
<div
|
||||
class="mb-5 grid grid-cols-2 gap-x-2 gap-y-3 md:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-6"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-full w-full items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2.5 text-sm font-medium text-gray-800 hover:bg-gray-50 hover:shadow-sm"
|
||||
v-for="(group, index) in [defaultGroup, ...customGroups]"
|
||||
:key="index"
|
||||
:class="{ '!bg-gray-100 shadow-sm': group.metadata.name === selectedGroup }"
|
||||
:class="{
|
||||
'!bg-gray-100 shadow-sm':
|
||||
group.metadata.name === selectedGroup,
|
||||
}"
|
||||
@click="selectedGroup = group.metadata.name"
|
||||
>
|
||||
<div class="inline-flex w-full flex-1 gap-x-2 break-all text-left">
|
||||
<div
|
||||
class="inline-flex w-full flex-1 gap-x-2 break-all text-left"
|
||||
>
|
||||
<slot name="text">
|
||||
{{ group?.spec.displayName }}
|
||||
</slot>
|
||||
@@ -395,17 +416,17 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
<li v-for="(file, index) in s3Objects.objects" :key="index">
|
||||
<VEntity :is-selected="checkSelection(file)">
|
||||
<template
|
||||
#checkbox
|
||||
>
|
||||
</div>
|
||||
<VEntityContainer>
|
||||
<VEntity
|
||||
v-for="(file, index) in s3Objects.objects"
|
||||
:key="index"
|
||||
:is-selected="checkSelection(file)"
|
||||
>
|
||||
<template #checkbox>
|
||||
<input
|
||||
v-model="selectedFiles"
|
||||
:value="file.key || ''"
|
||||
class="h-4 w-4 rounded border-gray-300 text-indigo-600"
|
||||
name="post-checkbox"
|
||||
:disabled="file.isLinked"
|
||||
type="checkbox"
|
||||
/>
|
||||
@@ -429,10 +450,8 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
<template #end>
|
||||
<VEntityField>
|
||||
<template #description>
|
||||
<VTag :theme="file.isLinked ? 'default':'primary'">
|
||||
{{
|
||||
file.isLinked ? '已关联' : '未关联'
|
||||
}}
|
||||
<VTag :theme="file.isLinked ? 'default' : 'primary'">
|
||||
{{ file.isLinked ? "已关联" : "未关联" }}
|
||||
</VTag>
|
||||
</template>
|
||||
</VEntityField>
|
||||
@@ -448,23 +467,32 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
</VEntityField>
|
||||
</template>
|
||||
</VEntity>
|
||||
</li>
|
||||
</ul>
|
||||
</VEntityContainer>
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
<template #footer>
|
||||
<div class="bg-white sm:flex sm:items-center justify-between">
|
||||
<div class="inline-flex items-center gap-5">
|
||||
<span class="text-xs text-gray-500 hidden md:flex">共 {{ s3Objects.objects?.length }} 项数据</span>
|
||||
<span class="text-xs text-gray-500 hidden md:flex">已自动过滤文件夹对象,页面实际显示数量少为正常现象</span>
|
||||
<span class="text-xs text-gray-500 hidden md:flex"
|
||||
>共 {{ s3Objects.objects?.length }} 项数据</span
|
||||
>
|
||||
<span class="text-xs text-gray-500 hidden md:flex"
|
||||
>已自动过滤文件夹对象,页面实际显示数量少为正常现象</span
|
||||
>
|
||||
</div>
|
||||
<div class="inline-flex items-center gap-5">
|
||||
<div class="inline-flex items-center gap-2">
|
||||
<VButton @click="handleFirstPage" :disabled="!policyName">返回第一页</VButton>
|
||||
<VButton @click="handleFirstPage" :disabled="!policyName"
|
||||
>返回第一页</VButton
|
||||
>
|
||||
|
||||
<span class="text-sm text-gray-500">第 {{ page }} 页</span>
|
||||
|
||||
<VButton @click="handleNextPage" :disabled="!s3Objects.hasMore || isFetching || !policyName">
|
||||
<VButton
|
||||
@click="handleNextPage"
|
||||
:disabled="!s3Objects.hasMore || isFetching || !policyName"
|
||||
>
|
||||
下一页
|
||||
</VButton>
|
||||
</div>
|
||||
@@ -499,11 +527,7 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
>
|
||||
<template #footer>
|
||||
<VSpace>
|
||||
<VButton
|
||||
:loading="isLinking"
|
||||
type="primary"
|
||||
@click="handleModalClose"
|
||||
>
|
||||
<VButton :loading="isLinking" type="primary" @click="handleModalClose">
|
||||
确定
|
||||
</VButton>
|
||||
</VSpace>
|
||||
@@ -516,8 +540,12 @@ watch(selectedLinkedStatusItem, handleFirstPage);
|
||||
<th class="border border-black font-normal">失败原因</th>
|
||||
</tr>
|
||||
<tr v-for="failedInfo in linkFailedTable" :key="failedInfo.objectKey">
|
||||
<th class="border border-black font-normal">{{ failedInfo.objectKey }}</th>
|
||||
<th class="border border-black font-normal">{{ failedInfo.message }}</th>
|
||||
<th class="border border-black font-normal">
|
||||
{{ failedInfo.objectKey }}
|
||||
</th>
|
||||
<th class="border border-black font-normal">
|
||||
{{ failedInfo.message }}
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
|
47
gradlew
vendored
47
gradlew
vendored
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,13 +82,11 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -114,7 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -133,22 +133,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
41
gradlew.bat
vendored
41
gradlew.bat
vendored
@@ -13,8 +13,10 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +27,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
@@ -1,6 +1,5 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
|
||||
mavenCentral()
|
||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
|
||||
maven { url 'https://maven.aliyun.com/repository/spring-plugin' }
|
||||
@@ -9,4 +8,3 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
rootProject.name = 'plugin-s3'
|
||||
|
||||
|
@@ -91,13 +91,16 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
return Mono.just(context);
|
||||
}
|
||||
var properties = S3OsProperties.convertFrom(deleteContext.configMap());
|
||||
return Mono.using(() -> buildS3Client(properties),
|
||||
return Mono.using(
|
||||
() -> buildS3Client(properties),
|
||||
client -> Mono.fromCallable(
|
||||
() -> client.deleteObject(DeleteObjectRequest.builder()
|
||||
.bucket(properties.getBucket())
|
||||
.key(objectKey)
|
||||
.build())).subscribeOn(Schedulers.boundedElastic()),
|
||||
S3Client::close)
|
||||
.build())),
|
||||
S3Client::close
|
||||
)
|
||||
.subscribeOn(Schedulers.boundedElastic())
|
||||
.doOnNext(response -> {
|
||||
checkResult(response, "delete object");
|
||||
log.info("Delete object {} from bucket {} successfully",
|
||||
@@ -105,8 +108,10 @@ public class S3OsAttachmentHandler implements AttachmentHandler {
|
||||
})
|
||||
.thenReturn(context);
|
||||
})
|
||||
// ignore when the object does not exist
|
||||
.onErrorComplete(NoSuchKeyException.class::isInstance)
|
||||
.onErrorMap(S3ExceptionHandler::map)
|
||||
.map(DeleteContext::attachment);
|
||||
.thenReturn(deleteContext.attachment());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -4,7 +4,7 @@ metadata:
|
||||
name: PluginS3ObjectStorage
|
||||
spec:
|
||||
enabled: true
|
||||
requires: ">=2.20.0"
|
||||
requires: ">=2.21.0"
|
||||
author:
|
||||
name: Halo
|
||||
website: https://github.com/halo-dev
|
||||
|
Reference in New Issue
Block a user