open-consul/ui-v2/app/services/repository/coordinate.js
John Cowen 31f36ce096 ui: Namespace Support (#6639)
Adds namespace support to the UI:

1. Namespace CRUD/management
2. Show Namespace in relevant areas (intentions, upstreams)
3. Main navigation bar improvements
4. Logic/integration to interact with a new `internal/acl/authorize` endpoint
2019-12-18 12:26:47 +00:00

24 lines
784 B
JavaScript

import { get } from '@ember/object';
import RepositoryService from 'consul-ui/services/repository';
import tomographyFactory from 'consul-ui/utils/tomography';
import distance from 'consul-ui/utils/distance';
const tomography = tomographyFactory(distance);
const modelName = 'coordinate';
export default RepositoryService.extend({
getModelName: function() {
return modelName;
},
findAllByNode: function(node, dc, nspace, configuration) {
return this.findAllByDatacenter(dc, nspace, configuration).then(function(coordinates) {
let results = {};
if (get(coordinates, 'length') > 1) {
results = tomography(node, coordinates.map(item => get(item, 'data')));
}
results.meta = get(coordinates, 'meta');
return results;
});
},
});