mirror of
https://github.com/status-im/consul.git
synced 2025-02-26 12:25:41 +00:00
* Add some less fake API data * Rename the models class so as to not be confused with JS Proxies * Rearrange routlets slightly and add some initial outletFor tests * Move away from a MeshChecks computed property and just use a helper * Just use ServiceChecks for healthiness filtering for the moment * Make TProxy cookie configurable * Amend exposed paths and upstreams so they know about meta AND proxy * Slight bit of TaggedAddresses refactor while I was checking for `meta` etc * Document CONSUL_TPROXY_ENABLE
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import RepositoryService from 'consul-ui/services/repository';
|
|
import { set } from '@ember/object';
|
|
import { ACCESS_READ } from 'consul-ui/abilities/base';
|
|
import dataSource from 'consul-ui/decorators/data-source';
|
|
|
|
const modelName = 'service-instance';
|
|
export default class ServiceInstanceService extends RepositoryService {
|
|
getModelName() {
|
|
return modelName;
|
|
}
|
|
|
|
shouldReconcile(item, params) {
|
|
return super.shouldReconcile(...arguments) && item.Service.Service === params.id;
|
|
}
|
|
|
|
@dataSource('/:partition/:ns/:dc/service-instances/for-service/:id')
|
|
async findByService(params, configuration = {}) {
|
|
if (typeof configuration.cursor !== 'undefined') {
|
|
params.index = configuration.cursor;
|
|
params.uri = configuration.uri;
|
|
}
|
|
return this.authorizeBySlug(
|
|
async (resources) => {
|
|
const instances = await this.query(params);
|
|
set(instances, 'firstObject.Service.Resources', resources);
|
|
return instances;
|
|
},
|
|
ACCESS_READ,
|
|
params
|
|
);
|
|
}
|
|
|
|
@dataSource('/:partition/:ns/:dc/service-instance/:serviceId/:node/:id')
|
|
async findBySlug(params, configuration = {}) {
|
|
return super.findBySlug(...arguments);
|
|
}
|
|
}
|