"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[373],{87827:(e,t,a)=>{a.r(t),a.d(t,{default:()=>D});var l=a(78580),n=a.n(l),r=a(55867),o=a(93185),s=a(67294),i=a(91877),d=a(40768),c=a(34858),u=a(19259),m=a(86074),b=a(18782),h=a(61337),g=a(14114),Z=a(70163),p=a(58593),_=a(34581),f=a(73727),y=a(48273),S=a(60331),T=a(51995),k=a(4715),C=a(83862),w=a(21742),v=a(11965);const A=function(e){let{tag:t,hasPerm:a,bulkSelectEnabled:l,tagFilter:n,refreshData:c,userId:m,addDangerToast:b,addSuccessToast:h,showThumbnails:g}=e;const p=a("can_write"),_=(0,T.Fg)(),S=(0,v.tZ)(C.v,null,p&&(0,v.tZ)(C.v.Item,null,(0,v.tZ)(u.Z,{title:(0,r.t)("Please confirm"),description:(0,v.tZ)(s.Fragment,null,(0,r.t)("Are you sure you want to delete")," ",(0,v.tZ)("b",null,t.name),"?"),onConfirm:()=>(e=>{(0,y.Qz)([e],h,b),c()})(t)},(e=>(0,v.tZ)("div",{role:"button",tabIndex:0,className:"action-button",onClick:e},(0,v.tZ)(Z.Z.Trash,{iconSize:"l"})," ",(0,r.t)("Delete"))))));return(0,v.tZ)(d.ZB,null,(0,v.tZ)(w.Z,{title:t.name,cover:(0,i.c)(o.T.THUMBNAILS)&&g?null:(0,v.tZ)(s.Fragment,null),url:void 0,linkComponent:f.rU,imgFallbackURL:"/static/assets/images/dashboard-card-fallback.svg",description:(0,r.t)("Modified %s",t.changed_on_delta_humanized),actions:(0,v.tZ)(w.Z.Actions,{onClick:e=>{e.stopPropagation(),e.preventDefault()}},(0,v.tZ)(k.Gj,{overlay:S},(0,v.tZ)(Z.Z.MoreVert,{iconColor:_.colors.grayscale.base})))}))},D=(0,g.ZP)((function(e){const{addDangerToast:t,addSuccessToast:a,user:{userId:l}}=e,{state:{loading:g,resourceCount:T,resourceCollection:k,bulkSelectEnabled:C},hasPerm:w,fetchData:D,toggleBulkSelect:z,refreshData:I}=(0,c.Yi)("tag",(0,r.t)("tag"),t),H=(0,h.OH)(null==l?void 0:l.toString(),null),M=w("can_write"),B=[{id:"changed_on_delta_humanized",desc:!0}];function F(e,t,a){(0,y.Qz)(e,t,a),I()}const N=(0,s.useMemo)((()=>[{Cell:e=>{let{row:{original:{name:t}}}=e;return(0,v.tZ)(S.Z,null,(0,v.tZ)(f.rU,{to:`/superset/all_entities/?tags=${t}`},t))},Header:(0,r.t)("Name"),accessor:"name"},{Cell:e=>{let{row:{original:{changed_on_delta_humanized:t}}}=e;return(0,v.tZ)("span",{className:"no-wrap"},t)},Header:(0,r.t)("Modified"),accessor:"changed_on_delta_humanized",size:"xl"},{Cell:e=>{let{row:{original:{created_by:t}}}=e;return t?(0,v.tZ)(_.Z,{users:[t]}):""},Header:(0,r.t)("Created by"),accessor:"created_by",disableSortBy:!0,size:"xl"},{Cell:e=>{let{row:{original:l}}=e;return(0,v.tZ)(d.eX,{className:"actions"},M&&(0,v.tZ)(u.Z,{title:(0,r.t)("Please confirm"),description:(0,v.tZ)(s.Fragment,null,(0,r.t)("Are you sure you want to delete")," ",(0,v.tZ)("b",null,l.dashboard_title),"?"),onConfirm:()=>F([l],a,t)},(e=>(0,v.tZ)(p.u,{id:"delete-action-tooltip",title:(0,r.t)("Delete"),placement:"bottom"},(0,v.tZ)("span",{role:"button",tabIndex:0,className:"action-button",onClick:e},(0,v.tZ)(Z.Z.Trash,null))))))},Header:(0,r.t)("Actions"),id:"actions",hidden:!M,disableSortBy:!0}]),[l,M,I,a,t]),L=(0,s.useMemo)((()=>[{Header:(0,r.t)("Created by"),id:"created_by",input:"select",operator:b.p.relationOneMany,unfilteredLabel:(0,r.t)("All"),fetchSelects:(0,d.tm)("tag","created_by",(0,d.v$)((e=>t((0,r.t)("An error occurred while fetching tag created by values: %s",e)))),e.user),paginate:!0},{Header:(0,r.t)("Search"),id:"name",input:"search",operator:b.p.contains}]),[t,e.user]),P=[{desc:!1,id:"name",label:(0,r.t)("Alphabetical"),value:"alphabetical"},{desc:!0,id:"changed_on_delta_humanized",label:(0,r.t)("Recently modified"),value:"recently_modified"},{desc:!1,id:"changed_on_delta_humanized",label:(0,r.t)("Least recently modified"),value:"least_recently_modified"}],E=(0,s.useCallback)((e=>(0,v.tZ)(A,{tag:e,hasPerm:w,bulkSelectEnabled:C,refreshData:I,showThumbnails:H?H.thumbnails:(0,i.c)(o.T.THUMBNAILS),userId:l,loading:g,addDangerToast:t,addSuccessToast:a})),[t,a,C,w,g,l,I,H]),U=[];return M&&U.push({name:(0,r.t)("Bulk select"),buttonStyle:"secondary","data-test":"bulk-select",onClick:z}),(0,v.tZ)(s.Fragment,null,(0,v.tZ)(m.Z,{name:(0,r.t)("Tags"),buttons:U}),(0,v.tZ)(u.Z,{title:(0,r.t)("Please confirm"),description:(0,r.t)("Are you sure you want to delete the selected tags?"),onConfirm:e=>F(e,a,t)},(e=>{const t=[];return M&&t.push({key:"delete",name:(0,r.t)("Delete"),type:"danger",onSelect:e}),(0,v.tZ)(s.Fragment,null,(0,v.tZ)(b.Z,{bulkActions:t,bulkSelectEnabled:C,cardSortSelectOptions:P,className:"dashboard-list-view",columns:N,count:T,data:k.filter((e=>{var t;return!n()(t=e.name).call(t,":")})),disableBulkSelect:z,fetchData:D,filters:L,initialSort:B,loading:g,pageSize:25,showThumbnails:H?H.thumbnails:(0,i.c)(o.T.THUMBNAILS),renderCard:E,defaultViewMode:(0,i.c)(o.T.LISTVIEWS_DEFAULT_CARD_VIEW)?"card":"table"}))})))}))}}]);
//# sourceMappingURL=268c371418ce55ed5a06.chunk.js.map