diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 index c04e6abec9b..e4f2869b21b 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 @@ -28,12 +28,11 @@ export default Ember.Controller.extend({ }, save() { - this.model - .save() - .then(() => { - this.transitionToRoute("adminApiKeys.show", this.model.id); - }) - .catch(popupAjaxError); + this.model.save().catch(popupAjaxError); + }, + + continue() { + this.transitionToRoute("adminApiKeys.show", this.model.id); } } }); diff --git a/app/assets/javascripts/admin/models/api-key.js.es6 b/app/assets/javascripts/admin/models/api-key.js.es6 index 7a20c288aea..06d861fa4a3 100644 --- a/app/assets/javascripts/admin/models/api-key.js.es6 +++ b/app/assets/javascripts/admin/models/api-key.js.es6 @@ -3,6 +3,7 @@ import AdminUser from "admin/models/admin-user"; import RestModel from "discourse/models/rest"; import { ajax } from "discourse/lib/ajax"; import { computed } from "@ember/object"; +import { fmt } from "discourse/lib/computed"; const ApiKey = RestModel.extend({ user: computed("_user", { @@ -19,17 +20,14 @@ const ApiKey = RestModel.extend({ } }), - @discourseComputed("key") - shortKey(key) { - return `${key.substring(0, 4)}...`; - }, - @discourseComputed("description") shortDescription(description) { if (!description || description.length < 40) return description; return `${description.substring(0, 40)}...`; }, + truncatedKey: fmt("truncated_key", "%@..."), + revoke() { return ajax(`${this.basePath}/revoke`, { type: "POST" diff --git a/app/assets/javascripts/admin/templates/api-keys-index.hbs b/app/assets/javascripts/admin/templates/api-keys-index.hbs index a0d5bf9f77e..7943a5b9e2a 100644 --- a/app/assets/javascripts/admin/templates/api-keys-index.hbs +++ b/app/assets/javascripts/admin/templates/api-keys-index.hbs @@ -19,7 +19,7 @@