go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/milo/ui/src/test_verdict/pages/regression_details_page/regression_details.tsx (about) 1 // Copyright 2024 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 import { Box, CircularProgress } from '@mui/material'; 16 import { useQuery } from '@tanstack/react-query'; 17 18 import { useChangepointsClient } from '@/analysis/hooks/prpc_clients'; 19 import { 20 ChangepointPredicate, 21 QueryChangepointsInGroupRequest, 22 } from '@/proto/go.chromium.org/luci/analysis/proto/v1/changepoints.pb'; 23 import { ParsedTestVariantBranchName } from '@/test_verdict/types'; 24 25 export interface RegressionDetailsProps { 26 readonly testVariantBranch: ParsedTestVariantBranchName; 27 readonly nominalStartPosition: string; 28 readonly startHour: string; 29 readonly predicate: ChangepointPredicate; 30 } 31 32 export function RegressionDetails({ 33 testVariantBranch, 34 nominalStartPosition, 35 startHour, 36 predicate, 37 }: RegressionDetailsProps) { 38 const client = useChangepointsClient(); 39 const { data, isLoading, isError, error } = useQuery( 40 client.QueryChangepointsInGroup.query( 41 QueryChangepointsInGroupRequest.fromPartial({ 42 project: testVariantBranch.project, 43 groupKey: { 44 testId: testVariantBranch.testId, 45 variantHash: testVariantBranch.variantHash, 46 refHash: testVariantBranch.refHash, 47 nominalStartPosition, 48 startHour, 49 }, 50 predicate, 51 }), 52 ), 53 ); 54 55 if (isError) { 56 throw error; 57 } 58 59 if (isLoading) { 60 return ( 61 <Box display="flex" justifyContent="center" alignItems="center"> 62 <CircularProgress /> 63 </Box> 64 ); 65 } 66 67 // TODO(b/321110247): Display all the test variant branches in a table with 68 // all the associated changepoints. 69 return <>{JSON.stringify(data.changepoints, undefined, 2)}</>; 70 }