Commit c9ed7a5c authored by Kevin Di Lallo's avatar Kevin Di Lallo
Browse files

added session terminated dialog

parent 8e4966df
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2021  InterDigital Communications, 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, { Component } from 'react';
import IDDialog from './id-dialog';

class IDSessionTerminatedDialog extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }

  render() {
    return (
      <IDDialog
        title={this.props.title}
        open={this.props.open}
        onClose={this.props.onClose}
        onSubmit={this.props.onClose}
        submitLabel = {'Ok'}
      >
        <div style={styles.text}>
          Your session has terminated. Please sign in again.
        </div>
      </IDDialog>
    );
  }
}

const styles = {
  text: {
    color: 'gray'
  }
};

export default IDSessionTerminatedDialog;
+17 −4
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ import {
  STATUS_SIGNIN_NOT_SUPPORTED,
  PAGE_HOME_INDEX,
  PAGE_CONFIGURE_INDEX,
  IDC_DIALOG_SIGN_IN
  IDC_DIALOG_SIGN_IN,
  IDC_DIALOG_SESSION_TERMINATED
} from '../meep-constants';

import {
@@ -159,7 +160,6 @@ class MeepContainer extends Component {
        this.props.changeSignInStatus(STATUS_SIGNIN_NOT_SUPPORTED);
      } else if (response.status === 200) {
        this.props.changeSignInStatus(STATUS_SIGNED_IN);
        this.startSessionKeepaliveTimer();
      } else {
        this.props.changeSignInStatus(STATUS_SIGNED_OUT);
        this.logout();
@@ -179,7 +179,6 @@ class MeepContainer extends Component {
        this.props.changeSignInStatus(STATUS_SIGNED_IN);
        this.props.changeCurrentPage(PAGE_CONFIGURE);
        this.props.changeTabIndex(PAGE_CONFIGURE_INDEX);
        this.startSessionKeepaliveTimer();
      } else {
        // Sign in failed
        this.logout();
@@ -206,6 +205,12 @@ class MeepContainer extends Component {
  startPlatformRefresh() {
    this.platformRefreshIntervalTimer = setInterval(
      () => {
        // Make sure watchdog timer is running if we are signed in
        if (this.props.signInStatus === STATUS_SIGNED_IN) {
          if (!this.sessionKeepaliveTimer) {
            this.startSessionKeepaliveTimer();
          }
        }
        this.checkPlatformStatus();
      },
      1000
@@ -303,8 +308,16 @@ class MeepContainer extends Component {
      .then(res => {
        this.props.changeCorePodsPhases(res.data.podStatus);
      })
      .catch(() => {
      .catch(error => {
        this.props.changeCorePodsPhases([]);

        // Log out if session was terminated
        if (this.props.signInStatus === STATUS_SIGNED_IN) {
          if (error.response.status === 401) {
            this.logout();
            this.props.changeCurrentDialog(IDC_DIALOG_SESSION_TERMINATED);
          }
        }
      });
  }

+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ export const MEEP_DLG_CONFIRM = 'meep-dlg-confirm';
// Dialog Types
// HOME
export const IDC_DIALOG_SIGN_IN = 'IDC_DIALOG_SIGN_IN';
export const IDC_DIALOG_SESSION_TERMINATED = 'IDC_DIALOG_SESSION_TERMINATED';
// CFG
export const IDC_DIALOG_OPEN_SCENARIO = 'IDC_DIALOG_OPEN_SCENARIO';
export const IDC_DIALOG_NEW_SCENARIO = 'IDC_DIALOG_NEW_SCENARIO';