Commit 826b024e authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub Enterprise
Browse files

Merge pull request #26 from wbu-tep/my_sp37_computedetails

changed compute pop to show MEC applications registered 
parents 18980b4c c7ccbd93
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -965,13 +965,15 @@ class AppContainer extends Component {
      return;
    }

    // Update App Instance table
    // Update App Instance table only if data is different 
    var appInstances = data ? data : [];
    const isArrayEqual = (x, y) => _.isEmpty(_.xorWith(x, y, _.isEqual));
    if (!isArrayEqual(this.props.appInstanceTable,appInstances)) {
      this.props.changeAppInstanceTable(appInstances);

      // Update Edge App states
      this.refreshEdgeApps(appInstances);
    }
  }

  refreshAppInstancesTable() {
    this.meepAppInfoApi.applicationsGET(null, (error, data, response) => {
+1 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ class AppInstanceInfo extends Component {
    let edgeApp = this.props.edgeApp;
    let isMec011 = edgeApp.pseudoName.includes('011');
    let disabled = (isMec011 || edgeApp.enableInProgressCount !== -1 || edgeApp.disableInProgressCount !== -1) ? true : false;
    let mepInfoStr = 'Running on ' + edgeApp.mepName;
    let mepInfoStr = edgeApp.name + ' running on ' + edgeApp.mepName;
    let appInfoStr = isMec011 ? 'ID: not applicable' : 'ID: ' + edgeApp.id;

    return (
+27 −13
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import L from 'leaflet';
import 'mapbox-gl';
import 'mapbox-gl-leaflet';
import tinycolor from 'tinycolor2';
import _ from 'lodash';

import {
  updateObject
@@ -501,20 +502,28 @@ class MapInfo extends Component {
    }
  }



  // UE Marker Event Handler
  updateComputePopup(marker) {
    if (marker) {
      // Retrieve state 
      var table = this.getTable();
    if (marker && table && table.entries) {
      var latlng = marker.getLatLng();
      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 appInstanceTable = this.props.appInstanceTable;
      var latlng = marker.getLatLng();
      // Parse mec application state on current popup
      var appInstances = [];
      for (var i = 0; i < appInstanceTable.length ; i++) {
        if (appInstanceTable[i].mepName === marker.options.meep.compute.id) {
          appInstances.push(appInstanceTable[i]);
        }
      }
      // Sort parsed array of mec app
      var sortedAppInstances = _.sortBy(appInstances, ['name']);
      // Modify render message
      var msg = '<b>id: ' + marker.options.meep.compute.id + '</b><br>';
      if (edgeProvider) {
        msg += 'service-provider: ' + edgeProvider + '<br>';
@@ -526,15 +535,18 @@ class MapInfo extends Component {
        }
        msg += '<br>';
      }
      if (services) {
        var serviceString = services.join(', ');
        msg += 'running-services: ' + serviceString + '<br>';
      msg += 'applications: <br>';
      if (appInstances) {
        sortedAppInstances.forEach(elem => {
          msg += '<li>' + elem.name + ' ' + '(id: ' + elem.id.substring(0,6) + '...' + elem.id.substring(elem.id.length - 6,elem.id.length + 1) + ')'   + '<br>';
        });
      }
      msg += 'location: ' + this.getLocationStr(latlng);
      marker.getPopup().setContent(msg);
    }
  }


  setUeMarker(ue) {
    var latlng = L.latLng(L.GeoJSON.coordsToLatLng(ue.location.coordinates));
    var pathLatLngs = ue.path ? L.GeoJSON.coordsToLatLngs(ue.path.coordinates) : null;
@@ -858,7 +870,9 @@ const mapStateToProps = state => {
    mapCfg: state.ui.mapCfg,
    // SBOX
    map: state.sbox.map,
    table: state.sbox.table
    table: state.sbox.table,
    // EDGE APPS
    appInstanceTable: state.sbox.appInstanceTable.data
  };
};