-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(resource-control): show resource control entry for clinic (#1582)
- Loading branch information
Showing
6 changed files
with
107 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/ResourceManager/context-impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
IResourceManagerDataSource, | ||
IResourceManagerContext, | ||
ReqConfig | ||
} from '@pingcap/tidb-dashboard-lib' | ||
import { AxiosPromise } from 'axios' | ||
|
||
import client, { | ||
ResourcemanagerCalibrateResponse, | ||
ResourcemanagerGetConfigResponse, | ||
ResourcemanagerResourceInfoRowDef | ||
} from '~/client' | ||
|
||
class DataSource implements IResourceManagerDataSource { | ||
getConfig( | ||
options?: ReqConfig | ||
): AxiosPromise<ResourcemanagerGetConfigResponse> { | ||
return client.getInstance().resourceManagerConfigGet(options) | ||
} | ||
getInformation( | ||
options?: ReqConfig | ||
): AxiosPromise<ResourcemanagerResourceInfoRowDef[]> { | ||
return client.getInstance().resourceManagerInformationGet(options) | ||
} | ||
|
||
getCalibrateByHardware( | ||
params: { workload: string }, | ||
options?: ReqConfig | undefined | ||
): AxiosPromise<ResourcemanagerCalibrateResponse> { | ||
return client | ||
.getInstance() | ||
.resourceManagerCalibrateHardwareGet(params, options) | ||
} | ||
getCalibrateByActual( | ||
params: { startTime: number; endTime: number }, | ||
options?: ReqConfig | undefined | ||
): AxiosPromise<ResourcemanagerCalibrateResponse> { | ||
return client | ||
.getInstance() | ||
.resourceManagerCalibrateActualGet(params, options) | ||
} | ||
|
||
metricsQueryGet(params: { | ||
endTimeSec?: number | ||
query?: string | ||
startTimeSec?: number | ||
stepSec?: number | ||
}) { | ||
return client | ||
.getInstance() | ||
.metricsQueryGet(params, { | ||
handleError: 'custom' | ||
} as ReqConfig) | ||
.then((res) => res.data) | ||
} | ||
} | ||
|
||
export const getResourceManagerContext: () => IResourceManagerContext = () => { | ||
return { | ||
ds: new DataSource(), | ||
cfg: {} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/ResourceManager/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
import { | ||
ResourceManagerApp, | ||
ResourceManagerProvider | ||
} from '@pingcap/tidb-dashboard-lib' | ||
import { getResourceManagerContext } from './context-impl' | ||
|
||
export default function () { | ||
return ( | ||
<ResourceManagerProvider value={getResourceManagerContext()}> | ||
<ResourceManagerApp /> | ||
</ResourceManagerProvider> | ||
) | ||
} |
8 changes: 8 additions & 0 deletions
8
ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/ResourceManager/meta.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { HddOutlined } from '@ant-design/icons' | ||
|
||
export default { | ||
id: 'resource_manager', | ||
routerPrefix: '/resource_manager', | ||
icon: HddOutlined, | ||
reactRoot: () => import('.') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters