Merge "refactor: update render tabs components"
This commit is contained in:
commit
32d07c8a94
@ -14,7 +14,7 @@ import BaseContentContext from 'components/PrometheusChart/component/context';
|
|||||||
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
const RenderTabs = () => {
|
const RenderTabs = ({ fetchPrometheusFunc }) => {
|
||||||
const [filters, setFilters] = useState({});
|
const [filters, setFilters] = useState({});
|
||||||
const [initData, setInitData] = useState([]);
|
const [initData, setInitData] = useState([]);
|
||||||
const [listData, setListData] = useState([]);
|
const [listData, setListData] = useState([]);
|
||||||
@ -22,10 +22,13 @@ const RenderTabs = () => {
|
|||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
const ctx = useContext(BaseContentContext);
|
const ctx = useContext(BaseContentContext);
|
||||||
const fetchData = createFetchPrometheusClient({
|
const fetchData = createFetchPrometheusClient(
|
||||||
|
{
|
||||||
requestType: 'current',
|
requestType: 'current',
|
||||||
metricKey: 'storageCluster.tabs',
|
metricKey: 'storageCluster.tabs',
|
||||||
});
|
},
|
||||||
|
fetchPrometheusFunc
|
||||||
|
);
|
||||||
|
|
||||||
const dataHandler = createDataHandler({
|
const dataHandler = createDataHandler({
|
||||||
modifyKeys: ['pools', 'osds'],
|
modifyKeys: ['pools', 'osds'],
|
||||||
@ -63,10 +66,10 @@ const RenderTabs = () => {
|
|||||||
async function handleInitData(data) {
|
async function handleInitData(data) {
|
||||||
const newData = [...data];
|
const newData = [...data];
|
||||||
const poolPromises = get(METRICDICT, 'storageCluster.poolTab.url', []).map(
|
const poolPromises = get(METRICDICT, 'storageCluster.poolTab.url', []).map(
|
||||||
(item) => fetchPrometheus(item, 'current')
|
(item) => (fetchPrometheusFunc || fetchPrometheus)(item, 'current')
|
||||||
);
|
);
|
||||||
const osdPromises = get(METRICDICT, 'storageCluster.osdTab.url', []).map(
|
const osdPromises = get(METRICDICT, 'storageCluster.osdTab.url', []).map(
|
||||||
(item) => fetchPrometheus(item, 'current')
|
(item) => (fetchPrometheusFunc || fetchPrometheus)(item, 'current')
|
||||||
);
|
);
|
||||||
|
|
||||||
function handler(ret, index, primaryKey) {
|
function handler(ret, index, primaryKey) {
|
||||||
|
Loading…
Reference in New Issue
Block a user