Skip to content

Commit

Permalink
Merge pull request #342 from bebna/master
Browse files Browse the repository at this point in the history
Fix for #302: tryoutoperation falls now back to root security object
  • Loading branch information
mohsen1 committed Feb 17, 2015
2 parents aa111f9 + c495d64 commit ef72525
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/scripts/directives/tryoperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,16 @@ SwaggerEditor.controller('TryOperation', function ($scope, formdataFilter,
return parseHeaders(xhr.getAllResponseHeaders());
}

$scope.getSecuirtyOptions = function () {
$scope.getSecurityOptions = function () {
var none = [NONE_SECURITY];
if (Array.isArray($scope.operation.security)) {
return none.concat($scope.operation.security.map(function (security) {
return Object.keys(security)[0];
}));
} else if (Array.isArray($scope.specs.security)) {
return none.concat($scope.specs.security.map(function (security) {
return Object.keys(security)[0];
}));
}
return none;
};
Expand Down
4 changes: 2 additions & 2 deletions app/templates/try-operation.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ <h4>Request</h4>
<tr>
<td><label>Security</label></td>
<td>
<select ng-model="$parent.selectedSecurity" ng-init="$parent.selectedSecurity = getSecuirtyOptions()[0]">
<option ng-repeat="option in getSecuirtyOptions()" value="{{option}}" ng-disabled="!$parent.securityIsAuthenticated(option)">
<select ng-model="$parent.selectedSecurity" ng-init="$parent.selectedSecurity = getSecurityOptions()[0]">
<option ng-repeat="option in getSecurityOptions()" value="{{option}}" ng-disabled="!$parent.securityIsAuthenticated(option)">
{{option + (!$parent.securityIsAuthenticated(option) ? ' (Not authenticated)' : '')}}
</option>
</select>
Expand Down

0 comments on commit ef72525

Please sign in to comment.