diff --git a/components/buckets/info.vue b/components/buckets/info.vue
index 0ee63ba..a998b42 100644
--- a/components/buckets/info.vue
+++ b/components/buckets/info.vue
@@ -28,7 +28,7 @@
匿名访问
-
+
@@ -55,7 +55,7 @@
{{ bucketName }}
-
+
访问策略
-
+
- {{ 111 }}
+ {{ policyOptions.find(item => item.value === bucketPolicy)?.label }}
@@ -82,7 +82,7 @@
禁用
-
+
副本
@@ -98,18 +98,10 @@
- todo
+ 关闭
-
-
- 对象锁
-
-
-
-
- todo
-
-
+
+
标签
@@ -135,6 +127,17 @@
{{ tag.Key }}:{{ tag.Value }}
+
+
+
+ 对象锁
+
+
+
+
+ 关闭
+
+
版本控制
@@ -151,6 +154,23 @@
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+ 取消
+
+
+
+
@@ -195,7 +215,56 @@ const props = defineProps<{ bucket: string }>()
const bucketName = computed(() => props.bucket as string)
-const { headBucket, getBucketTagging, putBucketTagging, putBucketVersioning, getBucketVersioning } = useBucket({})
+const { headBucket, getBucketTagging, deleteBucket, putBucketTagging, putBucketVersioning, getBucketVersioning , getBucketPolicy,
+ putBucketPolicy,} = useBucket({})
+
+/******** policy ***********************/
+import {setPolicy,getPolicy,getPolicies} from '~/utils/bucketPolicy'
+
+const policys = setPolicy([],'readonly',bucketName.value,'')
+console.log("🚀 ~ policys:", policys)
+const po = getPolicy(policys,bucketName.value,'')
+console.log(111,po)
+
+const bucketPolicy = ref("private")
+const getbucketPolicy = async () => {
+ try {
+ const res = await getBucketPolicy( bucketName.value )
+ console.log("🚀 ~ getbucketPolicy ~ res:", res)
+ // bucketPolicy.value = res.Policy
+ } catch (error) {
+ // console.error("Error fetching bucket policy:", error)
+ }
+}
+getbucketPolicy()
+
+const policyFormValue = ref({
+ policy: "private",
+ content:'{}'
+})
+const showPolicyModal = ref(false)
+const editPolicy = () => {
+ showPolicyModal.value = true
+}
+const policyOptions = [
+ {
+ label: "公有",
+ value: "public",
+ },
+ {
+ label: "私有",
+ value: "private",
+ },
+ {
+ label: "自定义",
+ value: "custom",
+ },
+]
+
+
+/******** policy ***********************/
+
+
/********Encrypt ***********************/
const showEncryptModal = ref(false)
@@ -321,18 +390,27 @@ const editTag = (index: number) => {
tagFormValue.value = { name: nowTag.Key, value: nowTag.Value } // 填充表单
showTagModal.value = true // 打开模态框
}
+const dialog = useDialog()
const handledeleteTag = (index: number) => {
- nowTagIndex.value = index
- tags.value.splice(index, 1) // 从标签列表中删除
+ dialog.error({
+ title: "警告",
+ content: "你确定要删除这个标签吗?",
+ positiveText: "确定",
+ negativeText: "取消",
+ onPositiveClick: async () => {
+ nowTagIndex.value = index
+ tags.value.splice(index, 1) // 从标签列表中删除
- // 调用 putBucketTagging 接口
- putBucketTagging(bucketName.value, { TagSet: tags.value })
- .then(() => {
- message.success("标签更新成功")
- })
- .catch((error) => {
- message.error("删除标签失败: " + error.message)
- })
+ // 调用 putBucketTagging 接口
+ putBucketTagging(bucketName.value, { TagSet: tags.value })
+ .then(() => {
+ message.success("标签更新成功")
+ })
+ .catch((error) => {
+ message.error("删除标签失败: " + error.message)
+ })
+ },
+ });
}
/********tag ***********************/
@@ -342,4 +420,13 @@ const {
status,
refresh,
} = useAsyncData(`head-bucket&${bucketName.value}`, () => headBucket(bucketName.value))
+
+const handleDelteBucket = ()=>{
+ deleteBucket(bucketName.value).then(()=>{
+ message.success("删除成功")
+ router.push("/browser")
+ }).catch((error)=>{
+ message.error("删除失败")
+ })
+}