diff --git a/lang/en-US.js b/lang/en-US.js index 280da3e56..2725ec4cc 100644 --- a/lang/en-US.js +++ b/lang/en-US.js @@ -88,6 +88,7 @@ export default { start: "Start", stop: "Stop", access_token: "Access Token", + token_list: "Token List", get_token: "Get New Token", manage_token: "Manage Access Token", save_token: "Save Access Token", diff --git a/pages/index.vue b/pages/index.vue index 8e9c5b041..9d3a5294a 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -400,7 +400,7 @@ @click="showTokenList = !showTokenList" v-tooltip.bottom="$t('use_token')" > - input + open_in_new - + + + + {{ $t("token_list") }} + + + clear_all + + + + + + - + - + + + + input + + delete - - - - add - {{ $t("add_new") }} - - - - - - - - - - Cancel - - - {{ $t("save_token") }} - - - + @@ -2364,6 +2360,7 @@ export default { this.httpPassword = ""; this.bearerToken = ""; this.showTokenRequest = false; + this.tokens = []; break; case "headers": this.headers = []; @@ -2379,6 +2376,9 @@ export default { this.clientId = ""; this.scope = ""; break; + case "tokens": + this.tokens = []; + break; default: (this.label = ""), (this.method = "GET"), @@ -2393,6 +2393,14 @@ export default { this.params = []; this.bodyParams = []; this.rawParams = ""; + this.showTokenRequest = false; + this.tokens = []; + this.accessTokenName = ""; + this.oidcDiscoveryUrl = ""; + this.authUrl = ""; + this.accessTokenUrl = ""; + this.clientId = ""; + this.scope = ""; } e.target.innerHTML = this.doneButton; this.$toast.info("Cleared", { @@ -2478,7 +2486,7 @@ export default { }); } }, - async handleAccessTokenRequest(){ + async handleAccessTokenRequest() { if (this.oidcDiscoveryUrl === "" && (this.authUrl === "" || this.accessTokenUrl === "")) { this.$toast.error("Please complete configuration urls.", { icon: "error" @@ -2505,12 +2513,16 @@ export default { let tokenInfo = await oauthRedirect(); if(tokenInfo.hasOwnProperty('access_token')) { this.bearerToken = tokenInfo.access_token; + this.addOAuthToken({ + name: this.accessTokenName, + value: tokenInfo.access_token + }); } }, - addOAuthToken() { + addOAuthToken({name, value}) { this.$store.commit("addOAuthToken", { - name: "", - value: "" + name, + value }); return false; }, @@ -2530,17 +2542,11 @@ export default { } }); }, - saveToken(){ - try { - this.$toast.info("Access token saved"); - this.showTokenList = false; - } catch (e) { - this.$toast.error(e, { - icon: "code" - }); - } + useOAuthToken(value) { + this.bearerToken = value; + this.showTokenList = false; }, - saveTokenRequest(){ + saveTokenRequest() { try { this.$toast.info("Token request saved"); this.showTokenRequestList = false; diff --git a/store/mutations.js b/store/mutations.js index bc76a5b93..446fbef65 100644 --- a/store/mutations.js +++ b/store/mutations.js @@ -101,10 +101,6 @@ export default { setOAuthTokenName({ oauth2 }, { index, value }) { oauth2.tokens[index].name = value; - }, - - setOAuthTokenValue({ oauth2 }, { index, value }) { - oauth2.tokens[index].value = value; - }, + } };