go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/web/rpcexplorer/src/views/services_list.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 { Link as RouterLink } from 'react-router-dom';
    16  
    17  import List from '@mui/material/List';
    18  import ListItem from '@mui/material/ListItem';
    19  import ListItemButton from '@mui/material/ListItemButton';
    20  import ListItemIcon from '@mui/material/ListItemIcon';
    21  import ListItemText from '@mui/material/ListItemText';
    22  
    23  import { ServiceIcon } from '../components/icons';
    24  import { useGlobals } from '../context/globals';
    25  
    26  
    27  const ServicesList = () => {
    28    const { descriptors } = useGlobals();
    29  
    30    return (
    31      <List dense>
    32        {descriptors.services.map((svc) => {
    33          return (
    34            <ListItem key={svc.name} disablePadding divider>
    35              <ListItemButton component={RouterLink} to={svc.name}>
    36                <ListItemIcon sx={{ minWidth: '40px' }}>
    37                  <ServiceIcon />
    38                </ListItemIcon>
    39                <ListItemText primary={svc.name} secondary={svc.help} />
    40              </ListItemButton>
    41            </ListItem>
    42          );
    43        })}
    44      </List>
    45    );
    46  };
    47  
    48  
    49  export default ServicesList;