diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f94f31..5536a19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.5.0](https://github.com/JeffBeltran/sanctum-tokens/compare/v1.4.0...v1.5.0) (2021-02-08) + + +### Features + +* add localization ([35d7f5a](https://github.com/JeffBeltran/sanctum-tokens/commit/35d7f5a255f3bf0a0a1814e20e2e0cde6aeee44d)), closes [#21](https://github.com/JeffBeltran/sanctum-tokens/issues/21) + # [1.4.0](https://github.com/JeffBeltran/sanctum-tokens/compare/v1.3.6...v1.4.0) (2021-02-07) diff --git a/dist/js/tool.js b/dist/js/tool.js index 250ab20..6993cac 100644 --- a/dist/js/tool.js +++ b/dist/js/tool.js @@ -1 +1 @@ -(()=>{var t={523:(t,e,n)=>{Nova.booting((function(t,e,s){t.component("sanctum-tokens",n(358).Z),t.component("create-token",n(811).Z),t.component("delete-token",n(342).Z),t.component("show-token",n(306).Z),t.component("token",n(396).Z)}))},429:()=>{},811:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});const s={props:{showAbilities:{required:!0,type:Boolean}},mounted:function(){document.querySelectorAll(".modal input")[0].focus()},methods:{handleKeydown:function(t){-1===["Escape","Enter"].indexOf(t.key)&&t.stopPropagation()},handleCreate:function(){this.$emit("create")},handleCancelledCreate:function(){this.$emit("cancelled-create")}}};const o=(0,n(900).Z)(s,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("modal",{attrs:{tabindex:"-1",role:"dialog"},on:{"modal-close":t.handleCancelledCreate}},[n("form",{staticClass:"bg-white rounded-lg shadow-lg overflow-hidden w-action-fields",attrs:{autocomplete:"off"},on:{keydown:t.handleKeydown,submit:function(e){return e.preventDefault(),e.stopPropagation(),t.handleCreate(e)}}},[n("div",[n("h2",{staticClass:"border-b border-40 py-8 px-8 text-90 font-normal text-xl"},[t._v("\n Create Personal Access Token\n ")]),t._v(" "),n("div",[n("div",{staticClass:"action"},[n("div",{staticClass:"border-b border-40"},[n("div",{staticClass:"flex w-full"},[n("div",{staticClass:"w-1/5 px-8 py-6"},[n("label",{staticClass:"inline-block text-80 pt-2 leading-tight",attrs:{for:"name"}},[t._v("Name")])]),t._v(" "),n("div",{staticClass:"py-6 px-8 w-1/2"},[t._t("name"),t._v(" "),n("div",{staticClass:"help-text help-text mt-2"})],2)]),t._v(" "),t.showAbilities?n("div",{staticClass:"flex w-full"},[n("div",{staticClass:"w-1/5 px-8 py-6"},[n("label",{staticClass:"inline-block text-80 pt-2 leading-tight",attrs:{for:"scopes"}},[t._v("Abilities")])]),t._v(" "),n("div",{staticClass:"py-6 px-8 w-1/2"},[t._t("abilities"),t._v(" "),n("div",{staticClass:"help-text help-text mt-2"},[t._v("\n Comma separated list of abilities to apply to token.\n ")])],2)]):t._e()])])])]),t._v(" "),n("div",{staticClass:"bg-30 px-6 py-3 flex"},[n("div",{staticClass:"flex items-center ml-auto"},[n("button",{staticClass:"btn btn-link dim cursor-pointer text-80 ml-auto mr-6",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.handleCancelledCreate(e)}}},[t._v("\n "+t._s(t.__("Cancel"))+"\n ")]),t._v(" "),n("button",{staticClass:"btn btn-default btn-primary",attrs:{dusk:"confirm-action-button",type:"submit"}},[n("span",[t._v(t._s(t.__("Create Token")))])])])])])])}),[],!1,null,null,null).exports},342:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});const s={props:{token:{required:!0,type:Object}},methods:{handleClose:function(){this.$emit("close")},handleConfirm:function(){this.$emit("confirm")}},mounted:function(){this.$refs.confirmButton.focus()}};const o=(0,n(900).Z)(s,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("modal",{on:{"modal-close":t.handleClose}},[n("form",{staticClass:"bg-white rounded-lg shadow-lg overflow-hidden",staticStyle:{width:"460px"},on:{submit:function(e){return e.preventDefault(),t.handleConfirm(e)}}},[n("div",{staticClass:"p-8"},[n("heading",{staticClass:"mb-6",attrs:{level:2}},[t._v("\n "+t._s(t.__("Delete Token"))+"\n ")]),t._v(" "),n("p",{staticClass:"text-80 leading-normal"},[t._v("\n Are you sure you want to delete the "+t._s(t.token.name)+" token?\n ")])],1),t._v(" "),n("div",{staticClass:"bg-30 px-6 py-3 flex"},[n("div",{staticClass:"ml-auto"},[n("button",{staticClass:"btn text-80 font-normal h-9 px-3 mr-3 btn-link",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.handleClose(e)}}},[t._v("\n "+t._s(t.__("Cancel"))+"\n ")]),t._v(" "),n("button",{ref:"confirmButton",staticClass:"btn btn-default btn-danger",attrs:{id:"confirm-delete-button",type:"submit"}},[t._v("\n "+t._s(t.__("Delete Token"))+"\n ")])])])])])}),[],!1,null,null,null).exports},306:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});const s={mounted:function(){document.querySelectorAll(".modal input")[0].focus()},methods:{handleKeydown:function(t){-1===["Escape","Enter"].indexOf(t.key)&&t.stopPropagation()},handleConfirm:function(){this.$emit("confirm")}}};const o=(0,n(900).Z)(s,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("modal",{attrs:{tabindex:"-1",role:"dialog"}},[n("form",{staticClass:"bg-white rounded-lg shadow-lg overflow-hidden w-action-fields",attrs:{autocomplete:"off"},on:{keydown:t.handleKeydown}},[n("div",[n("h2",{staticClass:"border-b border-40 py-8 px-8 text-90 font-normal text-xl"},[t._v("\n Personal Access Token\n ")]),t._v(" "),n("div",[n("div",{staticClass:"action"},[n("div",{staticClass:"flex flex-col border-b border-40"},[n("div",{staticClass:"flex items-center py-6 px-8"},[t._t("default")],2),t._v(" "),n("div",{staticClass:"flex items-center pb-6 px-8"},[n("div",{staticClass:"w-full rounded bg-danger-light text-danger-dark border-l-4 border-danger-dark p-4"},[n("div",{staticClass:"flex"},[n("div",{staticClass:"flex flex-shrink-0 items-center"},[n("svg",{staticClass:"h-5 w-5 text-yellow-400",attrs:{viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})])]),t._v(" "),n("div",{staticClass:"flex items-center ml-3"},[n("p",{staticClass:"text-sm leading-5 text-yellow-700"},[t._v("\n Make sure to copy your new personal access token now.\n You won't be able to see it again!\n ")])])])])])])])])]),t._v(" "),n("div",{staticClass:"bg-30 px-6 py-3 flex"},[n("div",{staticClass:"flex items-center ml-auto"},[n("button",{staticClass:"btn btn-default btn-primary",attrs:{dusk:"confirm-action-button",type:"submit"}},[t._v("\n Got it!\n ")])])])])])}),[],!1,null,null,null).exports},396:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});const s={props:{token:{required:!0,type:Object},showAbilities:{required:!0,type:Boolean}},data:function(){return{showDeleteModal:!1}},methods:{revokeToken:function(){this.$emit("revoke-token",this.token.id)}},computed:{lastUsed:function(){return this.token.last_used_at?moment(this.token.last_used_at).calendar():"—"}}};const o=(0,n(900).Z)(s,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("tr",[n("td",[n("div",{staticClass:"text-left text-left",attrs:{"via-resource":"users","via-resource-id":"1"}},[n("span",{staticClass:"whitespace-no-wrap"},[t._v(t._s(t.token.name))])])]),t._v(" "),t.showAbilities?n("td",[n("div",{staticClass:"text-left text-left",attrs:{"via-resource":"users","via-resource-id":"1"}},[n("span",{staticClass:"whitespace-no-wrap"},[t._v(t._s(t.token.abilities))])])]):t._e(),t._v(" "),n("td",[n("div",{staticClass:"text-left text-left",attrs:{"via-resource":"users","via-resource-id":"1"}},[n("span",{staticClass:"whitespace-no-wrap"},[t._v(t._s(t.lastUsed))])])]),t._v(" "),n("td",{staticClass:"td-fit text-right pr-6 align-middle"},[n("div",{staticClass:"inline-flex items-center"},[n("button",{staticClass:"inline-flex appearance-none cursor-pointer text-70 hover:text-primary mr-3 has-tooltip",on:{click:function(e){t.showDeleteModal=!0}}},[n("svg",{staticClass:"fill-current",attrs:{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-labelledby":"delete",role:"presentation"}},[n("path",{attrs:{"fill-rule":"nonzero",d:"M6 4V2a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2h5a1 1 0 0 1 0 2h-1v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6H1a1 1 0 1 1 0-2h5zM4 6v12h12V6H4zm8-2V2H8v2h4zM8 8a1 1 0 0 1 1 1v6a1 1 0 0 1-2 0V9a1 1 0 0 1 1-1zm4 0a1 1 0 0 1 1 1v6a1 1 0 0 1-2 0V9a1 1 0 0 1 1-1z"}})])])])]),t._v(" "),n("portal",{attrs:{to:"modals",transition:"fade-transition"}},[t.showDeleteModal?n("delete-token",{attrs:{token:t.token},on:{confirm:t.revokeToken,close:function(e){t.showDeleteModal=!1}}}):t._e()],1)],1)}),[],!1,null,"b56084f0",null).exports},358:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});const s={props:["resourceName","resourceId","panel"],data:function(){return{tokens:[],showAddModal:!1,tokenName:null,tokenAbilities:null,personalAccessToken:null,showPersonalAccessTokenModal:!1}},created:function(){this.fetchTokens()},methods:{copyToken:function(){this.$refs.token.select(),document.execCommand("copy")},openModal:function(){this.showAddModal=!0},confirmModal:function(){this.modalOpen=!1},closeModal:function(){this.showAddModal=!1,this.tokenName=null},createToken:function(){this.getNewToken(),this.closeModal()},getNewToken:function(){var t=this;Nova.request().post("/nova-vendor/sanctum-tokens/tokens/".concat(this.resourceName,"/").concat(this.resourceId),{name:this.tokenName,abilities:this.tokenAbilities?this.tokenAbilities:this.panel.options.defaultAbilities}).then((function(e){t.personalAccessToken=e.data,t.showPersonalAccessTokenModal=!0}))},fetchTokens:function(){var t=this;Nova.request().get("/nova-vendor/sanctum-tokens/tokens/".concat(this.resourceName,"/").concat(this.resourceId)).then((function(e){t.tokens=e.data.tokens}))},revokeToken:function(t){Nova.request().post("/nova-vendor/sanctum-tokens/tokens/".concat(this.resourceName,"/").concat(this.resourceId,"/revoke"),{token_id:t}).then((function(){location.reload()}))}}};const o=(0,n(900).Z)(s,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"relative",attrs:{dusk:"profiles-index-component"}},[n("h1",{staticClass:"mb-3 text-90 font-normal text-2xl"},[t._v("Personal Access Tokens")]),t._v(" "),n("div",{staticClass:"flex"},[n("div",{staticClass:"w-full flex items-center"},[n("div",{staticClass:"flex-no-shrink ml-auto mb-6"},[n("button",{staticClass:"btn btn-default btn-primary",on:{click:function(e){t.showAddModal=!0}}},[t._v("\n Create Token\n ")])])])]),t._v(" "),n("div",{staticClass:"card"},[t.tokens.length?n("div",{staticClass:"overflow-hidden overflow-x-auto relative"},[n("table",{staticClass:"table w-full",attrs:{cellspacing:"0",cellpadding:"0"}},[n("thead",[n("tr",[t._m(0),t._v(" "),t.panel.options.showAbilities?n("th",{staticClass:"text-left"},[n("span",[t._v("Abilities")])]):t._e(),t._v(" "),t._m(1),t._v(" "),n("th",[t._v(" ")])])]),t._v(" "),n("tbody",t._l(t.tokens,(function(e){return n("token",{key:e.id,attrs:{token:e,"show-abilities":t.panel.options.showAbilities},on:{"revoke-token":t.revokeToken}})})),1)])]):n("div",{staticClass:"flex justify-center items-center px-6 py-8"},[n("div",{staticClass:"text-center"},[n("svg",{staticClass:"w-5 h-5 mb-3",attrs:{fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",viewBox:"0 0 24 24",stroke:"currentColor"}},[n("path",{attrs:{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}})]),t._v(" "),n("h3",{staticClass:"text-base text-80 font-normal mb-6"},[t._v("\n No Tokens For User.\n ")]),t._v(" "),n("div",[n("button",{staticClass:"btn btn-sm btn-outline inline-flex items-center focus:outline-none focus:shadow-outline active:outline-none active:shadow-outline",on:{click:function(e){t.showAddModal=!0}}},[t._v("\n Create Token\n ")])])])])]),t._v(" "),n("portal",{attrs:{to:"modals",transition:"fade-transition"}},[t.showAddModal?n("create-token",{attrs:{"show-abilities":t.panel.options.showAbilities},on:{create:t.createToken,"cancelled-create":t.closeModal}},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.tokenName,expression:"tokenName"}],staticClass:"w-full form-control form-input form-input-bordered",attrs:{slot:"name",id:"name",list:"name-list",type:"text",placeholder:"Name"},domProps:{value:t.tokenName},on:{input:function(e){e.target.composing||(t.tokenName=e.target.value)}},slot:"name"}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.tokenAbilities,expression:"tokenAbilities"}],staticClass:"w-full form-control form-input form-input-bordered",attrs:{slot:"abilities",id:"abilities",list:"abilities-list",type:"text",placeholder:t.panel.options.defaultAbilities},domProps:{value:t.tokenAbilities},on:{input:function(e){e.target.composing||(t.tokenAbilities=e.target.value)}},slot:"abilities"})]):t._e(),t._v(" "),t.showPersonalAccessTokenModal?n("show-token",{on:{confirm:function(e){t.showPersonalAccessTokenModal=!1}}},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.personalAccessToken,expression:"personalAccessToken"}],ref:"token",staticClass:"w-full form-control form-input form-input-bordered",attrs:{id:"name",type:"text",placeholder:"Name",readonly:""},domProps:{value:t.personalAccessToken},on:{input:function(e){e.target.composing||(t.personalAccessToken=e.target.value)}}}),t._v(" "),n("button",{staticClass:"ml-4 flex items-center btn btn-link dim cursor-pointer text-80",attrs:{type:"button"},on:{click:t.copyToken}},[n("svg",{staticClass:"-ml-1 mr-2 h-5 w-5",attrs:{fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",viewBox:"0 0 24 24",stroke:"currentColor"}},[n("path",{attrs:{d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}})]),t._v("\n Copy\n ")])]):t._e()],1)],1)}),[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("th",{staticClass:"text-left"},[n("span",[t._v("Name")])])},function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("th",{staticClass:"text-left"},[n("span",[t._v("Last Used At")])])}],!1,null,null,null).exports},900:(t,e,n)=>{"use strict";function s(t,e,n,s,o,a,i,l){var r,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),s&&(c.functional=!0),a&&(c._scopeId="data-v-"+a),i?(r=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},c._ssrRegister=r):o&&(r=l?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),r)if(c.functional){c._injectStyles=r;var d=c.render;c.render=function(t,e){return r.call(e),d(t,e)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,r):[r]}return{exports:t,options:c}}n.d(e,{Z:()=>s})}},e={};function n(s){if(e[s])return e[s].exports;var o=e[s]={exports:{}};return t[s](o,o.exports,n),o.exports}n.m=t,n.x=t=>{},n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={103:0},e=[[523],[429]],s=t=>{},o=(o,a)=>{for(var i,l,[r,c,d,u]=a,p=0,f=[];p{}),s}a.forEach(o.bind(null,0)),a.push=o.bind(null,a.push.bind(a));var l=n.x;n.x=()=>(n.x=l||(t=>{}),(s=i)())})(),n.x()})(); \ No newline at end of file +(()=>{var t={523:(t,e,s)=>{Nova.booting((function(t,e,n){t.component("sanctum-tokens",s(682).Z),t.component("create-token",s(118).Z),t.component("delete-token",s(789).Z),t.component("show-token",s(515).Z),t.component("token",s(396).Z)}))},429:()=>{},118:(t,e,s)=>{"use strict";s.d(e,{Z:()=>o});const n={props:{showAbilities:{required:!0,type:Boolean}},mounted:function(){document.querySelectorAll(".modal input")[0].focus()},methods:{handleKeydown:function(t){-1===["Escape","Enter"].indexOf(t.key)&&t.stopPropagation()},handleCreate:function(){this.$emit("create")},handleCancelledCreate:function(){this.$emit("cancelled-create")}}};const o=(0,s(900).Z)(n,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("modal",{attrs:{tabindex:"-1",role:"dialog"},on:{"modal-close":t.handleCancelledCreate}},[s("form",{staticClass:"bg-white rounded-lg shadow-lg overflow-hidden w-action-fields",attrs:{autocomplete:"off"},on:{keydown:t.handleKeydown,submit:function(e){return e.preventDefault(),e.stopPropagation(),t.handleCreate(e)}}},[s("div",[s("h2",{staticClass:"border-b border-40 py-8 px-8 text-90 font-normal text-xl"},[t._v("\n "+t._s(t.__("Create Personal Access Token"))+"\n ")]),t._v(" "),s("div",[s("div",{staticClass:"action"},[s("div",{staticClass:"border-b border-40"},[s("div",{staticClass:"flex w-full"},[s("div",{staticClass:"w-1/5 px-8 py-6"},[s("label",{staticClass:"inline-block text-80 pt-2 leading-tight",attrs:{for:"name"}},[t._v(t._s(t.__("Name")))])]),t._v(" "),s("div",{staticClass:"py-6 px-8 w-1/2"},[t._t("name"),t._v(" "),s("div",{staticClass:"help-text help-text mt-2"})],2)]),t._v(" "),t.showAbilities?s("div",{staticClass:"flex w-full"},[s("div",{staticClass:"w-1/5 px-8 py-6"},[s("label",{staticClass:"inline-block text-80 pt-2 leading-tight",attrs:{for:"scopes"}},[t._v(t._s(t.__("Abilities")))])]),t._v(" "),s("div",{staticClass:"py-6 px-8 w-1/2"},[t._t("abilities"),t._v(" "),s("div",{staticClass:"help-text help-text mt-2"},[t._v("\n "+t._s(t.__("Comma separated list of abilities to apply to token."))+"\n ")])],2)]):t._e()])])])]),t._v(" "),s("div",{staticClass:"bg-30 px-6 py-3 flex"},[s("div",{staticClass:"flex items-center ml-auto"},[s("button",{staticClass:"btn btn-link dim cursor-pointer text-80 ml-auto mr-6",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.handleCancelledCreate(e)}}},[t._v("\n "+t._s(t.__("Cancel"))+"\n ")]),t._v(" "),s("button",{staticClass:"btn btn-default btn-primary",attrs:{dusk:"confirm-action-button",type:"submit"}},[s("span",[t._v(t._s(t.__("Create Token")))])])])])])])}),[],!1,null,null,null).exports},789:(t,e,s)=>{"use strict";s.d(e,{Z:()=>o});const n={props:{token:{required:!0,type:Object}},methods:{handleClose:function(){this.$emit("close")},handleConfirm:function(){this.$emit("confirm")}},mounted:function(){this.$refs.confirmButton.focus()}};const o=(0,s(900).Z)(n,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("modal",{on:{"modal-close":t.handleClose}},[s("form",{staticClass:"bg-white rounded-lg shadow-lg overflow-hidden",staticStyle:{width:"460px"},on:{submit:function(e){return e.preventDefault(),t.handleConfirm(e)}}},[s("div",{staticClass:"p-8"},[s("heading",{staticClass:"mb-6",attrs:{level:2}},[t._v("\n "+t._s(t.__("Delete Token"))+"\n ")]),t._v(" "),s("p",{staticClass:"text-80 leading-normal"},[t._v("\n "+t._s(t.__("Are you sure you want to delete the :token token?",{token:t.token.name}))+"\n ")])],1),t._v(" "),s("div",{staticClass:"bg-30 px-6 py-3 flex"},[s("div",{staticClass:"ml-auto"},[s("button",{staticClass:"btn text-80 font-normal h-9 px-3 mr-3 btn-link",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.handleClose(e)}}},[t._v("\n "+t._s(t.__("Cancel"))+"\n ")]),t._v(" "),s("button",{ref:"confirmButton",staticClass:"btn btn-default btn-danger",attrs:{id:"confirm-delete-button",type:"submit"}},[t._v("\n "+t._s(t.__("Delete Token"))+"\n ")])])])])])}),[],!1,null,null,null).exports},515:(t,e,s)=>{"use strict";s.d(e,{Z:()=>o});const n={mounted:function(){document.querySelectorAll(".modal input")[0].focus()},methods:{handleKeydown:function(t){-1===["Escape","Enter"].indexOf(t.key)&&t.stopPropagation()},handleConfirm:function(){this.$emit("confirm")}}};const o=(0,s(900).Z)(n,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("modal",{attrs:{tabindex:"-1",role:"dialog"}},[s("form",{staticClass:"bg-white rounded-lg shadow-lg overflow-hidden w-action-fields",attrs:{autocomplete:"off"},on:{keydown:t.handleKeydown}},[s("div",[s("h2",{staticClass:"border-b border-40 py-8 px-8 text-90 font-normal text-xl"},[t._v("\n "+t._s(t.__("Personal Access Token"))+"\n ")]),t._v(" "),s("div",[s("div",{staticClass:"action"},[s("div",{staticClass:"flex flex-col border-b border-40"},[s("div",{staticClass:"flex items-center py-6 px-8"},[t._t("default")],2),t._v(" "),s("div",{staticClass:"flex items-center pb-6 px-8"},[s("div",{staticClass:"w-full rounded bg-danger-light text-danger-dark border-l-4 border-danger-dark p-4"},[s("div",{staticClass:"flex"},[s("div",{staticClass:"flex flex-shrink-0 items-center"},[s("svg",{staticClass:"h-5 w-5 text-yellow-400",attrs:{viewBox:"0 0 20 20",fill:"currentColor"}},[s("path",{attrs:{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})])]),t._v(" "),s("div",{staticClass:"flex items-center ml-3"},[s("p",{staticClass:"text-sm leading-5 text-yellow-700"},[t._v("\n "+t._s(t.__("Make sure to copy your new personal access token now. You won't be able to see it again!"))+"\n ")])])])])])])])])]),t._v(" "),s("div",{staticClass:"bg-30 px-6 py-3 flex"},[s("div",{staticClass:"flex items-center ml-auto"},[s("button",{staticClass:"btn btn-default btn-primary",attrs:{dusk:"confirm-action-button",type:"submit"}},[t._v("\n "+t._s(t.__("Confirm"))+"\n ")])])])])])}),[],!1,null,null,null).exports},396:(t,e,s)=>{"use strict";s.d(e,{Z:()=>o});const n={props:{token:{required:!0,type:Object},showAbilities:{required:!0,type:Boolean}},data:function(){return{showDeleteModal:!1}},methods:{revokeToken:function(){this.$emit("revoke-token",this.token.id)}},computed:{lastUsed:function(){return this.token.last_used_at?moment(this.token.last_used_at).calendar():"—"}}};const o=(0,s(900).Z)(n,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("tr",[s("td",[s("div",{staticClass:"text-left text-left",attrs:{"via-resource":"users","via-resource-id":"1"}},[s("span",{staticClass:"whitespace-no-wrap"},[t._v(t._s(t.token.name))])])]),t._v(" "),t.showAbilities?s("td",[s("div",{staticClass:"text-left text-left",attrs:{"via-resource":"users","via-resource-id":"1"}},[s("span",{staticClass:"whitespace-no-wrap"},[t._v(t._s(t.token.abilities))])])]):t._e(),t._v(" "),s("td",[s("div",{staticClass:"text-left text-left",attrs:{"via-resource":"users","via-resource-id":"1"}},[s("span",{staticClass:"whitespace-no-wrap"},[t._v(t._s(t.lastUsed))])])]),t._v(" "),s("td",{staticClass:"td-fit text-right pr-6 align-middle"},[s("div",{staticClass:"inline-flex items-center"},[s("button",{staticClass:"inline-flex appearance-none cursor-pointer text-70 hover:text-primary mr-3 has-tooltip",on:{click:function(e){t.showDeleteModal=!0}}},[s("svg",{staticClass:"fill-current",attrs:{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-labelledby":"delete",role:"presentation"}},[s("path",{attrs:{"fill-rule":"nonzero",d:"M6 4V2a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2h5a1 1 0 0 1 0 2h-1v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6H1a1 1 0 1 1 0-2h5zM4 6v12h12V6H4zm8-2V2H8v2h4zM8 8a1 1 0 0 1 1 1v6a1 1 0 0 1-2 0V9a1 1 0 0 1 1-1zm4 0a1 1 0 0 1 1 1v6a1 1 0 0 1-2 0V9a1 1 0 0 1 1-1z"}})])])])]),t._v(" "),s("portal",{attrs:{to:"modals",transition:"fade-transition"}},[t.showDeleteModal?s("delete-token",{attrs:{token:t.token},on:{confirm:t.revokeToken,close:function(e){t.showDeleteModal=!1}}}):t._e()],1)],1)}),[],!1,null,"b56084f0",null).exports},682:(t,e,s)=>{"use strict";s.d(e,{Z:()=>o});const n={props:["resourceName","resourceId","panel"],data:function(){return{tokens:[],showAddModal:!1,tokenName:null,tokenAbilities:null,personalAccessToken:null,showPersonalAccessTokenModal:!1}},created:function(){this.fetchTokens()},methods:{copyToken:function(){this.$refs.token.select(),document.execCommand("copy")},openModal:function(){this.showAddModal=!0},confirmModal:function(){this.modalOpen=!1},closeModal:function(){this.showAddModal=!1,this.tokenName=null},createToken:function(){this.getNewToken(),this.closeModal()},getNewToken:function(){var t=this;Nova.request().post("/nova-vendor/sanctum-tokens/tokens/".concat(this.resourceName,"/").concat(this.resourceId),{name:this.tokenName,abilities:this.tokenAbilities?this.tokenAbilities:this.panel.options.defaultAbilities}).then((function(e){t.personalAccessToken=e.data,t.showPersonalAccessTokenModal=!0}))},fetchTokens:function(){var t=this;Nova.request().get("/nova-vendor/sanctum-tokens/tokens/".concat(this.resourceName,"/").concat(this.resourceId)).then((function(e){t.tokens=e.data.tokens}))},revokeToken:function(t){Nova.request().post("/nova-vendor/sanctum-tokens/tokens/".concat(this.resourceName,"/").concat(this.resourceId,"/revoke"),{token_id:t}).then((function(){location.reload()}))}}};const o=(0,s(900).Z)(n,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"relative",attrs:{dusk:"profiles-index-component"}},[s("h1",{staticClass:"mb-3 text-90 font-normal text-2xl"},[t._v("\n "+t._s(t.__("Personal Access Tokens"))+"\n ")]),t._v(" "),s("div",{staticClass:"flex"},[s("div",{staticClass:"w-full flex items-center"},[s("div",{staticClass:"flex-no-shrink ml-auto mb-6"},[s("button",{staticClass:"btn btn-default btn-primary",on:{click:function(e){t.showAddModal=!0}}},[t._v("\n "+t._s(t.__("Create Token"))+"\n ")])])])]),t._v(" "),s("div",{staticClass:"card"},[t.tokens.length?s("div",{staticClass:"overflow-hidden overflow-x-auto relative"},[s("table",{staticClass:"table w-full",attrs:{cellspacing:"0",cellpadding:"0"}},[s("thead",[s("tr",[s("th",{staticClass:"text-left"},[s("span",[t._v(t._s(t.__("Name")))])]),t._v(" "),t.panel.options.showAbilities?s("th",{staticClass:"text-left"},[s("span",[t._v(t._s(t.__("Abilities")))])]):t._e(),t._v(" "),s("th",{staticClass:"text-left"},[s("span",[t._v(t._s(t.__("Last Used At")))])]),t._v(" "),s("th",[t._v(" ")])])]),t._v(" "),s("tbody",t._l(t.tokens,(function(e){return s("token",{key:e.id,attrs:{token:e,"show-abilities":t.panel.options.showAbilities},on:{"revoke-token":t.revokeToken}})})),1)])]):s("div",{staticClass:"flex justify-center items-center px-6 py-8"},[s("div",{staticClass:"text-center"},[s("svg",{staticClass:"w-5 h-5 mb-3",attrs:{fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",viewBox:"0 0 24 24",stroke:"currentColor"}},[s("path",{attrs:{d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}})]),t._v(" "),s("h3",{staticClass:"text-base text-80 font-normal mb-6"},[t._v("\n "+t._s(t.__("No Tokens For User."))+"\n ")]),t._v(" "),s("div",[s("button",{staticClass:"btn btn-sm btn-outline inline-flex items-center focus:outline-none focus:shadow-outline active:outline-none active:shadow-outline",on:{click:function(e){t.showAddModal=!0}}},[t._v("\n "+t._s(t.__("Create Token"))+"\n ")])])])])]),t._v(" "),s("portal",{attrs:{to:"modals",transition:"fade-transition"}},[t.showAddModal?s("create-token",{attrs:{"show-abilities":t.panel.options.showAbilities},on:{create:t.createToken,"cancelled-create":t.closeModal}},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.tokenName,expression:"tokenName"}],staticClass:"w-full form-control form-input form-input-bordered",attrs:{slot:"name",id:"name",list:"name-list",type:"text",placeholder:"Name"},domProps:{value:t.tokenName},on:{input:function(e){e.target.composing||(t.tokenName=e.target.value)}},slot:"name"}),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.tokenAbilities,expression:"tokenAbilities"}],staticClass:"w-full form-control form-input form-input-bordered",attrs:{slot:"abilities",id:"abilities",list:"abilities-list",type:"text",placeholder:t.panel.options.defaultAbilities},domProps:{value:t.tokenAbilities},on:{input:function(e){e.target.composing||(t.tokenAbilities=e.target.value)}},slot:"abilities"})]):t._e(),t._v(" "),t.showPersonalAccessTokenModal?s("show-token",{on:{confirm:function(e){t.showPersonalAccessTokenModal=!1}}},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.personalAccessToken,expression:"personalAccessToken"}],ref:"token",staticClass:"w-full form-control form-input form-input-bordered",attrs:{id:"name",type:"text",placeholder:"Name",readonly:""},domProps:{value:t.personalAccessToken},on:{input:function(e){e.target.composing||(t.personalAccessToken=e.target.value)}}}),t._v(" "),s("button",{staticClass:"ml-4 flex items-center btn btn-link dim cursor-pointer text-80",attrs:{type:"button"},on:{click:t.copyToken}},[s("svg",{staticClass:"-ml-1 mr-2 h-5 w-5",attrs:{fill:"none","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",viewBox:"0 0 24 24",stroke:"currentColor"}},[s("path",{attrs:{d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}})]),t._v("\n "+t._s(t.__("Copy"))+"\n ")])]):t._e()],1)],1)}),[],!1,null,null,null).exports},900:(t,e,s)=>{"use strict";function n(t,e,s,n,o,a,i,l){var r,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=s,c._compiled=!0),n&&(c.functional=!0),a&&(c._scopeId="data-v-"+a),i?(r=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(i)},c._ssrRegister=r):o&&(r=l?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),r)if(c.functional){c._injectStyles=r;var d=c.render;c.render=function(t,e){return r.call(e),d(t,e)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,r):[r]}return{exports:t,options:c}}s.d(e,{Z:()=>n})}},e={};function s(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n](o,o.exports,s),o.exports}s.m=t,s.x=t=>{},s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={103:0},e=[[523],[429]],n=t=>{},o=(o,a)=>{for(var i,l,[r,c,d,u]=a,p=0,f=[];p{}),n}a.forEach(o.bind(null,0)),a.push=o.bind(null,a.push.bind(a));var l=s.x;s.x=()=>(s.x=l||(t=>{}),(n=i)())})(),s.x()})(); \ No newline at end of file diff --git a/package.json b/package.json index d2c7178..303c882 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sanctum-tokens", - "version": "1.4.0", + "version": "1.5.0", "repository": "github:JeffBeltran/sanctum-tokens", "private": true, "release": {