Commit 15f7a77d authored by Francis Renaud's avatar Francis Renaud
Browse files

Eliminated line layout

parent e110fcb4
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -158,9 +158,6 @@ const validateThroughput = (val) => {
  return null;
};

export const NC_TABLE_LAYOUT = 'NC_TABLE_LAYOUT';
export const NC_LINE_LAYOUT = 'NC_LINE_LAYOUT';

const TableLayout = (props) => {
  return (
    <div>
@@ -206,19 +203,9 @@ const LineLayout = (props) => {
  );
};

const NCLayout = (props) => {
  switch (props.layout) {
  case NC_LINE_LAYOUT:
    return (
      <LineLayout {...props} />
    );
  case NC_TABLE_LAYOUT:
    return (
      <TableLayout {...props} />
    );  
  }
};

// const NCLayout = (props) => (
//   <TableLayout {...props} />
// );

const NCGroup = ({prefix, onUpdate, element}) => {
  const formLabel = (valueName) => {
@@ -360,14 +347,13 @@ const NCGroup = ({prefix, onUpdate, element}) => {
  );

  return (
    <NCLayout
      layout={NC_TABLE_LAYOUT}
    <TableLayout
      latencyComponent={latencyComponent}
      latencyVariationComponent={latencyVariationComponent}
      packetLossComponent={packetLossComponent}
      throughputComponent={throughputComponent}
    >
    </NCLayout>
    </TableLayout>
  );
};

+0 −6
Original line number Diff line number Diff line
@@ -36,11 +36,6 @@ import {
  execZones
} from '../../state/exec';

import {
  NC_LINE_LAYOUT,
  NC_TABLE_LAYOUT
} from '../../components/helper-components/nc-group';

import {
  PAGE_EXECUTE
} from '../../state/ui';
@@ -72,7 +67,6 @@ const EventCreationFields = (props) => {
  case MOBILITY_EVENT:
    return (
      <MobilityEventPane
        layout={NC_TABLE_LAYOUT}
        element={props.element}
        eventTypes={props.eventTypes}
        api={props.api}
+56 −67
Original line number Diff line number Diff line
@@ -46,6 +46,39 @@ class MobilityEventPane extends Component {
    };
  }

  shouldComponentUpdate(nextProps) {

    /**
     * element={props.element}
        eventTypes={props.eventTypes}
        api={props.api}
        onSuccess={props.onSuccess}
        onClose={props.onClose}
        currentEvent={props.currentEvent}
        UEs={props.UEs}
        POAs={props.POAs}
        EDGEs={props.EDGEs}
        FOGs={props.FOGs}
        ZONEs={props.ZONEs}
        MobTypes={props.MobTypes}
        FogEdges={props.FogEdges}
        EdgeApps={props.EdgeApps}
     */
    return this.props.api !== nextProps.api
      || this.props.element !== nextProps.element
      || this.props.api !== nextProps.api
      || this.props.currentEvent !== nextProps.currentEvent
      || this.props.UEs !== nextProps.UEs
      || this.props.POAs !== nextProps.POAs
      || this.props.EDGEs !== nextProps.EDGEs
      || this.props.FOGs !== nextProps.FOGs
      || this.props.ZONEs !== nextProps.ZONEs
      || this.props.MobTypes !== nextProps.MobTypes
      || this.props.FogEdges !== nextProps.FogEdges
      || this.props.EdgeApps !== nextProps.EdgeApps;
      
  }

  triggerEvent(e) {
    e.preventDefault();
    var meepEvent = {
@@ -101,7 +134,7 @@ class MobilityEventPane extends Component {
      }
    }

    const TargetSelectComponent = (
    const TargetSelectComponent = () => (
      <>
      <Select
        style={styles.select}
@@ -114,7 +147,7 @@ class MobilityEventPane extends Component {
      </>
    );

    const DestinationSelectComponent = (
    const DestinationSelectComponent = () => (
      <>
      <Select
        style= {styles.select}
@@ -127,7 +160,7 @@ class MobilityEventPane extends Component {
      </>
    );

    const CancelApplyPairComponent = (
    const CancelApplyPairComponent = () => (
      <>
      <CancelApplyPair
        cancelText="Close"
@@ -138,32 +171,7 @@ class MobilityEventPane extends Component {
      </>
    );

    //check with list the target belongs to
    if (this.values.eventTarget === undefined || this.values.eventTarget === '') {
      return (
        <div>
          <Grid style={styles.field}>
            <GridCell span="8">
              
            </GridCell>
            <GridCell span="4">
            </GridCell>
          </Grid>

          <CancelApplyPair
            cancelText="Close"
            applyText="Submit"
            onCancel={this.props.onClose}
            onApply={(e) => this.triggerEvent(e)}
          />
        </div>
      );
    }

    let Layout = null;
    switch (this.props.layout) {
    case EVENT_CREATION_PANE_TABLE_LAYOUT:
      Layout = (
    let Layout = () => (
      <>
      <Grid style={styles.field}>
        <GridCell span="8">
@@ -182,29 +190,10 @@ class MobilityEventPane extends Component {
      <CancelApplyPairComponent />
      </>
    );
      break;

    case EVENT_CREATION_PANE_LINE_LAYOUT:
      Layout = (
        <>
        <Grid style={styles.field}>
          <GridCell span="6">
            <TargetSelectComponent />
          </GridCell>
          <GridCell span="6">
            <DestinationSelectComponent />
          </GridCell>
        </Grid>
        <CancelApplyPairComponent />
        </>
      );
      break;
    }
  
  
    return (
      <div>
        {Layout}
        <Layout />
      </div>
    );
  }
+2 −2
Original line number Diff line number Diff line
@@ -80,8 +80,8 @@ import {
} from '../state/ui';

// MEEP Controller REST API JS client
var basepath = 'http://' + location.host + location.pathname + 'v1';
// const basepath = 'http://10.3.16.73:30000/v1';
// var basepath = 'http://' + location.host + location.pathname + 'v1';
const basepath = 'http://10.3.16.73:30000/v1';

meepCtrlRestApiClient.ApiClient.instance.basePath = basepath.replace(/\/+$/, '');