From deed1fa14a13e44a4cd8f5fcb6eaa4af05593aa2 Mon Sep 17 00:00:00 2001 From: Mintu Gogoi Date: Tue, 23 Apr 2024 10:42:46 +0000 Subject: [PATCH 1/9] added filtering of status data based on type, source, status --- website/src/pages/StatusPage/StatusPage.tsx | 75 ++++++++++++++++++++- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/website/src/pages/StatusPage/StatusPage.tsx b/website/src/pages/StatusPage/StatusPage.tsx index 35842831a..878981d4c 100644 --- a/website/src/pages/StatusPage/StatusPage.tsx +++ b/website/src/pages/StatusPage/StatusPage.tsx @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React from "react"; +import React, { useState } from "react"; import RingLoader from "react-spinners/RingLoader"; import useApiCall from "../../utils/Hook"; @@ -32,15 +32,84 @@ export default function StatusPage() { `${import.meta.env.VITE_API_URL}recent` ); + const [filters, setFilters] = useState({ + type: '', + status: '', + source: '', + }); + + const filterData = (data) => { + return data.filter((item) => { + const itemType = item.type_of ? item.type_of.toString() : ''; + const itemSource = item.source ? item.source.toString() : ''; + const itemStatus = item.status ? item.status.toString() : ''; + + const matchesType = + filters.type === '' || filters.type === undefined || itemType === filters.type; + const matchesSource = + filters.source === '' || filters.source === undefined || itemSource === filters.source; + const matchesStatus = + filters.status === '' || filters.status === undefined || itemStatus === filters.status; + + return matchesType && matchesSource && matchesStatus; + }); + }; + + const handleFilterChange = (e) => { + const { name, value } = e.target; + setFilters((prevFilters) => ({ ...prevFilters, [name]: value })); + }; + + const filteredData = filterData(dataQueue); + return ( <>
+ {/* FILTERS OPTIONS*/} +
+ + + + + +
+ {/* EXECUTION QUEUE */} {!isLoadingQueue && dataQueue && dataQueue.length > 0 && ( - + )} {/* PREVIOUS EXECUTIONS */} @@ -48,7 +117,7 @@ export default function StatusPage() { dataPreviousExe && dataPreviousExe.length > 0 && ( )} From ad9b8b5f04a36159ce3d411326305eabc6c60f05 Mon Sep 17 00:00:00 2001 From: Mintu Gogoi Date: Tue, 23 Apr 2024 10:47:04 +0000 Subject: [PATCH 2/9] cleanup --- website/src/pages/StatusPage/StatusPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/src/pages/StatusPage/StatusPage.tsx b/website/src/pages/StatusPage/StatusPage.tsx index 878981d4c..e9a0608a9 100644 --- a/website/src/pages/StatusPage/StatusPage.tsx +++ b/website/src/pages/StatusPage/StatusPage.tsx @@ -72,7 +72,7 @@ export default function StatusPage() {
{/* EXECUTION QUEUE */} - {/* {!isLoadingQueue && dataQueue && dataQueue.length > 0 && ( - - )} */} - + {!isLoadingQueue && dataQueue && dataQueue.length > 0 && ( + + )} {/* PREVIOUS EXECUTIONS */} - {/* {!isLoadingPreviousExe && + {!isLoadingPreviousExe && dataPreviousExe && dataPreviousExe.length > 0 && ( - )} */} - + )} {/* SHOW LOADER BENEATH IF EITHER IS LOADING */} {(isLoadingPreviousExe || isLoadingQueue) && ( @@ -141,9 +148,9 @@ export default function StatusPage() {
)} - {/* {errorQueue && ( + {errorQueue && (
{errorQueue}
- )} */} + )} ); } diff --git a/website/src/pages/StatusPage/components/ExecutionQueue.tsx b/website/src/pages/StatusPage/components/ExecutionQueue.tsx index 52a9e1db5..5bde503a4 100644 --- a/website/src/pages/StatusPage/components/ExecutionQueue.tsx +++ b/website/src/pages/StatusPage/components/ExecutionQueue.tsx @@ -23,7 +23,7 @@ export default function ExecutionQueue(props) { const [executionQueue, setExecutionQueue] = useState([]); useEffect(() => { - for (const entry of data) { + const transformedData = data.map((entry) => { const newData = {}; newData["SHA"] = ( @@ -55,10 +55,11 @@ export default function ExecutionQueue(props) { } else { newData["PR"] = ; } + return newData; + }) - setExecutionQueue((p) => [...p, newData]); - } - }, []); + setExecutionQueue(transformedData); + },[data]) return (
diff --git a/website/src/pages/StatusPage/components/PreviousExecutions.tsx b/website/src/pages/StatusPage/components/PreviousExecutions.tsx index 9bffe3462..79468db5a 100644 --- a/website/src/pages/StatusPage/components/PreviousExecutions.tsx +++ b/website/src/pages/StatusPage/components/PreviousExecutions.tsx @@ -22,123 +22,68 @@ import DisplayList from "../../../common/DisplayList"; export default function PreviousExecutions(props) { const { data, title } = props; - // const [previousExecutions, setPreviousExecutions] = useState([]); - - // useEffect(() => { - // for (const entry of data) { - // const newData = {}; - - // newData["UUID"] = entry.uuid.slice(0, 8); - - // newData["SHA"] = ( - // - // {entry.git_ref.slice(0, 6)} - // - // ); - - // newData["Source"] = entry.source; - - // newData["Started"] = formatDate(entry.started_at) || "N/A"; - - // newData["Finished"] = formatDate(entry.finished_at) || "N/A"; - - // newData["Type"] = entry.type_of; - - // if (entry.pull_nb) { - // newData["PR"] = ( - // - // {entry.pull_nb} - // - // ); - // } else { - // newData["PR"] = ; - // } - - // newData["Go version"] = entry.golang_version; - - // newData["Status"] = ( - // - // {entry.status} - // - // ); - - // setPreviousExecutions((p) => [...p, newData]); - // } - // }, []); - - const previousExecutions = data.map((entry) => { - const newData = {}; - - newData["UUID"] = entry.uuid.slice(0, 8); - - newData["SHA"] = ( - - {entry.git_ref.slice(0, 6)} - - ); - - newData["Source"] = entry.source; - - newData["Started"] = formatDate(entry.started_at) || "N/A"; - - newData["Finished"] = formatDate(entry.finished_at) || "N/A"; - - newData["Type"] = entry.type_of; - - if (entry.pull_nb) { - newData["PR"] = ( + const [previousExecutions, setPreviousExecutions] = useState([]); + + useEffect(() => { + const transformedData = data.map((entry) => { + const newData = {}; + + newData["UUID"] = entry.uuid.slice(0, 8); + + newData["SHA"] = ( - {entry.pull_nb} + {entry.git_ref.slice(0, 6)} ); - } else { - newData["PR"] = ; - } - - newData["Go version"] = entry.golang_version; - - newData["Status"] = ( - - {entry.status} - - ); - - return newData; - }); + + newData["Source"] = entry.source; + + newData["Started"] = formatDate(entry.started_at) || "N/A"; + + newData["Finished"] = formatDate(entry.finished_at) || "N/A"; + + newData["Type"] = entry.type_of; + + if (entry.pull_nb) { + newData["PR"] = ( + + {entry.pull_nb} + + ); + } else { + newData["PR"] = ; + } + + newData["Go version"] = entry.golang_version; + + newData["Status"] = ( + + {entry.status} + + ); + + return newData; + }); + + setPreviousExecutions(transformedData); + }, [data]); return (
From 1ee233f6a1af01ad2c7054fde7e8ee617198acd8 Mon Sep 17 00:00:00 2001 From: utnim2 Date: Thu, 25 Apr 2024 00:24:03 +0530 Subject: [PATCH 5/9] remove the hardcoded data --- website/src/pages/StatusPage/data.json | 552 ------------------------- 1 file changed, 552 deletions(-) delete mode 100644 website/src/pages/StatusPage/data.json diff --git a/website/src/pages/StatusPage/data.json b/website/src/pages/StatusPage/data.json deleted file mode 100644 index 81bbeb6c2..000000000 --- a/website/src/pages/StatusPage/data.json +++ /dev/null @@ -1,552 +0,0 @@ -[ - { - "uuid": "875f2043-580c-4d16-9d04-1690daff6383", - "source": "cron", - "git_ref": "204bc50817a138e98486177a8900bfd0bedaecb7", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-24T00:00:23Z", - "finished_at": "2024-04-24T00:12:35Z" - }, - { - "uuid": "278890d5-42bb-42ef-bf7d-6b20aca41780", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:59:11Z", - "finished_at": "2024-04-23T01:01:05Z" - }, - { - "uuid": "ec402e63-1bc9-405a-a7cd-0aa74b169480", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:57:16Z", - "finished_at": "2024-04-23T00:59:09Z" - }, - { - "uuid": "172a2451-e3f4-4cd3-bc87-4d4f5bf293a3", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:55:23Z", - "finished_at": "2024-04-23T00:57:15Z" - }, - { - "uuid": "79ab0f77-2915-4b5a-a66f-64e26f72e67f", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:53:28Z", - "finished_at": "2024-04-23T00:55:22Z" - }, - { - "uuid": "669c009c-0d77-4719-ad73-369f9cb359d2", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:51:34Z", - "finished_at": "2024-04-23T00:53:27Z" - }, - { - "uuid": "e3f3a946-8c49-46fb-ba7f-dd586de673c6", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:49:39Z", - "finished_at": "2024-04-23T00:51:33Z" - }, - { - "uuid": "28aea9ae-97a3-4621-a518-f3cc83ef37a9", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:47:46Z", - "finished_at": "2024-04-23T00:49:39Z" - }, - { - "uuid": "ed38ba2a-5f49-45c6-846d-7acd9929d880", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:45:50Z", - "finished_at": "2024-04-23T00:47:45Z" - }, - { - "uuid": "27040bfb-05f4-4dd5-8311-b89f28b1e387", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:35:16Z", - "finished_at": "2024-04-23T00:45:49Z" - }, - { - "uuid": "e240c833-4bb3-45f1-a21a-bb896d840d4d", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:31:27Z", - "finished_at": "2024-04-23T00:35:16Z" - }, - { - "uuid": "9d49a9f8-ea98-4375-bd49-43cbc58947ce", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:27:37Z", - "finished_at": "2024-04-23T00:31:26Z" - }, - { - "uuid": "c5846378-52e2-4c63-aead-607e52346548", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:23:44Z", - "finished_at": "2024-04-23T00:27:36Z" - }, - { - "uuid": "2869067b-8526-47a2-a9c9-d453c488d319", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:19:50Z", - "finished_at": "2024-04-23T00:23:42Z" - }, - { - "uuid": "722ec96d-886a-4efa-9550-68face81635f", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:15:57Z", - "finished_at": "2024-04-23T00:19:48Z" - }, - { - "uuid": "9cf13d09-df78-46fd-8e60-43fb5396bfee", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:12:05Z", - "finished_at": "2024-04-23T00:15:56Z" - }, - { - "uuid": "023343ac-16fd-4bb6-95b4-9cac0de17f6b", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:08:11Z", - "finished_at": "2024-04-23T00:12:04Z" - }, - { - "uuid": "fb7ca6cd-0050-43c0-9028-ddfd11a73a19", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:04:17Z", - "finished_at": "2024-04-23T00:08:10Z" - }, - { - "uuid": "b55f5cfa-995f-49c4-b8a9-b9befb6a3685", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-23T00:00:25Z", - "finished_at": "2024-04-23T00:04:16Z" - }, - { - "uuid": "f830fa3b-3b99-47e0-bc5b-9fd081a57f75", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "finished", - "type_of": "tpcc", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-22T00:00:23Z", - "finished_at": "2024-04-22T00:10:41Z" - }, - { - "uuid": "60a597f1-f93d-4ab7-8745-9730dcdc487e", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "failed", - "type_of": "tpcc_fk_unmanaged", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-21T00:09:10Z", - "finished_at": "2024-04-21T00:15:16Z" - }, - { - "uuid": "66efebb3-1ebe-495c-b427-3f170fd28fcc", - "source": "cron", - "git_ref": "14b36d030ebe605894ff29eba6c7a1ba7d716fba", - "status": "failed", - "type_of": "tpcc_fk_unmanaged", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-21T00:00:26Z", - "finished_at": "2024-04-21T00:09:09Z" - }, - { - "uuid": "e956aba8-84c4-43d1-b450-0db25845c410", - "source": "cron_release-19.0-branch", - "git_ref": "e167ca8fb1ed988c13878ac2d0a1ca8f0e8b6dc1", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-20T00:00:44Z", - "finished_at": "2024-04-20T00:09:02Z" - }, - { - "uuid": "63b17298-c540-44d2-963c-4ff0f39be986", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:36:18Z", - "finished_at": "2024-04-19T00:40:04Z" - }, - { - "uuid": "ab9289ae-9942-44e9-b5f2-14f4a921f8b9", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:32:35Z", - "finished_at": "2024-04-19T00:36:17Z" - }, - { - "uuid": "f9f55b0a-1349-4516-8dfd-f20f045d47a6", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:28:50Z", - "finished_at": "2024-04-19T00:32:34Z" - }, - { - "uuid": "fcb449c5-7915-4fa7-b353-1a39bb3ce48e", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:25:00Z", - "finished_at": "2024-04-19T00:28:49Z" - }, - { - "uuid": "b310c643-59af-4d36-91ef-59e7c9618ba6", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:21:14Z", - "finished_at": "2024-04-19T00:24:59Z" - }, - { - "uuid": "0b05020c-f5f9-4cdd-8a77-00b550de5e06", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:17:33Z", - "finished_at": "2024-04-19T00:21:14Z" - }, - { - "uuid": "90b45b4d-32bc-4ad8-8099-bc17a5b84223", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:13:50Z", - "finished_at": "2024-04-19T00:17:32Z" - }, - { - "uuid": "e38aa8c1-e2cd-434a-b985-7c9fdd5558d4", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:10:06Z", - "finished_at": "2024-04-19T00:13:49Z" - }, - { - "uuid": "ad54a345-d5b6-41aa-a689-2f815845a697", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-19T00:00:26Z", - "finished_at": "2024-04-19T00:10:04Z" - }, - { - "uuid": "ca403e54-2126-4f51-ad9e-afd19720544d", - "source": "cron", - "git_ref": "f11de060c218d6663098b4094e246bec9a0e5f26", - "status": "failed", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-18T00:07:00Z", - "finished_at": "2024-04-18T00:13:06Z" - }, - { - "uuid": "913148a4-3652-4be1-bf13-8cebbe339cfc", - "source": "cron", - "git_ref": "f11de060c218d6663098b4094e246bec9a0e5f26", - "status": "failed", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-18T00:00:22Z", - "finished_at": "2024-04-18T00:06:59Z" - }, - { - "uuid": "c071496a-2c1d-4940-b37c-656aa1b7d2aa", - "source": "cron_release-19.0-branch", - "git_ref": "0784b659d39a15509c324750540071b6cc28864a", - "status": "finished", - "type_of": "tpcc_unsharded", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-17T00:00:21Z", - "finished_at": "2024-04-17T00:09:52Z" - }, - { - "uuid": "008b6e83-9d97-4679-ab9a-f848c2b68a04", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:58:02Z", - "finished_at": "2024-04-16T03:01:50Z" - }, - { - "uuid": "42c17cb2-01dc-4732-9a72-61f8ab4be1a9", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:54:10Z", - "finished_at": "2024-04-16T02:58:01Z" - }, - { - "uuid": "8b04e33c-0fed-4cea-aa1f-69cf5ff8a345", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:50:16Z", - "finished_at": "2024-04-16T02:54:08Z" - }, - { - "uuid": "2791bc92-9964-4231-93f8-a4e5aa429324", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:46:15Z", - "finished_at": "2024-04-16T02:50:15Z" - }, - { - "uuid": "03e2225b-41f4-453f-93ba-47d0bc1809c5", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:42:22Z", - "finished_at": "2024-04-16T02:46:14Z" - }, - { - "uuid": "cd84ea75-72aa-4e80-9a1c-fb990637d554", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:38:23Z", - "finished_at": "2024-04-16T02:42:20Z" - }, - { - "uuid": "21974123-d1d4-49ea-8076-30c2824176e5", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "finished", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:28:47Z", - "finished_at": "2024-04-16T02:38:22Z" - }, - { - "uuid": "4f6d632d-b7b3-4539-b9e0-ddc79595fb36", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "failed", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:22:48Z", - "finished_at": "2024-04-16T02:28:46Z" - }, - { - "uuid": "4545dcf6-feec-46f8-9475-f9bf04587649", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "failed", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:16:49Z", - "finished_at": "2024-04-16T02:22:47Z" - }, - { - "uuid": "4a9deb8e-e4c1-45df-9296-f28e91c05881", - "source": "cron_release-19.0-branch", - "git_ref": "05e8ad110e6e360740403f29f6bfa50f988f5590", - "status": "failed", - "type_of": "tpcc_fk", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:08:28Z", - "finished_at": "2024-04-16T02:16:48Z" - }, - { - "uuid": "5e00f904-0b38-4745-85b9-7645a640a25a", - "source": "cron", - "git_ref": "9e40015748ede158357bd7291f583db138abc3df", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:06:35Z", - "finished_at": "2024-04-16T02:08:27Z" - }, - { - "uuid": "00a8ac9f-a1e8-42ef-9978-4f886cc65ea6", - "source": "cron", - "git_ref": "9e40015748ede158357bd7291f583db138abc3df", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:04:40Z", - "finished_at": "2024-04-16T02:06:34Z" - }, - { - "uuid": "970babc6-21db-4606-9572-719fac9eb59a", - "source": "cron", - "git_ref": "9e40015748ede158357bd7291f583db138abc3df", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:02:45Z", - "finished_at": "2024-04-16T02:04:39Z" - }, - { - "uuid": "c19ce5ea-0aa8-4603-8056-d37cb3748a7d", - "source": "cron", - "git_ref": "9e40015748ede158357bd7291f583db138abc3df", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T02:00:50Z", - "finished_at": "2024-04-16T02:02:44Z" - }, - { - "uuid": "1cff1c1d-07b4-4fae-b3c0-48a1c36efbde", - "source": "cron", - "git_ref": "9e40015748ede158357bd7291f583db138abc3df", - "status": "finished", - "type_of": "oltp-readonly", - "pull_nb": 0, - "golang_version": "1.22.0", - "started_at": "2024-04-16T01:58:56Z", - "finished_at": "2024-04-16T02:00:50Z" - } -] \ No newline at end of file From 811693c83513c33f7c7a616449104d07760489ca Mon Sep 17 00:00:00 2001 From: utnim2 Date: Fri, 26 Apr 2024 02:57:07 +0530 Subject: [PATCH 6/9] added shadcn `select` component --- website/package.json | 1 + website/src/components/ui/select.tsx | 158 ++++++++++++++++++++ website/src/pages/StatusPage/StatusPage.tsx | 139 ++++++++++------- 3 files changed, 247 insertions(+), 51 deletions(-) create mode 100644 website/src/components/ui/select.tsx diff --git a/website/package.json b/website/package.json index 2b5f504cd..98bfddbd9 100644 --- a/website/package.json +++ b/website/package.json @@ -15,6 +15,7 @@ "@nivo/line": "^0.83.0", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.0.6", + "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "bytes": "^3.1.2", "class-variance-authority": "^0.7.0", diff --git a/website/src/components/ui/select.tsx b/website/src/components/ui/select.tsx new file mode 100644 index 000000000..7ce251032 --- /dev/null +++ b/website/src/components/ui/select.tsx @@ -0,0 +1,158 @@ +import * as React from "react" +import * as SelectPrimitive from "@radix-ui/react-select" +import { Check, ChevronDown, ChevronUp } from "lucide-react" + +import { cn } from "@/library/utils" + +const Select = SelectPrimitive.Root + +const SelectGroup = SelectPrimitive.Group + +const SelectValue = SelectPrimitive.Value + +const SelectTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + span]:line-clamp-1", + className + )} + {...props} + > + {children} + + + + +)) +SelectTrigger.displayName = SelectPrimitive.Trigger.displayName + +const SelectScrollUpButton = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + +)) +SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName + +const SelectScrollDownButton = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + +)) +SelectScrollDownButton.displayName = + SelectPrimitive.ScrollDownButton.displayName + +const SelectContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, position = "popper", ...props }, ref) => ( + + + + + {children} + + + + +)) +SelectContent.displayName = SelectPrimitive.Content.displayName + +const SelectLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SelectLabel.displayName = SelectPrimitive.Label.displayName + +const SelectItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + + + + + {children} + +)) +SelectItem.displayName = SelectPrimitive.Item.displayName + +const SelectSeparator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SelectSeparator.displayName = SelectPrimitive.Separator.displayName + +export { + Select, + SelectGroup, + SelectValue, + SelectTrigger, + SelectContent, + SelectLabel, + SelectItem, + SelectSeparator, + SelectScrollUpButton, + SelectScrollDownButton, +} diff --git a/website/src/pages/StatusPage/StatusPage.tsx b/website/src/pages/StatusPage/StatusPage.tsx index 5dddd4679..7b3d1cc05 100644 --- a/website/src/pages/StatusPage/StatusPage.tsx +++ b/website/src/pages/StatusPage/StatusPage.tsx @@ -21,6 +21,15 @@ import useApiCall from "../../utils/Hook"; import Hero from "./components/Hero"; import ExecutionQueue from "./components/PreviousExecutions"; import PreviousExecutions from "./components/PreviousExecutions"; +import datas from "./data.json"; + +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; interface dataTypes { uuid: string; @@ -45,36 +54,42 @@ export default function StatusPage() { ); const [filters, setFilters] = useState({ - type: '', - status: '', - source: '', + type: "", + status: "", + source: "", }); const filterData = (data: dataTypes[]) => { return data.filter((item) => { - const itemType = item.type_of ? item.type_of.toString() : ''; - const itemSource = item.source ? item.source.toString() : ''; - const itemStatus = item.status ? item.status.toString() : ''; + const itemType = item.type_of ? item.type_of.toString() : ""; + const itemSource = item.source ? item.source.toString() : ""; + const itemStatus = item.status ? item.status.toString() : ""; const matchesType = - filters.type === '' || filters.type === undefined || itemType === filters.type; + filters.type === "" || + filters.type === "All" || + itemType === filters.type; const matchesSource = - filters.source === '' || filters.source === undefined || itemSource === filters.source; + filters.source === "" || + filters.source === "All" || + itemSource === filters.source; const matchesStatus = - filters.status === '' || filters.status === undefined || itemStatus === filters.status; + filters.status === "" || + filters.status === "All" || + itemStatus === filters.status; - return (matchesType || filters.type === '' || filters.type === undefined) && - (matchesSource || filters.source === '' || filters.source === undefined) && - (matchesStatus || filters.status === '' || filters.status === undefined); + return matchesType && matchesSource && matchesStatus; }); }; - const handleFilterChange = (e: React.ChangeEvent) => { - const { name, value } = e.target; - setFilters((prevFilters) => ({ ...prevFilters, [name]: value })); + const handleFilterChange = (name: string, value: string) => { + setFilters((prevFilters) => ({ + ...prevFilters, + [name]: value === "" ? "" : value, + })); }; - const filteredDataQueue = filterData(dataQueue) as dataTypes[]; + const filteredDataQueue = filterData(dataQueue) as dataTypes[]; const filteredPreviousDataExe = filterData(dataPreviousExe) as dataTypes[]; return ( @@ -84,42 +99,64 @@ export default function StatusPage() {
{/* FILTERS OPTIONS*/} -
- - - - - + + ) + )} + + + + + +
{/* EXECUTION QUEUE */} From 2a64125ec5e7d2ea4109a65c3316bfdcce192375 Mon Sep 17 00:00:00 2001 From: utnim2 Date: Fri, 26 Apr 2024 23:17:19 +0530 Subject: [PATCH 7/9] added the license and removed the traces of hardcoded data --- website/src/components/ui/select.tsx | 16 ++++++++++++++++ website/src/pages/StatusPage/StatusPage.tsx | 7 +++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/website/src/components/ui/select.tsx b/website/src/components/ui/select.tsx index 7ce251032..ecd9b9af4 100644 --- a/website/src/components/ui/select.tsx +++ b/website/src/components/ui/select.tsx @@ -1,3 +1,19 @@ +/* +Copyright 2023 The Vitess Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + import * as React from "react" import * as SelectPrimitive from "@radix-ui/react-select" import { Check, ChevronDown, ChevronUp } from "lucide-react" diff --git a/website/src/pages/StatusPage/StatusPage.tsx b/website/src/pages/StatusPage/StatusPage.tsx index 7b3d1cc05..a553b56a2 100644 --- a/website/src/pages/StatusPage/StatusPage.tsx +++ b/website/src/pages/StatusPage/StatusPage.tsx @@ -21,7 +21,6 @@ import useApiCall from "../../utils/Hook"; import Hero from "./components/Hero"; import ExecutionQueue from "./components/PreviousExecutions"; import PreviousExecutions from "./components/PreviousExecutions"; -import datas from "./data.json"; import { Select, @@ -110,7 +109,7 @@ export default function StatusPage() { All - {[...new Set(datas.map((item: any) => item.type_of))].map( + {[...new Set(dataPreviousExe.map((item: any) => item.type_of))].map( (type) => ( {type} @@ -129,7 +128,7 @@ export default function StatusPage() { All - {[...new Set(datas.map((item: any) => item.source))].map( + {[...new Set(dataPreviousExe.map((item: any) => item.source))].map( (source) => ( {source} @@ -148,7 +147,7 @@ export default function StatusPage() { All - {[...new Set(datas.map((item: any) => item.status))].map( + {[...new Set(dataPreviousExe.map((item: any) => item.status))].map( (status) => ( {status} From fb28652a1b7ee1f2f155e7c67659d33fbe892de3 Mon Sep 17 00:00:00 2001 From: utnim2 Date: Mon, 6 May 2024 19:33:39 +0530 Subject: [PATCH 8/9] added some padding :) --- website/src/pages/StatusPage/StatusPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/pages/StatusPage/StatusPage.tsx b/website/src/pages/StatusPage/StatusPage.tsx index a553b56a2..24615536b 100644 --- a/website/src/pages/StatusPage/StatusPage.tsx +++ b/website/src/pages/StatusPage/StatusPage.tsx @@ -99,7 +99,7 @@ export default function StatusPage() { {/* FILTERS OPTIONS*/} -
+
handleFilterChange("type", value)} - > - - - - - All - {[...new Set(dataPreviousExe.map((item: any) => item.type_of))].map( - (type) => ( +
+
+ - - + + - - + + -
+ ))} + + +
- {/* EXECUTION QUEUE */} - {!isLoadingQueue && dataQueue && dataQueue.length > 0 && ( - - )} - - {/* PREVIOUS EXECUTIONS */} - {!isLoadingPreviousExe && - dataPreviousExe && - dataPreviousExe.length > 0 && ( - + {/* EXECUTION QUEUE */} + {!isLoadingQueue && dataQueue && dataQueue.length > 0 && ( + )} - {/* SHOW LOADER BENEATH IF EITHER IS LOADING */} - {(isLoadingPreviousExe || isLoadingQueue) && ( -
- -
- )} + {/* PREVIOUS EXECUTIONS */} + {!isLoadingPreviousExe && + dataPreviousExe && + dataPreviousExe.length > 0 && ( + + )} + + {/* SHOW LOADER BENEATH IF EITHER IS LOADING */} + {(isLoadingPreviousExe || isLoadingQueue) && ( +
+ +
+ )} - {errorQueue && ( -
{errorQueue}
- )} + {errorQueue && ( +
{errorQueue}
+ )} +
); }