X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2Flaunchpad_card%2FnsrScalingGroups.jsx;fp=skyquake%2Fplugins%2Flaunchpad%2Fsrc%2Flaunchpad_card%2FnsrScalingGroups.jsx;h=b6abf5c81bac5c8ddf868985689950f0ed5b383e;hb=e29efc315df33d546237e270470916e26df391d6;hp=0000000000000000000000000000000000000000;hpb=9c5e457509ba5a1822c316635c6308874e61b4b9;p=osm%2FUI.git diff --git a/skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx b/skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx new file mode 100644 index 000000000..b6abf5c81 --- /dev/null +++ b/skyquake/plugins/launchpad/src/launchpad_card/nsrScalingGroups.jsx @@ -0,0 +1,160 @@ +/* + * + * Copyright 2016 RIFT.IO Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +import React from 'react'; +import RecordViewStore from '../recordViewer/recordViewStore.js'; +import Button from 'widgets/button/rw.button.js'; +import Utils from 'utils/utils.js'; +import _ from 'underscore'; +import UpTime from 'widgets/uptime/uptime.jsx'; +import './nsrScalingGroups.scss'; + +export default class NsrScalingGroups extends React.Component { + constructor(props) { + super(props); + this.state = {}; + } + + handleExecuteClick = (nsr_id, scaling_group_id, event) => { + RecordViewStore.createScalingGroupInstance({ + nsr_id: nsr_id, + scaling_group_id: scaling_group_id + }); + } + + handleDeleteClick = (nsr_id, scaling_group_id, scaling_instance_index, event) => { + RecordViewStore.deleteScalingGroupInstance({ + nsr_id: nsr_id, + scaling_group_id: scaling_group_id, + scaling_instance_index: scaling_instance_index + }); + } + + createScalingGroupTable = (scalingGroupDesriptorName) => { + let trows = []; + + this.props.data['scaling-group-record'] && this.props.data['scaling-group-record'].map((sgr, sgri) => { + + sgr['instance'] ? sgr['instance'].map((sgrInstance, sgrInstanceIndex) => { + let id = sgrInstance['instance-id']; + let sgrName = sgr['scaling-group-name-ref']; + + if (sgrName == scalingGroupDesriptorName) { + trows.push( + + {sgrInstanceIndex + 1} + {id} + + {sgrInstance['op-status']} + + {sgrInstance['is-default'] == 'false' ? + + : null} + + + ); + } + }) : trows.push( + + No network services scaled in this group + + ); + }); + + let tbody = ( + + {trows} + + ); + + return ( + + + + + + + + + + + {tbody} +
IDUptimeStatus
+ ); + } + + getInstancesForScalingGroup = (scalingGroupDesriptorName) => { + let count = 0; + this.props.data['scaling-group-record'] && this.props.data['scaling-group-record'].map((sgr, sgri) => { + sgr['instance'] && sgr['instance'].map((sgrInstance, sgrInstanceIndex) => { + if (sgr['scaling-group-name-ref'] == scalingGroupDesriptorName) { + count++; + } + }); + }); + + return count; + } + + render() { + let scalingGroups = []; + + this.props.data['scaling-group-descriptor'] && this.props.data['scaling-group-descriptor'].map((sgd) => { + let sgvnfs = []; + let sgMaxCount = ( + + Max: + {sgd['max-instance-count']} + + ); + + sgd['vnfd-member'] && sgd['vnfd-member'].map((vnf) => { + let instanceCount = vnf['count']; + sgvnfs.push( + {vnf['short-name']} {instanceCount > 1 ? '(' + instanceCount + ')': ''} + ); + }); + + sgvnfs = Utils.arrayIntersperse(sgvnfs, ', '); + + let sgInstanceTable = this.createScalingGroupTable(sgd.name); + + let sgCreateInstanceButton =