d1b3a63b2f
In some circumstances a consul 1.4 client could be running in an un-upgraded 1.3 or lower cluster. Currently this gives a 500 error on the new ACL token endpoint. Here we catch this specific 500 error/message and set the users AccessorID to null. Elsewhere in the frontend we use this fact (AccessorID being null) to decide whether to present the legacy or the new ACL UI to the user. Also: - Re-adds in most of the old style ACL acceptance tests, now that we are keeping the old style UI - Restricts code editors to HCL only mode for all `Rules` editing (legacy/'half legacy'/new style) - Adds a [Stop using] button to the old style ACL rows so its possible to logout. - Updates copy and documentation links for the upgrade notices
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
import Route from '@ember/routing/route';
|
|
import { inject as service } from '@ember/service';
|
|
import { hash } from 'rsvp';
|
|
import { get } from '@ember/object';
|
|
|
|
import WithAclActions from 'consul-ui/mixins/acl/with-actions';
|
|
|
|
export default Route.extend(WithAclActions, {
|
|
repo: service('repository/acl'),
|
|
settings: service('settings'),
|
|
queryParams: {
|
|
s: {
|
|
as: 'filter',
|
|
replace: true,
|
|
},
|
|
},
|
|
beforeModel: function(transition) {
|
|
return get(this, 'settings')
|
|
.findBySlug('token')
|
|
.then(token => {
|
|
// If you don't have a token set or you have a
|
|
// token set with AccessorID set to not null (new ACL mode)
|
|
// then rewrite to the new acls
|
|
if (!token || get(token, 'AccessorID') !== null) {
|
|
// If you return here, you get a TransitionAborted error in the tests only
|
|
// everything works fine either way checking things manually
|
|
this.replaceWith('dc.acls.tokens');
|
|
}
|
|
});
|
|
},
|
|
model: function(params) {
|
|
return hash({
|
|
isLoading: false,
|
|
items: get(this, 'repo').findAllByDatacenter(this.modelFor('dc').dc.Name),
|
|
token: get(this, 'settings').findBySlug('token'),
|
|
});
|
|
},
|
|
setupController: function(controller, model) {
|
|
this._super(...arguments);
|
|
controller.setProperties(model);
|
|
},
|
|
});
|