diff --git a/browser/.babelrc b/browser/.babelrc deleted file mode 100644 index f9e96ea..0000000 --- a/browser/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - "es2015", - "react" - ], - "plugins": [ - "transform-object-rest-spread" - ] -} \ No newline at end of file diff --git a/browser/.editorconfig b/browser/.editorconfig deleted file mode 100644 index 3674a17..0000000 --- a/browser/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -# editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.json] -indent_size = 2 - -[*.md] -trim_trailing_whitespace = false diff --git a/browser/.esformatter b/browser/.esformatter deleted file mode 100644 index 1677d7c..0000000 --- a/browser/.esformatter +++ /dev/null @@ -1,23 +0,0 @@ -{ - "plugins": [ - "esformatter-jsx" - ], - // Copied from https://github.com/royriojas/esformatter-jsx - "jsx": { - "formatJSX": true, //Duh! that's the default - "attrsOnSameLineAsTag": false, // move each attribute to its own line - "maxAttrsOnTag": 3, // if lower or equal than 3 attributes, they will be kept on a single line - "firstAttributeOnSameLine": true, // keep the first attribute in the same line as the tag - "formatJSXExpressions": true, // default true, if false jsxExpressions won't be recursively formatted - "JSXExpressionsSingleLine": true, // default true, if false the JSXExpressions might span several lines - "alignWithFirstAttribute": false, // do not align attributes with the first tag - "spaceInJSXExpressionContainers": " ", // default to one space. Make it empty if you don't like spaces between JSXExpressionContainers - "removeSpaceBeforeClosingJSX": false, // default false. if true => - "closingTagOnNewLine": false, // default false. if true attributes on multiple lines will close the tag on a new line - "JSXAttributeQuotes": "", // possible values "single" or "double". Leave it as empty string if you don't want to modify the attributes' quotes - "htmlOptions": { - // put here the options for js-beautify.html - } - } -} - diff --git a/browser/.gitignore b/browser/.gitignore deleted file mode 100644 index 6e4ed66..0000000 --- a/browser/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -**/*.swp -cover.out -*~ -minio -!*/ -site/ -**/*.test -**/*.sublime-workspace -/.idea/ -/Minio.iml -**/access.log -build -vendor/**/*.js -vendor/**/*.json -release -.DS_Store -*.syso -coverage.txt -node_modules -production diff --git a/browser/.prettierrc b/browser/.prettierrc deleted file mode 100644 index cce9d3c..0000000 --- a/browser/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "semi": false -} diff --git a/browser/README.md b/browser/README.md deleted file mode 100644 index 8b1c945..0000000 --- a/browser/README.md +++ /dev/null @@ -1,180 +0,0 @@ -# MinIO File Browser - -``MinIO Browser`` provides minimal set of UI to manage buckets and objects on ``minio`` server. ``MinIO Browser`` is written in javascript and released under [Apache 2.0 License](./LICENSE). - - -## Installation - -### Install node -```sh -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash -exec -l $SHELL -nvm install stable -``` - -### Install node dependencies -```sh -npm install -``` - -### Install `go-bindata` and `go-bindata-assetfs` - -If you do not have a working Golang environment, please follow [Install Golang](https://golang.org/doc/install) - -```sh -go get github.com/go-bindata/go-bindata/go-bindata -go get github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs -``` - -## Generating Assets - -### Generate ui-assets.go - -```sh -npm run release -``` - -This generates ui-assets.go in the current directory. Now do `make` in the parent directory to build the minio binary with the newly generated ``ui-assets.go`` - - -## Run MinIO Browser with live reload - -### Run MinIO Browser with live reload - -```sh -npm run dev -``` - -Open [http://localhost:8080/minio/](http://localhost:8080/minio/) in your browser to play with the application. - -### Run MinIO Browser with live reload on custom port - -Edit `browser/webpack.config.js` - -```diff -diff --git a/browser/webpack.config.js b/browser/webpack.config.js -index 3ccdaba..9496c56 100644 ---- a/browser/webpack.config.js -+++ b/browser/webpack.config.js -@@ -58,6 +58,7 @@ var exports = { - historyApiFallback: { - index: '/minio/' - }, -+ port: 8888, - proxy: { - '/minio/webrpc': { - target: 'http://localhost:9000', -@@ -97,7 +98,7 @@ var exports = { - if (process.env.NODE_ENV === 'dev') { - exports.entry = [ - 'webpack/hot/dev-server', -- 'webpack-dev-server/client?http://localhost:8080', -+ 'webpack-dev-server/client?http://localhost:8888', - path.resolve(__dirname, 'app/index.js') - ] - } -``` - -```sh -npm run dev -``` - -Open [http://localhost:8888/minio/](http://localhost:8888/minio/) in your browser to play with the application. - -### Run MinIO Browser with live reload on any IP - -Edit `browser/webpack.config.js` - -```diff -diff --git a/browser/webpack.config.js b/browser/webpack.config.js -index 8bdbba53..139f6049 100644 ---- a/browser/webpack.config.js -+++ b/browser/webpack.config.js -@@ -71,6 +71,7 @@ var exports = { - historyApiFallback: { - index: '/minio/' - }, -+ host: '0.0.0.0', - proxy: { - '/minio/webrpc': { - target: 'http://localhost:9000', -``` - -```sh -npm run dev -``` - -Open [http://IP:8080/minio/](http://IP:8080/minio/) in your browser to play with the application. - - -## Run tests - - npm run test - - -## Docker development environment - -This approach will download the sources on your machine such that you are able to use your IDE or editor of choice. -A Docker container will be used in order to provide a controlled build environment without messing with your host system. - -### Prepare host system - -Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [Docker](https://docs.docker.com/get-docker/). - -### Development within container - -Prepare and build container -``` -git clone git@github.com:minio/minio.git -cd minio -docker build -t minio-dev -f Dockerfile.dev.browser . -``` - -Run container, build and run core -```sh -docker run -it --rm --name minio-dev -v "$PWD":/minio minio-dev - -cd /minio/browser -npm install -npm run release -cd /minio -make -./minio server /data -``` -Note `Endpoint` IP (the one which is _not_ `127.0.0.1`), `AccessKey` and `SecretKey` (both default to `minioadmin`) in order to enter them in the browser later. - - -Open another terminal. -Connect to container -```sh -docker exec -it minio-dev bash -``` - -Apply patch to allow access from outside container -```sh -cd /minio -git apply --ignore-whitespace < img { - width: 30px; - margin-top: 21px; -} - -@-webkit-keyframes fade-in { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -@keyframes fade-in { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -@-webkit-keyframes spin { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -@keyframes spin { - 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} diff --git a/browser/app/fonts/lato/lato-normal.woff b/browser/app/fonts/lato/lato-normal.woff deleted file mode 100755 index f231775..0000000 Binary files a/browser/app/fonts/lato/lato-normal.woff and /dev/null differ diff --git a/browser/app/fonts/lato/lato-normal.woff2 b/browser/app/fonts/lato/lato-normal.woff2 deleted file mode 100755 index 2a119eb..0000000 Binary files a/browser/app/fonts/lato/lato-normal.woff2 and /dev/null differ diff --git a/browser/app/img/arrow.svg b/browser/app/img/arrow.svg deleted file mode 100644 index fb5574f..0000000 --- a/browser/app/img/arrow.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/browser/app/img/browsers/chrome.png b/browser/app/img/browsers/chrome.png deleted file mode 100644 index 278ef4d..0000000 Binary files a/browser/app/img/browsers/chrome.png and /dev/null differ diff --git a/browser/app/img/browsers/firefox.png b/browser/app/img/browsers/firefox.png deleted file mode 100644 index 2803f10..0000000 Binary files a/browser/app/img/browsers/firefox.png and /dev/null differ diff --git a/browser/app/img/browsers/safari.png b/browser/app/img/browsers/safari.png deleted file mode 100644 index 4ed52b9..0000000 Binary files a/browser/app/img/browsers/safari.png and /dev/null differ diff --git a/browser/app/img/favicon/favicon-16x16.png b/browser/app/img/favicon/favicon-16x16.png deleted file mode 100644 index 1ef69e7..0000000 Binary files a/browser/app/img/favicon/favicon-16x16.png and /dev/null differ diff --git a/browser/app/img/favicon/favicon-32x32.png b/browser/app/img/favicon/favicon-32x32.png deleted file mode 100644 index 24f7381..0000000 Binary files a/browser/app/img/favicon/favicon-32x32.png and /dev/null differ diff --git a/browser/app/img/favicon/favicon-96x96.png b/browser/app/img/favicon/favicon-96x96.png deleted file mode 100644 index 7410eca..0000000 Binary files a/browser/app/img/favicon/favicon-96x96.png and /dev/null differ diff --git a/browser/app/img/login-img-bck.svg b/browser/app/img/login-img-bck.svg deleted file mode 100644 index 2dd8593..0000000 --- a/browser/app/img/login-img-bck.svg +++ /dev/null @@ -1,50 +0,0 @@ - - - - Untitled - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/browser/app/img/logo.svg b/browser/app/img/logo.svg deleted file mode 100644 index 504777e..0000000 --- a/browser/app/img/logo.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - logo - Created with Sketch. - - - - - \ No newline at end of file diff --git a/browser/app/img/more-h-light.svg b/browser/app/img/more-h-light.svg deleted file mode 100644 index 0c2e2da..0000000 --- a/browser/app/img/more-h-light.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/browser/app/img/more-h.svg b/browser/app/img/more-h.svg deleted file mode 100644 index cf69dcf..0000000 --- a/browser/app/img/more-h.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/browser/app/img/select-caret.svg b/browser/app/img/select-caret.svg deleted file mode 100644 index b2b26b8..0000000 --- a/browser/app/img/select-caret.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/browser/app/index.html b/browser/app/index.html deleted file mode 100644 index 61cc6e3..0000000 --- a/browser/app/index.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - MinIO Browser - - - - - - - - - -
-
- -
-
-
- - - - - - - diff --git a/browser/app/index.js b/browser/app/index.js deleted file mode 100644 index 99ec9e4..0000000 --- a/browser/app/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import "babel-polyfill" -import "./less/main.less" -import "@fortawesome/fontawesome-free/css/all.css" -import "material-design-iconic-font/dist/css/material-design-iconic-font.min.css" - -import React from "react" -import ReactDOM from "react-dom" -import { Router, Route } from "react-router-dom" -import { Provider } from "react-redux" - -import history from "./js/history" -import configureStore from "./js/store/configure-store" -import hideLoader from "./js/loader" -import App from "./js/App" - -const store = configureStore() - -ReactDOM.render( - - - - - , - document.getElementById("root") -) - -hideLoader() diff --git a/browser/app/js/App.js b/browser/app/js/App.js deleted file mode 100644 index 647cf9c..0000000 --- a/browser/app/js/App.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { Route, Switch, Redirect } from "react-router-dom" -import Browser from "./browser/Browser" -import Login from "./browser/Login" -import OpenIDLogin from "./browser/OpenIDLogin" -import web from "./web" - -export const App = () => { - return ( - - - - - - ) -} - -export default App diff --git a/browser/app/js/__tests__/App.test.js b/browser/app/js/__tests__/App.test.js deleted file mode 100644 index d7f96e1..0000000 --- a/browser/app/js/__tests__/App.test.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { shallow, mount } from "enzyme" -import { MemoryRouter } from "react-router-dom" -import App from "../App" - -jest.mock("../browser/Login", () => () =>
Login
) -jest.mock("../browser/Browser", () => () =>
Browser
) - -describe("App", () => { - it("should render without crashing", () => { - shallow() - }) - - it("should render Login component for '/login' route", () => { - const wrapper = mount( - - - - ) - expect(wrapper.text()).toBe("Login") - }) - - it("should render Browser component for '/' route", () => { - const wrapper = mount( - - - - ) - expect(wrapper.text()).toBe("Browser") - }) - - it("should render Browser component for '/bucket' route", () => { - const wrapper = mount( - - - - ) - expect(wrapper.text()).toBe("Browser") - }) - - it("should render Browser component for '/bucket/a/b/c' route", () => { - const wrapper = mount( - - - - ) - expect(wrapper.text()).toBe("Browser") - }) -}) diff --git a/browser/app/js/__tests__/jsonrpc-test.js b/browser/app/js/__tests__/jsonrpc-test.js deleted file mode 100644 index 65c511b..0000000 --- a/browser/app/js/__tests__/jsonrpc-test.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import JSONrpc from "../jsonrpc" - -describe("jsonrpc", () => { - it("should fail with invalid endpoint", done => { - try { - let jsonRPC = new JSONrpc({ - endpoint: "htt://localhost:9000", - namespace: "Test" - }) - } catch (e) { - done() - } - }) - it("should succeed with valid endpoint", () => { - let jsonRPC = new JSONrpc({ - endpoint: "http://localhost:9000/webrpc", - namespace: "Test" - }) - expect(jsonRPC.version).toEqual("2.0") - expect(jsonRPC.host).toEqual("localhost") - expect(jsonRPC.port).toEqual("9000") - expect(jsonRPC.path).toEqual("/webrpc") - expect(jsonRPC.scheme).toEqual("http") - }) -}) diff --git a/browser/app/js/alert/Alert.js b/browser/app/js/alert/Alert.js deleted file mode 100644 index 926f5fb..0000000 --- a/browser/app/js/alert/Alert.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import AlertComponent from "react-bootstrap/lib/Alert" - -const Alert = ({ show, type, message, onDismiss }) => ( - -
{message}
-
-) - -export default Alert diff --git a/browser/app/js/alert/AlertContainer.js b/browser/app/js/alert/AlertContainer.js deleted file mode 100644 index cda1de5..0000000 --- a/browser/app/js/alert/AlertContainer.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { connect } from "react-redux" -import Alert from "./Alert" -import * as alertActions from "./actions" - -export const AlertContainer = ({ alert, clearAlert }) => { - if (!alert.message) { - return "" - } - return -} - -const mapStateToProps = state => { - return { - alert: state.alert - } -} - -const mapDispatchToProps = dispatch => { - return { - clearAlert: () => dispatch(alertActions.clear()) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(AlertContainer) diff --git a/browser/app/js/alert/__tests___/Alert.test.js b/browser/app/js/alert/__tests___/Alert.test.js deleted file mode 100644 index f21d4e9..0000000 --- a/browser/app/js/alert/__tests___/Alert.test.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { shallow, mount } from "enzyme" -import Alert from "../Alert" - -describe("Alert", () => { - it("should render without crashing", () => { - shallow() - }) - - it("should call onDismiss when close button is clicked", () => { - const onDismiss = jest.fn() - const wrapper = mount( - - ) - wrapper.find("button").simulate("click", { preventDefault: jest.fn() }) - expect(onDismiss).toHaveBeenCalled() - }) -}) diff --git a/browser/app/js/alert/__tests___/AlertContainer.test.js b/browser/app/js/alert/__tests___/AlertContainer.test.js deleted file mode 100644 index 3b8ee65..0000000 --- a/browser/app/js/alert/__tests___/AlertContainer.test.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { shallow, mount } from "enzyme" -import { AlertContainer } from "../AlertContainer" - -describe("Alert", () => { - it("should render without crashing", () => { - shallow( - - ) - }) - - it("should render nothing if message is empty", () => { - const wrapper = shallow( - - ) - expect(wrapper.find("Alert").length).toBe(0) - }) -}) diff --git a/browser/app/js/alert/__tests___/actions.test.js b/browser/app/js/alert/__tests___/actions.test.js deleted file mode 100644 index 33aa7ee..0000000 --- a/browser/app/js/alert/__tests___/actions.test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import configureStore from "redux-mock-store" -import thunk from "redux-thunk" -import * as actionsAlert from "../actions" - -const middlewares = [thunk] -const mockStore = configureStore(middlewares) - -jest.useFakeTimers() - -describe("Alert actions", () => { - it("creates alert/SET action", () => { - const store = mockStore() - const expectedActions = [ - { - type: "alert/SET", - alert: { id: 0, message: "Test alert", type: "danger" } - } - ] - store.dispatch(actionsAlert.set({ message: "Test alert", type: "danger" })) - const actions = store.getActions() - expect(actions).toEqual(expectedActions) - }) - - it("creates alert/CLEAR action for non danger alerts", () => { - const store = mockStore() - const expectedActions = [ - { - type: "alert/SET", - alert: { id: 1, message: "Test alert" } - }, - { - type: "alert/CLEAR", - alert: { id: 1 } - } - ] - store.dispatch(actionsAlert.set({ message: "Test alert" })) - jest.runAllTimers() - const actions = store.getActions() - expect(actions).toEqual(expectedActions) - }) - - it("creates alert/CLEAR action directly", () => { - const store = mockStore() - const expectedActions = [ - { - type: "alert/CLEAR" - } - ] - store.dispatch(actionsAlert.clear()) - const actions = store.getActions() - expect(actions).toEqual(expectedActions) - }) -}) diff --git a/browser/app/js/alert/__tests___/reducer.test.js b/browser/app/js/alert/__tests___/reducer.test.js deleted file mode 100644 index d19a067..0000000 --- a/browser/app/js/alert/__tests___/reducer.test.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import reducer from "../reducer" -import * as actionsAlert from "../actions" - -describe("alert reducer", () => { - it("should return the initial state", () => { - expect(reducer(undefined, {})).toEqual({ - show: false, - type: "danger" - }) - }) - - it("should handle SET_ALERT", () => { - expect( - reducer(undefined, { - type: actionsAlert.SET, - alert: { id: 1, type: "danger", message: "Test message" } - }) - ).toEqual({ - show: true, - id: 1, - type: "danger", - message: "Test message" - }) - }) - - it("should clear alert if id not passed", () => { - expect( - reducer( - { show: true, type: "danger", message: "Test message" }, - { - type: actionsAlert.CLEAR - } - ) - ).toEqual({ - show: false, - type: "danger" - }) - }) - - it("should clear alert if id is matching", () => { - expect( - reducer( - { show: true, id: 1, type: "danger", message: "Test message" }, - { - type: actionsAlert.CLEAR, - alert: { id: 1 } - } - ) - ).toEqual({ - show: false, - type: "danger" - }) - }) - - it("should not clear alert if id is not matching", () => { - expect( - reducer( - { show: true, id: 1, type: "danger", message: "Test message" }, - { - type: actionsAlert.CLEAR, - alert: { id: 2 } - } - ) - ).toEqual({ - show: true, - id: 1, - type: "danger", - message: "Test message" - }) - }) -}) diff --git a/browser/app/js/alert/actions.js b/browser/app/js/alert/actions.js deleted file mode 100644 index 84b2144..0000000 --- a/browser/app/js/alert/actions.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export const SET = "alert/SET" -export const CLEAR = "alert/CLEAR" - -export let alertId = 0 - -export const set = alert => { - const id = alertId++ - return (dispatch, getState) => { - if (alert.type !== "danger" || alert.autoClear) { - setTimeout(() => { - dispatch({ - type: CLEAR, - alert: { - id - } - }) - }, 5000) - } - dispatch({ - type: SET, - alert: Object.assign({}, alert, { - id - }) - }) - } -} - -export const clear = () => { - return { type: CLEAR } -} diff --git a/browser/app/js/alert/reducer.js b/browser/app/js/alert/reducer.js deleted file mode 100644 index 65eab1a..0000000 --- a/browser/app/js/alert/reducer.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as actionsAlert from "./actions" - -const initialState = { - show: false, - type: "danger" -} -export default (state = initialState, action) => { - switch (action.type) { - case actionsAlert.SET: - return { - show: true, - id: action.alert.id, - type: action.alert.type, - message: action.alert.message - } - case actionsAlert.CLEAR: - if (action.alert && action.alert.id != state.id) { - return state - } else { - return initialState - } - default: - return state - } -} diff --git a/browser/app/js/browser/AboutModal.js b/browser/app/js/browser/AboutModal.js deleted file mode 100644 index 3e4f712..0000000 --- a/browser/app/js/browser/AboutModal.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { Modal } from "react-bootstrap" -import logo from "../../img/logo.svg" - -export const AboutModal = ({ serverInfo, hideAbout }) => { - const { version, platform, runtime } = serverInfo - return ( - - -
-
- - - -
-
-
    -
  • -
    Version
    - {version} -
  • -
  • -
    Platform
    - {platform} -
  • -
  • -
    Runtime
    - {runtime} -
  • -
-
-
-
- ) -} - -export default AboutModal diff --git a/browser/app/js/browser/Browser.js b/browser/app/js/browser/Browser.js deleted file mode 100644 index a68f532..0000000 --- a/browser/app/js/browser/Browser.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import classNames from "classnames" -import { connect } from "react-redux" -import SideBar from "./SideBar" -import MainContent from "./MainContent" -import AlertContainer from "../alert/AlertContainer" - -class Browser extends React.Component { - render() { - return ( -
- - - -
- ) - } -} - -export default connect(state => state)(Browser) diff --git a/browser/app/js/browser/BrowserDropdown.js b/browser/app/js/browser/BrowserDropdown.js deleted file mode 100644 index 36aa6f7..0000000 --- a/browser/app/js/browser/BrowserDropdown.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016, 2017, 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { connect } from "react-redux" -import { Dropdown } from "react-bootstrap" -import * as browserActions from "./actions" -import web from "../web" -import history from "../history" -import AboutModal from "./AboutModal" -import ChangePasswordModal from "./ChangePasswordModal" - -export class BrowserDropdown extends React.Component { - constructor(props) { - super(props) - this.state = { - showAboutModal: false, - showChangePasswordModal: false - } - } - showAbout(e) { - e.preventDefault() - this.setState({ - showAboutModal: true - }) - } - hideAbout() { - this.setState({ - showAboutModal: false - }) - } - showChangePassword(e) { - e.preventDefault() - this.setState({ - showChangePasswordModal: true - }) - } - hideChangePassword() { - this.setState({ - showChangePasswordModal: false - }) - } - componentDidMount() { - const { fetchServerInfo } = this.props - fetchServerInfo() - } - fullScreen(e) { - e.preventDefault() - let el = document.documentElement - if (el.requestFullscreen) { - el.requestFullscreen() - } - if (el.mozRequestFullScreen) { - el.mozRequestFullScreen() - } - if (el.webkitRequestFullscreen) { - el.webkitRequestFullscreen() - } - if (el.msRequestFullscreen) { - el.msRequestFullscreen() - } - } - logout(e) { - e.preventDefault() - web.Logout() - history.replace("/login") - } - render() { - const { serverInfo } = this.props - return ( -
  • - - - - - -
  • - - GitHub - -
  • -
  • - - Fullscreen - -
  • -
  • - - Documentation - -
  • -
  • - - Ask for help - -
  • -
  • - - About - - {this.state.showAboutModal && ( - - )} -
  • -
  • - - Change Password - - {this.state.showChangePasswordModal && ( - - )} -
  • -
  • - - Sign Out - -
  • - - - - ) - } -} - -const mapStateToProps = state => { - return { - serverInfo: state.browser.serverInfo - } -} - -const mapDispatchToProps = dispatch => { - return { - fetchServerInfo: () => dispatch(browserActions.fetchServerInfo()) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(BrowserDropdown) diff --git a/browser/app/js/browser/ChangePasswordModal.js b/browser/app/js/browser/ChangePasswordModal.js deleted file mode 100644 index 850a54e..0000000 --- a/browser/app/js/browser/ChangePasswordModal.js +++ /dev/null @@ -1,260 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { connect } from "react-redux" -import web from "../web" -import * as alertActions from "../alert/actions" -import { getRandomAccessKey, getRandomSecretKey } from "../utils" -import jwtDecode from "jwt-decode" -import classNames from "classnames" - -import { Modal, ModalBody, ModalHeader } from "react-bootstrap" -import InputGroup from "./InputGroup" -import { ACCESS_KEY_MIN_LENGTH, SECRET_KEY_MIN_LENGTH } from "../constants" - -export class ChangePasswordModal extends React.Component { - constructor(props) { - super(props) - this.state = { - currentAccessKey: "", - currentSecretKey: "", - currentSecretKeyVisible: false, - newAccessKey: "", - newSecretKey: "", - newSecretKeyVisible: false - } - } - // When its shown, it loads the access key from JWT token - componentWillMount() { - const token = jwtDecode(web.GetToken()) - this.setState({ - currentAccessKey: token.sub, - newAccessKey: token.sub - }) - } - - // Save the auth params and set them. - setAuth(e) { - const { showAlert } = this.props - - if (this.canUpdateCredentials()) { - const currentAccessKey = this.state.currentAccessKey - const currentSecretKey = this.state.currentSecretKey - const newAccessKey = this.state.newAccessKey - const newSecretKey = this.state.newSecretKey - web - .SetAuth({ - currentAccessKey, - currentSecretKey, - newAccessKey, - newSecretKey - }) - .then(data => { - showAlert({ - type: "success", - message: "Credentials updated successfully." - }) - }) - .catch(err => { - showAlert({ - type: "danger", - message: err.message - }) - }) - } - } - - generateAuth(e) { - const { serverInfo } = this.props - this.setState({ - newSecretKey: getRandomSecretKey(), - newSecretKeyVisible: true - }) - } - - canChangePassword() { - const { serverInfo } = this.props - // Password change is not allowed for temporary users(STS) - if(serverInfo.userInfo.isTempUser) { - return false - } - - // Password change is only allowed for regular users - if (!serverInfo.userInfo.isIAMUser) { - return false - } - - return true - } - - canUpdateCredentials() { - return ( - this.state.currentAccessKey.length > 0 && - this.state.currentSecretKey.length > 0 && - this.state.newAccessKey.length >= ACCESS_KEY_MIN_LENGTH && - this.state.newSecretKey.length >= SECRET_KEY_MIN_LENGTH - ) - } - - render() { - const { hideChangePassword, serverInfo } = this.props - const allowChangePassword = this.canChangePassword() - - if (!allowChangePassword) { - return ( - - Change Password - - Credentials of this user cannot be updated through MinIO Browser. - -
    - -
    -
    - ) - } - - return ( - - Change Password - -
    - - - { - this.setState({ - currentSecretKeyVisible: !this.state.currentSecretKeyVisible - }) - }} - className={ - "toggle-password fas fa-eye " + - (this.state.currentSecretKeyVisible ? "toggled" : "") - } - /> - { - this.setState({ currentSecretKey: e.target.value }) - }} - id="currentSecretKey" - label="Current Secret Key" - name="currentSecretKey" - type={this.state.currentSecretKeyVisible ? "text" : "password"} - spellCheck="false" - required="required" - autoComplete="false" - align="ig-left" - /> -
    - -
    - { - this.setState({ - newSecretKeyVisible: !this.state.newSecretKeyVisible - }) - }} - className={ - "toggle-password fas fa-eye " + - (this.state.newSecretKeyVisible ? "toggled" : "") - } - /> - { - this.setState({ newSecretKey: e.target.value }) - }} - id="newSecretKey" - label="New Secret Key" - name="newSecretKey" - type={this.state.newSecretKeyVisible ? "text" : "password"} - spellCheck="false" - required="required" - autoComplete="false" - align="ig-left" - onChange={e => { - this.setState({ newSecretKey: e.target.value }) - }} - /> -
    -
    -
    - - - -
    -
    - ) - } -} - -const mapStateToProps = state => { - return { - serverInfo: state.browser.serverInfo - } -} - -const mapDispatchToProps = dispatch => { - return { - showAlert: alert => dispatch(alertActions.set(alert)) - } -} - -export default connect( - mapStateToProps, - mapDispatchToProps -)(ChangePasswordModal) diff --git a/browser/app/js/browser/ConfirmModal.js b/browser/app/js/browser/ConfirmModal.js deleted file mode 100644 index e863204..0000000 --- a/browser/app/js/browser/ConfirmModal.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { Modal, ModalBody } from "react-bootstrap" - -let ConfirmModal = ({ - baseClass, - icon, - text, - sub, - okText, - cancelText, - okHandler, - cancelHandler, - show -}) => { - return ( - - -
    - -
    -
    {text}
    -
    {sub}
    -
    -
    - - -
    -
    - ) -} - -export default ConfirmModal diff --git a/browser/app/js/browser/Header.js b/browser/app/js/browser/Header.js deleted file mode 100644 index 53777b5..0000000 --- a/browser/app/js/browser/Header.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import Path from "../objects/Path" -import StorageInfo from "./StorageInfo" -import BrowserDropdown from "./BrowserDropdown" -import web from "../web" -import { minioBrowserPrefix } from "../constants" - -export const Header = () => { - const loggedIn = web.LoggedIn() - return ( -
    - - {loggedIn && } - -
    - ) -} - -export default Header diff --git a/browser/app/js/browser/Host.js b/browser/app/js/browser/Host.js deleted file mode 100644 index b9e3cc3..0000000 --- a/browser/app/js/browser/Host.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" - -export const Host = () => ( - -) - -export default Host diff --git a/browser/app/js/browser/InputGroup.js b/browser/app/js/browser/InputGroup.js deleted file mode 100644 index bdf746f..0000000 --- a/browser/app/js/browser/InputGroup.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" - -let InputGroup = ({ - label, - id, - name, - value, - onChange, - type, - spellCheck, - required, - readonly, - autoComplete, - align, - className -}) => { - var input = ( - - ) - if (readonly) - input = ( - - ) - return ( -
    - {input} - - -
    - ) -} - -export default InputGroup diff --git a/browser/app/js/browser/Login.js b/browser/app/js/browser/Login.js deleted file mode 100644 index ada8d65..0000000 --- a/browser/app/js/browser/Login.js +++ /dev/null @@ -1,187 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { connect } from "react-redux" -import logo from "../../img/logo.svg" -import Alert from "../alert/Alert" -import * as actionsAlert from "../alert/actions" -import InputGroup from "./InputGroup" -import web from "../web" -import { Redirect, Link } from "react-router-dom" -import OpenIDLoginButton from './OpenIDLoginButton' - -export class Login extends React.Component { - constructor(props) { - super(props) - this.state = { - accessKey: "", - secretKey: "", - discoveryDoc: {}, - clientId: "" - } - } - - // Handle field changes - accessKeyChange(e) { - this.setState({ - accessKey: e.target.value - }) - } - - secretKeyChange(e) { - this.setState({ - secretKey: e.target.value - }) - } - - handleSubmit(event) { - event.preventDefault() - const { showAlert, clearAlert, history } = this.props - let message = "" - if (this.state.accessKey === "") { - message = "Access Key cannot be empty" - } - if (this.state.secretKey === "") { - message = "Secret Key cannot be empty" - } - if (message) { - showAlert("danger", message) - return - } - web - .Login({ - username: this.state.accessKey, - password: this.state.secretKey - }) - .then(res => { - // Clear alerts from previous login attempts - clearAlert() - - history.push("/") - }) - .catch(e => { - showAlert("danger", e.message) - }) - } - - componentWillMount() { - const { clearAlert } = this.props - // Clear out any stale message in the alert of previous page - clearAlert() - document.body.classList.add("is-guest") - } - - componentDidMount() { - web.GetDiscoveryDoc().then(({ DiscoveryDoc, clientId }) => { - this.setState({ - clientId, - discoveryDoc: DiscoveryDoc - }) - }) - } - - componentWillUnmount() { - document.body.classList.remove("is-guest") - } - - render() { - const { clearAlert, alert } = this.props - if (web.LoggedIn()) { - return - } - let alertBox = - // Make sure you don't show a fading out alert box on the initial web-page load. - if (!alert.message) alertBox = "" - - const showOpenID = Boolean(this.state.discoveryDoc && this.state.discoveryDoc.authorization_endpoint) - return ( -
    - {alertBox} -
    -
    - - - - - {showOpenID && ( -
    -
    or
    - { - this.state.clientId ? ( - - Log in with OpenID - - ) : ( - - Log in with OpenID - - ) - } -
    - )} -
    -
    - - - -
    {window.location.host}
    -
    -
    - ) - } -} - -const mapDispatchToProps = dispatch => { - return { - showAlert: (type, message) => - dispatch(actionsAlert.set({ type: type, message: message })), - clearAlert: () => dispatch(actionsAlert.clear()) - } -} - -export default connect( - state => state, - mapDispatchToProps -)(Login) diff --git a/browser/app/js/browser/MainActions.js b/browser/app/js/browser/MainActions.js deleted file mode 100644 index a51d10c..0000000 --- a/browser/app/js/browser/MainActions.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * MinIO Cloud Storage (C) 2018 MinIO, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from "react" -import { connect } from "react-redux" -import { Dropdown, OverlayTrigger, Tooltip } from "react-bootstrap" -import web from "../web" -import * as actionsBuckets from "../buckets/actions" -import * as uploadsActions from "../uploads/actions" -import { getPrefixWritable } from "../objects/selectors" - -export const MainActions = ({ - prefixWritable, - uploadFile, - showMakeBucketModal -}) => { - const uploadTooltip = Upload file - const makeBucketTooltip = ( - Create bucket - ) - const onFileUpload = e => { - e.preventDefault() - let files = e.target.files - let filesToUploadCount = files.length - for (let i = 0; i < filesToUploadCount; i++) { - uploadFile(files.item(i)) - } - e.target.value = null - } - - const loggedIn = web.LoggedIn() - - if (loggedIn || prefixWritable) { - return ( - - - - - - - - - - - - - - {loggedIn && ( - - { - e.preventDefault() - showMakeBucketModal() - }} - > - - - - )} - - - ) - } else { - return