Commit 9da7510d authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub Enterprise
Browse files

Merge pull request #23 from wbu-tep/my_sp35_computedetails

Changed frontend compute node color & popup details
parents a1d769ee 16512b45
Loading
Loading
Loading
Loading
+32 −8
Original line number Diff line number Diff line
@@ -25,7 +25,10 @@ import {
  FIELD_WIRELESS_TYPE,
  FIELD_META_DISPLAY_MAP_COLOR,
  FIELD_META_DISPLAY_MAP_ICON,
  getElemFieldVal
  getElemFieldVal,
  FIELD_DATA_NETWORK_NAME,
  FIELD_EDGE_COMPUTE_PROVIDER,
  FIELD_DN_LADN
} from '../../util/elem-utils';

import {
@@ -70,7 +73,7 @@ const POA_OPACITY = 1.0;
const POA_RANGE_OPACITY = 0.05;

const COMPUTE_ICON = 'ion-android-cloud';
const COMPUTE_COLOR_DEFAULT = '#696969';
const COMPUTE_COLOR_DEFAULT = '#0a50f2';
const COMPUTE_OPACITY = 1.0;

const DEFAULT_MAP_STYLE = 'Positron';
@@ -307,13 +310,10 @@ class MapInfo extends Component {
  }

  getComputeColor(compute) {
    var color = undefined;
    if (this.isConnected(compute)) {
      color = this.getZoneColor(this.getComputeZone(compute));
    } else {
      color = DISCONNECTED_COLOR;
    if (!this.isConnected(compute)) {
      return DISCONNECTED_COLOR;
    }
    return color ? color : COMPUTE_COLOR_DEFAULT;
    return COMPUTE_COLOR_DEFAULT;
  }

  // Get connected status
@@ -505,7 +505,31 @@ class MapInfo extends Component {
  updateComputePopup(marker) {
    if (marker) {
      var latlng = marker.getLatLng();
      var table = this.getTable();
      var services = [];
      for (var i in table.entries) {
        if (table.entries[i].parent.val === marker.options.meep.compute.id) {
          services.push(table.entries[i].name.val);
        }
      }
      const networkName = getElemFieldVal(table.entries[marker.options.meep.compute.id], FIELD_DATA_NETWORK_NAME);
      const edgeProvider = getElemFieldVal(table.entries[marker.options.meep.compute.id], FIELD_EDGE_COMPUTE_PROVIDER);
      const ladn = getElemFieldVal(table.entries[marker.options.meep.compute.id], FIELD_DN_LADN);
      var msg = '<b>id: ' + marker.options.meep.compute.id + '</b><br>';
      if (edgeProvider) {
        msg += 'service-provider: ' + edgeProvider + '<br>';
      }
      if (networkName) {
        msg += 'data-network: ' + networkName;
        if (ladn) {
          msg += ' (LADN)';
        }
        msg += '<br>';
      }
      if (services) {
        var serviceString = services.join(', ');
        msg += 'running-services: ' + serviceString + '<br>';
      }
      msg += 'location: ' + this.getLocationStr(latlng);
      marker.getPopup().setContent(msg);
    }
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ export const FIELD_GEO_EOP_MODE = 'eopMode';
export const FIELD_GEO_VELOCITY = 'velocity';
export const FIELD_META_DISPLAY_MAP_COLOR = 'metaDisplayMapColor';
export const FIELD_META_DISPLAY_MAP_ICON = 'metaDisplayMapIcon';
export const FIELD_DATA_NETWORK_NAME = 'dataNetworkName';
export const FIELD_EDGE_COMPUTE_PROVIDER = 'edgeServiceProvider';
export const FIELD_DN_LADN = 'ladn';

export const getElemFieldVal = (elem, field) => {
  return (elem && elem[field]) ? elem[field].val : null;
+15 −1
Original line number Diff line number Diff line
@@ -24,7 +24,10 @@ import {
  FIELD_META_DISPLAY_MAP_COLOR,
  FIELD_META_DISPLAY_MAP_ICON,
  createElem,
  setElemFieldVal
  setElemFieldVal,
  FIELD_DATA_NETWORK_NAME,
  FIELD_EDGE_COMPUTE_PROVIDER,
  FIELD_DN_LADN
} from './elem-utils';

import {
@@ -258,6 +261,17 @@ export function getElementFromScenario(scenario, elementId) {
              setElemFieldVal(elem, FIELD_GEO_EOP_MODE, pl.geoData.eopMode || '');
              setElemFieldVal(elem, FIELD_GEO_VELOCITY, pl.geoData.velocity || '');
            }
            if (pl.dataNetwork) {
              if (pl.dataNetwork.dnn) {
                setElemFieldVal(elem, FIELD_DATA_NETWORK_NAME, pl.dataNetwork.dnn);
              }
              if (pl.dataNetwork.ecsp) {
                setElemFieldVal(elem, FIELD_EDGE_COMPUTE_PROVIDER, pl.dataNetwork.ecsp);
              }
              if (pl.dataNetwork.ladn) {
                setElemFieldVal(elem, FIELD_DN_LADN, pl.dataNetwork.ladn);
              }
            }
            if (pl.meta) {
              setElemFieldVal(elem, FIELD_META_DISPLAY_MAP_ICON, pl.meta[META_DISPLAY_MAP_ICON]);
            }