Commit 9d54c331 authored by Simon Pastor's avatar Simon Pastor
Browse files

PR review comments addressed

parent c52bbf25
Loading
Loading
Loading
Loading
+0 −56
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import (
	"fmt"
	"strconv"
	"strings"
//	"time"

	dkm "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-data-key-mgr"
	log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger"
@@ -94,60 +93,7 @@ func NewGisCache(sandboxName string, redisAddr string) (gc *GisCache, err error)
	log.Info("Created GIS Cache")
	return gc, nil
}
/*
// UpdateGisCacheInflux - Creates and initialize an Influx DB for a GIS Cache instance
func (gc *GisCache) UpdateGisCacheInflux(sandboxName string, scenarioName string, influxAddr string) (err error) {
	// Connect to Influx DB
	for retry := 0; gc.influxClient == nil && retry <= dbMaxRetryCount; retry++ {
		gc.influxClient, err = gc.connectInfluxDB(influxAddr)
		if err != nil {
			log.Warn("Failed to connect to InfluxDB. Retrying... Error: ", err)
		}
	}
	if err != nil {
		return err
	}
	log.Info("Connected to GIS Cache Influx DB")

	influxName := sandboxName
	if scenarioName != "" {
		influxName = influxName + "_" + scenarioName
	}

	gc.influxName = strings.Replace(influxName, "-", "_", -1)

	err = gc.CreateInfluxDb()
	if err != nil {
		log.Info("Error in creating influx db")
	}

	//nil or not
	return err
}

func (gc *GisCache) connectInfluxDB(addr string) (*influx.Client, error) {
	if addr == "" {
		addr = defaultInfluxDBAddr
	}
	log.Debug("InfluxDB Connector connecting to ", addr)

	client, err := influx.NewHTTPClient(influx.HTTPConfig{Addr: addr, InsecureSkipVerify: true})
	if err != nil {
		log.Error("InfluxDB Connector unable to connect ", addr)
		return nil, err
	}
	defer client.Close()

	_, version, err := client.Ping(1000 * time.Millisecond)
	if err != nil {
		log.Error("InfluxDB Connector unable to connect ", addr)
		return nil, err
	}

	log.Info("InfluxDB Connector connected to ", addr, " version: ", version)
	return &client, nil
}
*/
// SetPosition - Create or update entry in DB
func (gc *GisCache) SetPosition(typ string, name string, position *Position) error {
	key := gc.baseKey + posKey + typ + ":" + name
@@ -307,6 +253,4 @@ func (gc *GisCache) DelMeasurement(ue string, poa string) {
// Flush - Remove all GIS cache entries
func (gc *GisCache) Flush() {
	gc.rc.DBFlush(gc.baseKey)

//	gc.FlushInfluxDb()
}
+5 −6
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ import {
  updateObject
} from '@/js/util/object-util';

class ViewSpecificPane extends Component {
class DashCfgDetailPane extends Component {
  constructor(props) {
    super(props);
    autoBind(this);
@@ -207,8 +207,7 @@ class ViewSpecificPane extends Component {

const mapStateToProps = state => {
  return {
    sandboxCfg: state.ui.sandboxCfg,
    pduSessionEvent: state.ui.pduSessionEvent
    sandboxCfg: state.ui.sandboxCfg
  };
};

@@ -219,9 +218,9 @@ const mapDispatchToProps = dispatch => {
  };
};

const ConnectedViewSpecificPane = connect(
const ConnectedDashCfgDetailPane = connect(
  mapStateToProps,
  mapDispatchToProps
)(ViewSpecificPane);
)(DashCfgDetailPane);

export default ConnectedViewSpecificPane;
export default ConnectedDashCfgDetailPane;
+10 −54
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import { Grid, GridCell, GridInner } from '@rmwc/grid';
import { Typography } from '@rmwc/typography';
import { updateObject } from '@/js/util/object-util';
import * as d3 from 'd3';
import ViewSpecificPane from './view-specific-pane';
import DashCfgDetailPane from './dash-cfg-detail-pane';

import {
  getScenarioNodeChildren,
@@ -33,7 +33,6 @@ import {

import {
  uiExecChangeCurrentView,
  uiExecChangeViewStatus,
  uiExecChangeSourceNodeSelectedView1,
  uiExecChangeDestNodeSelectedView1,
  uiExecChangeSourceNodeSelectedView2,
@@ -43,20 +42,6 @@ import {
  uiExecChangeSandboxCfg
} from '@/js/state/ui';

import {
  execChangeSelectedScenarioElement,
  execResetSelectedScenarioElement,
  execUEs,
  execPOAs,
  execMobTypes,
  execEdges,
  execEdgeApps,
  execFogs,
  execFogEdges,
  execZones,
  execDNs
} from '@/js/state/exec';

import {
  EXEC_VIEW_SELECT,
  VIEW_1,
@@ -92,7 +77,7 @@ const ViewSelectFields = props => {
  switch (props.currentView) {
  case VIEW_1:
    return (
      <ViewSpecificPane
      <DashCfgDetailPane
        currentView={props.currentView}
        onSuccess={props.onSuccess}
        onClose={props.onClose}
@@ -113,7 +98,7 @@ const ViewSelectFields = props => {
    );
  case VIEW_2:
    return (
      <ViewSpecificPane
      <DashCfgDetailPane
        currentView={props.currentView}
        onSuccess={props.onSuccess}
        onClose={props.onClose}
@@ -139,7 +124,7 @@ const ViewSelectFields = props => {

const showInExecStr = '<exec>';

class ViewPane extends Component {
class DashCfgPane extends Component {
  constructor(props) {
    super(props);
    this.state = {};
@@ -206,23 +191,12 @@ class ViewPane extends Component {
    }
  }
  
  onViewPaneClose(e) {
  onDashCfgClose(e) {
    e.preventDefault();
    this.props.changeView('');
    this.props.changeViewStatus('');
    this.props.onClose(e);
  }

  updateElement(values) {
    if (values === null) {
      this.props.resetSelectedScenarioElement();
    } else {
      var element = updateObject({}, this.props.selectedScenarioElement);
      element = updateObject(element, values);
      this.props.changeSelectedScenarioElement(element);
    }
  }

  getRoot() {
    return d3.hierarchy(this.props.displayedScenario, getScenarioNodeChildren);
  }
@@ -265,14 +239,13 @@ class ViewPane extends Component {
          viewOptions={this.props.viewOptions}
          onChange={event => {
            this.props.changeView(event.target.value);
            this.props.changeViewStatus('');
          }}
          value={this.props.currentView}
        />
        <ViewSelectFields
          currentView={this.props.currentView}
          onSuccess={this.props.onSuccess}
          onClose={e => this.onViewPaneClose(e)}
          onClose={e => this.onDashCfgClose(e)}
          sandbox={this.props.sandbox}
          appIds={appIds}
          ueIds={ueIds}
@@ -292,7 +265,6 @@ class ViewPane extends Component {
          dashboardViewsList={dashboardViewsList}
          showApps={this.props.showApps}
        />

        <div>
          <Grid style={{ marginTop: 10 }}>
            <GridInner>
@@ -300,7 +272,7 @@ class ViewPane extends Component {
                <Button
                  outlined
                  style={styles.button}
                  onClick={e => this.onViewPaneClose(e)}
                  onClick={e => this.onDashCfgClose(e)}
                  data-cy={EXEC_BTN_DASHBOARD_BTN_CLOSE}
                >
                  Close
@@ -329,7 +301,6 @@ const styles = {
const mapStateToProps = state => {
  return {
    currentView: state.ui.execCurrentView,
    selectedScenarioElement: state.exec.selectedScenarioElement,
    page: state.ui.page,
    displayedScenario: state.exec.displayedScenario,
    sourceNodeSelectedView1: state.ui.sourceNodeSelectedView1,
@@ -342,17 +313,6 @@ const mapStateToProps = state => {
    view2Name: state.ui.dashboardView2,
    sandboxCfg: state.ui.sandboxCfg,
    dashboardOptions: state.monitor.dashboardOptions,
    UEs: execUEs(state),
    POAs: execPOAs(state),
    EDGEs: execEdges(state),
    FOGs: execFogs(state),
    ZONEs: execZones(state),
    DNs: execDNs(state),
    MobTypes: execMobTypes(state),
    EdgeApps: execEdgeApps(state),
    FogEdges: execFogEdges(state),
    table: state.exec.table,
    networkElements: state.exec.table.entries,
    showApps: state.ui.execShowApps
  };
};
@@ -360,10 +320,6 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => {
  return {
    changeView: view => dispatch(uiExecChangeCurrentView(view)),
    changeSelectedScenarioElement: element =>
      dispatch(execChangeSelectedScenarioElement(element)),
    resetSelectedScenarioElement: () => dispatch(execResetSelectedScenarioElement()),
    changeViewStatus: status => dispatch(uiExecChangeViewStatus(status)),
    changeSourceNodeSelectedView1: src => dispatch(uiExecChangeSourceNodeSelectedView1(src)),
    changeDestNodeSelectedView1: dest => dispatch(uiExecChangeDestNodeSelectedView1(dest)),
    changeSourceNodeSelectedView2: src => dispatch(uiExecChangeSourceNodeSelectedView2(src)),
@@ -374,9 +330,9 @@ const mapDispatchToProps = dispatch => {
  };
};

const ConnectedViewPane = connect(
const ConnectedDashCfgPane = connect(
  mapStateToProps,
  mapDispatchToProps
)(ViewPane);
)(DashCfgPane);

export default ConnectedViewPane;
export default ConnectedDashCfgPane;
+5 −5
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import {
  uiExecChangeEventCreationMode,
  uiExecChangeEventAutomationMode,
  uiExecChangeEventReplayMode,
  uiExecChangeViewMode
  uiExecChangeDashCfgMode
} from '../../state/ui';

import {
@@ -92,7 +92,7 @@ class EventContainer extends Component {
    this.props.changeEventCreationMode(true);
    this.props.changeEventAutomationMode(false);
    this.props.changeEventReplayMode(false);
    this.props.changeViewMode(false);
    this.props.changeDashCfgMode(false);
  }

  // EVENT AUTOMATION PANE
@@ -100,7 +100,7 @@ class EventContainer extends Component {
    this.props.changeEventCreationMode(false);
    this.props.changeEventAutomationMode(true);
    this.props.changeEventReplayMode(false);
    this.props.changeViewMode(false);
    this.props.changeDashCfgMode(false);
  }

  // SHOW REPLAY EVENT PANE
@@ -108,7 +108,7 @@ class EventContainer extends Component {
    this.props.changeEventCreationMode(false);
    this.props.changeEventAutomationMode(false);
    this.props.changeEventReplayMode(true);
    this.props.changeViewMode(false);
    this.props.changeDashCfgMode(false);

    // Refresh 
    this.props.onShowReplay();
@@ -216,7 +216,7 @@ const mapDispatchToProps = dispatch => {
    changeEventCreationMode: mode => dispatch(uiExecChangeEventCreationMode(mode)),
    changeEventAutomationMode: mode => dispatch(uiExecChangeEventAutomationMode(mode)),
    changeEventReplayMode: mode => dispatch(uiExecChangeEventReplayMode(mode)),
    changeViewMode: mode => dispatch(uiExecChangeViewMode(mode))
    changeDashCfgMode: mode => dispatch(uiExecChangeDashCfgMode(mode))
  };
};

+7 −27
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import HeadlineBar from '../../components/headline-bar';
import EventCreationPane from './event-creation-pane';
import EventAutomationPane from './event-automation-pane';
import EventReplayPane from './event-replay-pane';
import ViewPane from './view-pane';
import DashCfgPane from './dashboard-cfg-pane';

import ExecTable from './exec-table';

@@ -47,7 +47,6 @@ import { execChangeScenarioList} from '../../state/exec';
import {
  uiChangeCurrentDialog,
  uiExecChangeEventCreationMode,
  uiExecChangeViewMode,
  uiExecChangeEventAutomationMode,
  uiExecChangeEventReplayMode,
  uiExecChangeDashCfgMode,
@@ -216,7 +215,6 @@ class ExecPageContainer extends Component {
    this.props.eventCreationMode ? this.onQuitEventCreationMode() : '';
    this.props.eventAutomationMode ? this.onQuitEventAutomationMode() : '';
    this.props.eventReplayMode ? this.onQuitEventReplayMode() : '';
    this.props.viewMode ? this.onQuitViewMode() : '';

    // Retrieve list of available scenarios
    this.props.cfgApi.getScenarioList((error, data, response) => {
@@ -260,11 +258,6 @@ class ExecPageContainer extends Component {
    this.props.changeEventCreationMode(false);
  }

  // CLOSE VIEW PANE
  onQuitViewMode() {
    this.props.changeViewMode(false);
  }

  // CLOSE EVENT AUTOMATION PANE
  onQuitEventAutomationMode() {
    this.props.changeEventAutomationMode(false);
@@ -276,28 +269,18 @@ class ExecPageContainer extends Component {
  }

  // CONFIGURE DASHBOARD
  onOpenViewMode() {
    this.props.changeViewMode(true);
  onOpenDashCfg() {
    this.props.changeDashCfgMode(true);
    this.props.changeEventCreationMode(false);
    this.props.changeEventAutomationMode(false);
    this.props.changeEventReplayMode(false);
  }

  // CONFIGURE DASHBOARD
  onOpenDashCfg() {
    this.props.changeDashCfgMode(true);
  }

  // STOP CONFIGURE DASHBOARD
  onCloseDashCfg() {
    this.props.changeDashCfgMode(false);
  }

  // STOP CONFIGURE DASHBOARD
  onCloseViewMode() {
    this.props.changeViewMode(false);
  }

  // CONFIGURE EVENTS
  onOpenEventCfg() {
    this.props.changeEventCfgMode(true);
@@ -389,7 +372,7 @@ class ExecPageContainer extends Component {
      (this.props.scenarioState !== EXEC_STATE_IDLE) ? this.props.execScenarioName : 'None' :
      this.props.cfgScenarioName;

    const eventPaneOpen = this.props.eventCreationMode || this.props.eventAutomationMode || this.props.eventReplayMode || this.props.viewMode;
    const eventPaneOpen = this.props.eventCreationMode || this.props.eventAutomationMode || this.props.eventReplayMode || this.props.dashCfgMode;
    const spanLeft = eventPaneOpen ? 8 : 12;
    const spanRight = eventPaneOpen ? 4 : 0;
    return (
@@ -440,7 +423,6 @@ class ExecPageContainer extends Component {
                        onTerminate={this.onTerminateScenario}
                        onOpenDashCfg={this.onOpenDashCfg}
                        onOpenEventCfg={this.onOpenEventCfg}
                        onOpenViewMode={this.onOpenViewMode}
                      />
                    </GridCell>
                  </GridInner>
@@ -502,10 +484,10 @@ class ExecPageContainer extends Component {
                />
              </Elevation>
              <Elevation className='idcc-elevation' z={2}>
                <ViewPane
                <DashCfgPane
                  viewOptions={[VIEW_1, VIEW_2]}
                  hide={!this.props.viewMode}
                  onClose={this.onQuitViewMode}
                  hide={!this.props.dashCfgMode}
                  onClose={this.onCloseDashCfg}
                  sandbox={this.props.sandbox}
                  scenarioName={this.props.execScenarioName}
                  showApps={this.props.showApps}
@@ -547,7 +529,6 @@ const mapStateToProps = state => {
    scenarioState: state.exec.state.scenario,
    scenarios: state.exec.apiResults.scenarios,
    eventCreationMode: state.ui.eventCreationMode,
    viewMode: state.ui.viewMode,
    eventAutomationMode: state.ui.eventAutomationMode,
    eventReplayMode: state.ui.eventReplayMode,
    dashCfgMode: state.ui.dashCfgMode,
@@ -569,7 +550,6 @@ const mapDispatchToProps = dispatch => {
    changeEventReplayMode: val => dispatch(uiExecChangeEventReplayMode(val)), // (true or false)
    changeDashCfgMode: val => dispatch(uiExecChangeDashCfgMode(val)), // (true or false)
    changeEventCfgMode: val => dispatch(uiExecChangeEventCfgMode(val)), // (true or false)
    changeViewMode: val => dispatch(uiExecChangeViewMode(val)), // (true or false)
    changeCurrentEvent: e => dispatch(uiExecChangeCurrentEvent(e)),
    execChangeOkToTerminate: ok => dispatch(execChangeOkToTerminate(ok)),
    changeShowApps: show => dispatch(uiExecChangeShowApps(show)),
Loading