12 |
- /*! third party licenses: dist/vendor.LICENSE.txt */
- import{F as c,ai as u,al as d,b_ as o,cc as h,bR as a,bZ as s,aV as i}from"./core-common.mjs";import{n as l,a3 as m,a4 as p}from"./chunks/icons-TElqpmA8.mjs";const _={name:"OAuthItem",components:{Delete:m,NcButton:c,EyeOutline:p},props:{client:{type:Object,required:!0}},data(){return{id:this.client.id,name:this.client.name,redirectUri:this.client.redirectUri,clientId:this.client.clientId,clientSecret:this.client.clientSecret,renderSecret:!1}},computed:{renderedSecret(){return this.renderSecret?this.clientSecret:"****"},toggleAriaLabel(){return this.renderSecret?t("oauth2","Hide client secret"):t("oauth2","Show client secret")}},methods:{toggleSecret(){this.renderSecret=!this.renderSecret}}};var C=function(){var e=this,n=e._self._c;return n("tr",[n("td",[e._v(e._s(e.name))]),n("td",[e._v(e._s(e.redirectUri))]),n("td",[n("code",[e._v(e._s(e.clientId))])]),n("td",[n("div",{staticClass:"action-secret"},[n("code",[e._v(e._s(e.renderedSecret))]),n("NcButton",{attrs:{type:"tertiary-no-background","aria-label":e.toggleAriaLabel},on:{click:e.toggleSecret},scopedSlots:e._u([{key:"icon",fn:function(){return[n("EyeOutline",{attrs:{size:20}})]},proxy:!0}])})],1)]),n("td",{staticClass:"action-column"},[n("NcButton",{attrs:{type:"tertiary-no-background","aria-label":e.t("oauth2","Delete")},on:{click:function(r){return e.$emit("delete",e.id)}},scopedSlots:e._u([{key:"icon",fn:function(){return[n("Delete",{attrs:{size:20,title:e.t("oauth2","Delete")}})]},proxy:!0}])})],1)])},v=[],f=l(_,C,v,!1,null,"05e965c1");const y=f.exports,g={name:"App",components:{OAuthItem:y,NcSettingsSection:u,NcButton:c,NcTextField:d},props:{clients:{type:Array,required:!0}},data(){return{newClient:{name:"",redirectUri:"",errorMsg:"",error:!1},oauthDocLink:o("oauth2","oauth2-doc-link")}},computed:{instanceName(){return h().theming.name}},methods:{deleteClient(e){a.delete(s("apps/oauth2/clients/{id}",{id:e})).then(n=>{this.clients=this.clients.filter(r=>r.id!==e)})},addClient(){this.newClient.error=!1,a.post(s("apps/oauth2/clients"),{name:this.newClient.name,redirectUri:this.newClient.redirectUri}).then(e=>{this.clients.push(e.data),this.newClient.name="",this.newClient.redirectUri=""}).catch(e=>{this.newClient.error=!0,this.newClient.errorMsg=e.response.data.message})}}};var S=function(){var e=this,n=e._self._c;return n("NcSettingsSection",{attrs:{name:e.t("oauth2","OAuth 2.0 clients"),description:e.t("oauth2","OAuth 2.0 allows external services to request access to {instanceName}.",{instanceName:e.instanceName}),"doc-url":e.oauthDocLink}},[e.clients.length>0?n("table",{staticClass:"grid"},[n("thead",[n("tr",[n("th",[e._v(" "+e._s(e.t("oauth2","Name"))+" ")]),n("th",[e._v(" "+e._s(e.t("oauth2","Redirection URI"))+" ")]),n("th",[e._v(" "+e._s(e.t("oauth2","Client Identifier"))+" ")]),n("th",[e._v(" "+e._s(e.t("oauth2","Secret key"))+" ")]),n("th",[e._v(" "+e._s(e.t("oauth2","Delete client"))+" ")])])]),n("tbody",e._l(e.clients,function(r){return n("OAuthItem",{key:r.id,attrs:{client:r},on:{delete:e.deleteClient}})}),1)]):e._e(),n("br"),n("h3",[e._v(e._s(e.t("oauth2","Add client")))]),e.newClient.error?n("span",{staticClass:"msg error"},[e._v(e._s(e.newClient.errorMsg))]):e._e(),n("form",{staticClass:"oauth2-form",on:{submit:function(r){return r.preventDefault(),e.addClient.apply(null,arguments)}}},[n("NcTextField",{staticClass:"oauth2-form--input",attrs:{id:"name",value:e.newClient.name,type:"text",name:"name",label:e.t("oauth2","Name"),placeholder:e.t("oauth2","Name")},on:{"update:value":function(r){return e.$set(e.newClient,"name",r)}}}),n("NcTextField",{staticClass:"oauth2-form--input",attrs:{id:"redirectUri",value:e.newClient.redirectUri,type:"url",name:"redirectUri",label:e.t("oauth2","Redirection URI"),placeholder:e.t("oauth2","Redirection URI")},on:{"update:value":function(r){return e.$set(e.newClient,"redirectUri",r)}}}),n("NcButton",{staticClass:"inline-button",attrs:{"native-type":"submit"}},[e._v(" "+e._s(e.t("oauth2","Add"))+" ")])],1)])},b=[],w=l(g,S,b,!1,null,"bf7e297e");const N=w.exports;i.prototype.t=t,i.prototype.OC=OC;const U=o("oauth2","clients"),k=i.extend(N),x=new k({propsData:{clients:U}});x.$mount("#oauth2");
|