Fixes for license page (#620)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -31,6 +31,8 @@ import { LicenseInfo } from "./types";
|
|||||||
import { LinearProgress } from "@material-ui/core";
|
import { LinearProgress } from "@material-ui/core";
|
||||||
import { AppState } from "../../../store";
|
import { AppState } from "../../../store";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { niceBytes } from "../../../common/utils";
|
||||||
|
import Moment from "react-moment";
|
||||||
|
|
||||||
const mapState = (state: AppState) => ({
|
const mapState = (state: AppState) => ({
|
||||||
operatorMode: state.system.operatorMode,
|
operatorMode: state.system.operatorMode,
|
||||||
@@ -260,7 +262,16 @@ const License = ({ classes, operatorMode }: ILicenseProps) => {
|
|||||||
api
|
api
|
||||||
.invoke("GET", `/api/v1/subscription/info`)
|
.invoke("GET", `/api/v1/subscription/info`)
|
||||||
.then((res: LicenseInfo) => {
|
.then((res: LicenseInfo) => {
|
||||||
setLicenseInfo(res);
|
if (res) {
|
||||||
|
if (res.plan === "STANDARD") {
|
||||||
|
setCurrentPlanID(1);
|
||||||
|
} else if (res.plan === "ENTERPRISE") {
|
||||||
|
setCurrentPlanID(2);
|
||||||
|
} else {
|
||||||
|
setCurrentPlanID(1);
|
||||||
|
}
|
||||||
|
setLicenseInfo(res);
|
||||||
|
}
|
||||||
setLoadingLicenseInfo(false);
|
setLoadingLicenseInfo(false);
|
||||||
})
|
})
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
@@ -273,6 +284,7 @@ const License = ({ classes, operatorMode }: ILicenseProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const [licenseInfo, setLicenseInfo] = useState<LicenseInfo>();
|
const [licenseInfo, setLicenseInfo] = useState<LicenseInfo>();
|
||||||
|
const [currentPlanID, setCurrentPlanID] = useState<number>(0);
|
||||||
const [loadingLicenseInfo, setLoadingLicenseInfo] = useState<boolean>(true);
|
const [loadingLicenseInfo, setLoadingLicenseInfo] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -286,7 +298,6 @@ const License = ({ classes, operatorMode }: ILicenseProps) => {
|
|||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let currentPlanID = 0;
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@@ -348,7 +359,10 @@ const License = ({ classes, operatorMode }: ILicenseProps) => {
|
|||||||
gutterBottom
|
gutterBottom
|
||||||
className={classes.licenseInfoValue}
|
className={classes.licenseInfoValue}
|
||||||
>
|
>
|
||||||
{licenseInfo.storage_capacity}
|
{niceBytes(
|
||||||
|
(licenseInfo.storage_capacity * 1099511627776) // 1 Terabyte = 1099511627776 Bytes
|
||||||
|
.toString(10)
|
||||||
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
variant="button"
|
variant="button"
|
||||||
@@ -364,7 +378,7 @@ const License = ({ classes, operatorMode }: ILicenseProps) => {
|
|||||||
gutterBottom
|
gutterBottom
|
||||||
className={classes.licenseInfoValue}
|
className={classes.licenseInfoValue}
|
||||||
>
|
>
|
||||||
{licenseInfo.expires_at}
|
<Moment>{licenseInfo.expires_at}</Moment>
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6}>
|
<Grid item xs={6}>
|
||||||
|
|||||||
Reference in New Issue
Block a user