2018-10-26 16:36:15 +00:00
|
|
|
import RepositoryService from 'consul-ui/services/repository';
|
2021-02-23 08:56:42 +00:00
|
|
|
import dataSource from 'consul-ui/decorators/data-source';
|
|
|
|
|
2018-10-26 16:36:15 +00:00
|
|
|
const modelName = 'service';
|
2021-02-23 08:56:42 +00:00
|
|
|
export default class ServiceService extends RepositoryService {
|
2020-11-09 09:25:35 +00:00
|
|
|
getModelName() {
|
2018-10-26 16:36:15 +00:00
|
|
|
return modelName;
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
|
2021-02-23 08:56:42 +00:00
|
|
|
@dataSource('/:ns/:dc/services')
|
|
|
|
async findAllByDatacenter() {
|
|
|
|
return super.findAllByDatacenter(...arguments);
|
|
|
|
}
|
|
|
|
|
|
|
|
@dataSource('/:ns/:dc/gateways/for-service/:gateway')
|
|
|
|
findGatewayBySlug(params, configuration = {}) {
|
2020-05-29 15:07:36 +00:00
|
|
|
if (typeof configuration.cursor !== 'undefined') {
|
2021-02-23 08:56:42 +00:00
|
|
|
params.index = configuration.cursor;
|
|
|
|
params.uri = configuration.uri;
|
2020-05-29 15:07:36 +00:00
|
|
|
}
|
2021-02-23 08:56:42 +00:00
|
|
|
return this.store.query(this.getModelName(), params);
|
2020-11-09 09:25:35 +00:00
|
|
|
}
|
|
|
|
}
|