Files
nomad/ui/app/adapters/namespace.js
Mike Nomitch bc039a7a8a Adds Namespace UI to Access Control (#19402)
Adds Namespace UI to Access Control - Also adds two step buttons to other Access Control pages

---------

Co-authored-by: Phil Renaud <phil@riotindustries.com>
2024-01-16 09:20:50 -08:00

29 lines
723 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Watchable from './watchable';
import codesForError from '../utils/codes-for-error';
import classic from 'ember-classic-decorator';
@classic
export default class NamespaceAdapter extends Watchable {
findRecord(store, modelClass, id) {
return super.findRecord(...arguments).catch((error) => {
const errorCodes = codesForError(error);
if (errorCodes.includes('501')) {
return { Name: id };
}
});
}
urlForCreateRecord(_modelName, model) {
return this.urlForUpdateRecord(model.attr('name'), 'namespace');
}
urlForDeleteRecord(id) {
return this.urlForUpdateRecord(id, 'namespace');
}
}