Commit 2cf07c21 authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance error message on GUI

parent bde512d5
Loading
Loading
Loading
Loading
+37 −0
Changes for js-apps/frontend/src/js/app-constants.js: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -15,6 +15,43 @@ export const PAGE_DASHBOARD = 'DASHBOARD';

// Networks
export const DEFAULT_NO_NETWORK_FILE_SELECTED = 'Select a network';
export const SIMU5G_SCENARIO_NAMES = ['monaco-harbor', 'monaco-harbor-lite'];

export function isSimu5gScenarioName(name) {
  return SIMU5G_SCENARIO_NAMES.indexOf(name) !== -1;
}

export function isExternalNwSimulatorType(type) {
  var t = (type || '').toLowerCase();
  return t === 'simu5g' || t === 'oai';
}

export function isExternalNwSimulatorScenario(name, scenario) {
  if (isSimu5gScenarioName(name)) {
    return true;
  }
  try {
    var meta = scenario && scenario.deployment && scenario.deployment.userMeta;
    if (!meta) {
      return false;
    }
    if (meta['network-info']) {
      var info = JSON.parse(meta['network-info']);
      if (isExternalNwSimulatorType(info.type)) {
        return true;
      }
    }
    if (meta['mec-sandbox']) {
      var ms = JSON.parse(meta['mec-sandbox']);
      if (isExternalNwSimulatorType(ms.connectivityModel)) {
        return true;
      }
    }
  } catch (e) {
    return false;
  }
  return false;
}

// Minimum screen resolution
export const MIN_SCREEN_WIDTH = 840;
+12 −0
Changes for js-apps/frontend/src/js/containers/sandbox/configuration-pane.js: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import {
import {
  PAGE_SANDBOX,
  DEFAULT_NO_NETWORK_FILE_SELECTED,
  isSimu5gScenarioName,
  isExternalNwSimulatorScenario,
  NO_SCENARIO_NAME,
  ALERT_DEGRADED_NETWORK,
  ALERT_NEM_NOT_RUNNING,
@@ -406,6 +408,16 @@ class ConfigPane extends Component {

  updateAutomation(pauseButtonEnabled) {
    this.props.changeUpdateAutomationInProgressCount(2);
    if (isSimu5gScenarioName(this.props.networkFileSelected) ||
        isSimu5gScenarioName(this.props.activationInProgressScenarioName) ||
        isExternalNwSimulatorScenario(this.props.networkFileSelected, this.props.scenario) ||
        isExternalNwSimulatorScenario(this.props.activationInProgressScenarioName, this.props.scenario)) {
      this.props.automationApi.setAutomationStateByName('MOVEMENT', false);
      this.props.automationApi.setAutomationStateByName('MOBILITY', !pauseButtonEnabled);
      this.props.automationApi.setAutomationStateByName('POAS-IN-RANGE', true);
      this.props.automationApi.setAutomationStateByName('NETWORK-CHARACTERISTICS-UPDATE', false);
      return;
    }
    this.props.automationApi.setAutomationStateByName('MOVEMENT', !pauseButtonEnabled);
    this.props.automationApi.setAutomationStateByName('MOBILITY', !pauseButtonEnabled);
  }