From 966445b9ebfd85c1f602b11ac4cd3a58b7079b0f Mon Sep 17 00:00:00 2001 From: longjuan <769022681@qq.com> Date: Thu, 19 Oct 2023 18:11:16 +0800 Subject: [PATCH] perf: improve s3link role permissions --- build.gradle | 6 ++--- console/src/index.ts | 6 ++--- .../src/views/{HomeView.vue => S3Link.vue} | 0 src/main/resources/console/main.js | 2 +- .../extensions/s3os-role-template.yaml | 23 +++++++++++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) rename console/src/views/{HomeView.vue => S3Link.vue} (100%) create mode 100644 src/main/resources/extensions/s3os-role-template.yaml diff --git a/build.gradle b/build.gradle index 2dcfe8c..74b1c6a 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ 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.6" + id "run.halo.plugin.devtools" version "0.0.7" } group 'run.halo.s3os' @@ -16,7 +16,7 @@ repositories { } dependencies { - implementation platform('run.halo.tools.platform:plugin:2.9.0-SNAPSHOT') + implementation platform('run.halo.tools.platform:plugin:2.10.0-SNAPSHOT') compileOnly 'run.halo.app:api' implementation platform('software.amazon.awssdk:bom:2.19.8') @@ -33,7 +33,7 @@ configurations.runtimeClasspath { halo { - version = '2.9.0' + version = '2.10.0' } haloPlugin { diff --git a/console/src/index.ts b/console/src/index.ts index 12db0b9..3c894dd 100644 --- a/console/src/index.ts +++ b/console/src/index.ts @@ -1,6 +1,6 @@ import {definePlugin} from "@halo-dev/console-shared"; import type {PluginTab} from "@halo-dev/console-shared"; -import HomeView from "./views/HomeView.vue"; +import S3Link from "./views/S3Link.vue"; import {markRaw} from "vue"; export default definePlugin({ @@ -12,8 +12,8 @@ export default definePlugin({ { id: "s3-link", label: "关联S3文件", - component: markRaw(HomeView), - permissions: [] + component: markRaw(S3Link), + permissions: ["plugin:s3os:link"] }, ]; }, diff --git a/console/src/views/HomeView.vue b/console/src/views/S3Link.vue similarity index 100% rename from console/src/views/HomeView.vue rename to console/src/views/S3Link.vue diff --git a/src/main/resources/console/main.js b/src/main/resources/console/main.js index 4d18d9d..5595d6f 100644 --- a/src/main/resources/console/main.js +++ b/src/main/resources/console/main.js @@ -1,3 +1,3 @@ this.PluginS3ObjectStorage=function(Ge,s,x){"use strict";const Qe={viewBox:"0 0 32 32",width:"1.2em",height:"1.2em"},Ye=[s.createElementVNode("path",{fill:"currentColor",d:"M16 28h7v2h-7zm0-4h14v2H16zm0-4h14v2H16zM4 20v2h4.586L2 28.586L3.414 30L10 23.414V28h2v-8H4zM28 8H16l-3.414-3.414A2 2 0 0 0 11.172 4H4a2 2 0 0 0-2 2v12h2V6h7.172l3.414 3.414l.586.586H28v8h2v-8a2 2 0 0 0-2-2z"},null,-1)];function Ze(e,t){return s.openBlock(),s.createElementBlock("svg",Qe,Ye)}const ve={name:"carbon-folder-details-reference",render:Ze};function Ee(e,t){return function(){return e.apply(t,arguments)}}const{toString:et}=Object.prototype,{getPrototypeOf:ne}=Object,$=(e=>t=>{const n=et.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),_=e=>(e=e.toLowerCase(),t=>$(t)===e),J=e=>t=>typeof t===e,{isArray:j}=Array,H=J("undefined");function tt(e){return e!==null&&!H(e)&&e.constructor!==null&&!H(e.constructor)&&k(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const be=_("ArrayBuffer");function nt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&be(e.buffer),t}const rt=J("string"),k=J("function"),we=J("number"),K=e=>e!==null&&typeof e=="object",st=e=>e===!0||e===!1,W=e=>{if($(e)!=="object")return!1;const t=ne(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ot=_("Date"),it=_("File"),at=_("Blob"),lt=_("FileList"),ct=e=>K(e)&&k(e.pipe),ut=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||k(e.append)&&((t=$(e))==="formdata"||t==="object"&&k(e.toString)&&e.toString()==="[object FormData]"))},dt=_("URLSearchParams"),ft=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function M(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,o;if(typeof e!="object"&&(e=[e]),j(e))for(r=0,o=e.length;r0;)if(o=n[r],t===o.toLowerCase())return o;return null}const ge=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Se=e=>!H(e)&&e!==ge;function re(){const{caseless:e}=Se(this)&&this||{},t={},n=(r,o)=>{const a=e&&xe(t,o)||o;W(t[a])&&W(r)?t[a]=re(t[a],r):W(r)?t[a]=re({},r):j(r)?t[a]=r.slice():t[a]=r};for(let r=0,o=arguments.length;r(M(t,(o,a)=>{n&&k(o)?e[a]=Ee(o,n):e[a]=o},{allOwnKeys:r}),e),pt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),mt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},yt=(e,t,n,r)=>{let o,a,i;const c={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),a=o.length;a-- >0;)i=o[a],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&ne(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Et=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},bt=e=>{if(!e)return null;if(j(e))return e;let t=e.length;if(!we(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},wt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ne(Uint8Array)),xt=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=r.next())&&!o.done;){const a=o.value;t.call(e,a[0],a[1])}},gt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},St=_("HTMLFormElement"),Ct=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),Ce=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Nt=_("RegExp"),Ne=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};M(n,(o,a)=>{t(o,a,e)!==!1&&(r[a]=o)}),Object.defineProperties(e,r)},At=e=>{Ne(e,(t,n)=>{if(k(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(!!k(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Ot=(e,t)=>{const n={},r=o=>{o.forEach(a=>{n[a]=!0})};return j(e)?r(e):r(String(e).split(t)),n},Rt=()=>{},kt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),se="abcdefghijklmnopqrstuvwxyz",Ae="0123456789",Oe={DIGIT:Ae,ALPHA:se,ALPHA_DIGIT:se+se.toUpperCase()+Ae},Tt=(e=16,t=Oe.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function _t(e){return!!(e&&k(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const Bt=e=>{const t=new Array(10),n=(r,o)=>{if(K(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;const a=j(r)?[]:{};return M(r,(i,c)=>{const h=n(i,o+1);!H(h)&&(a[c]=h)}),t[o]=void 0,a}}return r};return n(e,0)},Ft=_("AsyncFunction"),l={isArray:j,isArrayBuffer:be,isBuffer:tt,isFormData:ut,isArrayBufferView:nt,isString:rt,isNumber:we,isBoolean:st,isObject:K,isPlainObject:W,isUndefined:H,isDate:ot,isFile:it,isBlob:at,isRegExp:Nt,isFunction:k,isStream:ct,isURLSearchParams:dt,isTypedArray:wt,isFileList:lt,forEach:M,merge:re,extend:ht,trim:ft,stripBOM:pt,inherits:mt,toFlatObject:yt,kindOf:$,kindOfTest:_,endsWith:Et,toArray:bt,forEachEntry:xt,matchAll:gt,isHTMLForm:St,hasOwnProperty:Ce,hasOwnProp:Ce,reduceDescriptors:Ne,freezeMethods:At,toObjectSet:Ot,toCamelCase:Ct,noop:Rt,toFiniteNumber:kt,findKey:xe,global:ge,isContextDefined:Se,ALPHABET:Oe,generateString:Tt,isSpecCompliantForm:_t,toJSONObject:Bt,isAsyncFn:Ft,isThenable:e=>e&&(K(e)||k(e))&&k(e.then)&&k(e.catch)};function y(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}l.inherits(y,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:l.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Re=y.prototype,ke={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{ke[e]={value:e}}),Object.defineProperties(y,ke),Object.defineProperty(Re,"isAxiosError",{value:!0}),y.from=(e,t,n,r,o,a)=>{const i=Object.create(Re);return l.toFlatObject(e,i,function(h){return h!==Error.prototype},c=>c!=="isAxiosError"),y.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,a&&Object.assign(i,a),i};const Vt=null;function oe(e){return l.isPlainObject(e)||l.isArray(e)}function Te(e){return l.endsWith(e,"[]")?e.slice(0,-2):e}function _e(e,t,n){return e?e.concat(t).map(function(o,a){return o=Te(o),!n&&a?"["+o+"]":o}).join(n?".":""):t}function Pt(e){return l.isArray(e)&&!e.some(oe)}const Dt=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function X(e,t,n){if(!l.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=l.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,T){return!l.isUndefined(T[m])});const r=n.metaTokens,o=n.visitor||f,a=n.dots,i=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&l.isSpecCompliantForm(t);if(!l.isFunction(o))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(l.isDate(d))return d.toISOString();if(!h&&l.isBlob(d))throw new y("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(d)||l.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function f(d,m,T){let R=d;if(d&&!T&&typeof d=="object"){if(l.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(l.isArray(d)&&Pt(d)||(l.isFileList(d)||l.endsWith(m,"[]"))&&(R=l.toArray(d)))return m=Te(m),R.forEach(function(D,te){!(l.isUndefined(D)||D===null)&&t.append(i===!0?_e([m],te,a):i===null?m:m+"[]",u(D))}),!1}return oe(d)?!0:(t.append(_e(T,m,a),u(d)),!1)}const p=[],w=Object.assign(Dt,{defaultVisitor:f,convertValue:u,isVisitable:oe});function E(d,m){if(!l.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(d),l.forEach(d,function(R,P){(!(l.isUndefined(R)||R===null)&&o.call(t,R,l.isString(P)?P.trim():P,m,w))===!0&&E(R,m?m.concat(P):[P])}),p.pop()}}if(!l.isObject(e))throw new TypeError("data must be an object");return E(e),t}function Be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ie(e,t){this._pairs=[],e&&X(e,this,t)}const Fe=ie.prototype;Fe.append=function(t,n){this._pairs.push([t,n])},Fe.toString=function(t){const n=t?function(r){return t.call(this,r,Be)}:Be;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function Lt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ve(e,t,n){if(!t)return e;const r=n&&n.encode||Lt,o=n&&n.serialize;let a;if(o?a=o(t,n):a=l.isURLSearchParams(t)?t.toString():new ie(t,n).toString(r),a){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class jt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){l.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Pe=jt,De={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ut=typeof URLSearchParams<"u"?URLSearchParams:ie,Ht=typeof FormData<"u"?FormData:null,Mt=typeof Blob<"u"?Blob:null,It=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),zt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),B={isBrowser:!0,classes:{URLSearchParams:Ut,FormData:Ht,Blob:Mt},isStandardBrowserEnv:It,isStandardBrowserWebWorkerEnv:zt,protocols:["http","https","file","blob","url","data"]};function qt(e,t){return X(e,new B.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,a){return B.isNode&&l.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function $t(e){return l.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Jt(e){const t={},n=Object.keys(e);let r;const o=n.length;let a;for(r=0;r=n.length;return i=!i&&l.isArray(o)?o.length:i,h?(l.hasOwnProp(o,i)?o[i]=[o[i],r]:o[i]=r,!c):((!o[i]||!l.isObject(o[i]))&&(o[i]=[]),t(n,r,o[i],a)&&l.isArray(o[i])&&(o[i]=Jt(o[i])),!c)}if(l.isFormData(e)&&l.isFunction(e.entries)){const n={};return l.forEachEntry(e,(r,o)=>{t($t(r),o,n,0)}),n}return null}const Kt={"Content-Type":void 0};function Wt(e,t,n){if(l.isString(e))try{return(t||JSON.parse)(e),l.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const G={transitional:De,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,a=l.isObject(t);if(a&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return o&&o?JSON.stringify(Le(t)):t;if(l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t))return t;if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return qt(t,this.formSerializer).toString();if((c=l.isFileList(t))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return X(c?{"files[]":t}:t,h&&new h,this.formSerializer)}}return a||o?(n.setContentType("application/json",!1),Wt(t)):t}],transformResponse:[function(t){const n=this.transitional||G.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(t&&l.isString(t)&&(r&&!this.responseType||o)){const i=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:B.classes.FormData,Blob:B.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};l.forEach(["delete","get","head"],function(t){G.headers[t]={}}),l.forEach(["post","put","patch"],function(t){G.headers[t]=l.merge(Kt)});const ae=G,Xt=l.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Gt=e=>{const t={};let n,r,o;return e&&e.split(` `).forEach(function(i){o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!(!n||t[n]&&Xt[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},je=Symbol("internals");function I(e){return e&&String(e).trim().toLowerCase()}function Q(e){return e===!1||e==null?e:l.isArray(e)?e.map(Q):String(e)}function Qt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Yt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function le(e,t,n,r,o){if(l.isFunction(r))return r.call(this,t,n);if(o&&(t=n),!!l.isString(t)){if(l.isString(r))return t.indexOf(r)!==-1;if(l.isRegExp(r))return r.test(t)}}function Zt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function vt(e,t){const n=l.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(o,a,i){return this[r].call(this,t,o,a,i)},configurable:!0})})}class Y{constructor(t){t&&this.set(t)}set(t,n,r){const o=this;function a(c,h,u){const f=I(h);if(!f)throw new Error("header name must be a non-empty string");const p=l.findKey(o,f);(!p||o[p]===void 0||u===!0||u===void 0&&o[p]!==!1)&&(o[p||h]=Q(c))}const i=(c,h)=>l.forEach(c,(u,f)=>a(u,f,h));return l.isPlainObject(t)||t instanceof this.constructor?i(t,n):l.isString(t)&&(t=t.trim())&&!Yt(t)?i(Gt(t),n):t!=null&&a(n,t,r),this}get(t,n){if(t=I(t),t){const r=l.findKey(this,t);if(r){const o=this[r];if(!n)return o;if(n===!0)return Qt(o);if(l.isFunction(n))return n.call(this,o,r);if(l.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=I(t),t){const r=l.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||le(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let o=!1;function a(i){if(i=I(i),i){const c=l.findKey(r,i);c&&(!n||le(r,r[c],c,n))&&(delete r[c],o=!0)}}return l.isArray(t)?t.forEach(a):a(t),o}clear(t){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const a=n[r];(!t||le(this,this[a],a,t,!0))&&(delete this[a],o=!0)}return o}normalize(t){const n=this,r={};return l.forEach(this,(o,a)=>{const i=l.findKey(r,a);if(i){n[i]=Q(o),delete n[a];return}const c=t?Zt(a):String(a).trim();c!==a&&delete n[a],n[c]=Q(o),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return l.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=t&&l.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[je]=this[je]={accessors:{}}).accessors,o=this.prototype;function a(i){const c=I(i);r[c]||(vt(o,i),r[c]=!0)}return l.isArray(t)?t.forEach(a):a(t),this}}Y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.freezeMethods(Y.prototype),l.freezeMethods(Y);const F=Y;function ce(e,t){const n=this||ae,r=t||n,o=F.from(r.headers);let a=r.data;return l.forEach(e,function(c){a=c.call(n,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function Ue(e){return!!(e&&e.__CANCEL__)}function z(e,t,n){y.call(this,e==null?"canceled":e,y.ERR_CANCELED,t,n),this.name="CanceledError"}l.inherits(z,y,{__CANCEL__:!0});function en(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const tn=B.isStandardBrowserEnv?function(){return{write:function(n,r,o,a,i,c){const h=[];h.push(n+"="+encodeURIComponent(r)),l.isNumber(o)&&h.push("expires="+new Date(o).toGMTString()),l.isString(a)&&h.push("path="+a),l.isString(i)&&h.push("domain="+i),c===!0&&h.push("secure"),document.cookie=h.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function nn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function rn(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function He(e,t){return e&&!nn(t)?rn(e,t):t}const sn=B.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(a){let i=a;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(i){const c=l.isString(i)?o(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function on(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function an(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,a=0,i;return t=t!==void 0?t:1e3,function(h){const u=Date.now(),f=r[a];i||(i=u),n[o]=h,r[o]=u;let p=a,w=0;for(;p!==o;)w+=n[p++],p=p%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),u-i{const a=o.loaded,i=o.lengthComputable?o.total:void 0,c=a-n,h=r(c),u=a<=i;n=a;const f={loaded:a,total:i,progress:i?a/i:void 0,bytes:c,rate:h||void 0,estimated:h&&i&&u?(i-a)/h:void 0,event:o};f[t?"download":"upload"]=!0,e(f)}}const Z={http:Vt,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){let o=e.data;const a=F.from(e.headers).normalize(),i=e.responseType;let c;function h(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}l.isFormData(o)&&(B.isStandardBrowserEnv||B.isStandardBrowserWebWorkerEnv?a.setContentType(!1):a.setContentType("multipart/form-data;",!1));let u=new XMLHttpRequest;if(e.auth){const E=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.set("Authorization","Basic "+btoa(E+":"+d))}const f=He(e.baseURL,e.url);u.open(e.method.toUpperCase(),Ve(f,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function p(){if(!u)return;const E=F.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!i||i==="text"||i==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:E,config:e,request:u};en(function(R){n(R),h()},function(R){r(R),h()},m),u=null}if("onloadend"in u?u.onloadend=p:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(p)},u.onabort=function(){!u||(r(new y("Request aborted",y.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new y("Network Error",y.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let d=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const m=e.transitional||De;e.timeoutErrorMessage&&(d=e.timeoutErrorMessage),r(new y(d,m.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,u)),u=null},B.isStandardBrowserEnv){const E=(e.withCredentials||sn(f))&&e.xsrfCookieName&&tn.read(e.xsrfCookieName);E&&a.set(e.xsrfHeaderName,E)}o===void 0&&a.setContentType(null),"setRequestHeader"in u&&l.forEach(a.toJSON(),function(d,m){u.setRequestHeader(m,d)}),l.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&i!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Me(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Me(e.onUploadProgress)),(e.cancelToken||e.signal)&&(c=E=>{!u||(r(!E||E.type?new z(null,e,u):E),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c)));const w=on(f);if(w&&B.protocols.indexOf(w)===-1){r(new y("Unsupported protocol "+w+":",y.ERR_BAD_REQUEST,e));return}u.send(o||null)})}};l.forEach(Z,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ln={getAdapter:e=>{e=l.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let o=0;oe instanceof F?e.toJSON():e;function U(e,t){t=t||{};const n={};function r(u,f,p){return l.isPlainObject(u)&&l.isPlainObject(f)?l.merge.call({caseless:p},u,f):l.isPlainObject(f)?l.merge({},f):l.isArray(f)?f.slice():f}function o(u,f,p){if(l.isUndefined(f)){if(!l.isUndefined(u))return r(void 0,u,p)}else return r(u,f,p)}function a(u,f){if(!l.isUndefined(f))return r(void 0,f)}function i(u,f){if(l.isUndefined(f)){if(!l.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function c(u,f,p){if(p in t)return r(u,f);if(p in e)return r(void 0,u)}const h={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(u,f)=>o(ze(u),ze(f),!0)};return l.forEach(Object.keys(Object.assign({},e,t)),function(f){const p=h[f]||o,w=p(e[f],t[f],f);l.isUndefined(w)&&p!==c||(n[f]=w)}),n}const qe="1.4.0",de={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{de[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const $e={};de.transitional=function(t,n,r){function o(a,i){return"[Axios v"+qe+"] Transitional option '"+a+"'"+i+(r?". "+r:"")}return(a,i,c)=>{if(t===!1)throw new y(o(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!$e[i]&&($e[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,i,c):!0}};function cn(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const a=r[o],i=t[a];if(i){const c=e[a],h=c===void 0||i(c,a,e);if(h!==!0)throw new y("option "+a+" must be "+h,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+a,y.ERR_BAD_OPTION)}}const fe={assertOptions:cn,validators:de},V=fe.validators;class v{constructor(t){this.defaults=t,this.interceptors={request:new Pe,response:new Pe}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=U(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:V.transitional(V.boolean),forcedJSONParsing:V.transitional(V.boolean),clarifyTimeoutError:V.transitional(V.boolean)},!1),o!=null&&(l.isFunction(o)?n.paramsSerializer={serialize:o}:fe.assertOptions(o,{encode:V.function,serialize:V.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i;i=a&&l.merge(a.common,a[n.method]),i&&l.forEach(["delete","get","head","post","put","patch","common"],d=>{delete a[d]}),n.headers=F.concat(i,a);const c=[];let h=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(h=h&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let f,p=0,w;if(!h){const d=[Ie.bind(this),void 0];for(d.unshift.apply(d,c),d.push.apply(d,u),w=d.length,f=Promise.resolve(n);p{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(c=>{r.subscribe(c),a=c}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,c){r.reason||(r.reason=new z(a,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new he(function(o){t=o}),cancel:t}}}const un=he;function dn(e){return function(n){return e.apply(null,n)}}function fn(e){return l.isObject(e)&&e.isAxiosError===!0}const pe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(pe).forEach(([e,t])=>{pe[t]=e});const hn=pe;function Je(e){const t=new ee(e),n=Ee(ee.prototype.request,t);return l.extend(n,ee.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Je(U(e,o))},n}const S=Je(ae);S.Axios=ee,S.CanceledError=z,S.CancelToken=un,S.isCancel=Ue,S.VERSION=qe,S.toFormData=X,S.AxiosError=y,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=dn,S.isAxiosError=fn,S.mergeConfig=U,S.AxiosHeaders=F,S.formToJSON=e=>Le(l.isHTMLForm(e)?new FormData(e):e),S.HttpStatusCode=hn,S.default=S;const pn=S,mn={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}.VITE_API_URL,q=pn.create({baseURL:mn,withCredentials:!0});q.interceptors.response.use(e=>e,async e=>{const t=e.response;if(!t)return Promise.reject(e);const{status:n}=t;return n!==200&&x.Toast.error("status: "+n),Promise.reject(e)}),q.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";function yn(e){return q.post("/apis/s3os.halo.run/v1alpha1/attachments/link",e)}function En(e){const t={continuationToken:e.continuationToken,continuationObject:e.continuationObject,pageSize:e.pageSize,unlinked:e.unlinked};return q.get(`/apis/s3os.halo.run/v1alpha1/objects/${e.policyName}`,{params:t})}function bn(){return q.get("/apis/s3os.halo.run/v1alpha1/policies/s3")}const wn={class:"m-0 md:m-4"},xn={class:"block w-full bg-gray-50 px-4 py-3"},gn={class:"relative flex flex-col flex-wrap items-start gap-4 sm:flex-row sm:items-center"},Sn={class:"hidden items-center sm:flex"},Cn={class:"flex w-full flex-1 items-center sm:w-auto"},Nn={key:0,class:"flex items-center gap-2"},An={class:"flex flex-row gap-2"},On={class:"box-border h-full w-full divide-y divide-gray-100",role:"list"},Rn=["value","disabled"],kn={class:"bg-white sm:flex sm:items-center justify-between"},Tn={class:"inline-flex items-center gap-5"},_n={class:"text-xs text-gray-500 hidden md:flex"},Bn=s.createElementVNode("span",{class:"text-xs text-gray-500 hidden md:flex"},"\u5DF2\u81EA\u52A8\u8FC7\u6EE4\u6587\u4EF6\u5939\u5BF9\u8C61\uFF0C\u9875\u9762\u5B9E\u9645\u663E\u793A\u6570\u91CF\u5C11\u4E3A\u6B63\u5E38\u73B0\u8C61",-1),Fn={class:"inline-flex items-center gap-5"},Vn={class:"inline-flex items-center gap-2"},Pn={class:"text-sm text-gray-500"},Dn={class:"inline-flex items-center gap-2"},Ln=["value"],jn=s.createElementVNode("span",{class:"text-sm text-gray-500"},"\u6761/\u9875",-1),Un={class:"flex flex-col"},Hn={key:0},Mn=s.createElementVNode("tr",null,[s.createElementVNode("th",{class:"border border-black font-normal"},"\u5931\u8D25\u5BF9\u8C61"),s.createElementVNode("th",{class:"border border-black font-normal"},"\u5931\u8D25\u539F\u56E0")],-1),In={class:"border border-black font-normal"},zn={class:"border border-black font-normal"},qn=s.defineComponent({__name:"HomeView",setup(e){const t=s.ref([]),n=s.ref(""),r=s.ref(1),o=s.ref(50),a=s.ref([{label:"\u8BF7\u9009\u62E9\u7B56\u7565",value:"",attrs:{disabled:!0}}]),i=s.ref({objects:[],hasMore:!1,currentToken:"",nextToken:"",currentContinuationObject:"",nextContinuationObject:""}),c=s.ref(!1),h=s.ref(!1),u=s.ref(!1),f=s.ref(!0),p=s.ref(""),w=s.ref([]),E=[{label:"\u5168\u90E8"},{label:"\u672A\u5173\u8054",value:!0}],d=s.ref(!1),m=s.ref(E[0].value),T=s.computed(()=>f.value?"\u6B63\u5728\u52A0\u8F7D\u7B56\u7565":a.value.length<=1?"\u6CA1\u6709\u53EF\u7528\u7684\u7B56\u7565\uFF0C\u8BF7\u524D\u5F80\u3010\u9644\u4EF6\u3011\u6DFB\u52A0S3\u7B56\u7565":n.value?"\u8BE5\u7B56\u7565\u7684 \u6876/\u6587\u4EF6\u5939 \u4E0B\u6CA1\u6709\u6587\u4EF6":"\u8BF7\u5728\u5DE6\u4E0A\u65B9\u9009\u62E9\u7B56\u7565"),R=g=>{var N;const{checked:b}=g.target;b?t.value=((N=i.value.objects)==null?void 0:N.filter(A=>!A.isLinked).map(A=>A.key||""))||[]:(t.value.length=0,d.value=!1)},P=async()=>{try{const g=await bn();g.status==200&&(a.value=[{label:"\u8BF7\u9009\u62E9\u7B56\u7565",value:"",attrs:{disabled:!0}}],g.data.forEach(b=>{a.value.push({label:b.spec.displayName,value:b.metadata.name,attrs:{}})}))}catch(g){console.error(g)}f.value=!1};s.onMounted(()=>{P()}),s.watch(t,g=>{var b,N;d.value=((b=i.value.objects)==null?void 0:b.filter(A=>!A.isLinked).filter(A=>!g.includes(A.key||"")).length)==0&&((N=i.value.objects)==null?void 0:N.length)!=0}),s.watch(m,()=>{me()});const D=()=>{i.value.currentToken=i.value.nextToken,i.value.currentContinuationObject=i.value.nextContinuationObject,i.value.nextToken="",i.value.nextContinuationObject=""},te=()=>{i.value.currentToken="",i.value.currentContinuationObject="",i.value.nextToken="",i.value.nextContinuationObject=""},L=async()=>{var g,b;if(!!n.value){c.value=!0,i.value.objects=[];try{const N=await En({policyName:n.value,pageSize:o.value,continuationToken:i.value.currentToken,continuationObject:i.value.currentContinuationObject,unlinked:m.value});N.status==200&&(i.value=N.data,((g=i.value.objects)==null?void 0:g.length)==0&&i.value.hasMore&&i.value.nextToken?(D(),await L()):((b=i.value.objects)==null?void 0:b.length)==0&&!i.value.hasMore&&r.value>1&&(r.value=1,te(),await L(),x.Toast.warning("\u6700\u540E\u4E00\u9875\u4E3A\u7A7A\uFF0C\u5DF2\u8FD4\u56DE\u7B2C\u4E00\u9875")))}catch(N){console.error(N)}t.value.length=0,d.value=!1,c.value=!1}},$n=g=>t.value.includes(g.key||""),Ke=async()=>{u.value=!0,h.value=!0,p.value=`\u6B63\u5728\u5173\u8054${t.value.length}\u4E2A\u6587\u4EF6`,w.value=[];const g=await yn({policyName:n.value,objectKeys:t.value}),b=g.data.items.filter(A=>A.success).length,N=g.data.items.filter(A=>!A.success).length;p.value=`\u5173\u8054\u6210\u529F${b}\u4E2A\u6587\u4EF6\uFF0C\u5173\u8054\u5931\u8D25${N}\u4E2A\u6587\u4EF6`,N>0&&(w.value=g.data.items.filter(A=>!A.success)),u.value=!1},Jn=g=>{t.value=[g.key||""],Ke()},Kn=()=>{!n.value||i.value.hasMore&&(c.value=!0,r.value+=1,D(),L())},me=()=>{!n.value||(c.value=!0,r.value=1,te(),L())},We=()=>{h.value=!1,L()};return(g,b)=>{const N=s.resolveComponent("FormKit"),A=s.resolveComponent("FilterCleanButton"),Wn=s.resolveComponent("FilterDropdown"),Xn=s.resolveComponent("AttachmentFileTypeIcon"),Gn=s.resolveDirective("tooltip");return s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createVNode(s.unref(x.VPageHeader),{title:"\u5173\u8054S3\u6587\u4EF6(Beta)"},{icon:s.withCtx(()=>[s.createVNode(s.unref(ve),{class:"mr-2 self-center"})]),_:1}),s.createElementVNode("div",wn,[s.createVNode(s.unref(x.VCard),{"body-class":["!p-0"]},{header:s.withCtx(()=>[s.createElementVNode("div",xn,[s.createElementVNode("div",gn,[s.createElementVNode("div",Sn,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[0]||(b[0]=C=>d.value=C),class:"h-4 w-4 rounded border-gray-300 text-indigo-600",type:"checkbox",onChange:R},null,544),[[s.vModelCheckbox,d.value]])]),s.createElementVNode("div",Cn,[t.value.length?(s.openBlock(),s.createBlock(s.unref(x.VSpace),{key:1},{default:s.withCtx(()=>[s.createVNode(s.unref(x.VButton),{type:"primary",onClick:Ke},{default:s.withCtx(()=>[s.createTextVNode(" \u5173\u8054 ")]),_:1})]),_:1})):(s.openBlock(),s.createElementBlock("div",Nn,[s.createTextVNode(" \u7B56\u7565: "),s.createVNode(N,{id:"policyChoose","outer-class":"!p-0 w-48",modelValue:n.value,"onUpdate:modelValue":b[1]||(b[1]=C=>n.value=C),name:"policyName",type:"select",options:a.value,onChange:b[2]||(b[2]=C=>L())},null,8,["modelValue","options"])]))]),s.createVNode(s.unref(x.VSpace),{spacing:"lg",class:"flex-wrap"},{default:s.withCtx(()=>[m.value!=E[0].value?(s.openBlock(),s.createBlock(A,{key:0,onClick:b[3]||(b[3]=C=>m.value=E[0].value)})):s.createCommentVNode("",!0),s.createVNode(Wn,{modelValue:m.value,"onUpdate:modelValue":b[4]||(b[4]=C=>m.value=C),label:g.$t("core.common.filters.labels.status"),items:E},null,8,["modelValue","label"]),s.createElementVNode("div",An,[s.createElementVNode("div",{class:"group cursor-pointer rounded p-1 hover:bg-gray-200",onClick:b[5]||(b[5]=C=>L())},[s.withDirectives(s.createVNode(s.unref(x.IconRefreshLine),{class:s.normalizeClass([{"animate-spin text-gray-900":c.value},"h-4 w-4 text-gray-600 group-hover:text-gray-900"])},null,8,["class"]),[[Gn,g.$t("core.common.buttons.refresh")]])])])]),_:1})])])]),footer:s.withCtx(()=>{var C;return[s.createElementVNode("div",kn,[s.createElementVNode("div",Tn,[s.createElementVNode("span",_n,"\u5171 "+s.toDisplayString((C=i.value.objects)==null?void 0:C.length)+" \u9879\u6570\u636E",1),Bn]),s.createElementVNode("div",Fn,[s.createElementVNode("div",Vn,[s.createVNode(s.unref(x.VButton),{size:"small",onClick:me,disabled:!n.value},{default:s.withCtx(()=>[s.createTextVNode("\u8FD4\u56DE\u7B2C\u4E00\u9875")]),_:1},8,["disabled"]),s.createElementVNode("span",Pn,"\u7B2C "+s.toDisplayString(r.value)+" \u9875",1),s.createVNode(s.unref(x.VButton),{size:"small",onClick:Kn,disabled:!i.value.hasMore||c.value||!n.value},{default:s.withCtx(()=>[s.createTextVNode(" \u4E0B\u4E00\u9875 ")]),_:1},8,["disabled"])]),s.createElementVNode("div",Dn,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":b[7]||(b[7]=O=>o.value=O),class:"h-8 border outline-none rounded-base px-2 text-gray-800 text-sm border-gray-300",onChange:me},[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList([20,50,100,200],(O,ye)=>s.createElementVNode("option",{key:ye,value:O},s.toDisplayString(O),9,Ln)),64))],544),[[s.vModelSelect,o.value]]),jn])])])]}),default:s.withCtx(()=>{var C;return[c.value?(s.openBlock(),s.createBlock(s.unref(x.VLoading),{key:0})):(C=i.value.objects)!=null&&C.length?(s.openBlock(),s.createBlock(s.Transition,{key:2,appear:"",name:"fade"},{default:s.withCtx(()=>[s.createElementVNode("ul",On,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.value.objects,(O,ye)=>(s.openBlock(),s.createElementBlock("li",{key:ye},[s.createVNode(s.unref(x.VEntity),{"is-selected":$n(O)},{checkbox:s.withCtx(()=>[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[6]||(b[6]=Xe=>t.value=Xe),value:O.key||"",class:"h-4 w-4 rounded border-gray-300 text-indigo-600",name:"post-checkbox",disabled:O.isLinked,type:"checkbox"},null,8,Rn),[[s.vModelCheckbox,t.value]])]),start:s.withCtx(()=>[s.createVNode(s.unref(x.VEntityField),null,{description:s.withCtx(()=>[s.createVNode(Xn,{"display-ext":!1,"file-name":O.displayName||"",width:8,height:8},null,8,["file-name"])]),_:2},1024),s.createVNode(s.unref(x.VEntityField),{title:O.displayName||"",description:O.key||""},null,8,["title","description"])]),end:s.withCtx(()=>[s.createVNode(s.unref(x.VEntityField),null,{description:s.withCtx(()=>[s.createVNode(s.unref(x.VTag),{theme:O.isLinked?"default":"primary"},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(O.isLinked?"\u5DF2\u5173\u8054":"\u672A\u5173\u8054"),1)]),_:2},1032,["theme"])]),_:2},1024),s.createVNode(s.unref(x.VEntityField),null,{description:s.withCtx(()=>[s.createVNode(s.unref(x.VButton),{disabled:O.isLinked||!1,onClick:Xe=>Jn(O)},{default:s.withCtx(()=>[s.createTextVNode(" \u5173\u8054 ")]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),_:2},1032,["is-selected"])]))),128))])]),_:1})):(s.openBlock(),s.createBlock(s.Transition,{key:1,appear:"",name:"fade"},{default:s.withCtx(()=>[s.createVNode(s.unref(x.VEmpty),{message:"\u7A7A\u7A7A\u5982\u4E5F",title:s.unref(T)},null,8,["title"])]),_:1}))]}),_:1})]),s.createVNode(s.unref(x.VModal),{visible:h.value,fullscreen:!1,title:"\u5173\u8054\u7ED3\u679C",width:500,"mount-to-body":!0,onClose:We},{footer:s.withCtx(()=>[s.createVNode(s.unref(x.VSpace),null,{default:s.withCtx(()=>[s.createVNode(s.unref(x.VButton),{loading:u.value,type:"primary",onClick:We},{default:s.withCtx(()=>[s.createTextVNode(" \u786E\u5B9A ")]),_:1},8,["loading"])]),_:1})]),default:s.withCtx(()=>[s.createElementVNode("div",Un,[s.createTextVNode(s.toDisplayString(p.value)+" ",1),w.value.length!=0?(s.openBlock(),s.createElementBlock("table",Hn,[Mn,(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(w.value,C=>(s.openBlock(),s.createElementBlock("tr",{key:C.objectKey},[s.createElementVNode("th",In,s.toDisplayString(C.objectKey),1),s.createElementVNode("th",zn,s.toDisplayString(C.message),1)]))),128))])):s.createCommentVNode("",!0)])]),_:1},8,["visible"])],64)}}});return Ge.definePlugin({components:{},routes:[],extensionPoints:{"plugin:self:tabs:create":()=>[{id:"s3-link",label:"\u5173\u8054S3\u6587\u4EF6",component:s.markRaw(qn),permissions:[]}]}})}(HaloConsoleShared,Vue,HaloComponents); +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[je]=this[je]={accessors:{}}).accessors,o=this.prototype;function a(i){const c=I(i);r[c]||(vt(o,i),r[c]=!0)}return l.isArray(t)?t.forEach(a):a(t),this}}Y.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.freezeMethods(Y.prototype),l.freezeMethods(Y);const F=Y;function ce(e,t){const n=this||ae,r=t||n,o=F.from(r.headers);let a=r.data;return l.forEach(e,function(c){a=c.call(n,a,o.normalize(),t?t.status:void 0)}),o.normalize(),a}function Ue(e){return!!(e&&e.__CANCEL__)}function z(e,t,n){y.call(this,e==null?"canceled":e,y.ERR_CANCELED,t,n),this.name="CanceledError"}l.inherits(z,y,{__CANCEL__:!0});function en(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const tn=B.isStandardBrowserEnv?function(){return{write:function(n,r,o,a,i,c){const h=[];h.push(n+"="+encodeURIComponent(r)),l.isNumber(o)&&h.push("expires="+new Date(o).toGMTString()),l.isString(a)&&h.push("path="+a),l.isString(i)&&h.push("domain="+i),c===!0&&h.push("secure"),document.cookie=h.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function nn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function rn(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function He(e,t){return e&&!nn(t)?rn(e,t):t}const sn=B.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(a){let i=a;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(i){const c=l.isString(i)?o(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function on(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function an(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,a=0,i;return t=t!==void 0?t:1e3,function(h){const u=Date.now(),f=r[a];i||(i=u),n[o]=h,r[o]=u;let p=a,w=0;for(;p!==o;)w+=n[p++],p=p%e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),u-i{const a=o.loaded,i=o.lengthComputable?o.total:void 0,c=a-n,h=r(c),u=a<=i;n=a;const f={loaded:a,total:i,progress:i?a/i:void 0,bytes:c,rate:h||void 0,estimated:h&&i&&u?(i-a)/h:void 0,event:o};f[t?"download":"upload"]=!0,e(f)}}const Z={http:Vt,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){let o=e.data;const a=F.from(e.headers).normalize(),i=e.responseType;let c;function h(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}l.isFormData(o)&&(B.isStandardBrowserEnv||B.isStandardBrowserWebWorkerEnv?a.setContentType(!1):a.setContentType("multipart/form-data;",!1));let u=new XMLHttpRequest;if(e.auth){const E=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";a.set("Authorization","Basic "+btoa(E+":"+d))}const f=He(e.baseURL,e.url);u.open(e.method.toUpperCase(),Ve(f,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function p(){if(!u)return;const E=F.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!i||i==="text"||i==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:E,config:e,request:u};en(function(R){n(R),h()},function(R){r(R),h()},m),u=null}if("onloadend"in u?u.onloadend=p:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(p)},u.onabort=function(){!u||(r(new y("Request aborted",y.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new y("Network Error",y.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let d=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const m=e.transitional||De;e.timeoutErrorMessage&&(d=e.timeoutErrorMessage),r(new y(d,m.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,u)),u=null},B.isStandardBrowserEnv){const E=(e.withCredentials||sn(f))&&e.xsrfCookieName&&tn.read(e.xsrfCookieName);E&&a.set(e.xsrfHeaderName,E)}o===void 0&&a.setContentType(null),"setRequestHeader"in u&&l.forEach(a.toJSON(),function(d,m){u.setRequestHeader(m,d)}),l.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),i&&i!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Me(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Me(e.onUploadProgress)),(e.cancelToken||e.signal)&&(c=E=>{!u||(r(!E||E.type?new z(null,e,u):E),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c)));const w=on(f);if(w&&B.protocols.indexOf(w)===-1){r(new y("Unsupported protocol "+w+":",y.ERR_BAD_REQUEST,e));return}u.send(o||null)})}};l.forEach(Z,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ln={getAdapter:e=>{e=l.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let o=0;oe instanceof F?e.toJSON():e;function U(e,t){t=t||{};const n={};function r(u,f,p){return l.isPlainObject(u)&&l.isPlainObject(f)?l.merge.call({caseless:p},u,f):l.isPlainObject(f)?l.merge({},f):l.isArray(f)?f.slice():f}function o(u,f,p){if(l.isUndefined(f)){if(!l.isUndefined(u))return r(void 0,u,p)}else return r(u,f,p)}function a(u,f){if(!l.isUndefined(f))return r(void 0,f)}function i(u,f){if(l.isUndefined(f)){if(!l.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function c(u,f,p){if(p in t)return r(u,f);if(p in e)return r(void 0,u)}const h={url:a,method:a,data:a,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(u,f)=>o(ze(u),ze(f),!0)};return l.forEach(Object.keys(Object.assign({},e,t)),function(f){const p=h[f]||o,w=p(e[f],t[f],f);l.isUndefined(w)&&p!==c||(n[f]=w)}),n}const qe="1.4.0",de={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{de[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const $e={};de.transitional=function(t,n,r){function o(a,i){return"[Axios v"+qe+"] Transitional option '"+a+"'"+i+(r?". "+r:"")}return(a,i,c)=>{if(t===!1)throw new y(o(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!$e[i]&&($e[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,i,c):!0}};function cn(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const a=r[o],i=t[a];if(i){const c=e[a],h=c===void 0||i(c,a,e);if(h!==!0)throw new y("option "+a+" must be "+h,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+a,y.ERR_BAD_OPTION)}}const fe={assertOptions:cn,validators:de},V=fe.validators;class v{constructor(t){this.defaults=t,this.interceptors={request:new Pe,response:new Pe}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=U(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:a}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:V.transitional(V.boolean),forcedJSONParsing:V.transitional(V.boolean),clarifyTimeoutError:V.transitional(V.boolean)},!1),o!=null&&(l.isFunction(o)?n.paramsSerializer={serialize:o}:fe.assertOptions(o,{encode:V.function,serialize:V.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i;i=a&&l.merge(a.common,a[n.method]),i&&l.forEach(["delete","get","head","post","put","patch","common"],d=>{delete a[d]}),n.headers=F.concat(i,a);const c=[];let h=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(h=h&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let f,p=0,w;if(!h){const d=[Ie.bind(this),void 0];for(d.unshift.apply(d,c),d.push.apply(d,u),w=d.length,f=Promise.resolve(n);p{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](o);r._listeners=null}),this.promise.then=o=>{let a;const i=new Promise(c=>{r.subscribe(c),a=c}).then(o);return i.cancel=function(){r.unsubscribe(a)},i},t(function(a,i,c){r.reason||(r.reason=new z(a,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new he(function(o){t=o}),cancel:t}}}const un=he;function dn(e){return function(n){return e.apply(null,n)}}function fn(e){return l.isObject(e)&&e.isAxiosError===!0}const pe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(pe).forEach(([e,t])=>{pe[t]=e});const hn=pe;function Je(e){const t=new ee(e),n=Ee(ee.prototype.request,t);return l.extend(n,ee.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Je(U(e,o))},n}const S=Je(ae);S.Axios=ee,S.CanceledError=z,S.CancelToken=un,S.isCancel=Ue,S.VERSION=qe,S.toFormData=X,S.AxiosError=y,S.Cancel=S.CanceledError,S.all=function(t){return Promise.all(t)},S.spread=dn,S.isAxiosError=fn,S.mergeConfig=U,S.AxiosHeaders=F,S.formToJSON=e=>Le(l.isHTMLForm(e)?new FormData(e):e),S.HttpStatusCode=hn,S.default=S;const pn=S,mn={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}.VITE_API_URL,q=pn.create({baseURL:mn,withCredentials:!0});q.interceptors.response.use(e=>e,async e=>{const t=e.response;if(!t)return Promise.reject(e);const{status:n}=t;return n!==200&&x.Toast.error("status: "+n),Promise.reject(e)}),q.defaults.headers.common["X-Requested-With"]="XMLHttpRequest";function yn(e){return q.post("/apis/s3os.halo.run/v1alpha1/attachments/link",e)}function En(e){const t={continuationToken:e.continuationToken,continuationObject:e.continuationObject,pageSize:e.pageSize,unlinked:e.unlinked};return q.get(`/apis/s3os.halo.run/v1alpha1/objects/${e.policyName}`,{params:t})}function bn(){return q.get("/apis/s3os.halo.run/v1alpha1/policies/s3")}const wn={class:"m-0 md:m-4"},xn={class:"block w-full bg-gray-50 px-4 py-3"},gn={class:"relative flex flex-col flex-wrap items-start gap-4 sm:flex-row sm:items-center"},Sn={class:"hidden items-center sm:flex"},Cn={class:"flex w-full flex-1 items-center sm:w-auto"},Nn={key:0,class:"flex items-center gap-2"},An={class:"flex flex-row gap-2"},On={class:"box-border h-full w-full divide-y divide-gray-100",role:"list"},Rn=["value","disabled"],kn={class:"bg-white sm:flex sm:items-center justify-between"},Tn={class:"inline-flex items-center gap-5"},_n={class:"text-xs text-gray-500 hidden md:flex"},Bn=s.createElementVNode("span",{class:"text-xs text-gray-500 hidden md:flex"},"\u5DF2\u81EA\u52A8\u8FC7\u6EE4\u6587\u4EF6\u5939\u5BF9\u8C61\uFF0C\u9875\u9762\u5B9E\u9645\u663E\u793A\u6570\u91CF\u5C11\u4E3A\u6B63\u5E38\u73B0\u8C61",-1),Fn={class:"inline-flex items-center gap-5"},Vn={class:"inline-flex items-center gap-2"},Pn={class:"text-sm text-gray-500"},Dn={class:"inline-flex items-center gap-2"},Ln=["value"],jn=s.createElementVNode("span",{class:"text-sm text-gray-500"},"\u6761/\u9875",-1),Un={class:"flex flex-col"},Hn={key:0},Mn=s.createElementVNode("tr",null,[s.createElementVNode("th",{class:"border border-black font-normal"},"\u5931\u8D25\u5BF9\u8C61"),s.createElementVNode("th",{class:"border border-black font-normal"},"\u5931\u8D25\u539F\u56E0")],-1),In={class:"border border-black font-normal"},zn={class:"border border-black font-normal"},qn=s.defineComponent({__name:"S3Link",setup(e){const t=s.ref([]),n=s.ref(""),r=s.ref(1),o=s.ref(50),a=s.ref([{label:"\u8BF7\u9009\u62E9\u7B56\u7565",value:"",attrs:{disabled:!0}}]),i=s.ref({objects:[],hasMore:!1,currentToken:"",nextToken:"",currentContinuationObject:"",nextContinuationObject:""}),c=s.ref(!1),h=s.ref(!1),u=s.ref(!1),f=s.ref(!0),p=s.ref(""),w=s.ref([]),E=[{label:"\u5168\u90E8"},{label:"\u672A\u5173\u8054",value:!0}],d=s.ref(!1),m=s.ref(E[0].value),T=s.computed(()=>f.value?"\u6B63\u5728\u52A0\u8F7D\u7B56\u7565":a.value.length<=1?"\u6CA1\u6709\u53EF\u7528\u7684\u7B56\u7565\uFF0C\u8BF7\u524D\u5F80\u3010\u9644\u4EF6\u3011\u6DFB\u52A0S3\u7B56\u7565":n.value?"\u8BE5\u7B56\u7565\u7684 \u6876/\u6587\u4EF6\u5939 \u4E0B\u6CA1\u6709\u6587\u4EF6":"\u8BF7\u5728\u5DE6\u4E0A\u65B9\u9009\u62E9\u7B56\u7565"),R=g=>{var N;const{checked:b}=g.target;b?t.value=((N=i.value.objects)==null?void 0:N.filter(A=>!A.isLinked).map(A=>A.key||""))||[]:(t.value.length=0,d.value=!1)},P=async()=>{try{const g=await bn();g.status==200&&(a.value=[{label:"\u8BF7\u9009\u62E9\u7B56\u7565",value:"",attrs:{disabled:!0}}],g.data.forEach(b=>{a.value.push({label:b.spec.displayName,value:b.metadata.name,attrs:{}})}))}catch(g){console.error(g)}f.value=!1};s.onMounted(()=>{P()}),s.watch(t,g=>{var b,N;d.value=((b=i.value.objects)==null?void 0:b.filter(A=>!A.isLinked).filter(A=>!g.includes(A.key||"")).length)==0&&((N=i.value.objects)==null?void 0:N.length)!=0}),s.watch(m,()=>{me()});const D=()=>{i.value.currentToken=i.value.nextToken,i.value.currentContinuationObject=i.value.nextContinuationObject,i.value.nextToken="",i.value.nextContinuationObject=""},te=()=>{i.value.currentToken="",i.value.currentContinuationObject="",i.value.nextToken="",i.value.nextContinuationObject=""},L=async()=>{var g,b;if(!!n.value){c.value=!0,i.value.objects=[];try{const N=await En({policyName:n.value,pageSize:o.value,continuationToken:i.value.currentToken,continuationObject:i.value.currentContinuationObject,unlinked:m.value});N.status==200&&(i.value=N.data,((g=i.value.objects)==null?void 0:g.length)==0&&i.value.hasMore&&i.value.nextToken?(D(),await L()):((b=i.value.objects)==null?void 0:b.length)==0&&!i.value.hasMore&&r.value>1&&(r.value=1,te(),await L(),x.Toast.warning("\u6700\u540E\u4E00\u9875\u4E3A\u7A7A\uFF0C\u5DF2\u8FD4\u56DE\u7B2C\u4E00\u9875")))}catch(N){console.error(N)}t.value.length=0,d.value=!1,c.value=!1}},$n=g=>t.value.includes(g.key||""),Ke=async()=>{u.value=!0,h.value=!0,p.value=`\u6B63\u5728\u5173\u8054${t.value.length}\u4E2A\u6587\u4EF6`,w.value=[];const g=await yn({policyName:n.value,objectKeys:t.value}),b=g.data.items.filter(A=>A.success).length,N=g.data.items.filter(A=>!A.success).length;p.value=`\u5173\u8054\u6210\u529F${b}\u4E2A\u6587\u4EF6\uFF0C\u5173\u8054\u5931\u8D25${N}\u4E2A\u6587\u4EF6`,N>0&&(w.value=g.data.items.filter(A=>!A.success)),u.value=!1},Jn=g=>{t.value=[g.key||""],Ke()},Kn=()=>{!n.value||i.value.hasMore&&(c.value=!0,r.value+=1,D(),L())},me=()=>{!n.value||(c.value=!0,r.value=1,te(),L())},We=()=>{h.value=!1,L()};return(g,b)=>{const N=s.resolveComponent("FormKit"),A=s.resolveComponent("FilterCleanButton"),Wn=s.resolveComponent("FilterDropdown"),Xn=s.resolveComponent("AttachmentFileTypeIcon"),Gn=s.resolveDirective("tooltip");return s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createVNode(s.unref(x.VPageHeader),{title:"\u5173\u8054S3\u6587\u4EF6(Beta)"},{icon:s.withCtx(()=>[s.createVNode(s.unref(ve),{class:"mr-2 self-center"})]),_:1}),s.createElementVNode("div",wn,[s.createVNode(s.unref(x.VCard),{"body-class":["!p-0"]},{header:s.withCtx(()=>[s.createElementVNode("div",xn,[s.createElementVNode("div",gn,[s.createElementVNode("div",Sn,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[0]||(b[0]=C=>d.value=C),class:"h-4 w-4 rounded border-gray-300 text-indigo-600",type:"checkbox",onChange:R},null,544),[[s.vModelCheckbox,d.value]])]),s.createElementVNode("div",Cn,[t.value.length?(s.openBlock(),s.createBlock(s.unref(x.VSpace),{key:1},{default:s.withCtx(()=>[s.createVNode(s.unref(x.VButton),{type:"primary",onClick:Ke},{default:s.withCtx(()=>[s.createTextVNode(" \u5173\u8054 ")]),_:1})]),_:1})):(s.openBlock(),s.createElementBlock("div",Nn,[s.createTextVNode(" \u7B56\u7565: "),s.createVNode(N,{id:"policyChoose","outer-class":"!p-0 w-48",modelValue:n.value,"onUpdate:modelValue":b[1]||(b[1]=C=>n.value=C),name:"policyName",type:"select",options:a.value,onChange:b[2]||(b[2]=C=>L())},null,8,["modelValue","options"])]))]),s.createVNode(s.unref(x.VSpace),{spacing:"lg",class:"flex-wrap"},{default:s.withCtx(()=>[m.value!=E[0].value?(s.openBlock(),s.createBlock(A,{key:0,onClick:b[3]||(b[3]=C=>m.value=E[0].value)})):s.createCommentVNode("",!0),s.createVNode(Wn,{modelValue:m.value,"onUpdate:modelValue":b[4]||(b[4]=C=>m.value=C),label:g.$t("core.common.filters.labels.status"),items:E},null,8,["modelValue","label"]),s.createElementVNode("div",An,[s.createElementVNode("div",{class:"group cursor-pointer rounded p-1 hover:bg-gray-200",onClick:b[5]||(b[5]=C=>L())},[s.withDirectives(s.createVNode(s.unref(x.IconRefreshLine),{class:s.normalizeClass([{"animate-spin text-gray-900":c.value},"h-4 w-4 text-gray-600 group-hover:text-gray-900"])},null,8,["class"]),[[Gn,g.$t("core.common.buttons.refresh")]])])])]),_:1})])])]),footer:s.withCtx(()=>{var C;return[s.createElementVNode("div",kn,[s.createElementVNode("div",Tn,[s.createElementVNode("span",_n,"\u5171 "+s.toDisplayString((C=i.value.objects)==null?void 0:C.length)+" \u9879\u6570\u636E",1),Bn]),s.createElementVNode("div",Fn,[s.createElementVNode("div",Vn,[s.createVNode(s.unref(x.VButton),{size:"small",onClick:me,disabled:!n.value},{default:s.withCtx(()=>[s.createTextVNode("\u8FD4\u56DE\u7B2C\u4E00\u9875")]),_:1},8,["disabled"]),s.createElementVNode("span",Pn,"\u7B2C "+s.toDisplayString(r.value)+" \u9875",1),s.createVNode(s.unref(x.VButton),{size:"small",onClick:Kn,disabled:!i.value.hasMore||c.value||!n.value},{default:s.withCtx(()=>[s.createTextVNode(" \u4E0B\u4E00\u9875 ")]),_:1},8,["disabled"])]),s.createElementVNode("div",Dn,[s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":b[7]||(b[7]=O=>o.value=O),class:"h-8 border outline-none rounded-base px-2 text-gray-800 text-sm border-gray-300",onChange:me},[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList([20,50,100,200],(O,ye)=>s.createElementVNode("option",{key:ye,value:O},s.toDisplayString(O),9,Ln)),64))],544),[[s.vModelSelect,o.value]]),jn])])])]}),default:s.withCtx(()=>{var C;return[c.value?(s.openBlock(),s.createBlock(s.unref(x.VLoading),{key:0})):(C=i.value.objects)!=null&&C.length?(s.openBlock(),s.createBlock(s.Transition,{key:2,appear:"",name:"fade"},{default:s.withCtx(()=>[s.createElementVNode("ul",On,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.value.objects,(O,ye)=>(s.openBlock(),s.createElementBlock("li",{key:ye},[s.createVNode(s.unref(x.VEntity),{"is-selected":$n(O)},{checkbox:s.withCtx(()=>[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[6]||(b[6]=Xe=>t.value=Xe),value:O.key||"",class:"h-4 w-4 rounded border-gray-300 text-indigo-600",name:"post-checkbox",disabled:O.isLinked,type:"checkbox"},null,8,Rn),[[s.vModelCheckbox,t.value]])]),start:s.withCtx(()=>[s.createVNode(s.unref(x.VEntityField),null,{description:s.withCtx(()=>[s.createVNode(Xn,{"display-ext":!1,"file-name":O.displayName||"",width:8,height:8},null,8,["file-name"])]),_:2},1024),s.createVNode(s.unref(x.VEntityField),{title:O.displayName||"",description:O.key||""},null,8,["title","description"])]),end:s.withCtx(()=>[s.createVNode(s.unref(x.VEntityField),null,{description:s.withCtx(()=>[s.createVNode(s.unref(x.VTag),{theme:O.isLinked?"default":"primary"},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(O.isLinked?"\u5DF2\u5173\u8054":"\u672A\u5173\u8054"),1)]),_:2},1032,["theme"])]),_:2},1024),s.createVNode(s.unref(x.VEntityField),null,{description:s.withCtx(()=>[s.createVNode(s.unref(x.VButton),{disabled:O.isLinked||!1,onClick:Xe=>Jn(O)},{default:s.withCtx(()=>[s.createTextVNode(" \u5173\u8054 ")]),_:2},1032,["disabled","onClick"])]),_:2},1024)]),_:2},1032,["is-selected"])]))),128))])]),_:1})):(s.openBlock(),s.createBlock(s.Transition,{key:1,appear:"",name:"fade"},{default:s.withCtx(()=>[s.createVNode(s.unref(x.VEmpty),{message:"\u7A7A\u7A7A\u5982\u4E5F",title:s.unref(T)},null,8,["title"])]),_:1}))]}),_:1})]),s.createVNode(s.unref(x.VModal),{visible:h.value,fullscreen:!1,title:"\u5173\u8054\u7ED3\u679C",width:500,"mount-to-body":!0,onClose:We},{footer:s.withCtx(()=>[s.createVNode(s.unref(x.VSpace),null,{default:s.withCtx(()=>[s.createVNode(s.unref(x.VButton),{loading:u.value,type:"primary",onClick:We},{default:s.withCtx(()=>[s.createTextVNode(" \u786E\u5B9A ")]),_:1},8,["loading"])]),_:1})]),default:s.withCtx(()=>[s.createElementVNode("div",Un,[s.createTextVNode(s.toDisplayString(p.value)+" ",1),w.value.length!=0?(s.openBlock(),s.createElementBlock("table",Hn,[Mn,(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(w.value,C=>(s.openBlock(),s.createElementBlock("tr",{key:C.objectKey},[s.createElementVNode("th",In,s.toDisplayString(C.objectKey),1),s.createElementVNode("th",zn,s.toDisplayString(C.message),1)]))),128))])):s.createCommentVNode("",!0)])]),_:1},8,["visible"])],64)}}});return Ge.definePlugin({components:{},routes:[],extensionPoints:{"plugin:self:tabs:create":()=>[{id:"s3-link",label:"\u5173\u8054S3\u6587\u4EF6",component:s.markRaw(qn),permissions:["plugin:s3os:link"]}]}})}(HaloConsoleShared,Vue,HaloComponents); diff --git a/src/main/resources/extensions/s3os-role-template.yaml b/src/main/resources/extensions/s3os-role-template.yaml new file mode 100644 index 0000000..b833d2b --- /dev/null +++ b/src/main/resources/extensions/s3os-role-template.yaml @@ -0,0 +1,23 @@ +apiVersion: v1alpha1 +kind: "Role" +metadata: + name: role-template-s3os-link + labels: + halo.run/role-template: "true" + annotations: + rbac.authorization.halo.run/dependencies: | + [ "role-template-manage-attachments", "role-template-view-plugins" ] + rbac.authorization.halo.run/module: "S3 Attachments Management" + rbac.authorization.halo.run/display-name: "S3 Link" + rbac.authorization.halo.run/ui-permissions: | + ["plugin:s3os:link"] +rules: + - apiGroups: [ "s3os.halo.run" ] + resources: [ "policies" ] + resourceNames: [ "s3" ] + verbs: [ "get", "list" ] + - apiGroups: [ "s3os.halo.run" ] + resources: [ "objects" ] + verbs: [ "get", "list" ] + - nonResourceURLs: ["/apis/s3os.halo.run/v1alpha1/attachments/link"] + verbs: [ "create" ]