From cf24ecb42414e794470aebc6ebcd81102bbfc09d Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 16 Dec 2019 12:16:54 +0000 Subject: [PATCH] Accept ember-data as the source of truth instead of Consul for ns CRUD The data properties sent to be saved in the backend or the same ones that we receive back if its successful therefore we can just ignore the result and avoid ember-data syncing problems --- ui-v2/app/routes/dc.js | 11 ----------- ui-v2/app/serializers/nspace.js | 17 +++++------------ .../app/templates/dc/nspaces/-notifications.hbs | 2 +- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/ui-v2/app/routes/dc.js b/ui-v2/app/routes/dc.js index a5aed71bfc84..f7911b7f14a3 100644 --- a/ui-v2/app/routes/dc.js +++ b/ui-v2/app/routes/dc.js @@ -69,15 +69,4 @@ export default Route.extend({ setupController: function(controller, model) { controller.setProperties(model); }, - actions: { - // TODO: This will eventually be deprecated please see - // https://deprecations.emberjs.com/v3.x/#toc_deprecate-router-events - willTransition: function(transition) { - // This will refresh both dcs and nspaces on any route transition - // under here - if (typeof transition !== 'undefined' && transition.from.name.endsWith('nspaces.create')) { - this.refresh(); - } - }, - }, }); diff --git a/ui-v2/app/serializers/nspace.js b/ui-v2/app/serializers/nspace.js index f782051bba85..1ce0c024874e 100644 --- a/ui-v2/app/serializers/nspace.js +++ b/ui-v2/app/serializers/nspace.js @@ -42,18 +42,11 @@ export default Serializer.extend({ }, respondForCreateRecord: function(respond, serialized, data) { return respond((headers, body) => { - // potentially this could be default functionality - // we are basically making the assumption here that if a create - // comes back with a record then we should prefer that over the local - // one seeing as it has come from the backend, could we potenitally lose - // data that is stored in the frontend here? - // if we were to do this as a default thing we'd have to use uid here - // which we don't know until its gone through the serializer after this - const item = this.store.peekRecord('nspace', body.Name); - if (item) { - this.store.unloadRecord(item); - } - return body; + // The data properties sent to be saved in the backend + // or the same ones that we receive back if its successfull + // therefore we can just ignore the result and avoid ember-data + // syncing problems + return {}; }); }, respondForUpdateRecord: function(respond, serialized, data) { diff --git a/ui-v2/app/templates/dc/nspaces/-notifications.hbs b/ui-v2/app/templates/dc/nspaces/-notifications.hbs index 17a2023bcea8..48617141128e 100644 --- a/ui-v2/app/templates/dc/nspaces/-notifications.hbs +++ b/ui-v2/app/templates/dc/nspaces/-notifications.hbs @@ -12,7 +12,7 @@ {{/if}} {{ else if (eq type 'delete')}} {{#if (eq status 'success') }} - Your namespace was deleted. + Your namespace has been marked for deletion. {{else}} There was an error deleting your namespace. {{/if}}