Commit 33a0e55d authored by Mo Firouz's avatar Mo Firouz
Browse files

Fix various issues with Storage on the Console. Prevent refresh on Status view...

Fix various issues with Storage on the Console. Prevent refresh on Status view if server is unreachable.
parent 56c495ba
Loading
Loading
Loading
Loading
+17 −17

File changed.

Preview size limit exceeded, changes collapsed.

+12 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ import {Dispatch} from 'redux';
import {connect} from 'react-redux';
import {ApplicationState, ConnectedReduxProps} from '../../store';
import * as statusActions from '../../store/status/actions';
import {StatusNodes} from '../../store/status/types';
import {Node, StatusNodes} from '../../store/status/types';

import Header from '../../components/header';
import Sidebar from '../../components/sidebar';
@@ -71,6 +71,16 @@ class Status extends Component<Props, State> {
    const now = new Date();
    const t = now.valueOf();

    if (data && data.nodes && data.nodes.length == 0) {
      data.nodes.push({
        name: "",
        avg_latency_ms: NaN,
        avg_rate_sec: NaN,
        avg_input_kbs: NaN,
        avg_output_kbs: NaN
      } as Node);
    }

    if (
      data &&
      data.nodes &&
@@ -209,6 +219,7 @@ class Status extends Component<Props, State> {
            pointRadius: 0,
            fill: false,
            lineTension: 0.2,
            spanGaps: false,
            borderWidth: 2
          }))
        },
+10 −4
Original line number Diff line number Diff line
@@ -156,7 +156,6 @@ class Storage extends Component<Props, State>
    {
      this.props.deleteManyRequest();
      (document.getElementById('user_id') as HTMLInputElement).value = '';
      this.props.fetchManyRequest({});
    }
  }

@@ -166,9 +165,16 @@ class Storage extends Component<Props, State>
    event.preventDefault();
    if(confirm('Are you sure you want to delete this object?'))
    {
      this.props.deleteRequest(object);
      (document.getElementById('user_id') as HTMLInputElement).value = '';
      this.props.fetchManyRequest({});
      var user_id = (document.getElementById('user_id') as HTMLInputElement).value;

      var request = {
        filter: user_id,
        user_id: object.user_id,
        collection: object.collection,
        key: object.key
      } as StorageObjectRequest;

      this.props.deleteRequest(request);
    }
  }

+1 −3
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ function* handleFetch()
  }
  catch(err)
  {
    console.error(err);
    if(err.status === 401)
    {
      localStorage.clear();
@@ -33,8 +32,7 @@ function* handleFetch()
    else if(err instanceof Error)
    {
      yield put(statusError(err.stack!));
      localStorage.clear();
      window.location.href = '/';
      // don't punt to the login screen. Just leave be.
    }
    else
    {
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ export const storageUpdateError = (message: string) => action(

export const storageDeleteRequest = (data: StorageObjectRequest) => action(
  StorageActionTypes.DELETE_REQUEST,
  data
  data,
);
export const storageDeleteSuccess = () => action(
  StorageActionTypes.DELETE_SUCCESS
Loading