open-consul/ui-v2/app/services/repository/intention.js
John Cowen 76f97836b2
ui: Quote service names when filtering for intentions (#7888)
* ui: Quote service names for intention filtering

* ui: return null if we ever get an error with anything else
2020-05-14 17:18:24 +01:00

25 lines
698 B
JavaScript

import RepositoryService from 'consul-ui/services/repository';
import { PRIMARY_KEY } from 'consul-ui/models/intention';
const modelName = 'intention';
export default RepositoryService.extend({
getModelName: function() {
return modelName;
},
getPrimaryKey: function() {
return PRIMARY_KEY;
},
findByService: function(slug, dc, nspace, configuration = {}) {
const query = {
dc: dc,
nspace: nspace,
filter: `SourceName == "${slug}" or DestinationName == "${slug}"`,
};
if (typeof configuration.cursor !== 'undefined') {
query.index = configuration.cursor;
}
return this.store.query(this.getModelName(), {
...query,
});
},
});