PageSourceSearch

https://aac4all.org/build/assets/vendor-Cv9jbyNW.js

js aac4all.org collected 2026-10-05 21:51:34 UTC 5,348 bytes, 1 lines download raw bytes

1import{C as m}from"./vendor-PsfSDRsN.js";import{n as l,M as i,ai as u,fU as p,bP as h,W as f,I as v,Y as g,ey as n,bR as b,S as y,bT as c,fV as C,fW as _,fX as F,fY as R,l as I,e0 as D,a as d,b7 as T,F as a,eA as E}from"./app-CIjA8Id4.js";import{A as S}from"./vendor-COpiQ4l5.js";import{R as A}from"./vendor-cIB5U-dI.js";import"./vendor-BSVKvc99.js";import"./vendor-CXell45K.js";const P={name:"StatsActionComponent",components:{ChartComponent:m,CircularProgress:f,ActionCardLayout:S,GenericForm:h},mixins:[p],props:{resource:{type:A,default:void 0},action:{required:!0,type:u},model:{default:void 0,type:i}},data(){return{loading:!0,errored:!1,paramsForm:void 0,params:{},records:[],previousRecords:[]}},computed:{periodKey(){return this.params.period},previousPeriod(){return this.computePeriod(this.period.after.subtract(1,this.period.granularity))},eventsNames(){return this.paramsForm.field("event").attributes.items.filter(e=>this.params.event?e.id===(this.params.event instanceof i?this.params.event.id:this.params.event):!0).map(e=>e.name).join("/").toLowerCase()},chartData(){const e=(t,s,r,o={})=>({label:t,data:s,borderColor:r,pointBorderColor:"rgba(0, 0, 0, 0)",pointBackgroun
1dColor:"rgba(0, 0, 0, 0)",pointHoverBackgroundColor:r,pointHoverBorderColor:r,...o});return{labels:this.records.map(t=>t.date.format(this.periodDateFormat)),datasets:[e(this.$t("resources.common.actions.stats.currentPeriod"),this.records.map(t=>t.count),this.$vuetify.theme.currentTheme.primary),e(this.$t("resources.common.actions.stats.previousPeriod"),this.previousRecords.map(t=>t.count),this.$vuetify.theme.currentTheme.accent,{borderDash:[3,5],borderWidth:2})]}},chartOptions(){return{legend:{onClick:e=>e.stopPropagation()},tooltips:{mode:"index",intersect:!1,callbacks:{title:e=>{var o;const t=e[0].value,s=(o=e[1])==null?void 0:o.value;if(s===void 0||s==="0")return"—";const r=Math.round((t-s)/s*100);return r===0?"0%":r>0?`+ ${r}%`:`- ${Math.abs(r)}%`},label:({datasetIndex:e,index:t,value:s})=>{const r=e===0?this.resolveDisplayedDateFromIndex(this.records,t):this.resolveDisplayedDateFromIndex(this.previousRecords,t);return this.$t("resources.common.actions.stats.statsLabel",{date:r,value:s,events:this.eventsNames})}}}}},debouncedFetchRecords(){return E(this.fetchRecords,250)},resourceTypesItems(){const e=["app-pages","calendar-events","blog-posts"];return a.ORGANIZATIONS&&e.unshift("organizations"),a.ARTICLES&&e.push("articles"),a.FORUM&&e.push("forum-subjects"),a.REPOSITORY&&e.push("repository-items"),a.LR_TRAINING_RESOURCES&&e.push("training-resources","training-resource-requests"),a.OPEN_BADGES&&e.push("open-badges","open-badge-assertions"),a.CONTACTS&&e.push("light-user-forms"),a.ADVANCED_FORMS&&e.push("forms"),e.map(t=>({id:t,name:this.$t(`likable.likableTypes.${t}`)}))}},mounted(){this.paramsForm=new b().fields(this.computePeriodSelect().prependInnerIcon(y).sm(6).md(3).xl(2).doesNotEndLine(),new c("event",C).totallyHidden(!!this.action.options.restrictedEvent).prependInnerIcon(_).label(this.$t("resources.common.actions.stats.event")).chips(!1).clearable().value(this.action.options.restrictedEvent||F).sm(6).md(3).xl(2).doesNotEndLine(),new c("origin",R).prependInnerIcon(I).label(this.$t("resources.common.actions.stats.origin")).chips(!1).clearable().sm(6).md(3).xl(2).doesNotEndLine(),new D("resourceType").totallyHidden(!d()).label(this.$t("resources.common.actions.stats.resourceType")).items(this.resourceTypesItems).value(this.model?this.model.constructor.pluralType:void 0).clearable().returnObject(!1).sm(6).md(3).xl(2).doesNotEndLine(),new T("resourceId").totallyHidden(!d()).when(e=>!!e.getValue("resourceType")).label(this.$t("resources.common.actions.stats.resourceId")).value(this.model?this.model.id:"").clearable().sm(6).md(3).xl(2).doesNotEndLine())},methods:{handleParamsChange(e){this.loading=!0,this.params=e.getFilteredValues(),this.debouncedFetchRecords()},resolveDisplayedDateFromIndex(e,t){return e[t].date.format(this.periodDateFormat)},async fetchRecords(){this.loading=!0,this.errored=!1;let e,t;try{({records:e,previousRecords:t}=await this.fetchRecordsForPeriod(this.period))}catch{this.errored=!0,this.loading=!1;return}this.records=this.computeCompleteData(this.period,e),this.previousRecords=this.computeCompleteData(this.previousPeriod,t),this.loading=!1},async fetchRecordsForPeriod(e){return(await g.get(`/api/v1/services/stats/records/fetch/by-${e.granularity}`,{params:{withPrevious:"1",filters:{before:e.before.format("YYYY-MM-DD"),after:e.after.format("YYYY-MM-DD"),event:n(this.params.event,"id"),origin:n(this.params.origin,"id"),resourceType:this.params.resourceType,resourceId:this.params.resourceId}}})).data}}};var x=function(){var t=this,s=t._self._c;return s("action-card-layout",{attrs:{action:t.action}},[t.paramsForm?s("generic-form",{staticClass:"mb-3",attrs:{form:t.paramsForm},on:{change:t.handleParamsChange}}):t._e(),t.loading===!1&&t.errored===!1?s("chart-component",{attrs:{"chart-data":t.chartData,"chart-options":t.chartOptions,"chart-type":"line","chart-style":"max-height: 300px"}}):s(v,{staticStyle:{height:"300px"},attrs:{"align-center":"","justify-center":""}},[t.loading?s("circular-progress"):s("span",[t._v(" "+t._s(t.$t("resources.common.actions.stats.noData"))+" ")])],1)],1)},N=[],$=l(P,x,N,!1,null,"219dc79a");const k=$.exports;export{k as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.