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

//# sourceMappingURL=FileHistoryPage-react19.78a465350796c2b681c5.js.map