2018-11-06 09:13:23 +00:00
|
|
|
import RepositoryService from 'consul-ui/services/repository';
|
2018-10-19 15:17:02 +00:00
|
|
|
import { get } from '@ember/object';
|
|
|
|
import { Promise } from 'rsvp';
|
|
|
|
import statusFactory from 'consul-ui/utils/acls-status';
|
2018-11-02 14:44:36 +00:00
|
|
|
import isValidServerErrorFactory from 'consul-ui/utils/http/acl/is-valid-server-error';
|
2018-11-06 09:13:23 +00:00
|
|
|
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/policy';
|
|
|
|
|
2018-11-02 14:44:36 +00:00
|
|
|
const isValidServerError = isValidServerErrorFactory();
|
|
|
|
const status = statusFactory(isValidServerError, Promise);
|
2018-10-19 15:17:02 +00:00
|
|
|
const MODEL_NAME = 'policy';
|
2018-11-06 09:13:23 +00:00
|
|
|
|
|
|
|
export default RepositoryService.extend({
|
2018-10-19 15:17:02 +00:00
|
|
|
getModelName: function() {
|
|
|
|
return MODEL_NAME;
|
|
|
|
},
|
|
|
|
getPrimaryKey: function() {
|
|
|
|
return PRIMARY_KEY;
|
|
|
|
},
|
|
|
|
getSlugKey: function() {
|
|
|
|
return SLUG_KEY;
|
|
|
|
},
|
|
|
|
status: function(obj) {
|
|
|
|
return status(obj);
|
|
|
|
},
|
|
|
|
translate: function(item) {
|
|
|
|
return get(this, 'store').translate('policy', get(item, 'Rules'));
|
|
|
|
},
|
|
|
|
});
|