n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 7.4 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.13.4`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`532378a7-e09e-44da-bf9c-54600ea143ee`,e._sentryDebugIdIdentifier=`sentry-dbid-532378a7-e09e-44da-bf9c-54600ea143ee`)})()}catch{}import{o as e}from"./chunk-DxpFCn6T.js";import{$ as t,A as n,C as r,E as i,Ft as a,N as o,Sn as s,T as c,Wt as l,X as u,_ as d,_n as f,j as p,rt as m,w as h,yt as g}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{bt as _,xt as v}from"./_MapCache-CUJwh2qp.js";import{Nt as y,Qi as b,Ri as x,Rt as S,Yi as C,Zi as w,lt as T}from"./src-wni2AGA3.js";import{t as E}from"./_plugin-vue_export-helper-Dm3nT7Ps.js";import"./sanitize-html-my1ogl5v.js";import{As as D,Tr as ee,en as O,hr as k,ja as A,jr as j,r as M,vn as te}from"./users.store-BHWXXawf.js";import{n as ne,t as re}from"./col-DUeOzW-F.js";import{Ps as ie,h as ae,mo as N}from"./constants-CIP7tKq1.js";import"./merge-BqvKZ38d.js";import{N as P,r as F}from"./_baseOrderBy-CaKruttV.js";import"./dateformat-CYfyw486.js";import"./useDebounce-CTeIt-cH.js";import"./versions.store-CNV-esbv.js";import{t as I}from"./usePageRedirectionHelper-Dxb_B6-R.js";import{t as L}from"./apiKeys.store-CpIgHA9V.js";var R=E(o({__name:`ApiKeyCard`,props:{apiKey:{}},emits:[`edit`,`delete`],setup(e,{emit:o}){let u={EDIT:`edit`,DELETE:`delete`},d=[{label:`Edit`,value:u.EDIT},{label:`Delete`,value:u.DELETE}],m=_(),v=a(null),b=e,x=o;async function C(e){e===u.EDIT?x(`edit`,b.apiKey.id):e===u.DELETE&&x(`delete`,b.apiKey.id)}let T=e=>e.expiresAt?e.expiresAt<=Date.now()/1e3:!1,E=e=>{if(!e.expiresAt)return m.baseText(`settings.api.neverExpires`);if(T(e))return m.baseText(`settings.api.expired`);let t=N.fromSeconds(e.expiresAt).toFormat(`ccc, MMM d yyyy`);return m.baseText(`settings.api.expirationTime`,{interpolate:{time:t}})};return(a,o)=>(t(),h(l(y),{class:f(a.$style.cardLink),"data-test-id":`api-key-card`,onClick:o[0]||=e=>C(`edit`)},{header:g(()=>[r(`div`,null,[p(l(w),{tag:`h2`,bold:``,class:f(a.$style.cardHeading)},{default:g(()=>[n(s(e.apiKey.label),1)]),_:1},8,[`class`]),r(`div`,{class:f([a.$style.cardDescription])},[p(l(w),{color:T(e.apiKey)?`warning`:`text-light`,size:`small`},{default:g(()=>[r(`span`,null,s(E(e.apiKey)),1)]),_:1},8,[`color`])],2)]),e.apiKey.apiKey.includes(`*`)?(t(),i(`div`,{key:0,class:f(a.$style.cardApiKey)},[p(l(w),{color:`text-light`,size:`small`},{default:g(()=>[n(s(e.apiKey.apiKey),1)]),_:1})],2)):c(``,!0)]),append:g(()=>[r(`div`,{ref_key:`cardActions`,ref:v,class:f(a.$style.cardActions)},[p(l(S),{actions:d,theme:`dark`,onAction:C})],2)]),_:1},8,[`class`]))}}),[[`__cssModules`,{$style:{cardLink:`_cardLink_ec33a_125`,cardHeading:`_cardHeading_ec33a_135`,cardDescription:`_cardDescription_ec33a_142`,cardActions:`_cardActions_ec33a_149`,cardApiKey:`_cardApiKey_ec33a_158`}}]]),z=[`textContent`],B=[`textContent`],V={class:`mt-m text-right`},H=E(o({__name:`SettingsApiView`,setup(e){let o=D(),y=M(),S=k(),{showError:E,showMessage:ie}=ee(),{confirm:N}=j(),H=te(),U=_(),{goToUpgrade:W}=I(),G=O(),K=a(!1),q=L(),{getAndCacheApiKeys:oe,deleteApiKey:se,getApiKeyAvailableScopes:ce}=q,{apiKeysSortByCreationDate:J}=P(q),{isSwaggerUIEnabled:Y,publicApiPath:le,publicApiLatestVersion:X}=o,{baseUrl:ue}=F(),{isPublicApiEnabled:Z}=o,Q=a(``),$=async()=>{G.track(`User clicked create API key button`),y.openModalWithData({name:A,data:{mode:`new`}})};u(async()=>{H.set(U.baseText(`settings.api`)),Q.value=Y?`${ue}${le}/v${X}/docs`:`https://${ae}/api/api-reference/`,Z&&await fe()});function de(){W(`settings-n8n-api`,`upgrade-api`,`redirect`)}async function fe(){try{K.value=!0,await Promise.all([oe(),ce()])}catch(e){E(e,U.baseText(`settings.api.view.error`))}finally{K.value=!1}}async function pe(e){if(await N(U.baseText(`settings.api.delete.description`),U.baseText(`settings.api.delete.title`),{confirmButtonText:U.baseText(`settings.api.delete.button`),cancelButtonText:U.baseText(`generic.cancel`)})===`confirm`)try{await se(e),ie({title:U.baseText(`settings.api.delete.toast`),type:`success`})}catch(e){E(e,U.baseText(`settings.api.delete.error`))}finally{G.track(`User clicked delete API key button`)}}function me(e){y.openModalWithData({name:A,data:{mode:`edit`,activeId:e}})}return(e,a)=>(t(),i(`div`,{class:f(e.$style.container)},[r(`div`,{class:f(e.$style.header)},[p(l(C),{size:`2xlarge`},{default:g(()=>[n(s(l(U).baseText(`settings.api`)),1)]),_:1})],2),l(Z)&&l(J).length?(t(),i(`p`,{key:0,class:f(e.$style.topHint)},[p(l(w),null,{default:g(()=>[p(l(v),{keypath:`settings.api.view.info`,tag:`span`,scope:`global`},{apiAction:g(()=>[r(`a`,{"data-test-id":`api-docs-link`,href:`https://docs.n8n.io/api`,target:`_blank`,textContent:s(l(U).baseText(`settings.api.view.info.api`))},null,8,z)]),webhookAction:g(()=>[r(`a`,{"data-test-id":`webhook-docs-link`,href:`https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/`,target:`_blank`,textContent:s(l(U).baseText(`settings.api.view.info.webhook`))},null,8,B)]),_:1})]),_:1})],2)):c(``,!0),r(`div`,{class:f(e.$style.apiKeysContainer)},[l(J).length?(t(!0),i(d,{key:0},m(l(J),(n,r)=>(t(),h(l(ne),{key:n.id,gutter:10,class:f([{[e.$style.destinationItem]:r!==l(J).length-1}])},{default:g(()=>[p(l(re),null,{default:g(()=>[p(R,{"api-key":n,onDelete:pe,onEdit:me},null,8,[`api-key`])]),_:2},1024)]),_:2},1032,[`class`]))),128)):c(``,!0)],2),l(Z)&&l(J).length?(t(),i(`div`,{key:1,class:f(e.$style.BottomHint)},[p(l(w),{size:`small`,color:`text-light`},{default:g(()=>[n(s(l(U).baseText(`settings.api.view.${l(o).isSwaggerUIEnabled?`tryapi`:`more-details`}`)),1)]),_:1}),a[0]||=n(` `+s(` `)+` `,-1),l(Y)?(t(),h(l(T),{key:0,"data-test-id":`api-playground-link`,to:Q.value,"new-window":!0,size:`small`},{default:g(()=>[n(s(l(U).baseText(`settings.api.view.apiPlayground`)),1)]),_:1},8,[`to`])):(t(),h(l(T),{key:1,"data-test-id":`api-endpoint-docs-link`,to:Q.value,"new-window":!0,size:`small`},{default:g(()=>[n(s(l(U).baseText(`settings.api.view.external-docs`)),1)]),_:1},8,[`to`]))],2)):c(``,!0),r(`div`,V,[l(Z)&&l(J).length?(t(),h(l(b),{key:0,size:`large`,onClick:$},{default:g(()=>[n(s(l(U).baseText(`settings.api.create.button`)),1)]),_:1})):c(``,!0)]),!l(Z)&&l(S).userIsTrialing?(t(),h(l(x),{key:2,"data-test-id":`public-api-upgrade-cta`,heading:l(U).baseText(`settings.api.trial.upgradePlan.title`),description:l(U).baseText(`settings.api.trial.upgradePlan.description`),"button-text":l(U).baseText(`settings.api.trial.upgradePlan.cta`),"onClick:button":de},null,8,[`heading`,`description`,`button-text`])):c(``,!0),l(Z)&&!l(J).length?(t(),h(l(x),{key:3,"button-text":l(U).baseText(K.value?`settings.api.create.button.loading`:`settings.api.create.button`),description:l(U).baseText(`settings.api.create.description`),"onClick:button":$},null,8,[`button-text`,`description`])):c(``,!0)],2))}}),[[`__cssModules`,{$style:{header:`_header_g9f1h_125`,card:`_card_g9f1h_135`,destinationItem:`_destinationItem_g9f1h_139`,delete:`_delete_g9f1h_143`,topHint:`_topHint_g9f1h_150`,BottomHint:`_BottomHint_g9f1h_161`,apiKeysContainer:`_apiKeysContainer_g9f1h_166`}}]]);export{H as default};
//# sourceMappingURL=SettingsApiView-Ui_nI3gs.js.map