diff --git a/ui-v2/app/components/consul-nspace-list/index.hbs b/ui-v2/app/components/consul-nspace-list/index.hbs index f5a35d2dfe..a156fb0724 100644 --- a/ui-v2/app/components/consul-nspace-list/index.hbs +++ b/ui-v2/app/components/consul-nspace-list/index.hbs @@ -21,6 +21,7 @@ {{/if}} +{{#if (not item.DeletedAt)}} @@ -50,6 +51,7 @@ {{/if}} +{{/if}} {{/if}} \ No newline at end of file diff --git a/ui-v2/app/services/repository/nspace.js b/ui-v2/app/services/repository/nspace.js index 5a6822cdf4..040b1b8049 100644 --- a/ui-v2/app/services/repository/nspace.js +++ b/ui-v2/app/services/repository/nspace.js @@ -12,6 +12,27 @@ export default RepositoryService.extend({ getModelName: function() { return modelName; }, + remove: function(item) { + // Namespace deletion is more of a soft delete. + // Therefore the namespace still exists once we've requested a delete/removal. + // This makes 'removing' more of a custom action rather than a standard + // ember-data delete. + // Here we use the same request for a delete but we bypass ember-data's + // destroyRecord/unloadRecord and serialization so we don't get + // ember data error messages when the UI tries to update a 'DeletedAt' property + // on an object that ember-data is trying to delete + const res = this.store.adapterFor('nspace').rpc( + (adapter, request, serialized, unserialized) => { + return adapter.requestForDeleteRecord(request, serialized, unserialized); + }, + (serializer, respond, serialized, unserialized) => { + return item; + }, + item, + 'nspace' + ); + return res; + }, findAll: function(configuration = {}) { const query = {}; if (typeof configuration.cursor !== 'undefined') {