RIFT-15970: RIFT-287: Manually triggered autoscaling scaling limits test - No UI... 87/1587/1
authorKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Wed, 19 Apr 2017 04:36:08 +0000 (00:36 -0400)
committerKIRAN KASHALKAR <kiran.kashalkar@riftio.com>
Wed, 19 Apr 2017 04:36:08 +0000 (00:36 -0400)
Signed-off-by: KIRAN KASHALKAR <kiran.kashalkar@riftio.com>
skyquake/framework/widgets/button/rw.button.js
skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx

index 41730eb..5d684ec 100644 (file)
@@ -251,7 +251,8 @@ module.exports = React.createClass({
         onKeyPress:        this.onKeyPress,
         onKeyUp:           this.onKeyUp,
         onFocus:           this.onFocus,
-        onBlur:            this.onBlur
+        onBlur:            this.onBlur,
+        disabled:          this.isDisabled, 
       },
       button_icon,
       React.createElement("span", {className: "rw-button__label"}, display)
index be8d4eb..db94ded 100644 (file)
  */
 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
@@ -68,7 +74,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>
                        );
@@ -132,7 +138,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 +163,5 @@ export default class NsrScalingGroups extends React.Component {
        }
 
 }
+
+export default SkyquakeComponent(NsrScalingGroups);