open-consul/ui/packages/consul-ui/app/services/repository/node.js

28 lines
762 B
JavaScript

import RepositoryService from 'consul-ui/services/repository';
import dataSource from 'consul-ui/decorators/data-source';
const modelName = 'node';
export default class NodeService extends RepositoryService {
getModelName() {
return modelName;
}
@dataSource('/:partition/:ns/:dc/nodes')
async findAllByDatacenter() {
return super.findAllByDatacenter(...arguments);
}
@dataSource('/:partition/:ns/:dc/node/:id')
async findBySlug() {
return super.findBySlug(...arguments);
}
@dataSource('/:partition/:ns/:dc/leader')
findLeader(params, configuration = {}) {
if (typeof configuration.refresh !== 'undefined') {
params.uri = configuration.uri;
}
return this.store.queryLeader(this.getModelName(), params);
}
}