diff --git a/ui/src/Components/LabelSetList/index.js b/ui/src/Components/LabelSetList/index.js index 4dca3c903..e2383e82a 100644 --- a/ui/src/Components/LabelSetList/index.js +++ b/ui/src/Components/LabelSetList/index.js @@ -1,8 +1,6 @@ -import React from "react"; +import React, { useState } from "react"; import PropTypes from "prop-types"; -import { useLocalStore, useObserver } from "mobx-react"; - import { AlertStore } from "Stores/AlertStore"; import { IsMobile } from "Common/Device"; import { hashObject } from "Common/Hash"; @@ -29,54 +27,44 @@ const GroupListToUniqueLabelsList = (groups) => { }; const LabelSetList = ({ alertStore, labelsList }) => { - const pagination = useLocalStore(() => ({ - activePage: 1, - onPageChange(pageNumber) { - pagination.activePage = pageNumber; - }, - })); + const [activePage, setActivePage] = useState(1); const maxPerPage = IsMobile() ? 5 : 10; - return useObserver(() => - labelsList.length > 0 ? ( + return labelsList.length > 0 ? ( +
+

Affected alerts

-

Affected alerts

-
-
    - {labelsList - .slice( - (pagination.activePage - 1) * maxPerPage, - pagination.activePage * maxPerPage - ) - .map((labels, index) => ( -
  • - {Object.entries(labels).map(([name, value]) => ( - - ))} -
  • - ))} -
-
- +
    + {labelsList + .slice((activePage - 1) * maxPerPage, activePage * maxPerPage) + .map((labels, index) => ( +
  • + {Object.entries(labels).map(([name, value]) => ( + + ))} +
  • + ))} +
- ) : ( -

No alerts matched

- ) + +
+ ) : ( +

No alerts matched

); }; LabelSetList.propTypes = {