mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 00:45:43 +03:00
Adds Namespace UI to Access Control - Also adds two step buttons to other Access Control pages --------- Co-authored-by: Phil Renaud <phil@riotindustries.com>
25 lines
634 B
JavaScript
25 lines
634 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
export default function rollbackWithoutChangedAttrs(model) {
|
|
// The purpose of this function was to allow deletes to fail
|
|
// and then roll them back without rolling back
|
|
// other changed attributes.
|
|
|
|
// A failed delete followed by trying to re-view the
|
|
// model in question was throwing uncaught Errros
|
|
|
|
let forLater = {};
|
|
Object.keys(model.changedAttributes()).forEach((key) => {
|
|
forLater[key] = model.get(key);
|
|
});
|
|
|
|
model.rollbackAttributes();
|
|
|
|
Object.keys(forLater).forEach((key) => {
|
|
model.set(key, forLater[key]);
|
|
});
|
|
}
|