Commit 328438cd authored by Kevin Di Lallo's avatar Kevin Di Lallo
Browse files

frontend updates to get & display registered MEC services

parent 3f2d9fce
Loading
Loading
Loading
Loading
+46 −6
Original line number Diff line number Diff line
version: 1.8.1
version: 1.8.2
repo:
  name: AdvantEDGE

@@ -905,6 +905,21 @@ repo:

    # Go Packages
    go-packages:
      meep-ams-client:
        # location of source code
        src: go-packages/meep-ams-client
        # supports linting
        lint: false
      meep-app-support-client:
        # location of source code
        src: go-packages/meep-app-support-client
        # supports linting
        lint: false
      meep-applications:
        # location of source code
        src: go-packages/meep-applications
        # supports linting
        lint: true
      meep-couch:
        # location of source code
        src: go-packages/meep-couch
@@ -930,6 +945,11 @@ repo:
        src: go-packages/meep-gis-cache
        # supports linting
        lint: true
      meep-gis-engine-client:
        # location of source code
        src: go-packages/meep-gis-engine-client
        # supports linting
        lint: false
      meep-http-logger:
        # location of source code
        src: go-packages/meep-http-logger
@@ -985,6 +1005,11 @@ repo:
        src: go-packages/meep-net-char-mgr
        # supports linting
        lint: true
      meep-pdu-session-store:
        # location of source code
        src: go-packages/meep-pdu-session-store
        # supports linting
        lint: true
      meep-redis:
        # location of source code
        src: go-packages/meep-redis
@@ -1010,6 +1035,11 @@ repo:
        src: go-packages/meep-sandbox-store
        # supports linting
        lint: true
      meep-service-mgmt-client:
        # location of source code
        src: go-packages/meep-service-mgmt-client
        # supports linting
        lint: false
      meep-sessions:
        # location of source code
        src: go-packages/meep-sessions
@@ -1020,6 +1050,11 @@ repo:
        src: go-packages/meep-subscriptions
        # supports linting
        lint: true
      meep-swagger-api-mgr:
        # location of source code
        src: go-packages/meep-swagger-api-mgr
        # supports linting
        lint: true
      meep-users:
        # location of source code
        src: go-packages/meep-users
@@ -1030,11 +1065,6 @@ repo:
        src: go-packages/meep-wais-client
        # supports linting
        lint: false
      meep-ams-client:
        # location of source code
        src: go-packages/meep-ams-client
        # supports linting
        lint: false
      meep-watchdog:
        # location of source code
        src: go-packages/meep-watchdog
@@ -1048,6 +1078,16 @@ repo:

    # Javascript Packages
    js-packages:
      meep-auth-svc-client:
        # location of source code
        src: js-packages/meep-auth-svc-client
        # supports linting
        lint: false
      meep-gis-engine-client:
        # location of source code
        src: js-packages/meep-gis-engine-client
        # supports linting
        lint: false
      meep-metrics-engine-client:
        # location of source code
        src: js-packages/meep-metrics-engine-client
+7 −0
Original line number Diff line number Diff line
@@ -853,6 +853,13 @@ services:
        path: '/events/{type}'
        method: 'POST'
        mode: 'allow'
      - name: 'ServicesGET'
        path: '/services'
        method: 'GET'
        mode: 'verify'
        roles:
          admin: 'allow'
          user: 'allow'
  #------------------------------
  #  WAI Service (Sbox)
  #------------------------------
+74 −14
Original line number Diff line number Diff line
@@ -98,7 +98,8 @@ import {
  sboxChangeMapPoaList,
  sboxChangeMapComputeList,
  sboxChangeApiTable,
  sboxChangeAppInstanceTable
  sboxChangeAppInstanceTable,
  sboxChangeSvcTable
} from '../state/sbox';

const SBOX_ERR_COUNT_MAX = 5;
@@ -160,7 +161,8 @@ class AppContainer extends Component {
    this.meepSandboxControlApi = new meepPlatformCtrlRestApiClient.SandboxControlApi();
    this.meepActiveScenarioApi = new meepSandboxCtrlRestApiClient.ActiveScenarioApi();
    this.meepEventsApi = new meepSandboxCtrlRestApiClient.EventsApi();
    this.meepAppInfoApi = new meepSandboxCtrlRestApiClient.ApplicationsApi();
    this.meepApplicationsApi = new meepSandboxCtrlRestApiClient.ApplicationsApi();
    this.meepServicesApi = new meepSandboxCtrlRestApiClient.ServicesApi();
    this.meepMetricsEngineApi = new meepMetricsEngineRestApiClient.MetricsApi();
    this.meepGisAutomationApi = new meepGisEngineRestApiClient.AutomationApi();
    this.meepGeoDataApi = new meepGisEngineRestApiClient.GeospatialDataApi();
@@ -301,6 +303,7 @@ class AppContainer extends Component {
                this.refreshAutomation();
                this.refreshMetricsTable();
                this.refreshAppInstancesTable();
                this.refreshServices();
              }
            }
          }
