Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/settings/lib/SetupChecks/TaskProcessingSuccessRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function run(): SetupResult {
if ($taskCount === 0) {
return SetupResult::success(
$this->l10n->n(
'No scheduled tasks in the last day.',
'No scheduled tasks in the last %n day.',
'No scheduled tasks in the last %n days.',
$lastNDays
)
Expand All @@ -71,7 +71,7 @@ public function run(): SetupResult {
if (($failedCount / $taskCount) < self::MAX_FAILURE_PERCENTAGE) {
return SetupResult::success(
$this->l10n->n(
'Most tasks were successful in the last day.',
'Most tasks were successful in the last %n day.',
'Most tasks were successful in the last %n days.',
$lastNDays
)
Expand Down
4 changes: 2 additions & 2 deletions apps/systemtags/src/components/SystemTagPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export default defineComponent({
if (this.toAdd.length === 1 && this.toRemove.length === 1) {
return n(
'systemtags',
'{tag1} will be set and {tag2} will be removed from 1 file.',
'{tag1} will be set and {tag2} will be removed from {count} file.',
'{tag1} will be set and {tag2} will be removed from {count} files.',
this.nodes.length,
{
Expand Down Expand Up @@ -317,7 +317,7 @@ export default defineComponent({

const removeStringSingular = n(
'systemtags',
'{tag} will be removed from 1 file.',
'{tag} will be removed from {count} file.',
'{tag} will be removed from {count} files.',
this.nodes.length,
{
Expand Down
2 changes: 2 additions & 0 deletions dist/SystemTagPicker-CaLZnZms.chunk.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import{f as R,a as q,d as Q}from"./index-C6ey-Mhx.chunk.mjs";import{a as _}from"./index-DL1yHC1K-orb-zzee.chunk.mjs";import{_ as A,l as J}from"./public-C1mLBHT3.chunk.mjs";import{t as f,g as L,e as K,p as W,a as k}from"./translation-DoG5ZELJ-C5oC8Tcn.chunk.mjs";import{N as X}from"./logger-D3RVzcfQ-B261d025.chunk.mjs";import{N as Y}from"./NcCheckboxRadioSwitch-D8Dfv4iw-B_doZ1-m.chunk.mjs";import{P as tt,N as et}from"./Plus-Dpju2rIw.chunk.mjs";import st from"./index-BWDoVtMf.chunk.mjs";import{N as at}from"./index-BRuD4Qrz.chunk.mjs";import{N as it}from"./NcEmptyContent-CGAPqk4S-q4HLj68a.chunk.mjs";import{N as ot}from"./TrashCanOutline-CW4_EEhq.chunk.mjs";import{N as lt}from"./mdi-Ci0zJ0QG.chunk.mjs";import{_ as nt}from"./NcTextField.vue_vue_type_script_setup_true_lang-BQHjkK8r-Dv0_ThWG.chunk.mjs";import{o as a,f as d,g,t as p,h as C,m as w,b as rt,r as c,c as h,w as m,F as E,k as u,B as ct,Q as dt,j as N,L as mt,M as gt,y as ht}from"./Web-ByHSuvRG.chunk.mjs";import{P as pt}from"./PencilOutline-DJX4SP_q.chunk.mjs";import{l as S,g as O,s as x,e as I,h as z,c as ut,i as yt,f as ft,u as Ct}from"./api-CZO4veWo.chunk.mjs";import{e as bt,i as kt,a as Nt}from"./systemtags-init.mjs";import"./createElementId-DhjFt1I9-CZ2eH1SD.chunk.mjs";import"./NcModal-DUWLRm_F-C0gD58QY.chunk.mjs";import"./colors-BDeMBgfq-D1xNHBAd.chunk.mjs";import"./NcInputField-B1bGxYHt-DVZQKody.chunk.mjs";import"./index-D-iKxf2E.chunk.mjs";import"./util-djQ-4xJ5.chunk.mjs";import"./index-BTFugZfg.chunk.mjs";import"./NcPasswordField-Be5_qcfm-DrwSQ-mu.chunk.mjs";import"./dav-sq7XGhQT.chunk.mjs";import"./index-CI-5vlTq.chunk.mjs";import"./externalStorageUtils-CpkXDsx2.chunk.mjs";import"./index-Cza7fYcZ.chunk.mjs";const At={name:"CheckCircleIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},vt=["aria-hidden","aria-label"],wt=["fill","width","height"],Tt={d:"M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M10 17L5 12L6.41 10.59L10 14.17L17.59 6.58L19 8L10 17Z"},_t={key:0};function Lt(t,s,e,o,l,n){return a(),d("span",w(t.$attrs,{"aria-hidden":e.title?null:"true","aria-label":e.title,class:"material-design-icon check-circle-icon",role:"img",onClick:s[0]||(s[0]=i=>t.$emit("click",i))}),[(a(),d("svg",{fill:e.fillColor,class:"material-design-icon__svg",width:e.size,height:e.size,viewBox:"0 0 24 24"},[g("path",Tt,[e.title?(a(),d("title",_t,p(e.title),1)):C("",!0)])],8,wt))],16,vt)}const St=A(At,[["render",Lt]]),It={name:"CircleIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},$t=["aria-hidden","aria-label"],Rt=["fill","width","height"],Et={d:"M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"},Ot={key:0};function xt(t,s,e,o,l,n){return a(),d("span",w(t.$attrs,{"aria-hidden":e.title?null:"true","aria-label":e.title,class:"material-design-icon circle-icon",role:"img",onClick:s[0]||(s[0]=i=>t.$emit("click",i))}),[(a(),d("svg",{fill:e.fillColor,class:"material-design-icon__svg",width:e.size,height:e.size,viewBox:"0 0 24 24"},[g("path",Et,[e.title?(a(),d("title",Ot,p(e.title),1)):C("",!0)])],8,Rt))],16,$t)}const zt=A(It,[["render",xt]]),Pt={name:"CircleOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Mt=["aria-hidden","aria-label"],Vt=["fill","width","height"],Bt={d:"M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"},Ut={key:0};function Dt(t,s,e,o,l,n){return a(),d("span",w(t.$attrs,{"aria-hidden":e.title?null:"true","aria-label":e.title,class:"material-design-icon circle-outline-icon",role:"img",onClick:s[0]||(s[0]=i=>t.$emit("click",i))}),[(a(),d("svg",{fill:e.fillColor,class:"material-design-icon__svg",width:e.size,height:e.size,viewBox:"0 0 24 24"},[g("path",Bt,[e.title?(a(),d("title",Ut,p(e.title),1)):C("",!0)])],8,Vt))],16,Mt)}const Gt=A(Pt,[["render",Dt]]),jt={name:"TagOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ft=["aria-hidden","aria-label"],Ht=["fill","width","height"],Zt={d:"M21.41 11.58L12.41 2.58A2 2 0 0 0 11 2H4A2 2 0 0 0 2 4V11A2 2 0 0 0 2.59 12.42L11.59 21.42A2 2 0 0 0 13 22A2 2 0 0 0 14.41 21.41L21.41 14.41A2 2 0 0 0 22 13A2 2 0 0 0 21.41 11.58M13 20L4 11V4H11L20 13M6.5 5A1.5 1.5 0 1 1 5 6.5A1.5 1.5 0 0 1 6.5 5Z"},qt={key:0};function Qt(t,s,e,o,l,n){return a(),d("span",w(t.$attrs,{"aria-hidden":e.title?null:"true","aria-label":e.title,class:"material-design-icon tag-outline-icon",role:"img",onClick:s[0]||(s[0]=i=>t.$emit("click",i))}),[(a(),d("svg",{fill:e.fillColor,class:"material-design-icon__svg",width:e.size,height:e.size,viewBox:"0 0 24 24"},[g("path",Zt,[e.title?(a(),d("title",qt,p(e.title),1)):C("",!0)])],8,Ht))],16,Ft)}const Jt=A(jt,[["render",Qt]]),Kt=Q(Ct,500),Wt=getComputedStyle(document.body).getPropertyValue("--color-main-background").replace("#","")||(Nt()?"000000":"ffffff");var P=(t=>(t.BASE="base",t.LOADING="loading",t.CREATING_TAG="creating-tag",t.DONE="done",t))(P||{});const Xt=J("systemtags","restrictSystemTagsCreationToAdmin",!1),Yt=rt({name:"SystemTagPicker",components:{CheckIcon:St,CircleIcon:zt,CircleOutlineIcon:Gt,NcButton:X,NcCheckboxRadioSwitch:Y,NcChip:et,NcColorPicker:st,NcDialog:at,NcEmptyContent:it,NcLoadingIcon:ot,NcNoteCard:lt,NcTextField:nt,PencilIcon:pt,PlusIcon:tt,TagIcon:Jt},props:{nodes:{type:Array,required:!0}},emits:{close(t){return t===null||typeof t=="boolean"}},setup(){return{emit:R,Status:P,t:f,canEditOrCreateTag:!Xt||q()?.isAdmin}},data(){return{status:"base",opened:!0,openedPicker:!1,input:"",tags:[],tagList:{},toAdd:[],toRemove:[]}},computed:{sortedTags(){return[...this.tags].sort((t,s)=>t.displayName.localeCompare(s.displayName,L(),{ignorePunctuation:!0}))},filteredTags(){return this.input.trim()===""?this.sortedTags:this.sortedTags.filter(t=>t.displayName.normalize().toLowerCase().includes(this.input.normalize().toLowerCase()))},hasChanges(){return this.toAdd.length>0||this.toRemove.length>0},canCreateTag(){return this.input.trim()!==""&&!this.tags.some(t=>t.displayName.trim().toLocaleLowerCase()===this.input.trim().toLocaleLowerCase())},statusMessage(){if(this.toAdd.length===0&&this.toRemove.length===0)return"";if(this.toAdd.length===1&&this.toRemove.length===1)return k("systemtags","{tag1} will be set and {tag2} will be removed from {count} file.","{tag1} will be set and {tag2} will be removed from {count} files.",this.nodes.length,{tag1:this.formatTagChip(this.toAdd[0]),tag2:this.formatTagChip(this.toRemove[0]),count:this.nodes.length},{escape:!1});const t=this.toAdd.map(this.formatTagChip),s=t.pop(),e=this.toRemove.map(this.formatTagChip),o=e.pop(),l=k("systemtags","{tag} will be set to 1 file.","{tag} will be set to {count} files.",this.nodes.length,{tag:s,count:this.nodes.length},{escape:!1}),n=k("systemtags","{tag} will be removed from {count} file.","{tag} will be removed from {count} files.",this.nodes.length,{tag:o,count:this.nodes.length},{escape:!1}),i=k("systemtags","{tags} and {lastTag} will be set to 1 file.","{tags} and {lastTag} will be set to {count} files.",this.nodes.length,{tags:t.join(", "),lastTag:s,count:this.nodes.length},{escape:!1}),y=k("systemtags","{tags} and {lastTag} will be removed from 1 file.","{tags} and {lastTag} will be removed from {count} files.",this.nodes.length,{tags:e.join(", "),lastTag:o,count:this.nodes.length},{escape:!1});return this.toAdd.length===1&&this.toRemove.length===0?l:this.toAdd.length===0&&this.toRemove.length===1?n:this.toAdd.length>1&&this.toRemove.length===0?i:this.toAdd.length===0&&this.toRemove.length>1?y:this.toAdd.length>1&&this.toRemove.length===1?`${i} ${n}`:this.toAdd.length===1&&this.toRemove.length>1?`${l} ${y}`:`${i} ${y}`}},beforeMount(){ft().then(t=>{this.tags=t}),this.tagList=this.nodes.reduce((t,s)=>((I(s)||[]).forEach(e=>{t[e]=(t[e]||0)+1}),t),{}),this.canEditOrCreateTag||S.debug("System tag creation is restricted to admins and the current user is not an admin")},methods:{formatTagChip(t){const s=this.$refs.chip.$el.cloneNode(!0);if(t.color){const e=this.tagListStyle(t);Object.entries(e).forEach(([o,l])=>{s.style.setProperty(o,l)})}return s.outerHTML.replace("%s",K(W.sanitize(t.displayName)))},formatTagName(t){return t.userVisible?t.userAssignable?t.displayName:f("systemtags","{displayName} (restricted)",{displayName:t.displayName}):f("systemtags","{displayName} (hidden)",{displayName:t.displayName})},onColorChange(t,s){t.color=s.replace("#",""),Kt(t)},isChecked(t){return t.displayName in this.tagList&&this.tagList[t.displayName]===this.nodes.length},isIndeterminate(t){return t.displayName in this.tagList&&this.tagList[t.displayName]!==0&&this.tagList[t.displayName]!==this.nodes.length},onCheckUpdate(t,s){s?(this.toAdd.push(t),this.toRemove=this.toRemove.filter(e=>e.id!==t.id),this.tagList[t.displayName]=this.nodes.length):(this.toRemove.push(t),this.toAdd=this.toAdd.filter(e=>e.id!==t.id),this.tagList[t.displayName]=0)},async onNewTag(){if(!this.canEditOrCreateTag){_(f("systemtags","Only admins can create new tags"));return}this.status="creating-tag";try{const t={displayName:this.input.trim(),userAssignable:!0,userVisible:!0,canAssign:!0},s=await ut(t),e=await yt(s);this.tags.push(e),this.input="",this.onCheckUpdate(e,!0),await this.$nextTick(),Array.isArray(this.$refs.tags)&&this.$refs.tags.find(o=>o.dataset.cySystemtagsPickerTag===s.toString())?.scrollIntoView({behavior:"instant",block:"center",inline:"center"})}catch(t){_(t?.message||f("systemtags","Failed to create tag"))}finally{this.status="base"}},async onSubmit(){this.status="loading",S.debug("Applying tags",{toAdd:this.toAdd,toRemove:this.toRemove});try{for(const s of this.toAdd){const{etag:e,objects:o}=await O(s,"files"),l=[...new Set([...o.map(n=>n.id).filter(Boolean),...this.nodes.map(n=>n.fileid).filter(Boolean)])];await x(s,"files",l.map(n=>({id:n,type:"files"})),e)}for(const s of this.toRemove){const{etag:e,objects:o}=await O(s,"files"),l=new Set(this.nodes.map(i=>i.fileid)),n=o.map(i=>i.id).filter((i,y,T)=>!l.has(i)&&T.indexOf(i)===y);await x(s,"files",n.map(i=>({id:i,type:"files"})),e)}}catch(s){S.error("Failed to apply tags",{error:s}),_(f("systemtags","Failed to apply tags changes")),this.status="base";return}const t=[];this.toAdd.forEach(s=>{this.nodes.forEach(e=>{const o=[...I(e)||[],s.displayName].sort((l,n)=>l.localeCompare(n,L(),{ignorePunctuation:!0}));z(e,o),t.push(e)})}),this.toRemove.forEach(s=>{this.nodes.forEach(e=>{const o=[...I(e)||[]].filter(l=>l!==s.displayName).sort((l,n)=>l.localeCompare(n,L(),{ignorePunctuation:!0}));z(e,o),t.push(e)})}),t.forEach(s=>R("systemtags:node:updated",s)),this.status="done",setTimeout(()=>{this.opened=!1,this.$emit("close",!0)},2e3)},onCancel(){this.opened=!1,this.$emit("close",null)},tagListStyle(t){if(!t.color)return{"--color-circle-icon":"var(--color-text-maxcontrast)"};const s=bt(`#${t.color}`,`#${Wt}`),e=kt(s)?"#000000":"#ffffff";return{"--color-circle-icon":"var(--color-primary-element)","--color-primary":s,"--color-primary-text":e,"--color-primary-element":s,"--color-primary-element-text":e}}}}),te={class:"systemtags-picker__input"},ee={class:"systemtags-picker__tags","data-cy-systemtags-picker-tags":""},se=["data-cy-systemtags-picker-tag"],ae={class:"systemtags-picker__tag-create-subline"},ie={class:"systemtags-picker__note"},oe=["innerHTML"];function le(t,s,e,o,l,n){const i=c("NcLoadingIcon"),y=c("CheckIcon"),T=c("NcEmptyContent"),M=c("TagIcon"),V=c("NcTextField"),B=c("NcCheckboxRadioSwitch"),U=c("CircleIcon"),D=c("CircleOutlineIcon"),G=c("PencilIcon"),v=c("NcButton"),j=c("NcColorPicker"),F=c("PlusIcon"),$=c("NcNoteCard"),H=c("NcChip"),Z=c("NcDialog");return a(),h(Z,{"data-cy-systemtags-picker":"",noClose:t.status===t.Status.LOADING,name:t.t("systemtags","Manage tags"),open:t.opened,class:ht(["systemtags-picker--"+t.status,"systemtags-picker"]),closeOnClickOutside:"",outTransition:"","onUpdate:open":t.onCancel},{actions:m(()=>[u(v,{disabled:t.status!==t.Status.BASE,variant:"tertiary","data-cy-systemtags-picker-button-cancel":"",onClick:t.onCancel},{default:m(()=>[N(p(t.t("systemtags","Cancel")),1)]),_:1},8,["disabled","onClick"]),u(v,{disabled:!t.hasChanges||t.status!==t.Status.BASE,"data-cy-systemtags-picker-button-submit":"",onClick:t.onSubmit},{default:m(()=>[N(p(t.t("systemtags","Apply")),1)]),_:1},8,["disabled","onClick"])]),default:m(()=>[t.status===t.Status.LOADING||t.status===t.Status.DONE?(a(),h(T,{key:0,name:t.t("systemtags","Applying tags changes…")},{icon:m(()=>[t.status===t.Status.LOADING?(a(),h(i,{key:0})):(a(),h(y,{key:1,fillColor:"var(--color-border-success)"}))]),_:1},8,["name"])):(a(),d(E,{key:1},[g("div",te,[u(V,{modelValue:t.input,"onUpdate:modelValue":s[0]||(s[0]=r=>t.input=r),label:t.canEditOrCreateTag?t.t("systemtags","Search or create tag"):t.t("systemtags","Search tag"),"data-cy-systemtags-picker-input":""},{default:m(()=>[u(M,{size:20})]),_:1},8,["modelValue","label"])]),g("ul",ee,[(a(!0),d(E,null,ct(t.filteredTags,r=>(a(),d("li",{key:r.id,ref_for:!0,ref:"tags","data-cy-systemtags-picker-tag":r.id,style:dt(t.tagListStyle(r)),class:"systemtags-picker__tag"},[u(B,{modelValue:t.isChecked(r),disabled:!r.canAssign,indeterminate:t.isIndeterminate(r),label:r.displayName,class:"systemtags-picker__tag-checkbox","onUpdate:modelValue":b=>t.onCheckUpdate(r,b)},{default:m(()=>[N(p(t.formatTagName(r)),1)]),_:2},1032,["modelValue","disabled","indeterminate","label","onUpdate:modelValue"]),t.canEditOrCreateTag?(a(),h(j,{key:0,"data-cy-systemtags-picker-tag-color":r.id,modelValue:`#${r.color||"000000"}`,shown:t.openedPicker===r.id,class:"systemtags-picker__tag-color","onUpdate:shown":b=>t.openedPicker=b?r.id:!1,onSubmit:b=>t.onColorChange(r,b)},{default:m(()=>[u(v,{"aria-label":t.t("systemtags","Change tag color"),variant:"tertiary"},{icon:m(()=>[r.color?(a(),h(U,{key:0,size:24,fillColor:"var(--color-circle-icon)",class:"button-color-circle"})):(a(),h(D,{key:1,size:24,fillColor:"var(--color-circle-icon)",class:"button-color-empty"})),u(G,{class:"button-color-pencil"})]),_:2},1032,["aria-label"])]),_:2},1032,["data-cy-systemtags-picker-tag-color","modelValue","shown","onUpdate:shown","onSubmit"])):C("",!0)],12,se))),128)),g("li",null,[t.canEditOrCreateTag&&t.canCreateTag?(a(),h(v,{key:0,disabled:t.status===t.Status.CREATING_TAG,alignment:"start",class:"systemtags-picker__tag-create",type:"submit",variant:"tertiary","data-cy-systemtags-picker-button-create":"",onClick:t.onNewTag},{icon:m(()=>[u(F)]),default:m(()=>[N(p(t.input.trim()),1),s[1]||(s[1]=g("br",null,null,-1)),g("span",ae,p(t.t("systemtags","Create new tag")),1)]),_:1},8,["disabled","onClick"])):C("",!0)])]),g("div",ie,[t.hasChanges?(a(),h($,{key:1,type:"info"},{default:m(()=>[g("span",{innerHTML:t.statusMessage},null,8,oe)]),_:1})):(a(),h($,{key:0,type:"info"},{default:m(()=>[N(p(t.t("systemtags","Choose tags for the selected files")),1)]),_:1}))])],64)),mt(g("div",null,[u(H,{ref:"chip",text:"%s",noClose:"",variant:"primary"},null,512)],512),[[gt,!1]])]),_:1},8,["noClose","name","open","class","onUpdate:open"])}const Pe=A(Yt,[["render",le],["__scopeId","data-v-1f458e10"]]);export{Pe as default};
//# sourceMappingURL=SystemTagPicker-CaLZnZms.chunk.mjs.map
1 change: 1 addition & 0 deletions dist/SystemTagPicker-CaLZnZms.chunk.mjs.map

Large diffs are not rendered by default.

Loading
Loading