service.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { request } from 'umi';
  2. import BaseService from '@/utils/BaseService';
  3. import SystemConst from '@/utils/const';
  4. import type { AccessItem } from './typings';
  5. class Service extends BaseService<AccessItem> {
  6. public queryGatewayDetail = (data: any) =>
  7. request(`/${SystemConst.API_BASE}/gateway/device/detail/_query`, {
  8. method: 'POST',
  9. data,
  10. });
  11. public queryList = (data: any) =>
  12. request(`/${SystemConst.API_BASE}/gateway/device/detail/_query`, {
  13. method: 'POST',
  14. data,
  15. });
  16. public startUp = (id: string) =>
  17. request(`/${SystemConst.API_BASE}/gateway/device/${id}/_startup`, {
  18. method: 'POST',
  19. });
  20. public shutDown = (id: string) =>
  21. request(`/${SystemConst.API_BASE}/gateway/device/${id}/_shutdown`, {
  22. method: 'POST',
  23. });
  24. public getProviders = () =>
  25. request(`/${SystemConst.API_BASE}/gateway/device/providers`, {
  26. method: 'GET',
  27. });
  28. public getNetworkList = (networkType: string, params?: any) =>
  29. request(`/${SystemConst.API_BASE}/network/config/${networkType}/_alive`, {
  30. method: 'GET',
  31. params,
  32. });
  33. public getProtocolList = (transport?: string, params?: any) => {
  34. return request(`/${SystemConst.API_BASE}/protocol/supports/${transport ? transport : ''}`, {
  35. method: 'GET',
  36. params,
  37. });
  38. };
  39. public getChildConfigView = (id: string) => {
  40. return request(`/${SystemConst.API_BASE}/protocol/${id}/transports`, {
  41. method: 'GET',
  42. });
  43. };
  44. public getConfigView = (id: string, transport: string) =>
  45. request(`/${SystemConst.API_BASE}/protocol/${id}/transport/${transport}`, {
  46. method: 'GET',
  47. });
  48. public getClusters = () =>
  49. request(`/${SystemConst.API_BASE}/network/resources/clusters`, {
  50. method: 'GET',
  51. });
  52. public getResourcesCurrent = () =>
  53. request(`${SystemConst.API_BASE}/network/resources/alive/_current`, {
  54. method: 'GET',
  55. });
  56. }
  57. export default Service;