"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9898],{93746(L,d,n){n.r(d),n.d(d,{default:()=>F,getAuthorProfileUrl:()=>S});var t=n(74848),h=n(29189),R=n(54148),a=n(52358),E=n(58807),f=n(74144),g=n(45415),T=n(91660),v=n(68763),c=n(10470),$=n(59197),x=n(85678),y=n(5246),A=n(81428),C=n(57440),m=n(21286),I=n(1365),P=n(1172);function j(r){return!!r&&new Set(["github","githubEnterprise","gitlab","bitbucket"]).has(r)}function F(){const r=(0,R.g)(),e=r.name??"",i=r["*"]??"",[u]=(0,A.z)(),l=u.get("repo_type"),s=!j(l),o=(0,x.c2)({name:e}),p=(0,I.LO)(o.data?.spec)?.url,U=(0,x.$j)(s?h.hT:{name:e,path:i}),M=o.isError&&(0,C.E)(o.error)||s,N=s?(0,a.t)("provisioning.file-history-page.history-not-supported","File history is not supported for this repository"):(0,a.t)("provisioning.file-history-page.repository-not-found","Repository not found");return(0,t.jsx)(y.Y,{navId:"provisioning",pageNav:{text:`History: ${i}`,subTitle:o.data?.spec?.title??"Repository"},children:(0,t.jsx)(y.Y.Contents,{isLoading:!1,children:M?(0,t.jsxs)(E.p,{message:N,variant:"not-found",children:[(0,t.jsx)(f.E,{element:"p",children:l!=="git"&&(0,t.jsx)(a.x6,{i18nKey:"provisioning.file-history-page.repository-config-exists-configuration",children:"Make sure the repository config exists in the configuration file."})}),(0,t.jsx)(g.Y,{href:m.mL,children:(0,t.jsx)(a.x6,{i18nKey:"provisioning.file-history-page.back-to-repositories",children:"Back to repositories"})})]}):(0,t.jsx)("div",{children:U.data?(0,t.jsx)(H,{history:U.data,path:i,repo:e,repoType:l??void 0,repoUrl:p}):(0,t.jsx)(T.y,{})})})})}function H({history:r,path:e,repo:i,repoType:u,repoUrl:l}){return r.items?(0,t.jsx)(v.B,{direction:"column",children:r.items.map(s=>(0,t.jsxs)(c.Z,{noMargin:!0,href:`${m.mL}/${encodeURIComponent(i)}/file/${e}?${new URLSearchParams({ref:s.ref}).toString()}`,children:[(0,t.jsx)(c.Z.Heading,{children:s.message}),(0,t.jsx)(c.Z.Meta,{children:(0,t.jsx)("span",{children:(0,P.E)(s.createdAt)})}),(0,t.jsx)(c.Z.Description,{children:(0,t.jsx)(v.B,{children:s.authors.map(o=>{const p=S(u,o.username,l);return(0,t.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[o.avatarURL&&(0,t.jsx)($.n,{userView:{user:{name:o.name,avatarUrl:o.avatarURL},lastActiveAt:new Date().toISOString()},showTooltip:!1}),p?(0,t.jsx)(g.Y,{href:p,external:!0,children:o.name}):(0,t.jsx)(f.E,{children:o.name})]},o.username)})})})]},s.ref))}):(0,t.jsx)(a.x6,{i18nKey:"provisioning.history-view.not-found",children:"Not found"})}function S(r,e,i){if(!(!i||!j(r)))try{return`${new URL(i).origin}/${encodeURIComponent(e)}`}catch{return}}},1172(L,d,n){n.d(d,{E:()=>t});function t(h){return h?new Date(h).toLocaleString():"N/A"}}}]);

//# sourceMappingURL=FileHistoryPage.ed6d55ec6a677ad09dd8.js.map