@@ -496,7 +499,7 @@ class AppContainer extends Component {
  deleteAppInstances() {
    var appInstances = this.props.appInstancesSelected;
    for (var i = 0; i < appInstances.length; i++) {
      this.meepAppInfoApi.applicationsAppInstanceIdDELETE(appInstances[i], null);
      this.meepApplicationsApi.applicationsAppInstanceIdDELETE(appInstances[i], null);
    }
    this.props.changeAppInstancesSelected([]);
  }
@@ -506,9 +509,9 @@ class AppContainer extends Component {
      'name': param.appName,
      'mepName': param.mepName,
      'type': 'USER',
      'state': 'INITIALIZED'
      'persist': false
    };
    this.meepAppInfoApi.applicationsPOST(formParams, (error, data, response) => {
    this.meepApplicationsApi.applicationsPOST(formParams, (error, data, response) => {
      this.createAppInstanceCb(error, data, response);
    });
    this.props.changeCurrentDialog(null);
@@ -713,6 +716,7 @@ class AppContainer extends Component {
        this.props.changeApiTable(null);
        this.props.changeApiDetailedData(null);
        this.props.changeAppInstanceTable([]);
        this.props.changeSvcTable([]);
      }
      return;
    }
@@ -948,6 +952,41 @@ class AppContainer extends Component {
    });
  }

  /**
   * Callback function to receive the result of the servicesGET operation.
   * @callback module:api/ServicesApi~servicesGETCallback
   * @param {String} error Error message, if any.
   * @param {Array.<module:model/ServiceInfo>} data The data returned by the service call.
   * @param {String} response The complete HTTP response.
   */
  getServicesCb(error, data) {
    if (error !== null) {
      this.props.changeSvcTable([]);
      return;
    }

    // Make sure are ready to update state
    if (this.props.updateAppInstancesInProgressCount !== -1) {
      return;
    }

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

      // Update Edge App states
      this.refreshEdgeApps(this.props.appInstanceTable, services);
    }
  }

  refreshServices() {
    this.meepServicesApi.servicesGET(null, (error, data, response) => {
      this.getServicesCb(error, data, response);
    });
  }

  /**
   * Callback function to receive the result of the postHttpQuery operation.
   * @callback module:api/AppsApi~applicationsGET
@@ -973,12 +1012,12 @@ class AppContainer extends Component {
      this.props.changeAppInstanceTable(appInstances);

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

  refreshAppInstancesTable() {
    this.meepAppInfoApi.applicationsGET(null, (error, data, response) => {
    this.meepApplicationsApi.applicationsGET(null, (error, data, response) => {
      this.getAppInstancesCb(error, data, response);
    });
  }
@@ -995,7 +1034,19 @@ class AppContainer extends Component {
    return null;
  }

  refreshEdgeApps(appInstances) {
  getSvcInstance(appId, services) {
    if (services) {
      for (var i = 0; i < services.length; i++) {
        let service = services[i];
        if (service.appId === appId) {
          return service;
        }
      }
    }
    return null;
  }

  refreshEdgeApps(appInstances, services) {
    if (!this.props.edgeApps) {
      return;
    }
@@ -1017,16 +1068,19 @@ class AppContainer extends Component {

      // Find matching app instance, if any
      let appInstance = this.getAppInstance(edgeApp.id, appInstances);
      let svcInstance = this.getSvcInstance(edgeApp.id, services);

      // Update service state
      if (appInstance === null) {
      if (appInstance === null || svcInstance === null) {
        if (edgeApp.enabled) {
          edgeApp.enabled = false;
          edgeApp.svcId = '';
          updateRequired = true;
        }
      } else {
        if (!edgeApp.enabled) {
          edgeApp.instance = appInstance.name;
          edgeApp.svcId = svcInstance.id;
          edgeApp.enabled = true;
          updateRequired = true;
        }
@@ -1042,7 +1096,7 @@ class AppContainer extends Component {
    }
  }

  decrementEdgeApps(appInstances) {
  decrementEdgeApps(appInstances, services) {
    if (!this.props.edgeApps) {
      return;
    }
@@ -1068,8 +1122,10 @@ class AppContainer extends Component {
        // Enable controls immediately after operation is complete
        if (edgeApp.enableInProgressCount < (EDGE_APP_ENABLE_COUNT_MAX - BLACKOUT_TIME)) {
          let appInstance = this.getAppInstance(edgeApp.id, appInstances);
          if (appInstance !== null) {
          let svcInstance = this.getSvcInstance(edgeApp.id, services);
          if (appInstance !== null && svcInstance !== null) {
            edgeApp.instance = appInstance.name;
            edgeApp.svcId = svcInstance.id;
            edgeApp.enabled = true;
            edgeApp.enableInProgressCount = -1;
          }
@@ -1080,8 +1136,10 @@ class AppContainer extends Component {
        // Enable controls immediately after operation is complete
        if (edgeApp.disableInProgressCount < (EDGE_APP_DISABLE_COUNT_MAX - BLACKOUT_TIME)) {
          let appInstance = this.getAppInstance(edgeApp.id, appInstances);
          if (appInstance === null) {
          let svcInstance = this.getSvcInstance(edgeApp.id, services);
          if (appInstance === null || svcInstance === null) {
            edgeApp.enabled = false;
            edgeApp.svcId = '';
            edgeApp.disableInProgressCount = -1;
          }
        }
@@ -1114,7 +1172,7 @@ class AppContainer extends Component {
    }

    // Edge App counters
    this.decrementEdgeApps(this.props.appInstanceTable);
    this.decrementEdgeApps(this.props.appInstanceTable, this.props.svcTable);
  }

  renderPage() {
@@ -1135,7 +1193,7 @@ class AppContainer extends Component {
          eventsApi={this.meepEventsApi}
          metricsApi={this.meepMetricsEngineApi}
          automationApi={this.meepGisAutomationApi}
          applicationsApi={this.meepAppInfoApi}
          applicationsApi={this.meepApplicationsApi}
        />
      );

@@ -1284,6 +1342,7 @@ const mapStateToProps = state => {
    edgeApps: state.ui.edgeApps,
    appInstanceTable: state.sbox.appInstanceTable.data,
    appInstancesSelected: state.ui.appInstancesSelected,
    svcTable: state.sbox.svcTable.data,
    updateUeInProgressCount: state.ui.updateUeInProgressCount,
    updateAppInstancesInProgressCount: state.ui.updateAppInstancesInProgressCount,
    activationInProgressCount: state.ui.activationInProgressCount,
@@ -1327,6 +1386,7 @@ const mapDispatchToProps = dispatch => {
    changeMapComputeList: list => dispatch(sboxChangeMapComputeList(list)),
    changeApiTable: value => dispatch(sboxChangeApiTable(value)),
    changeAppInstanceTable: value => dispatch(sboxChangeAppInstanceTable(value)),
    changeSvcTable: value => dispatch(sboxChangeSvcTable(value)),
    changeUpdateUeInProgressCount: count => dispatch(uiSandboxChangeUpdateUeInProgressCount(count)),
    changeUpdateAutomationInProgressCount: count => dispatch(uiSandboxChangeUpdateAutomationInProgressCount(count)),
    changeUpdateAppInstancesInProgressCount: count => dispatch(uiSandboxChangeUpdateAppInstancesInProgressCount(count)),
+5 −2
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ class AppInstanceInfo extends Component {
    let disabled = (isMec011 || edgeApp.enableInProgressCount !== -1 || edgeApp.disableInProgressCount !== -1) ? true : false;
    let mepInfoStr = (isMec011) ? edgeApp.mepName + ' platform API' : edgeApp.instance + ' running on ' + edgeApp.mepName;
    let appInfoStr = 'appInstanceId: ' + edgeApp.id;
    let svcInfoStr = 'serviceId: ' + ((edgeApp.svcId) ? edgeApp.svcId : 'unavailable');

    return (
      <>
@@ -142,8 +143,10 @@ class AppInstanceInfo extends Component {
            </p>
            <Typography className="text-color-main" use="body1">
              {mepInfoStr}
              {!isMec011 && appInfoStr && <br/>}
              {!isMec011 && <br/>}
              {!isMec011 && appInfoStr}
              {!isMec011 && <br/>}
              {!isMec011 && svcInfoStr}
            </Typography>
          </GridCell>
        </Grid>
+1 −0
Original line number Diff line number Diff line
@@ -332,6 +332,7 @@ class ConfigPane extends Component {
      let edgeAppInstance = this.getEdgeApp(edgeApp.id, this.props.edgeApps);
      if (edgeAppInstance !== null) {
        edgeApp.enabled = edgeAppInstance.enabled;
        edgeApp.svcId = edgeAppInstance.svcId;
        edgeApp.enableInProgressCount = edgeAppInstance.enableInProgressCount;
        edgeApp.disableInProgressCount = edgeAppInstance.disableInProgressCount;
      } else {
Loading