Skip to content

Commit 1f832fa

Browse files
bexsoftkaankabalak
andauthored
Connected Object details page to navigation (#394)
Connected Object details page to navigation schema. Also connected file details view with backend Co-authored-by: Kaan Kabalak <[email protected]>
1 parent be569ae commit 1f832fa

File tree

29 files changed

+1211
-58
lines changed

29 files changed

+1211
-58
lines changed

portal-ui/package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

portal-ui/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@types/lodash": "^4.14.149",
1414
"@types/node": "12.12.8",
1515
"@types/react": "16.9.11",
16+
"@types/react-copy-to-clipboard": "^4.3.0",
1617
"@types/react-dom": "16.9.4",
1718
"@types/react-redux": "^7.1.5",
1819
"@types/react-router": "^5.1.3",
@@ -35,6 +36,7 @@
3536
"react-async-hook": "^3.6.1",
3637
"react-chartjs-2": "^2.9.0",
3738
"react-codemirror2": "^7.1.0",
39+
"react-copy-to-clipboard": "^5.0.2",
3840
"react-dom": "^16.12.0",
3941
"react-hot-loader": "^4.13.0",
4042
"react-moment": "^0.9.7",

portal-ui/src/icons/CopyIcon.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This file is part of MinIO Console Server
2+
// Copyright (c) 2020 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 from "react";
18+
import { SvgIcon } from "@material-ui/core";
19+
class CopyIcon extends React.Component {
20+
render() {
21+
return (
22+
<SvgIcon>
23+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
24+
<title>ic_h_copy-new_sl</title>
25+
<g id="Layer_2" data-name="Layer 2">
26+
<g id="Layer_1-2" data-name="Layer 1">
27+
<path
28+
className="cls-1"
29+
d="M0,0V16H16V0ZM11.886,9.048H9.048v2.838h-2.1V9.048H4.114v-2.1H6.952V4.114h2.1V6.952h2.838Z"
30+
/>
31+
</g>
32+
</g>
33+
</svg>
34+
</SvgIcon>
35+
);
36+
}
37+
}
38+
39+
export default CopyIcon;

portal-ui/src/icons/DeleteIcon.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,20 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import React from "react";
18-
import {SvgIcon} from "@material-ui/core";
18+
import { SvgIcon } from "@material-ui/core";
1919
class DeleteIcon extends React.Component {
20-
render() {
21-
return (<SvgIcon>
22-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
23-
<title>ic_h_delete</title>
24-
<g id="Layer_2" data-name="Layer 2">
25-
<g id="Layer_1-2" data-name="Layer 1">
26-
<path className="cls-1"
27-
d="M0,8H0a8,8,0,0,0,8,8H8a8,8,0,0,0,8-8h0A8,8,0,0,0,8,0H8A8,8,0,0,0,0,8Zm10.007,3.489L8,9.482,5.993,11.489,4.511,10.007,6.518,8,4.511,5.993,5.993,4.511,8,6.518l2.007-2.007,1.482,1.482L9.482,8l2.007,2.007Z"/>
28-
</g>
29-
</g>
30-
</svg>
31-
</SvgIcon>)
32-
}
20+
render() {
21+
return (
22+
<SvgIcon>
23+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10.402 13">
24+
<path
25+
d="M6.761 1V0H3.64v1H.004v1h10.4V1zM.004 2.998l1.672 10h7.052l1.673-10zm3.412 8.243l-.552-6.478h.653l.553 6.472zm3.569 0h-.653l.551-6.472h.654z"
26+
className="a"
27+
></path>
28+
</svg>
29+
</SvgIcon>
30+
);
31+
}
3332
}
3433

3534
export default DeleteIcon;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This file is part of MinIO Console Server
2+
// Copyright (c) 2020 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 from "react";
18+
import SvgIcon from "@material-ui/core/SvgIcon";
19+
20+
class DownloadIcon extends React.Component {
21+
render() {
22+
return (
23+
<SvgIcon>
24+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 12.996">
25+
<path d="M11.05 9.096v1.95h-9.1v-1.95H0v3.9h13v-3.9z"></path>
26+
<path d="M6.5 9.75L9 6.672H7.475V0h-1.95v6.672H4z"></path>
27+
</svg>
28+
</SvgIcon>
29+
);
30+
}
31+
}
32+
33+
export default DownloadIcon;

portal-ui/src/icons/ShareIcon.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This file is part of MinIO Console Server
2+
// Copyright (c) 2020 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 from "react";
18+
import SvgIcon from "@material-ui/core/SvgIcon";
19+
20+
class ShareIcon extends React.Component {
21+
render() {
22+
return (
23+
<SvgIcon>
24+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13">
25+
<path
26+
d="M11.05 8.617v2.429h-9.1v-9.1h2.429v-1.95H0v13h13V8.617z"
27+
className="a"
28+
></path>
29+
<path
30+
d="M3.854 9.256h1.95a4.945 4.945 0 013.6-4.74v1.3l.6-.487 2.474-2.012L9.4.817v1.7a6.9 6.9 0 00-5.546 6.739z"
31+
className="a"
32+
></path>
33+
</svg>
34+
</SvgIcon>
35+
);
36+
}
37+
}
38+
39+
export default ShareIcon;

portal-ui/src/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
export { default as PermissionIcon } from "./PermissionIcon";
18+
export { default as CopyIcon } from "./CopyIcon";
1819
export { default as CreateIcon } from "./CreateIcon";
1920
export { default as DeleteIcon } from "./DeleteIcon";
2021
export { default as ServiceAccountIcon } from "./ServiceAccountIcon";

portal-ui/src/screens/Console/Buckets/ListBuckets/AddBucket.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ const AddBucket = ({
221221
addBucketVersioned(event.target.checked);
222222
}}
223223
label={"Versioning"}
224-
indicatorLabel={"On"}
224+
indicatorLabels={["On", "Off"]}
225225
/>
226226
</Grid>
227227
<Grid item xs={12}>
@@ -234,7 +234,7 @@ const AddBucket = ({
234234
addBucketQuota(event.target.checked);
235235
}}
236236
label={"Enable Bucket Quota"}
237-
indicatorLabel={"On"}
237+
indicatorLabels={["On", "Off"]}
238238
/>
239239
</Grid>
240240
{enableQuota && (

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ListObjects/ListObjects.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const styles = (theme: Theme) =>
129129
interface IListObjectsProps {
130130
classes: any;
131131
match: any;
132-
addRoute: (param1: string, param2: string) => any;
132+
addRoute: (param1: string, param2: string, param3: string) => any;
133133
setAllRoutes: (path: string) => any;
134134
routesList: Route[];
135135
}
@@ -319,13 +319,16 @@ const ListObjects = ({
319319
const lastIndex = idElementClean.length - 1;
320320
const newPath = `${currentPath}/${idElementClean[lastIndex]}`;
321321

322-
addRoute(newPath, idElementClean[lastIndex]);
322+
addRoute(newPath, idElementClean[lastIndex], "path");
323323
return;
324324
}
325-
326325
// Element is a file. we open details here
327-
// TODO: Add details open function here.
328-
//console.log("object", idElementClean);
326+
const pathInArray = idElement.split("/");
327+
const fileName = pathInArray[pathInArray.length - 1];
328+
const newPath = `${currentPath}/${fileName}`;
329+
330+
addRoute(newPath, fileName, "file");
331+
return;
329332
};
330333

331334
const uploadObject = (e: any): void => {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React, { useEffect, useState } from "react";
2+
import ListObjects from "./ListObjects";
3+
import ObjectDetails from "../ObjectDetails/ObjectDetails";
4+
import get from "lodash/get";
5+
import { addRoute, setAllRoutes } from "../../../../ObjectBrowser/actions";
6+
import { connect } from "react-redux";
7+
import { withRouter } from "react-router-dom";
8+
import { ObjectBrowserState, Route } from "../../../../ObjectBrowser/reducers";
9+
10+
interface ObjectBrowserReducer {
11+
objectBrowser: ObjectBrowserState;
12+
}
13+
14+
interface ObjectRoutingProps {
15+
routesList: Route[];
16+
match: any;
17+
}
18+
19+
const ObjectRouting = ({ routesList, match }: ObjectRoutingProps) => {
20+
const currentItem = routesList[routesList.length - 1];
21+
22+
useEffect(() => {
23+
const url = get(match, "url", "/object-browser");
24+
25+
if (url !== routesList[routesList.length - 1].route) {
26+
setAllRoutes(url);
27+
}
28+
}, [match, routesList, setAllRoutes]);
29+
30+
return currentItem.type === "path" ? (
31+
<ListObjects />
32+
) : (
33+
<ObjectDetails routesList={routesList} />
34+
);
35+
};
36+
37+
const mapStateToProps = ({ objectBrowser }: ObjectBrowserReducer) => ({
38+
routesList: get(objectBrowser, "routesList", []),
39+
});
40+
41+
const mapDispatchToProps = (dispatch: any) => {
42+
return {
43+
dispatchSetAllRoutes: (route: string) => dispatch(setAllRoutes(route)),
44+
};
45+
};
46+
47+
const connector = connect(mapStateToProps, mapDispatchToProps);
48+
49+
export default withRouter(connector(ObjectRouting));

0 commit comments

Comments
 (0)