github.com/minio/console@v1.4.1/web-app/src/screens/AnonymousAccess/AnonymousAccess.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, { Fragment, Suspense } from "react";
    18  import { ApplicationLogo, Button } from "mds";
    19  import { Route, Routes } from "react-router-dom";
    20  import { IAM_PAGES } from "../../common/SecureComponent/permissions";
    21  import { resetSession } from "../Console/consoleSlice";
    22  import { useAppDispatch } from "../../store";
    23  import { resetSystem } from "../../systemSlice";
    24  import { getLogoVar } from "../../config";
    25  import ObjectBrowser from "../Console/ObjectBrowser/ObjectBrowser";
    26  import LoadingComponent from "../../common/LoadingComponent";
    27  import ObjectManager from "../Console/Common/ObjectManager/ObjectManager";
    28  import ObjectManagerButton from "../Console/Common/ObjectManager/ObjectManagerButton";
    29  
    30  const AnonymousAccess = () => {
    31    const dispatch = useAppDispatch();
    32  
    33    return (
    34      <Fragment>
    35        <div
    36          style={{
    37            background:
    38              "linear-gradient(90deg, rgba(16,47,81,1) 0%, rgba(13,28,64,1) 100%)",
    39            height: 100,
    40            width: "100%",
    41            alignItems: "center",
    42            display: "flex",
    43            paddingLeft: 16,
    44            paddingRight: 16,
    45          }}
    46        >
    47          <div style={{ width: 200, flexShrink: 1 }}>
    48            <ApplicationLogo
    49              applicationName={"console"}
    50              subVariant={getLogoVar()}
    51              inverse={true}
    52            />
    53          </div>
    54          <div style={{ flexGrow: 1 }}></div>
    55          <div style={{ flexShrink: 1, display: "flex", flexDirection: "row" }}>
    56            <Button
    57              id={"go-to-login"}
    58              variant={"text"}
    59              onClick={() => {
    60                dispatch(resetSession());
    61                dispatch(resetSystem());
    62              }}
    63              sx={{ color: "white", textTransform: "initial" }}
    64            >
    65              Login
    66            </Button>
    67            <ObjectManagerButton />
    68          </div>
    69        </div>
    70  
    71        <Suspense fallback={<LoadingComponent />}>
    72          <ObjectManager />
    73        </Suspense>
    74        <Routes>
    75          <Route
    76            path={`${IAM_PAGES.OBJECT_BROWSER_VIEW}/*`}
    77            element={
    78              <Suspense fallback={<LoadingComponent />}>
    79                <ObjectBrowser />
    80              </Suspense>
    81            }
    82          />
    83        </Routes>
    84      </Fragment>
    85    );
    86  };
    87  export default AnonymousAccess;