|
5 | 5 | <thead>
|
6 | 6 | <tr>
|
7 | 7 | <th style="width: 15%">Protocol</th>
|
8 |
| - <th style="width: 15%">From Port</th> |
9 |
| - <th style="width: 15%">To Port</th> |
| 8 | + <th style="width: 12%" uib-tooltip="From Port is used for TCP and UDP, Type is used for ICMP.">From Port/Type</th> |
| 9 | + <th style="width: 12%" uib-tooltip="To Port is used for TCP and UDP, Code is used for ICMP.">To Port/Code</th> |
| 10 | + <th style="width: 20%" uib-tooltip="Remote value can either be a security group or a CIDR.">Remote</th> |
10 | 11 | <th style="width: 15%">CIDR</th>
|
11 | 12 | <th></th>
|
12 | 13 | </tr>
|
|
15 | 16 | <tbody>
|
16 | 17 | <tr ng-repeat="rule in securityGroup.rules">
|
17 | 18 | <td><select class="form-control input-sm" ng-model="rule.ruleType"
|
18 |
| - ng-options="protocol as protocol.toUpperCase() for protocol in ['tcp']" required></select></td> |
19 |
| - <td><input class="form-control input-sm" name="fromPort_{{$index}}" type="number" min="1" max="{{rule.toPort}}" ng-model="rule.fromPort" required/></td> |
20 |
| - <td><input class="form-control input-sm" name="toPort_{{$index}}" type="number" min="{{rule.fromPort}}" max="65535" ng-model="rule.toPort" required/></td> |
21 |
| - <td><input class="form-control input-sm" type="text" ng-model="rule.cidr" required/></td> |
| 19 | + ng-options="protocol as protocol.toUpperCase() for protocol in ['TCP', 'UDP','ICMP']" required></select></td> |
| 20 | + |
| 21 | + <!--If ruleType is equal to TCP or UDP--> |
| 22 | + <td ng-if="rule.ruleType.toUpperCase() === 'TCP' || rule.ruleType.toUpperCase() === 'UDP' "> |
| 23 | + <input class="form-control input-sm" name="fromPort_{{$index}}" type="number" min="1" max="{{rule.toPort}}" ng-model="rule.fromPort" required/> |
| 24 | + </td> |
| 25 | + <td ng-if="rule.ruleType.toUpperCase() === 'TCP' || rule.ruleType.toUpperCase() === 'UDP' "> |
| 26 | + <input class="form-control input-sm" name="toPort_{{$index}}" type="number" min="{{rule.fromPort}}" max="65535" ng-model="rule.toPort" required/> |
| 27 | + </td> |
| 28 | + |
| 29 | + <!--If ruleType equal to ICMP--> |
| 30 | + <td ng-if="rule.ruleType.toUpperCase() === 'ICMP' "> |
| 31 | + <input class="form-control input-sm" name="icmpType_{{$index}}" |
| 32 | + type="number" min="-1" max="255" ng-model="rule.icmpType" required |
| 33 | + validate-type="{{rule.icmpCode}}" icmp-index="{{$index}}"/> |
| 34 | + </td> |
| 35 | + <td ng-if="rule.ruleType.toUpperCase() === 'ICMP' "> |
| 36 | + <input class="form-control input-sm" name="icmpCode_{{$index}}" |
| 37 | + type="number" min="-1" max="255" ng-model="rule.icmpCode" required/> |
| 38 | + </td> |
| 39 | + |
| 40 | + <td> |
| 41 | + <ui-select ng-model="rule.remoteSecurityGroupId" class="form-control input-sm" required style="width: 100%" on-select="remoteSecurityGroupSelected($index, rule.remoteSecurityGroupId)"> |
| 42 | + <ui-select-match>{{$select.selected.name}}</ui-select-match> |
| 43 | + <ui-select-choices repeat="securityGroup.id as securityGroup in availableSecurityGroups | filter: $select.search | limitTo: rulesController.infiniteScroll.currentItems" |
| 44 | + infinite-scroll="rulesController.addMoreItems()" |
| 45 | + infinite-scroll-distance="2"> |
| 46 | + <span ng-bind-html="securityGroup.name | highlight: $select.search"></span> |
| 47 | + </ui-select-choices> |
| 48 | + </ui-select> |
| 49 | + </td> |
| 50 | + |
| 51 | + <td ng-if="rule.remoteSecurityGroupId.id === undefined && rule.remoteSecurityGroupId === 'CIDR'"> |
| 52 | + <input class="form-control input-sm" type="text" ng-model="rule.cidr" required ng-disabled="!(rule.remoteSecurityGroupId.id === undefined && rule.remoteSecurityGroupId === 'CIDR')" /> |
| 53 | + </td> |
| 54 | + <td ng-if="rule.remoteSecurityGroupId.id === undefined && rule.remoteSecurityGroupId !== 'CIDR'"> |
| 55 | + <input class="form-control input-sm" type="text" ng-model="rule.cidr" ng-disabled="rule.remoteSecurityGroupId.id === undefined && rule.remoteSecurityGroupId !== 'CIDR'"/> |
| 56 | + </td> |
| 57 | + |
22 | 58 | <td><a class="sm-label"
|
23 | 59 | ng-click="rulesController.removeRule($index)">
|
24 | 60 | <span class="glyphicon glyphicon-trash"></span></a>
|
25 | 61 | </td>
|
| 62 | + |
| 63 | + <!--Validation--> |
26 | 64 | <td>
|
27 | 65 | <validation-error ng-if="rules['fromPort_'+$index].$error.min"
|
28 | 66 | message="Port should be greater than 0.">
|
|
36 | 74 | <validation-error ng-if="rules['toPort_'+$index].$error.max"
|
37 | 75 | message="Port should be less than or equal to 65535.">
|
38 | 76 | </validation-error>
|
| 77 | + |
| 78 | + <validation-error ng-if="rules['icmpType_'+$index].$error.min" |
| 79 | + message="ICMP Type should be greater than or equal to -1."> |
| 80 | + </validation-error> |
| 81 | + <validation-error ng-if="rules['icmpType_'+$index].$error.max" |
| 82 | + message="ICMP Type should be less than or equal to 255."> |
| 83 | + </validation-error> |
| 84 | + <validation-error ng-if="rules['icmpType_'+$index].$error.validateType" |
| 85 | + message="ICMP Type cannot be -1 when Code is greater that -1."> |
| 86 | + </validation-error> |
| 87 | + |
| 88 | + <validation-error ng-if="rules['icmpCode_'+$index].$error.min" |
| 89 | + message="ICMP Code should be greater than or equal to -1."> |
| 90 | + </validation-error> |
| 91 | + <validation-error ng-if="rules['icmpCode_'+$index].$error.max" |
| 92 | + message="ICMP Code should be less than or equal to 255."> |
| 93 | + </validation-error> |
39 | 94 | </td>
|
40 | 95 | </tr>
|
41 | 96 | </tbody>
|
|
51 | 106 | </div>
|
52 | 107 | </table>
|
53 | 108 | </div>
|
| 109 | + <div class="col-md-12" style="margin-top: 20px"> |
| 110 | + <div class="col-md-12"> |
| 111 | + <p> |
| 112 | + <span ng-if="state.refreshingSecurityGroups"><span class="small glyphicon glyphicon-refresh glyphicon-spinning"></span></span> |
| 113 | + Security groups |
| 114 | + <span ng-if="!state.refreshingSecurityGroups">last refreshed {{ rulesController.getSecurityGroupRefreshTime() | timestamp }}</span> |
| 115 | + <span ng-if="state.refreshingSecurityGroups"> refreshing...</span> |
| 116 | + </p> |
| 117 | + <p>If you're not finding a security group that was recently added, |
| 118 | + <a href ng-click="rulesController.refreshSecurityGroups()">click here</a> to refresh the list. |
| 119 | + </p> |
| 120 | + </div> |
| 121 | + </div> |
54 | 122 | </div>
|
55 | 123 | </ng-form>
|
0 commit comments