update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b third try
[osm/UI.git] / skyquake / plugins / launchpad / src / launchpad_card / nsrScalingGroups.jsx
index be8d4eb..ffd21bb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 
+ *
  *   Copyright 2016 RIFT.IO Inc
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  */
 import React from 'react';
 import RecordViewStore from '../recordViewer/recordViewStore.js';
+import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx';
 import Button from 'widgets/button/rw.button.js';
 import Utils from 'utils/utils.js';
 import UpTime from 'widgets/uptime/uptime.jsx';
 import './nsrScalingGroups.scss';
 
-export default class NsrScalingGroups extends React.Component {
+class NsrScalingGroups extends React.Component {
        constructor(props) {
                super(props);
                this.state = {};
        }
 
-       handleExecuteClick = (nsr_id, scaling_group_id, event) => {
+       handleExecuteClick = (nsr_id, scaling_group_id, max_instance_count, event) => {
+               let self = this;
+               if (this.getInstancesForScalingGroup(scaling_group_id) == max_instance_count) {
+                       self.props.flux.actions.global.showNotification("Maximum allowed scaling instances created for this group. Cannot create any more");
+                       return;
+               }
                RecordViewStore.createScalingGroupInstance({
                        nsr_id: nsr_id,
                        scaling_group_id: scaling_group_id
@@ -59,6 +65,7 @@ export default class NsrScalingGroups extends React.Component {
                                                        <td>{id}</td>
                                                        <td><UpTime initialTime={sgrInstance['create-time']} run={true} /></td>
                                                        <td>{sgrInstance['op-status']}</td>
+                                                        <td>{sgrInstance['config-status']}</td>
                                                        <td>
                                                                {sgrInstance['is-default'] == 'false' ? <a onClick={this.handleDeleteClick.bind(this, this.props.data.id, sgrName, id)} title="Delete">
                                                        <span className="oi" data-glyph="trash" aria-hidden="true"></span>
@@ -68,7 +75,7 @@ export default class NsrScalingGroups extends React.Component {
                                        );
                                }
                        }) : trows.push(
-                               <tr key={sgrInstanceIndex}>
+                               <tr key={sgri}>
                                        <td colSpan="5" style={{textAlign: 'center'}}>No network services scaled in this group</td>
                                </tr>
                        );
@@ -86,8 +93,9 @@ export default class NsrScalingGroups extends React.Component {
                                <tr>
                                        <th style={{width: '6%'}}></th>
                                    <th style={{width: '12%'}}>ID</th>
-                                   <th style={{width: '37%'}}>Uptime</th>
-                                   <th style={{width: '37%'}}>Status</th>
+                                   <th style={{width: '24%'}}>Uptime</th>
+                                   <th style={{width: '25%'}}>Status</th>
+                                    <th style={{width: '25%'}}>Config-Status</th>
                                    <th style={{width: '7%'}}> </th>
                                </tr>
                            </thead>
@@ -132,7 +140,7 @@ export default class NsrScalingGroups extends React.Component {
 
                        let sgInstanceTable = this.createScalingGroupTable(sgd.name);
 
-                       let sgCreateInstanceButton = <Button label='Create Scaling Group Instance' className="dark" isDisabled={this.getInstancesForScalingGroup(sgd.name) == sgd["max-instance-count"]} isLoading={false} onClick={this.handleExecuteClick.bind(this, this.props.data.id, sgd.name)} />
+                       let sgCreateInstanceButton = <Button label='Create Scaling Group Instance' className="dark" isDisabled={this.getInstancesForScalingGroup(sgd.name) == sgd["max-instance-count"]} isLoading={false} onClick={this.handleExecuteClick.bind(this, this.props.data.id, sgd.name, sgd['max-instance-count'])} />
 
                        let scalingGroup =
                                <div>
@@ -157,3 +165,5 @@ export default class NsrScalingGroups extends React.Component {
        }
 
 }
+
+export default SkyquakeComponent(NsrScalingGroups);