Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 152 additions & 106 deletions portal-ui/bindata_assetfs.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion portal-ui/src/ProtectedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ProtectedRoute = ({
}
})
.catch(() => setSessionLoading(false));
}, [saveSessionResponse]);
}, [saveSessionResponse, consoleOperatorMode, userLoggedIn]);

// if we still trying to retrieve user session render nothing
if (sessionLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import React, { useState, useEffect } from "react";
import React, { useEffect, useState } from "react";
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
import Grid from "@material-ui/core/Grid";
import TextField from "@material-ui/core/TextField";
Expand All @@ -33,7 +33,6 @@ import {
searchField,
} from "../../../../Common/FormComponents/common/styleLibrary";
import PageHeader from "../../../../Common/PageHeader/PageHeader";
import storage from "local-storage-fallback";
import { isNullOrUndefined } from "util";
import { Button, Input } from "@material-ui/core";
import * as reactMoment from "react-moment";
Expand Down Expand Up @@ -166,6 +165,29 @@ const ListObjects = ({
const bucketName = match.params["bucket"];
const internalPaths = match.params[0];

const verifyIfIsFile = () => {
const bucketName = match.params["bucket"];
const internalPaths = match.params[0];

api
.invoke(
"GET",
`/api/v1/buckets/${bucketName}/objects?prefix=${internalPaths}`
)
.then((res: BucketObjectsList) => {
//It is a file since it has elements in the object, setting file flag and waiting for component mount
if (res.objects !== null) {
setLastAsFile();
} else {
// It is a folder, we remove loader
setLoading(false);
}
})
.catch((err: any) => {
setLoading(false);
});
};

let extraPath = "";
if (internalPaths) {
extraPath = `?prefix=${internalPaths}/`;
Expand All @@ -186,7 +208,7 @@ const ListObjects = ({
.catch((err: any) => {
setLoading(false);
});
}, [loading, match]);
}, [loading, match, setLastAsFile]);

useEffect(() => {
const url = get(match, "url", "/object-browser");
Expand All @@ -195,29 +217,6 @@ const ListObjects = ({
}
}, [match, routesList, setAllRoutes]);

const verifyIfIsFile = () => {
const bucketName = match.params["bucket"];
const internalPaths = match.params[0];

api
.invoke(
"GET",
`/api/v1/buckets/${bucketName}/objects?prefix=${internalPaths}`
)
.then((res: BucketObjectsList) => {
//It is a file since it has elements in the object, setting file flag and waiting for component mount
if (res.objects !== null) {
setLastAsFile();
} else {
// It is a folder, we remove loader
setLoading(false);
}
})
.catch((err: any) => {
setLoading(false);
});
};

const closeDeleteModalAndRefresh = (refresh: boolean) => {
setDeleteOpen(false);

Expand Down Expand Up @@ -245,7 +244,6 @@ const ListObjects = ({
if (isNullOrUndefined(e) || isNullOrUndefined(e.target)) {
return;
}
const token: string = storage.getItem("token")!;
e.preventDefault();
let file = e.target.files[0];
const fileName = file.name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const ObjectDetails = ({
setLoadObjectData(false);
});
}
}, [loadObjectData]);
}, [loadObjectData, bucketName, pathInBucket]);

let tagKeys: string[] = [];

Expand Down Expand Up @@ -341,6 +341,11 @@ const ObjectDetails = ({
)}
<Grid container>
<Grid item xs={12} className={classes.container}>
{error !== "" && (
<Grid item xs={12}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the correct class name for error message

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how we display errors in so many places XD do we have a component for errors?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, but right now we are using a class called errorBlock

{error}
</Grid>
)}
<Grid item xs={12} className={classes.obTitleSection}>
<div>
<BrowserBreadcrumbs />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const SetLegalHoldModal = ({
useEffect(() => {
const status = get(actualInfo, "legal_hold_status", "OFF");
setLegalHoldEnabled(status === "ON");
}, []);
}, [actualInfo]);

const onSubmit = (e: React.FormEvent) => {
e.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const SetRetention = ({
setType(objectInfo.retention_mode.toLowerCase());
setAlreadyConfigured(true);
}
}, []);
}, [objectInfo]);

