// This file is part of MinIO Console Server
// Copyright (c) 2023 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
import React, { Fragment, useState } from "react";
import { Box, Link } from "@mui/material";
import { ClusterRegistered, FormTitle } from "./utils";
import { Button, CopyIcon, OfflineRegistrationIcon } from "mds";
import TooltipWrapper from "../Common/TooltipWrapper/TooltipWrapper";
import CopyToClipboard from "react-copy-to-clipboard";
import RegisterHelpBox from "./RegisterHelpBox";
import { AppState, useAppDispatch } from "../../../store";
import { useSelector } from "react-redux";
import CommentBoxWrapper from "../Common/FormComponents/CommentBoxWrapper/CommentBoxWrapper";
import useApi from "../Common/Hooks/useApi";
import { fetchLicenseInfo } from "./registerThunks";
import {
setErrorSnackMessage,
setServerNeedsRestart,
} from "../../../systemSlice";
const OfflineRegistration = () => {
const dispatch = useAppDispatch();
const subnetRegToken = useSelector(
(state: AppState) => state.register.subnetRegToken
);
const clusterRegistered = useSelector(
(state: AppState) => state.register.clusterRegistered
);
const licenseInfo = useSelector(
(state: AppState) => state.register.licenseInfo
);
const offlineRegUrl = `https://subnet.min.io/cluster/register?token=${subnetRegToken}`;
const [licenseKey, setLicenseKey] = useState("");
const [isSaving, invokeApplyLicenseApi] = useApi(
() => {
dispatch(fetchLicenseInfo());
dispatch(setServerNeedsRestart(true));
},
(err) => {
dispatch(setErrorSnackMessage(err));
}
);
const applyAirGapLicense = () => {
invokeApplyLicenseApi("PUT", `/api/v1/configs/subnet`, {
key_values: [{ key: "license", value: licenseKey }],
});
};
return (
{clusterRegistered && licenseInfo ? (
) : (
}
title={`Register cluster in an Air-gap environment`}
/>
Click on the link to register this cluster in SUBNET and
get a License Key for this Air-Gap deployment
Note: If this machine does not have internet connection,
Copy paste the following URL in a browser where you access
SUBNET and follow the instructions to complete the
registration