go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/frontend/ui/src/views/rules/rules_page.tsx (about)

     1  // Copyright 2022 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 {
    16    Link,
    17    useParams,
    18  } from 'react-router-dom';
    19  
    20  import Button from '@mui/material/Button';
    21  import Container from '@mui/material/Container';
    22  import Grid from '@mui/material/Grid';
    23  
    24  import HelpTooltip from '@/components/help_tooltip/help_tooltip';
    25  import RulesTable from '@/components/rules_table/rules_table';
    26  import PageHeading from '@/components/headings/page_heading/page_heading';
    27  
    28  const rulesDescription = 'Rules define an association between failures and bugs. LUCI Analysis uses these ' +
    29    'associations to calculate bug impact, automatically adjust bug priority and verified status, and ' +
    30    'to surface bugs for failures in the MILO test results UI.';
    31  
    32  const RulesPage = () => {
    33    const { project } = useParams();
    34    return (
    35      <Container maxWidth={false}>
    36        <Grid container>
    37          <Grid item xs={8}>
    38            <PageHeading>
    39              Rules in project {project}<HelpTooltip text={rulesDescription}></HelpTooltip>
    40            </PageHeading>
    41          </Grid>
    42          <Grid item xs={4} sx={{ textAlign: 'right' }}>
    43            <Button component={Link} variant='contained' to='new' sx={{ marginBlockStart: '20px' }}>New Rule</Button>
    44          </Grid>
    45        </Grid>
    46        {(project) && (
    47          <RulesTable project={project}></RulesTable>
    48        )}
    49      </Container>
    50    );
    51  };
    52  
    53  export default RulesPage;
    54