const dateElement = useRef<IRefObject>(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ const ShareFile = ({
bucketName,
dataObject,
}: IShareFileProps) => {
const [shareURL, setShareURL] = useState("");
const [isLoadingFile, setIsLoadingFile] = useState(false);
const [error, setError] = useState("");
const [selectedDate, setSelectedDate] = useState("");
const [dateValid, setDateValid] = useState(true);
const [openSnack, setOpenSnack] = useState(false);
const [snackBarMessage, setSnackbarMessage] = useState("");
const [shareURL, setShareURL] = useState<string>("");
const [isLoadingFile, setIsLoadingFile] = useState<boolean>(false);
const [error, setError] = useState<string>("");
const [selectedDate, setSelectedDate] = useState<string>("");
const [dateValid, setDateValid] = useState<boolean>(true);
const [openSnack, setOpenSnack] = useState<boolean>(false);
const [snackBarMessage, setSnackbarMessage] = useState<string>("");

const showSnackBarMessage = (text: string) => {
setSnackbarMessage(text);
Expand All @@ -66,13 +66,13 @@ const ShareFile = ({
setSelectedDate(newDate);
return;
}
setShareURL("");
setSelectedDate("");
};

useEffect(() => {
if (dateValid) {
setIsLoadingFile(true);
setShareURL("");

const slDate = new Date(`${selectedDate}T23:59:59`);
const currDate = new Date();
Expand Down Expand Up @@ -116,9 +116,7 @@ const ShareFile = ({
});
return;
}

setShareURL("");
}, [dataObject, selectedDate]);
}, [dataObject, selectedDate, bucketName, dateValid, setShareURL]);

const snackBarAction = (
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const SetAccessPolicy = ({

useEffect(() => {
setAccessPolicy(actualPolicy);
}, []);
}, [setAccessPolicy, actualPolicy]);

return (
<ModalWrapper
Expand Down
22 changes: 16 additions & 6 deletions portal-ui/src/screens/Console/Buckets/ViewBucket/ViewBucket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ const ViewBucket = ({ classes, match }: IViewBucketProps) => {
const [isVersioned, setIsVersioned] = useState<boolean>(false);
const [encryptionEnabled, setEncryptionEnabled] = useState<boolean>(false);

const fetchEvents = () => {
const fetchEvents = useCallback(() => {
setLoadingBucket(true);
const bucketName = match.params["bucketName"];
api
Expand Down Expand Up @@ -263,7 +263,7 @@ const ViewBucket = ({ classes, match }: IViewBucketProps) => {
.catch((err: any) => {
setError(err);
});
};
}, [match]);

const fetchBucketsSize = useCallback(() => {
const bucketName = match.params["bucketName"];
Expand All @@ -287,7 +287,7 @@ const ViewBucket = ({ classes, match }: IViewBucketProps) => {
setLoadingSize(false);
setErrorSize(err);
});
}, []);
}, [match]);

const loadInfo = useCallback(() => {
const bucketName = match.params["bucketName"];
Expand All @@ -305,7 +305,7 @@ const ViewBucket = ({ classes, match }: IViewBucketProps) => {
});
}, [match]);

const fetchBucketEncryptionInfo = () => {
const fetchBucketEncryptionInfo = useCallback(() => {
const bucketName = match.params["bucketName"];
api
.invoke("GET", `/api/v1/buckets/${bucketName}/encryption/info`)
Expand All @@ -317,7 +317,7 @@ const ViewBucket = ({ classes, match }: IViewBucketProps) => {
.catch((err) => {
console.log(err);
});
};
}, [match]);

const closeAddModalAndRefresh = () => {
setAccessPolicyScreenOpen(false);
Expand All @@ -336,7 +336,7 @@ const ViewBucket = ({ classes, match }: IViewBucketProps) => {
fetchEvents();
fetchBucketsSize();
fetchBucketEncryptionInfo();
}, [loadInfo]);
}, [loadInfo, fetchEvents, fetchBucketsSize, fetchBucketEncryptionInfo]);

const bucketName = match.params["bucketName"];

