Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connected filters for bucket details sections #801

Merged
merged 3 commits into from
Jun 9, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ const BucketEventsPanel = ({

const tableActions = [{ type: "delete", onClick: confirmDeleteEvent }];

const filteredRecords = records.filter((item: BucketEvent) => {
if(item.arn.toLowerCase().includes(filter.toLowerCase())) {
return true;
}
return false;
});

return (
<Fragment>
{deleteOpen && (
Expand Down Expand Up @@ -170,7 +177,7 @@ const BucketEventsPanel = ({
{ label: "Suffix", elementKey: "suffix" },
]}
isLoading={loadingEvents}
records={records}
records={filteredRecords}
entityName="Events"
idField="id"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const BucketLifecyclePanel = ({
const [lifecycleRecords, setLifecycleRecords] = useState<LifeCycleItem[]>([]);
const [addLifecycleOpen, setAddLifecycleOpen] = useState<boolean>(false);
const [editLifecycleOpen, setEditLifecycleOpen] = useState<boolean>(false);
const [filter, setFilter] = useState<string>("");

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

Expand Down Expand Up @@ -153,6 +154,16 @@ const BucketLifecyclePanel = ({
},
];

const filteredRecords = lifecycleRecords.filter(
(item: LifeCycleItem) => {
if (item.id.toLocaleLowerCase().includes(filter.toLowerCase()))
{
return true;
}
return false;
}
);

return (
<Fragment>
{editLifecycleOpen && (
Expand Down Expand Up @@ -180,7 +191,7 @@ const BucketLifecyclePanel = ({
id="search-resource"
label=""
onChange={(event) => {
// setFilter(event.target.value);
setFilter(event.target.value);
}}
InputProps={{
disableUnderline: true,
Expand Down Expand Up @@ -211,7 +222,7 @@ const BucketLifecyclePanel = ({
itemActions={[]}
columns={lifecycleColumns}
isLoading={loadingLifecycle}
records={lifecycleRecords}
records={filteredRecords}
entityName="Lifecycle"
customEmptyMessage="There are no Lifecycle rules yet"
idField="id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const BucketReplicationPanel = ({
useState<boolean>(false);
const [openSetReplication, setOpenSetReplication] = useState<boolean>(false);
const [selectedRRule, setSelectedRRule] = useState<string>("");
const [filter, setFilter] = useState<string>("");

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

Expand Down Expand Up @@ -185,6 +186,19 @@ const BucketReplicationPanel = ({
},
];

const filteredRecords = replicationRules.filter(
(item: BucketReplicationRule) => {
if (
(item.prefix &&
item.prefix.toLowerCase().includes(filter.toLowerCase())) ||
(item.tags && item.tags.toLowerCase().includes(filter.toLowerCase()))
) {
return true;
}
return false;
}
);

return (
<Fragment>
{openSetReplication && (
Expand All @@ -211,7 +225,7 @@ const BucketReplicationPanel = ({
id="search-resource"
label=""
onChange={(event) => {
// setFilter(event.target.value);
setFilter(event.target.value);
}}
InputProps={{
disableUnderline: true,
Expand Down Expand Up @@ -274,7 +288,7 @@ const BucketReplicationPanel = ({
{ label: "Status", elementKey: "status" },
]}
isLoading={loadingReplication}
records={replicationRules}
records={filteredRecords}
entityName="Replication Rules"
idField="id"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import React, { Fragment, useEffect, useState } from "react";
import { connect } from "react-redux";
import get from "lodash/get";
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
import {
actionsTray,
Expand All @@ -28,29 +27,15 @@ import {
} from "../../Common/FormComponents/common/styleLibrary";
import Grid from "@material-ui/core/Grid";
import {
Button,
IconButton,
Menu,
MenuItem,
TextField,
} from "@material-ui/core";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
import TableWrapper from "../../Common/TableWrapper/TableWrapper";
import Paper from "@material-ui/core/Paper";
import api from "../../../../common/api";
import PageHeader from "../../Common/PageHeader/PageHeader";
import { ILog, ITenant } from "../ListTenants/types";
import { LicenseInfo } from "../../License/types";
import { Link } from "react-router-dom";
import { setErrorSnackMessage } from "../../../../actions";
import MoreVertIcon from "@material-ui/icons/MoreVert";
import TenantYAML from "./TenantYAML";
import SubnetLicenseTenant from "./SubnetLicenseTenant";
import InputAdornment from "@material-ui/core/InputAdornment";
import SearchIcon from "@material-ui/icons/Search";
import history from "../../../../history";
import { LogMessage } from "../../Logs/types";

interface ITenantDetailsProps {
classes: any;
Expand Down Expand Up @@ -165,8 +150,6 @@ const TenantDetails = ({
match,
setErrorSnackMessage,
}: ITenantDetailsProps) => {
const [selectedTab, setSelectedTab] = useState<number>(0);
const [log, setLog] = useState<string>("");
const [highlight, setHighlight] = useState<string>("");
const [logLines, setLogLines] = useState<string[]>([]);
const tenantNamespace = match.params["tenantNamespace"];
Expand Down Expand Up @@ -225,13 +208,12 @@ const TenantDetails = ({
`/api/v1/namespaces/${tenantNamespace}/tenants/${tenantName}/pods/${podName}`
)
.then((res: string) => {
setLog(res);
setLogLines(res.split("\n"));
})
.catch((err) => {
setErrorSnackMessage(err);
});
}, [tenantNamespace, tenantName, podName]);
}, [tenantNamespace, tenantName, podName, setErrorSnackMessage]);

return (
<React.Fragment>
Expand Down