upgrading react and refactoring components (#5409) (#5444)

- upgraded react from v16.2.0
- upgraded react-router to v4.2.0 and re-writen the routes
- using prettier to format the code
- added jest to unit test components/reducers/selectors

This provides a skeleton to start of with. Only basic unit test
cases are added, remaining needs to be added.

In terms of functionality, it provides login, listing and searching
buckets. Remaining functionalities will be added in upcoming patches.
This commit is contained in:
Kanagaraj M
2018-02-01 09:23:11 +05:30
committed by Harshavardhana
parent 76be54551f
commit 9ab6a8035f
41 changed files with 2896 additions and 2978 deletions

View File

@@ -1,5 +1,5 @@
/*
* Minio Cloud Storage (C) 2016 Minio, Inc.
* 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.
@@ -14,17 +14,14 @@
* limitations under the License.
*/
import { browserHistory } from 'react-router'
import JSONrpc from './jsonrpc'
import * as actions from './actions'
import { minioBrowserPrefix } from './constants.js'
import Moment from 'moment'
import storage from 'local-storage-fallback'
export default class Web {
constructor(endpoint, dispatch) {
class Web {
constructor(endpoint) {
const namespace = 'Web'
this.dispatch = dispatch
this.JSONrpc = new JSONrpc({
endpoint,
namespace
@@ -37,7 +34,7 @@ export default class Web {
.catch(err => {
if (err.status === 401) {
storage.removeItem('token')
browserHistory.push(`${minioBrowserPrefix}/login`)
location.reload()
throw new Error('Please re-login.')
}
if (err.status)
@@ -128,3 +125,7 @@ export default class Web {
return this.makeCall('ListAllBucketPolicies', args)
}
}
const web = new Web(`${window.location.protocol}//${window.location.host}${minioBrowserPrefix}/webrpc`);
export default web;