Expand Down Expand Up @@ -439,6 +439,16 @@ const ViewBucket = ({ classes, match }: IViewBucketProps) => {
{error}
</Grid>
)}
{errBucket !== "" && (
<Grid item xs={12}>
{errBucket}
</Grid>
)}
{errorSize !== "" && (
<Grid item xs={12}>
{errorSize}
</Grid>
)}
<Grid item xs={12} className={classes.container}>
<Grid item xs={12}>
<div className={classes.headerContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const DateSelector = forwardRef(
useEffect(() => {
const [isValid, dateString] = validDate(year, month, day);
onDateChange(dateString, isValid);
}, [month, day, year]);
}, [month, day, year, onDateChange]);

const resetDate = () => {
setMonth("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@ const initialConfiguration = {
};

const ConfigurationsList = ({ classes }: IListConfiguration) => {
const [editScreenOpen, setEditScreenOpen] = useState(false);
const [selectedConfiguration, setSelectedConfiguration] = useState(
initialConfiguration
);
const [filter, setFilter] = useState("");
const [currentConfiguration, setCurrentConfiguration] = useState<number>(0);

const tableActions = [
Expand All @@ -92,13 +90,6 @@ const ConfigurationsList = ({ classes }: IListConfiguration) => {
},
];

const filteredRecords: IConfigurationElement[] = configurationElements.filter(
(elementItem) =>
elementItem.configuration_id
.toLocaleLowerCase()
.includes(filter.toLocaleLowerCase())
);

const backToInitialConfig = () => {
setCurrentConfiguration(0);
setSelectedConfiguration(initialConfiguration);
Expand All @@ -125,7 +116,7 @@ const ConfigurationsList = ({ classes }: IListConfiguration) => {
},
]}
isLoading={false}
records={filteredRecords}
records={configurationElements}
entityName="Configurations"
idField="configuration_id"
customPaperHeight={classes.customConfigurationPage}
Expand Down
1 change: 0 additions & 1 deletion portal-ui/src/screens/Console/Console.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import api from "../../common/api";
import Account from "./Account/Account";
import Users from "./Users/Users";
import Groups from "./Groups/Groups";
import ListNotificationEndpoints from "./Configurations/NotificationEndpoints/ListNotificationEndpoints";
import ConfigurationMain from "./Configurations/ConfigurationMain";
import WebhookPanel from "./Configurations/ConfigurationPanels/WebhookPanel";
import ListTenants from "./Tenants/ListTenants/ListTenants";
Expand Down
3 changes: 1 addition & 2 deletions portal-ui/src/screens/Console/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ import {
DashboardIcon,
GroupsIcon,
IAMPoliciesIcon,
LambdaNotificationsIcon,
MirroringIcon,
ServiceAccountsIcon,
TraceIcon,
UsersIcon,
WarpIcon,
TraceIcon,
} from "../../../icons";
import { clearSession } from "../../../common/utils";
import LicenseIcon from "../../../icons/LicenseIcon";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const BrowseBuckets = ({

useEffect(() => {
resetRoutesList(true);
}, [match]);
}, [match, resetRoutesList]);

useEffect(() => {
if (loading) {
Expand Down
2 changes: 1 addition & 1 deletion portal-ui/src/screens/Console/Policies/AddPolicy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const AddPolicy = ({
policyEdit ? JSON.stringify(JSON.parse(policyEdit.policy), null, 4) : ""
);
}
}, []);
}, [policyEdit]);

const resetForm = () => {
setPolicyName("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import React, { useState, useEffect } from "react";
import React, { useEffect, useState } from "react";
import get from "lodash/get";
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
import {
containerForHeader,
modalBasic,
} from "../../Common/FormComponents/common/styleLibrary";
import Grid from "@material-ui/core/Grid";
import { Button, IconButton } from "@material-ui/core";
import { Button } from "@material-ui/core";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
import { CreateIcon } from "../../../../icons";
Expand All @@ -33,7 +33,7 @@ import AddPoolModal from "./AddPoolModal";
import AddBucket from "../../Buckets/ListBuckets/AddBucket";
import ReplicationSetup from "./ReplicationSetup";
import api from "../../../../common/api";
import { ITenant, IPool } from "../ListTenants/types";
import { IPool, ITenant } from "../ListTenants/types";
import PageHeader from "../../Common/PageHeader/PageHeader";
import UsageBarWrapper from "../../Common/UsageBarWrapper/UsageBarWrapper";
import UpdateTenantModal from "./UpdateTenantModal";
Expand Down
Loading