23 | );
24 | }
25 | }
26 |
27 | export default ObjectDeleteModal;
28 |
--------------------------------------------------------------------------------
/font-awesome/scss/_path.scss:
--------------------------------------------------------------------------------
1 | /* FONT PATH
2 | * -------------------------- */
3 |
4 | @font-face {
5 | font-family: 'FontAwesome';
6 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}');
7 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'),
8 | url('#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}') format('woff2'),
9 | url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'),
10 | url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'),
11 | url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg');
12 | // src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts
13 | font-weight: normal;
14 | font-style: normal;
15 | }
16 |
--------------------------------------------------------------------------------
/src/browser/js/jest/setup.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import "jest-enzyme"
18 | import { configure } from "enzyme"
19 | import Adapter from "enzyme-adapter-react-16"
20 |
21 | configure({ adapter: new Adapter() })
22 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use Node.js version 18 on Debian Bullseye
2 | FROM node:18-bullseye
3 |
4 | # The /app directory should act as the main application directory
5 | WORKDIR /app
6 |
7 | # Copy the app package and package-lock.json file
8 | COPY package*.json ./
9 |
10 | # Install node packages
11 | RUN npm install --ignore-scripts
12 |
13 | # Copy Webpack configuration, Babel configuration, and source files
14 | COPY webpack.config.js .babelrc ./
15 | COPY ./src ./src
16 |
17 |
18 | # Install the `serve` package globally to run the application
19 | RUN npm install -g serve
20 |
21 | # Set the environment variable to resolve the OpenSSL issue
22 | ENV NODE_OPTIONS=--openssl-legacy-provider
23 |
24 | # Build the app
25 | RUN npm run build
26 |
27 | # Expose the port (example: 3000)
28 | EXPOSE 3000
29 |
30 | # Start the app using the `serve` command
31 | CMD ["serve", "-s", "site"]
--------------------------------------------------------------------------------
/font-awesome/less/animated.less:
--------------------------------------------------------------------------------
1 | // Animated Icons
2 | // --------------------------
3 |
4 | .@{fa-css-prefix}-spin {
5 | -webkit-animation: fa-spin 2s infinite linear;
6 | animation: fa-spin 2s infinite linear;
7 | }
8 |
9 | .@{fa-css-prefix}-pulse {
10 | -webkit-animation: fa-spin 1s infinite steps(8);
11 | animation: fa-spin 1s infinite steps(8);
12 | }
13 |
14 | @-webkit-keyframes fa-spin {
15 | 0% {
16 | -webkit-transform: rotate(0deg);
17 | transform: rotate(0deg);
18 | }
19 | 100% {
20 | -webkit-transform: rotate(359deg);
21 | transform: rotate(359deg);
22 | }
23 | }
24 |
25 | @keyframes fa-spin {
26 | 0% {
27 | -webkit-transform: rotate(0deg);
28 | transform: rotate(0deg);
29 | }
30 | 100% {
31 | -webkit-transform: rotate(359deg);
32 | transform: rotate(359deg);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/font-awesome/scss/_animated.scss:
--------------------------------------------------------------------------------
1 | // Spinning Icons
2 | // --------------------------
3 |
4 | .#{$fa-css-prefix}-spin {
5 | -webkit-animation: fa-spin 2s infinite linear;
6 | animation: fa-spin 2s infinite linear;
7 | }
8 |
9 | .#{$fa-css-prefix}-pulse {
10 | -webkit-animation: fa-spin 1s infinite steps(8);
11 | animation: fa-spin 1s infinite steps(8);
12 | }
13 |
14 | @-webkit-keyframes fa-spin {
15 | 0% {
16 | -webkit-transform: rotate(0deg);
17 | transform: rotate(0deg);
18 | }
19 | 100% {
20 | -webkit-transform: rotate(359deg);
21 | transform: rotate(359deg);
22 | }
23 | }
24 |
25 | @keyframes fa-spin {
26 | 0% {
27 | -webkit-transform: rotate(0deg);
28 | transform: rotate(0deg);
29 | }
30 | 100% {
31 | -webkit-transform: rotate(359deg);
32 | transform: rotate(359deg);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/browser/img/more-h-light.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/browser/js/history.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import createHistory from "history/createHashHistory";
18 | import { minioBrowserPrefix } from "./constants";
19 |
20 | const history = createHistory({
21 | basename: minioBrowserPrefix
22 | });
23 |
24 | export default history;
25 |
--------------------------------------------------------------------------------
/src/browser/js/browser/__tests__/Host.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | import React from "react"
19 | import { shallow } from "enzyme"
20 | import Host from "../Host"
21 |
22 | describe("Host", () => {
23 | it("should render without crashing", () => {
24 | shallow()
25 | })
26 | })
27 |
--------------------------------------------------------------------------------
/src/browser/js/__tests__/jsonrpc-test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2016 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import JSONrpc from "../jsonrpc"
18 |
19 | describe("jsonrpc", () => {
20 | it("should succeed with valid endpoint", () => {
21 | let jsonRPC = new JSONrpc({
22 |
23 | })
24 | expect(jsonRPC.version).toEqual("2.0")
25 | })
26 | })
27 |
--------------------------------------------------------------------------------
/src/browser/js/browser/__tests__/MainContent.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import MainContent from "../MainContent"
20 |
21 | describe("MainContent", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 | })
26 |
--------------------------------------------------------------------------------
/src/browser/js/objects/selectors.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { createSelector } from "reselect";
18 |
19 | export const getCurrentPrefix = state => state.objects.currentPrefix;
20 |
21 | export const getCheckedList = state => state.objects.checkedList;
22 |
23 | export const getPrefixWritable = state => state.objects.prefixWritable;
24 |
--------------------------------------------------------------------------------
/src/browser/less/inc/animate/fadeOutUp.less:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes fadeOutUp {
2 | 0% {
3 | opacity: 1;
4 | -webkit-transform: translateY(0);
5 | }
6 |
7 | 100% {
8 | opacity: 0;
9 | -webkit-transform: translateY(-20px);
10 | }
11 | }
12 | @-moz-keyframes fadeOutUp {
13 | 0% {
14 | opacity: 1;
15 | -moz-transform: translateY(0);
16 | }
17 |
18 | 100% {
19 | opacity: 0;
20 | -moz-transform: translateY(-20px);
21 | }
22 | }
23 | @-o-keyframes fadeOutUp {
24 | 0% {
25 | opacity: 1;
26 | -o-transform: translateY(0);
27 | }
28 |
29 | 100% {
30 | opacity: 0;
31 | -o-transform: translateY(-20px);
32 | }
33 | }
34 | @keyframes fadeOutUp {
35 | 0% {
36 | opacity: 1;
37 | transform: translateY(0);
38 | }
39 |
40 | 100% {
41 | opacity: 0;
42 | transform: translateY(-20px);
43 | }
44 | }
45 |
46 | .fadeOutUp {
47 | -webkit-animation-name: fadeOutUp;
48 | -moz-animation-name: fadeOutUp;
49 | -o-animation-name: fadeOutUp;
50 | animation-name: fadeOutUp;
51 | }
--------------------------------------------------------------------------------
/src/sdk/aws-sdk-client.js:
--------------------------------------------------------------------------------
1 | import AWS from "aws-sdk";
2 |
3 | class AwsSdk {
4 | constructor(accessKeyId, secretAccessKey, endpoint) {
5 | this.aws3 = new AWS.S3({
6 | accessKeyId,
7 | secretAccessKey,
8 | endpoint,
9 | s3ForcePathStyle: true
10 | });
11 | }
12 |
13 | selectObjectContent(params) {
14 | return new Promise((resolve, reject) => {
15 | this.aws3.selectObjectContent(params, (err, data) => {
16 | if (err) {
17 | reject(err);
18 | } else {
19 | let result = "";
20 | const events = data.Payload;
21 | for (const event of events) {
22 | if (event.Records) {
23 | result = result.concat(event.Records.Payload.toString());
24 | } else if (event.Stats) {
25 | } else if (event.End) {
26 | resolve(result);
27 | }
28 | }
29 | }
30 | });
31 | });
32 | }
33 | }
34 |
35 | export default AwsSdk;
36 |
--------------------------------------------------------------------------------
/src/browser/js/objects/__tests__/ObjectsSection.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { ObjectsSection } from "../ObjectsSection"
20 |
21 | describe("ObjectsSection", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 | })
26 |
--------------------------------------------------------------------------------
/src/browser/less/inc/animate/fadeInUp.less:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes fadeInUp {
2 | 0% {
3 | opacity: 0;
4 | -webkit-transform: translateY(20px);
5 | }
6 |
7 | 100% {
8 | opacity: 1;
9 | -webkit-transform: translateY(0);
10 | }
11 | }
12 |
13 | @-moz-keyframes fadeInUp {
14 | 0% {
15 | opacity: 0;
16 | -moz-transform: translateY(20px);
17 | }
18 |
19 | 100% {
20 | opacity: 1;
21 | -moz-transform: translateY(0);
22 | }
23 | }
24 |
25 | @-o-keyframes fadeInUp {
26 | 0% {
27 | opacity: 0;
28 | -o-transform: translateY(20px);
29 | }
30 |
31 | 100% {
32 | opacity: 1;
33 | -o-transform: translateY(0);
34 | }
35 | }
36 |
37 | @keyframes fadeInUp {
38 | 0% {
39 | opacity: 0;
40 | transform: translateY(20px);
41 | }
42 |
43 | 100% {
44 | opacity: 1;
45 | transform: translateY(0);
46 | }
47 | }
48 |
49 | .fadeInUp {
50 | -webkit-animation-name: fadeInUp;
51 | -moz-animation-name: fadeInUp;
52 | -o-animation-name: fadeInUp;
53 | animation-name: fadeInUp;
54 | }
--------------------------------------------------------------------------------
/src/browser/less/inc/animate/fadeInDown.less:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes fadeInDown {
2 | 0% {
3 | opacity: 0;
4 | -webkit-transform: translateY(-20px);
5 | }
6 |
7 | 100% {
8 | opacity: 1;
9 | -webkit-transform: translateY(0);
10 | }
11 | }
12 |
13 | @-moz-keyframes fadeInDown {
14 | 0% {
15 | opacity: 0;
16 | -moz-transform: translateY(-20px);
17 | }
18 |
19 | 100% {
20 | opacity: 1;
21 | -moz-transform: translateY(0);
22 | }
23 | }
24 |
25 | @-o-keyframes fadeInDown {
26 | 0% {
27 | opacity: 0;
28 | -ms-transform: translateY(-20px);
29 | }
30 |
31 | 100% {
32 | opacity: 1;
33 | -ms-transform: translateY(0);
34 | }
35 | }
36 |
37 | @keyframes fadeInDown {
38 | 0% {
39 | opacity: 0;
40 | transform: translateY(-20px);
41 | }
42 |
43 | 100% {
44 | opacity: 1;
45 | transform: translateY(0);
46 | }
47 | }
48 |
49 | .fadeInDown {
50 | -webkit-animation-name: fadeInDown;
51 | -moz-animation-name: fadeInDown;
52 | -o-animation-name: fadeInDown;
53 | animation-name: fadeInDown;
54 | }
--------------------------------------------------------------------------------
/src/browser/less/inc/animate/fadeOutDown.less:
--------------------------------------------------------------------------------
1 | @-webkit-keyframes fadeOutDown {
2 | 0% {
3 | opacity: 1;
4 | -webkit-transform: translateY(0);
5 | }
6 |
7 | 100% {
8 | opacity: 0;
9 | -webkit-transform: translateY(20px);
10 | }
11 | }
12 |
13 | @-moz-keyframes fadeOutDown {
14 | 0% {
15 | opacity: 1;
16 | -moz-transform: translateY(0);
17 | }
18 |
19 | 100% {
20 | opacity: 0;
21 | -moz-transform: translateY(20px);
22 | }
23 | }
24 |
25 | @-o-keyframes fadeOutDown {
26 | 0% {
27 | opacity: 1;
28 | -o-transform: translateY(0);
29 | }
30 |
31 | 100% {
32 | opacity: 0;
33 | -o-transform: translateY(20px);
34 | }
35 | }
36 |
37 | @keyframes fadeOutDown {
38 | 0% {
39 | opacity: 1;
40 | transform: translateY(0);
41 | }
42 |
43 | 100% {
44 | opacity: 0;
45 | transform: translateY(20px);
46 | }
47 | }
48 |
49 | .fadeOutDown {
50 | -webkit-animation-name: fadeOutDown;
51 | -moz-animation-name: fadeOutDown;
52 | -o-animation-name: fadeOutDown;
53 | animation-name: fadeOutDown;
54 | }
--------------------------------------------------------------------------------
/src/browser/js/loader.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | let delay = [0, 400];
18 |
19 | function handleLoader(i) {
20 | if (i < 2) {
21 | setTimeout(function() {
22 | document.querySelector(".page-load").classList.add("pl-" + i);
23 | handleLoader(i + 1);
24 | }, delay[i]);
25 | }
26 | }
27 |
28 | const hideLoader = () => handleLoader(0);
29 |
30 | export default hideLoader;
31 |
--------------------------------------------------------------------------------
/src/browser/js/browser/Host.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2016, 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 |
19 | export const Host = ({ endPoint, bucketName }) => (
20 |
21 |
22 | {endPoint}
23 |
24 | {bucketName}
25 |
26 |
27 | );
28 |
29 | export default Host;
30 |
--------------------------------------------------------------------------------
/src/browser/js/browser/__tests__/Browser.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import Browser from "../Browser"
20 | import configureStore from "redux-mock-store"
21 |
22 | const mockStore = configureStore()
23 |
24 | describe("Browser", () => {
25 | it("should render without crashing", () => {
26 | const store = mockStore()
27 | shallow()
28 | })
29 | })
30 |
--------------------------------------------------------------------------------
/src/browser/js/store/configure-store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { createStore, applyMiddleware } from "redux";
18 | import thunkMiddleware from "redux-thunk";
19 | import reducers from "../reducers";
20 |
21 | const createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(createStore);
22 |
23 | export default function configureStore(initialState) {
24 | const store = createStoreWithMiddleware(reducers, initialState);
25 | return store;
26 | }
27 |
--------------------------------------------------------------------------------
/src/browser/js/alert/Alert.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import AlertComponent from "react-bootstrap/lib/Alert";
19 |
20 | const Alert = ({ show, type, message, onDismiss }) => (
21 |
26 |
{message}
27 |
28 | );
29 |
30 | export default Alert;
31 |
--------------------------------------------------------------------------------
/src/browser/js/objects/ObjectsSection.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import ObjectsHeader from "./ObjectsHeader";
19 | import ObjectsListContainer from "./ObjectsListContainer";
20 |
21 | export class ObjectsSection extends React.Component {
22 | render() {
23 | return (
24 |
25 |
26 |
27 |
28 |
29 |
30 | );
31 | }
32 | }
33 |
34 | export default ObjectsSection;
35 |
--------------------------------------------------------------------------------
/src/browser/js/buckets/__tests__/BucketSearch.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { BucketSearch } from "../BucketSearch"
20 |
21 | describe("BucketSearch", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should call onChange with search text", () => {
27 | const onChange = jest.fn()
28 | const wrapper = shallow()
29 | wrapper.find("input").simulate("change", { target: { value: "test" } })
30 | expect(onChange).toHaveBeenCalledWith("test")
31 | })
32 | })
33 |
--------------------------------------------------------------------------------
/src/browser/js/objects/DeleteObjectConfirmModal.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import ConfirmModal from "../browser/ConfirmModal";
19 |
20 | export const DeleteObjectConfirmModal = ({
21 | deleteObject,
22 | hideDeleteConfirmModal
23 | }) => (
24 |
34 | );
35 |
36 | export default DeleteObjectConfirmModal;
37 |
--------------------------------------------------------------------------------
/src/browser/js/alert/__tests___/Alert.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow, mount } from "enzyme"
19 | import Alert from "../Alert"
20 |
21 | describe("Alert", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should call onDismiss when close button is clicked", () => {
27 | const onDismiss = jest.fn()
28 | const wrapper = mount(
29 |
30 | )
31 | wrapper.find("button").simulate("click", { preventDefault: jest.fn() })
32 | expect(onDismiss).toHaveBeenCalled()
33 | })
34 | })
35 |
--------------------------------------------------------------------------------
/src/browser/js/alert/__tests___/AlertContainer.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow, mount } from "enzyme"
19 | import { AlertContainer } from "../AlertContainer"
20 |
21 | describe("Alert", () => {
22 | it("should render without crashing", () => {
23 | shallow(
24 |
25 | )
26 | })
27 |
28 | it("should render nothing if message is empty", () => {
29 | const wrapper = shallow(
30 |
31 | )
32 | expect(wrapper.find("Alert").length).toBe(0)
33 | })
34 | })
35 |
--------------------------------------------------------------------------------
/src/browser/js/buckets/BucketContainer.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import { connect } from "react-redux";
19 | import * as actionsBuckets from "./actions";
20 | import { getCurrentBucket } from "./selectors";
21 | import Bucket from "./Bucket";
22 |
23 | const mapStateToProps = (state, ownProps) => {
24 | return {
25 | isActive: getCurrentBucket(state) === ownProps.bucket
26 | };
27 | };
28 |
29 | const mapDispatchToProps = dispatch => {
30 | return {
31 | selectBucket: bucket => dispatch(actionsBuckets.selectBucket(bucket))
32 | };
33 | };
34 |
35 | export default connect(
36 | mapStateToProps,
37 | mapDispatchToProps
38 | )(Bucket);
39 |
--------------------------------------------------------------------------------
/src/browser/js/alert/reducer.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import * as actionsAlert from "./actions";
18 |
19 | const initialState = {
20 | show: false,
21 | type: "danger"
22 | };
23 | export default (state = initialState, action) => {
24 | switch (action.type) {
25 | case actionsAlert.SET:
26 | return {
27 | show: true,
28 | id: action.alert.id,
29 | type: action.alert.type,
30 | message: action.alert.message
31 | };
32 | case actionsAlert.CLEAR:
33 | if (action.alert && action.alert.id != state.id) {
34 | return state;
35 | } else {
36 | return initialState;
37 | }
38 | default:
39 | return state;
40 | }
41 | };
42 |
--------------------------------------------------------------------------------
/src/browser/js/reducers.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import { combineReducers } from "redux";
18 | import browser from "./browser/reducer";
19 | import alert from "./alert/reducer";
20 | import buckets from "./buckets/reducer";
21 | import objects from "./objects/reducer";
22 | import uploads from "./uploads/reducer";
23 | import {editor} from "config-editor-base"
24 | import alertModals from "./alertModals/reducer";
25 | import dashboardStatus from "./dashboardStatus/reducer";
26 |
27 |
28 | const rootReducer = combineReducers({
29 | browser,
30 | alert,
31 | buckets,
32 | objects,
33 | uploads,
34 | editor,
35 | dashboardStatus,
36 | alertModals
37 | });
38 |
39 | export default rootReducer;
40 |
--------------------------------------------------------------------------------
/src/browser/js/browser/DeviceTable.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import { connect } from "react-redux";
3 |
4 | export class DeviceTable extends React.Component {
5 | createTable = deviceFileContent => {
6 | let table = [];
7 |
8 | for (let i = 0; i < Object.keys(deviceFileContent).length; i++) {
9 | table.push(
10 |
43 | );
44 | };
45 |
46 | export default connect(state => {
47 | return {
48 | latestUiVersion: state.latestUiVersion
49 | };
50 | })(BrowserUpdate);
51 |
--------------------------------------------------------------------------------
/src/browser/js/buckets/BucketSearch.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import { connect } from "react-redux";
19 | import * as actionsBuckets from "./actions";
20 |
21 | export const BucketSearch = ({ filter, onChange }) => (
22 |
51 |
52 | );
53 | }
54 | }
55 |
56 | export default Header;
57 |
--------------------------------------------------------------------------------
/src/browser/js/browser/ConfirmModal.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2016, 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import { Modal, ModalBody } from "react-bootstrap";
19 |
20 | let ConfirmModal = ({
21 | baseClass,
22 | icon,
23 | text,
24 | sub,
25 | okText,
26 | cancelText,
27 | okHandler,
28 | cancelHandler,
29 | show
30 | }) => {
31 | return (
32 |
38 |
39 |
40 |
41 |
42 |
{text}
43 |
{sub}
44 |
45 |
46 |
49 |
52 |
53 |
54 | );
55 | };
56 |
57 | export default ConfirmModal;
58 |
--------------------------------------------------------------------------------
/src/browser/js/objects/__tests__/PrefixContainer.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { PrefixContainer } from "../PrefixContainer"
20 |
21 | describe("PrefixContainer", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should render ObjectItem with props", () => {
27 | const wrapper = shallow()
28 | expect(wrapper.find("Connect(ObjectItem)").length).toBe(1)
29 | expect(wrapper.find("Connect(ObjectItem)").prop("name")).toBe("abc/")
30 | })
31 |
32 | it("should call selectPrefix when the prefix is clicked", () => {
33 | const selectPrefix = jest.fn()
34 | const wrapper = shallow(
35 |
40 | )
41 | wrapper.find("Connect(ObjectItem)").prop("onClick")()
42 | expect(selectPrefix).toHaveBeenCalledWith("xyz/abc/")
43 | })
44 | })
45 |
--------------------------------------------------------------------------------
/src/browser/js/uploads/__tests__/UploadModal.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { UploadModal } from "../UploadModal"
20 |
21 | describe("UploadModal", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should render AbortConfirmModal when showAbort is true", () => {
27 | const wrapper = shallow()
28 | expect(wrapper.find("Connect(AbortConfirmModal)").length).toBe(1)
29 | })
30 |
31 | it("should render nothing when there are no files being uploaded", () => {
32 | const wrapper = shallow()
33 | expect(wrapper.find("noscript").length).toBe(1)
34 | })
35 |
36 | it("should show upload progress when one or more files are being uploaded", () => {
37 | const wrapper = shallow(
38 |
41 | )
42 | expect(wrapper.find("ProgressBar").length).toBe(1)
43 | })
44 |
45 | })
46 |
--------------------------------------------------------------------------------
/src/browser/js/objects/__tests__/DeleteObjectConfirmModal.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { DeleteObjectConfirmModal } from "../DeleteObjectConfirmModal"
20 |
21 | describe("DeleteObjectConfirmModal", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should call deleteObject when Delete is clicked", () => {
27 | const deleteObject = jest.fn()
28 | const wrapper = shallow(
29 |
30 | )
31 | wrapper.find("ConfirmModal").prop("okHandler")()
32 | expect(deleteObject).toHaveBeenCalled()
33 | })
34 |
35 | it("should call hideDeleteConfirmModal when Cancel is clicked", () => {
36 | const hideDeleteConfirmModal = jest.fn()
37 | const wrapper = shallow(
38 |
41 | )
42 | wrapper.find("ConfirmModal").prop("cancelHandler")()
43 | expect(hideDeleteConfirmModal).toHaveBeenCalled()
44 | })
45 | })
46 |
--------------------------------------------------------------------------------
/src/browser/js/buckets/__tests__/BucketContainer.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import BucketContainer from "../BucketContainer"
20 | import configureStore from "redux-mock-store"
21 |
22 | const mockStore = configureStore()
23 |
24 | describe("BucketContainer", () => {
25 | let store
26 | beforeEach(() => {
27 | store = mockStore({
28 | buckets: {
29 | currentBucket: "Test"
30 | }
31 | })
32 | store.dispatch = jest.fn()
33 | })
34 |
35 | it("should render without crashing", () => {
36 | shallow()
37 | })
38 |
39 | it('maps state and dispatch to props', () => {
40 | const wrapper = shallow()
41 | expect(wrapper.props()).toEqual(expect.objectContaining({
42 | isActive: expect.any(Boolean),
43 | selectBucket: expect.any(Function)
44 | }))
45 | })
46 |
47 | it('maps selectBucket to dispatch action', () => {
48 | const wrapper = shallow()
49 | wrapper.props().selectBucket()
50 | expect(store.dispatch).toHaveBeenCalled()
51 | })
52 | })
53 |
--------------------------------------------------------------------------------
/src/browser/js/buckets/__tests__/BucketPolicyModal.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow, mount } from "enzyme"
19 | import { BucketPolicyModal } from "../BucketPolicyModal"
20 | import { READ_ONLY, WRITE_ONLY, READ_WRITE } from "../../constants"
21 |
22 | describe("BucketPolicyModal", () => {
23 | it("should render without crashing", () => {
24 | shallow()
25 | })
26 |
27 | it("should call hideBucketPolicy when close button is clicked", () => {
28 | const hideBucketPolicy = jest.fn()
29 | const wrapper = shallow(
30 |
31 | )
32 | wrapper.find("button").simulate("click")
33 | expect(hideBucketPolicy).toHaveBeenCalled()
34 | })
35 |
36 | it("should include the PolicyInput and Policy components when there are any policies", () => {
37 | const wrapper = shallow(
38 |
39 | )
40 | expect(wrapper.find("Connect(PolicyInput)").length).toBe(1)
41 | expect(wrapper.find("Connect(Policy)").length).toBe(1)
42 | })
43 | })
44 |
--------------------------------------------------------------------------------
/src/browser/js/objects/__tests__/ObjectsListContainer.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { ObjectsListContainer } from "../ObjectsListContainer"
20 |
21 | describe("ObjectsList", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should render ObjectsList with objects", () => {
27 | const wrapper = shallow(
28 |
32 | )
33 | expect(wrapper.find("ObjectsList").length).toBe(1)
34 | expect(wrapper.find("ObjectsList").prop("objects")).toEqual([
35 | { name: "test1.jpg" },
36 | { name: "test2.jpg" }
37 | ])
38 | })
39 |
40 | it("should show the loading indicator at the bottom if there are more elements to display", () => {
41 | const wrapper = shallow(
42 |
43 | )
44 | expect(wrapper.find(".text-center").prop("style")).toHaveProperty("display", "block")
45 | })
46 | })
47 |
--------------------------------------------------------------------------------
/src/browser/less/inc/mixin.less:
--------------------------------------------------------------------------------
1 | /*--------------------------
2 | User Select
3 | ----------------------------*/
4 | .user-select(@value) {
5 | -webkit-user-select: @value;
6 | -moz-user-select: @value;
7 | -ms-user-select: @value;
8 | user-select: @value;
9 | }
10 |
11 |
12 | /*----------------------------------------
13 | CSS Animations based on animate.css
14 | -----------------------------------------*/
15 | .animated(@name, @duration) {
16 | -webkit-animation-name: @name;
17 | animation-name: @name;
18 | -webkit-animation-duration: @duration;
19 | animation-duration: @duration;
20 | -webkit-animation-fill-mode: both;
21 | animation-fill-mode: both;
22 | }
23 |
24 | /*-------------------------------------------------
25 | For loop mixin for generate custom classes
26 | --------------------------------------------------*/
27 | .for(@i, @n) {.-each(@i)}
28 | .for(@n) when (isnumber(@n)) {.for(1, @n)}
29 | .for(@i, @n) when not (@i = @n) {
30 | .for((@i + (@n - @i) / abs(@n - @i)), @n);
31 | }
32 |
33 | .for(@array) when (default()) {.for-impl_(length(@array))}
34 | .for-impl_(@i) when (@i > 1) {.for-impl_((@i - 1))}
35 | .for-impl_(@i) when (@i > 0) {.-each(extract(@array, @i))}
36 |
37 | /*----------------------------------------
38 | List Loader
39 | -----------------------------------------*/
40 | .list-loader(@width, @height, @borderColor, @borderColorBottom) {
41 | content: '';
42 | width: @width;
43 | height: @height;
44 | border-radius: 50%;
45 | .animated(zoomIn, 500ms);
46 | border: 2px solid @borderColor;
47 | border-bottom-color: @borderColorBottom;
48 | position: absolute;
49 | z-index: 1;
50 | -webkit-animation: zoomIn 250ms, spin 700ms 250ms infinite linear;
51 | animation: zoomIn 250ms, spin 700ms 250ms infinite linear;
52 | }
53 |
--------------------------------------------------------------------------------
/src/browser/js/buckets/__tests__/BucketDropdown.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow, mount } from "enzyme"
19 | import { BucketDropdown } from "../BucketDropdown"
20 |
21 | describe("BucketDropdown", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should call toggleDropdown on dropdown toggle", () => {
27 | const spy = jest.spyOn(BucketDropdown.prototype, 'toggleDropdown')
28 | const wrapper = shallow(
29 |
30 | )
31 | wrapper
32 | .find("Uncontrolled(Dropdown)")
33 | .simulate("toggle")
34 | expect(spy).toHaveBeenCalled()
35 | spy.mockReset()
36 | spy.mockRestore()
37 | })
38 | // No Need of delete test case
39 | /* it("should call deleteBucket when Delete link is clicked", () => {
40 | const deleteBucket = jest.fn()
41 | const wrapper = shallow(
42 |
43 | )
44 | wrapper
45 | .find("li a")
46 | .at(0)
47 | .simulate("click", { stopPropagation: jest.fn() })
48 | expect(deleteBucket).toHaveBeenCalledWith("test")
49 | }) */
50 | })
51 |
--------------------------------------------------------------------------------
/font-awesome/less/mixins.less:
--------------------------------------------------------------------------------
1 | // Mixins
2 | // --------------------------
3 |
4 | .fa-icon() {
5 | display: inline-block;
6 | font: normal normal normal @fa-font-size-base/@fa-line-height-base FontAwesome; // shortening font declaration
7 | font-size: inherit; // can't have font-size inherit on line above, so need to override
8 | text-rendering: auto; // optimizelegibility throws things off #1094
9 | -webkit-font-smoothing: antialiased;
10 | -moz-osx-font-smoothing: grayscale;
11 |
12 | }
13 |
14 | .fa-icon-rotate(@degrees, @rotation) {
15 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=@{rotation})";
16 | -webkit-transform: rotate(@degrees);
17 | -ms-transform: rotate(@degrees);
18 | transform: rotate(@degrees);
19 | }
20 |
21 | .fa-icon-flip(@horiz, @vert, @rotation) {
22 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=@{rotation}, mirror=1)";
23 | -webkit-transform: scale(@horiz, @vert);
24 | -ms-transform: scale(@horiz, @vert);
25 | transform: scale(@horiz, @vert);
26 | }
27 |
28 |
29 | // Only display content to screen readers. A la Bootstrap 4.
30 | //
31 | // See: http://a11yproject.com/posts/how-to-hide-content/
32 |
33 | .sr-only() {
34 | position: absolute;
35 | width: 1px;
36 | height: 1px;
37 | padding: 0;
38 | margin: -1px;
39 | overflow: hidden;
40 | clip: rect(0,0,0,0);
41 | border: 0;
42 | }
43 |
44 | // Use in conjunction with .sr-only to only display content when it's focused.
45 | //
46 | // Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
47 | //
48 | // Credit: HTML5 Boilerplate
49 |
50 | .sr-only-focusable() {
51 | &:active,
52 | &:focus {
53 | position: static;
54 | width: auto;
55 | height: auto;
56 | margin: 0;
57 | overflow: visible;
58 | clip: auto;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/browser/js/objects/ObjectsList.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2016, 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import ObjectContainer from "./ObjectContainer";
19 | import PrefixContainer from "./PrefixContainer";
20 |
21 | export const ObjectsList = ({ objects, sessionMetaList, sessionStartTimeList, sessionObjectsMetaList, objectsS3MetaStart }) => {
22 | const list = objects.map(object => {
23 |
24 |
25 | if (object.name.endsWith("/")) {
26 | const sessionMeta = sessionMetaList.filter(session => session.prefix == object.name)[0]
27 | const sessionStartTime = sessionStartTimeList.filter(session => session.prefix == object.name)[0]
28 | return ;
29 | } else {
30 | const objectMeta = sessionObjectsMetaList.filter(objectMeta => objectMeta.name == object.name)[0]
31 | const objectS3MetaStart = objectsS3MetaStart.filter(objectMeta => objectMeta.name == object.name)[0]
32 | return ;
33 | }
34 | });
35 | return
{list}
;
36 | };
37 |
38 | export default ObjectsList;
39 |
--------------------------------------------------------------------------------
/font-awesome/scss/_mixins.scss:
--------------------------------------------------------------------------------
1 | // Mixins
2 | // --------------------------
3 |
4 | @mixin fa-icon() {
5 | display: inline-block;
6 | font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration
7 | font-size: inherit; // can't have font-size inherit on line above, so need to override
8 | text-rendering: auto; // optimizelegibility throws things off #1094
9 | -webkit-font-smoothing: antialiased;
10 | -moz-osx-font-smoothing: grayscale;
11 |
12 | }
13 |
14 | @mixin fa-icon-rotate($degrees, $rotation) {
15 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation})";
16 | -webkit-transform: rotate($degrees);
17 | -ms-transform: rotate($degrees);
18 | transform: rotate($degrees);
19 | }
20 |
21 | @mixin fa-icon-flip($horiz, $vert, $rotation) {
22 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}, mirror=1)";
23 | -webkit-transform: scale($horiz, $vert);
24 | -ms-transform: scale($horiz, $vert);
25 | transform: scale($horiz, $vert);
26 | }
27 |
28 |
29 | // Only display content to screen readers. A la Bootstrap 4.
30 | //
31 | // See: http://a11yproject.com/posts/how-to-hide-content/
32 |
33 | @mixin sr-only {
34 | position: absolute;
35 | width: 1px;
36 | height: 1px;
37 | padding: 0;
38 | margin: -1px;
39 | overflow: hidden;
40 | clip: rect(0,0,0,0);
41 | border: 0;
42 | }
43 |
44 | // Use in conjunction with .sr-only to only display content when it's focused.
45 | //
46 | // Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1
47 | //
48 | // Credit: HTML5 Boilerplate
49 |
50 | @mixin sr-only-focusable {
51 | &:active,
52 | &:focus {
53 | position: static;
54 | width: auto;
55 | height: auto;
56 | margin: 0;
57 | overflow: visible;
58 | clip: auto;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/browser/js/browser/InputGroup.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2016, 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 |
19 | let InputGroup = ({
20 | label,
21 | id,
22 | name,
23 | value,
24 | onChange,
25 | type,
26 | spellCheck,
27 | required,
28 | readonly,
29 | autoComplete,
30 | align,
31 | className
32 | }) => {
33 | var input = (
34 |
45 | );
46 | if (readonly)
47 | input = (
48 |
60 | );
61 | return (
62 |
63 | {input}
64 |
65 |
66 |
67 | );
68 | };
69 |
70 | export default InputGroup;
71 |
--------------------------------------------------------------------------------
/src/browser/js/uploads/__tests__/AbortConfirmModal.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { AbortConfirmModal } from "../AbortConfirmModal"
20 |
21 | describe("AbortConfirmModal", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should call abort for every upload when Abort is clicked", () => {
27 | const abort = jest.fn()
28 | const wrapper = shallow(
29 |
36 | )
37 | wrapper.instance().abortUploads()
38 | expect(abort.mock.calls.length).toBe(2)
39 | expect(abort.mock.calls[0][0]).toBe("a-b/-test1")
40 | expect(abort.mock.calls[1][0]).toBe("a-b/-test2")
41 | })
42 |
43 | it("should call hideAbort when cancel is clicked", () => {
44 | const hideAbort = jest.fn()
45 | const wrapper = shallow()
46 | wrapper.find("ConfirmModal").prop("cancelHandler")()
47 | expect(hideAbort).toHaveBeenCalled()
48 | })
49 | })
50 |
--------------------------------------------------------------------------------
/src/browser/js/uploads/reducer.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import * as uploadsActions from "./actions";
18 |
19 | const add = (files, action) => ({
20 | ...files,
21 | [action.slug]: {
22 | loaded: 0,
23 | size: action.size,
24 | name: action.name
25 | }
26 | });
27 |
28 | const updateProgress = (files, action) => ({
29 | ...files,
30 | [action.slug]: {
31 | ...files[action.slug],
32 | loaded: action.loaded
33 | }
34 | });
35 |
36 | const stop = (files, action) => {
37 | const newFiles = Object.assign({}, files);
38 | delete newFiles[action.slug];
39 | return newFiles;
40 | };
41 |
42 | export default (state = { files: {}, showAbortModal: false }, action) => {
43 | switch (action.type) {
44 | case uploadsActions.ADD:
45 | return {
46 | ...state,
47 | files: add(state.files, action)
48 | };
49 | case uploadsActions.UPDATE_PROGRESS:
50 | return {
51 | ...state,
52 | files: updateProgress(state.files, action)
53 | };
54 | case uploadsActions.STOP:
55 | return {
56 | ...state,
57 | files: stop(state.files, action)
58 | };
59 | case uploadsActions.SHOW_ABORT_MODAL:
60 | return {
61 | ...state,
62 | showAbortModal: action.show
63 | };
64 | default:
65 | return state;
66 | }
67 | };
68 |
--------------------------------------------------------------------------------
/src/browser/js/objects/__tests__/ObjectContainer.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow } from "enzyme"
19 | import { ObjectContainer } from "../ObjectContainer"
20 |
21 | describe("ObjectContainer", () => {
22 | it("should render without crashing", () => {
23 | shallow()
24 | })
25 |
26 | it("should render ObjectItem with props", () => {
27 | const wrapper = shallow()
28 | expect(wrapper.find("Connect(ObjectItem)").length).toBe(1)
29 | expect(wrapper.find("Connect(ObjectItem)").prop("name")).toBe("test1.jpg")
30 | })
31 |
32 | it("should pass actions to ObjectItem", () => {
33 | const wrapper = shallow(
34 |
35 | )
36 | expect(wrapper.find("Connect(ObjectItem)").prop("actionButtons")).not.toBe(
37 | undefined
38 | )
39 | })
40 |
41 | it("should pass empty actions to ObjectItem when checkedObjectCount is more than 0", () => {
42 | const wrapper = shallow(
43 |
44 | )
45 | expect(wrapper.find("Connect(ObjectItem)").prop("actionButtons")).toBe(
46 | undefined
47 | )
48 | })
49 | })
50 |
--------------------------------------------------------------------------------
/src/browser/js/browser/MobileHeader.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import classNames from "classnames";
19 | import { connect } from "react-redux";
20 | import logo from "../../img/logo.png";
21 | import * as actionsCommon from "./actions";
22 |
23 | export const MobileHeader = ({ sidebarOpen, toggleSidebar }) => (
24 |
25 |
57 | );
58 | };
59 |
60 | export default Bucket;
61 |
--------------------------------------------------------------------------------
/src/browser/js/objects/PreviewObjectModal.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import { connect } from "react-redux";
19 | import { Modal, ModalHeader, ModalBody } from "react-bootstrap";
20 | import * as objectsActions from "./actions";
21 |
22 | const PreviewObjectModal = ({
23 | previewObjectDetails: { content, object },
24 | hidePreviewObject
25 | }) => (
26 |
33 |
34 |
37 |
38 |
Object preview
39 |
Preview {object.name}
40 |
41 |
42 |
43 |
{content.objContent}
44 |
45 |
46 |
47 | );
48 |
49 | const mapStateToProps = (state, ownProps) => {
50 | return {
51 | object: ownProps.object,
52 | previewObjectDetails: state.objects.previewObject
53 | };
54 | };
55 |
56 | const mapDispatchToProps = dispatch => {
57 | return {
58 | hidePreviewObject: () => dispatch(objectsActions.hidePreviewObject())
59 | };
60 | };
61 |
62 | export default connect(mapStateToProps, mapDispatchToProps)(PreviewObjectModal);
63 |
--------------------------------------------------------------------------------
/src/browser/js/browser/AboutModal.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react";
18 | import { Modal } from "react-bootstrap";
19 | import logo from "../../img/logo.png";
20 |
21 | export const AboutModal = ({ serverInfo, hideAbout }) => {
22 | const { version, memory, platform, runtime } = serverInfo;
23 | return (
24 |
30 |
33 |
61 | );
62 | };
63 |
64 | const mapStateToProps = state => {
65 | return {
66 | currentBucket: getCurrentBucket(state),
67 | currentPrefix: state.objects.currentPrefix
68 | };
69 | };
70 |
71 | const mapDispatchToProps = dispatch => {
72 | return {
73 | selectPrefix: prefix => dispatch(actionsObjects.selectPathPrefix(prefix))
74 | };
75 | };
76 |
77 | export default connect(
78 | mapStateToProps,
79 | mapDispatchToProps
80 | )(Path);
81 |
--------------------------------------------------------------------------------
/src/browser/js/buckets/__tests__/Policy.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import React from "react"
18 | import { shallow, mount } from "enzyme"
19 | import { Policy } from "../Policy"
20 | import { READ_ONLY, WRITE_ONLY, READ_WRITE, NONE } from "../../constants"
21 | import web from "../../web"
22 |
23 | jest.mock("../../web", () => ({
24 | SetBucketPolicy: jest.fn(() => {
25 | return Promise.resolve()
26 | })
27 | }))
28 |
29 | describe("Policy", () => {
30 | it("should render without crashing", () => {
31 | shallow()
32 | })
33 |
34 | it("should not render when policy is listed as 'none'", () => {
35 | const wrapper = shallow()
36 | expect(wrapper.find(".pmb-list").length).toBe(0)
37 | })
38 |
39 | it("should call web.setBucketPolicy and fetchPolicies on submit", () => {
40 | const fetchPolicies = jest.fn()
41 | const wrapper = shallow(
42 |
48 | )
49 | wrapper.find("button").simulate("click", { preventDefault: jest.fn() })
50 |
51 | expect(web.SetBucketPolicy).toHaveBeenCalledWith({
52 | bucketName: "bucket",
53 | prefix: "foo",
54 | policy: "none"
55 | })
56 |
57 | setImmediate(() => {
58 | expect(fetchPolicies).toHaveBeenCalledWith("bucket")
59 | })
60 | })
61 |
62 | it("should change the empty string to '*' while displaying prefixes", () => {
63 | const wrapper = shallow(
64 |
65 | )
66 | expect(wrapper.find(".pmbl-item").at(0).text()).toEqual("*")
67 | })
68 | })
69 |
--------------------------------------------------------------------------------
/src/browser/js/alert/__tests___/reducer.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Minio Cloud Storage (C) 2018 Minio, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | import reducer from "../reducer"
18 | import * as actionsAlert from "../actions"
19 |
20 | describe("alert reducer", () => {
21 | it("should return the initial state", () => {
22 | expect(reducer(undefined, {})).toEqual({
23 | show: false,
24 | type: "danger"
25 | })
26 | })
27 |
28 | it("should handle SET_ALERT", () => {
29 | expect(
30 | reducer(undefined, {
31 | type: actionsAlert.SET,
32 | alert: { id: 1, type: "danger", message: "Test message" }
33 | })
34 | ).toEqual({
35 | show: true,
36 | id: 1,
37 | type: "danger",
38 | message: "Test message"
39 | })
40 | })
41 |
42 | it("should clear alert if id not passed", () => {
43 | expect(
44 | reducer(
45 | { show: true, type: "danger", message: "Test message" },
46 | {
47 | type: actionsAlert.CLEAR
48 | }
49 | )
50 | ).toEqual({
51 | show: false,
52 | type: "danger"
53 | })
54 | })
55 |
56 | it("should clear alert if id is matching", () => {
57 | expect(
58 | reducer(
59 | { show: true, id: 1, type: "danger", message: "Test message" },
60 | {
61 | type: actionsAlert.CLEAR,
62 | alert: { id: 1 }
63 | }
64 | )
65 | ).toEqual({
66 | show: false,
67 | type: "danger"
68 | })
69 | })
70 |
71 | it("should not clear alert if id is not matching", () => {
72 | expect(
73 | reducer(
74 | { show: true, id: 1, type: "danger", message: "Test message" },
75 | {
76 | type: actionsAlert.CLEAR,
77 | alert: { id: 2 }
78 | }
79 | )
80 | ).toEqual({
81 | show: true,
82 | id: 1,
83 | type: "danger",
84 | message: "Test message"
85 | })
86 | })
87 | })
88 |
--------------------------------------------------------------------------------
/src/browser/js/objects/corsError.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const CorsError = props => {
4 | return (
5 |
6 |
7 |
8 |
9 |
10 | We are unable to connect to the bucket {props.currentBucket} as the
11 | bucket's CORS configuration for this domain is not enabled. CORS needs
12 | to be configured on the S3 bucket to be accessed directly from the
13 | browser.
14 |
15 |
16 | If you're using AWS, please follow the below steps to enable CORS to
17 | access the bucket objects:
18 |
19 |
20 |
Navigate to the Amazon S3 console.
21 |
22 | Choose an existing bucket or create a new bucket if desired. Note the
23 | bucket name and bucket region for later use in the application.
24 |
25 |
26 | Click the Properties tab, open the Permissions section, and click Edit
27 | CORS Configuration.
28 |
29 |
Copy the below XML into the text box and click Save.