github.com/minio/console@v1.4.1/web-app/src/screens/Console/Logs/LogSearch/LogSearchFullModal.tsx (about)

     1  // This file is part of MinIO Console Server
     2  // Copyright (c) 2021 MinIO, Inc.
     3  //
     4  // This program is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Affero General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // This program is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  // GNU Affero General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Affero General Public License
    15  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    16  
    17  import React, { Fragment } from "react";
    18  import { Button, Grid } from "mds";
    19  import get from "lodash/get";
    20  import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper";
    21  import { IReqInfoSearchResults } from "./types";
    22  import { LogSearchColumnLabels } from "./utils";
    23  
    24  interface ILogSearchFullModal {
    25    modalOpen: boolean;
    26    logSearchElement: IReqInfoSearchResults;
    27    onClose: () => void;
    28  }
    29  
    30  const LogSearchFullModal = ({
    31    modalOpen,
    32    logSearchElement,
    33    onClose,
    34  }: ILogSearchFullModal) => {
    35    const jsonItems = Object.keys(logSearchElement);
    36  
    37    return (
    38      <Fragment>
    39        <ModalWrapper
    40          modalOpen={modalOpen}
    41          title="Full Log Information"
    42          onClose={() => {
    43            onClose();
    44          }}
    45        >
    46          <Grid container>
    47            <Grid item xs={12}>
    48              <table>
    49                <tbody>
    50                  {jsonItems.map((objectKey: string, index: number) => (
    51                    <tr key={`logSearch-${index.toString()}`}>
    52                      <th
    53                        style={{
    54                          fontWeight: 700,
    55                          paddingRight: "10px",
    56                          textAlign: "left",
    57                        }}
    58                      >
    59                        {get(LogSearchColumnLabels, objectKey, `${objectKey}`)}
    60                      </th>
    61                      <td>{get(logSearchElement, objectKey, "")}</td>
    62                    </tr>
    63                  ))}
    64                </tbody>
    65              </table>
    66            </Grid>
    67            <Grid
    68              item
    69              xs={12}
    70              sx={{ display: "flex", justifyContent: "flex-end" }}
    71            >
    72              <Button
    73                id={"close-log-search"}
    74                variant="callAction"
    75                color="primary"
    76                onClick={onClose}
    77                label={"Close"}
    78              />
    79            </Grid>
    80          </Grid>
    81        </ModalWrapper>
    82      </Fragment>
    83    );
    84  };
    85  
    86  export default LogSearchFullModal;