github.com/minio/console@v1.4.1/web-app/src/screens/Console/Buckets/VersioningInfo.tsx (about)

     1  // This file is part of MinIO Console Server
     2  // Copyright (c) 2023 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 from "react";
    18  import { DisabledIcon, EnabledIcon, Box } from "mds";
    19  import { BucketVersioningResponse } from "api/consoleApi";
    20  import LabelWithIcon from "./BucketDetails/SummaryItems/LabelWithIcon";
    21  
    22  const VersioningInfo = ({
    23    versioningState = {},
    24  }: {
    25    versioningState?: BucketVersioningResponse;
    26  }) => {
    27    return (
    28      <Box
    29        sx={{
    30          display: "flex",
    31          flexDirection: "column",
    32          gap: 2,
    33        }}
    34      >
    35        <Box sx={{ fontWeight: "medium", display: "flex", gap: 2 }}>
    36          {versioningState.excludeFolders ? (
    37            <LabelWithIcon
    38              icon={
    39                versioningState.excludeFolders ? (
    40                  <EnabledIcon style={{ color: "green" }} />
    41                ) : (
    42                  <DisabledIcon />
    43                )
    44              }
    45              label={
    46                <label style={{ textDecoration: "normal" }}>
    47                  Exclude Folders
    48                </label>
    49              }
    50            />
    51          ) : null}
    52        </Box>
    53        {versioningState.excludedPrefixes?.length ? (
    54          <Box
    55            sx={{
    56              fontWeight: "medium",
    57              display: "flex",
    58              justifyItems: "end",
    59              placeItems: "flex-start",
    60              flexDirection: "column",
    61              gap: 1,
    62            }}
    63          >
    64            <Box>Excluded Prefixes :</Box>
    65            <div
    66              style={{
    67                maxHeight: "200px",
    68                overflowY: "auto",
    69                placeItems: "flex-start",
    70                justifyItems: "end",
    71                flexDirection: "column",
    72                display: "flex",
    73              }}
    74            >
    75              {versioningState.excludedPrefixes?.map((it) => (
    76                <div>
    77                  <strong>{it.prefix}</strong>
    78                </div>
    79              ))}
    80            </div>
    81          </Box>
    82        ) : null}
    83      </Box>
    84    );
    85  };
    86  
    87  export default VersioningInfo;