ui: Use a custom request for nspace deletion (#8878)
* Turn repo.remove into a custom action to bypass ember-data deletion * Don't show actions on a deleting nspace
This commit is contained in:
parent
0b3f438703
commit
09fbe303b2
|
@ -21,6 +21,7 @@
|
|||
{{/if}}
|
||||
</BlockSlot>
|
||||
<BlockSlot @name="actions" as |Actions|>
|
||||
{{#if (not item.DeletedAt)}}
|
||||
<Actions as |Action|>
|
||||
<Action data-test-edit-action @href={{href-to 'dc.nspaces.edit' item.Name}}>
|
||||
<BlockSlot @name="label">
|
||||
|
@ -50,6 +51,7 @@
|
|||
</Action>
|
||||
{{/if}}
|
||||
</Actions>
|
||||
{{/if}}
|
||||
</BlockSlot>
|
||||
</ListCollection>
|
||||
{{/if}}
|
|
@ -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') {
|
||||
|
|
Loading…
Reference in New Issue