[KEYCLOAK-5806] - Changing apply policy component and more tests
This commit is contained in:
parent
2ace312501
commit
3846cfdb4f
4 changed files with 65 additions and 50 deletions
|
@ -1309,9 +1309,11 @@ module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route
|
||||||
|
|
||||||
var policies = [];
|
var policies = [];
|
||||||
|
|
||||||
|
if ($scope.selectedPolicies) {
|
||||||
for (i = 0; i < $scope.selectedPolicies.length; i++) {
|
for (i = 0; i < $scope.selectedPolicies.length; i++) {
|
||||||
policies.push($scope.selectedPolicies[i].id);
|
policies.push($scope.selectedPolicies[i].id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scope.policy.policies = policies;
|
$scope.policy.policies = policies;
|
||||||
delete $scope.policy.config;
|
delete $scope.policy.config;
|
||||||
|
@ -1355,9 +1357,11 @@ module.controller('ResourceServerPolicyScopeDetailCtrl', function($scope, $route
|
||||||
|
|
||||||
var policies = [];
|
var policies = [];
|
||||||
|
|
||||||
|
if ($scope.selectedPolicies) {
|
||||||
for (i = 0; i < $scope.selectedPolicies.length; i++) {
|
for (i = 0; i < $scope.selectedPolicies.length; i++) {
|
||||||
policies.push($scope.selectedPolicies[i].id);
|
policies.push($scope.selectedPolicies[i].id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scope.policy.policies = policies;
|
$scope.policy.policies = policies;
|
||||||
delete $scope.policy.config;
|
delete $scope.policy.config;
|
||||||
|
|
|
@ -55,29 +55,33 @@
|
||||||
<div class="form-group clearfix">
|
<div class="form-group clearfix">
|
||||||
<label class="col-md-2 control-label" for="policies">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
<label class="col-md-2 control-label" for="policies">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input type="hidden" ui-select2="policiesUiSelect" id="policies" data-ng-change="selectPolicy(selectedPolicy);" data-ng-model="selectedPolicy" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..." />
|
<table class="table table-striped table-bordered" style="margin-top: 0px" id="selected-policies">
|
||||||
<p/>
|
|
||||||
<table class="table table-striped table-bordered" id="selected-policies">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="kc-table-actions" colspan="3">
|
<th class="kc-table-actions" colspan="2">
|
||||||
<div class="form-inline">
|
<div class="form-inline col-md-12" style="width: 107%">
|
||||||
<div class="form-group">
|
<div class="form-group" style="width: 100%">
|
||||||
|
<div class="input-group" style="width: 100%">
|
||||||
|
<input type="hidden" ui-select2="policiesUiSelect" id="policies" data-ng-change="selectPolicy(selectedPolicy);" data-ng-model="selectedPolicy" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..."/>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right">
|
</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<th class="kc-table-actions">
|
||||||
|
<div class="pull-right" style="width: 100%">
|
||||||
<select id="create-policy" class="form-control" ng-model="policyType"
|
<select id="create-policy" class="form-control" ng-model="policyType"
|
||||||
ng-options="p.name for p in policyProviders track by p.type"
|
ng-options="p.name for p in policyProviders track by p.type"
|
||||||
data-ng-change="addPolicy(policyType);">
|
data-ng-change="addPolicy(policyType);"
|
||||||
|
data-ng-hide="historyBackOnSaveOrCancel">
|
||||||
<option value="" disabled selected>{{:: 'authz-create-policy' | translate}}...</option>
|
<option value="" disabled selected>{{:: 'authz-create-policy' | translate}}...</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-hide="!selectedPolicies || selectedPolicies.length == 0">
|
<tr data-ng-hide="!selectedPolicies || selectedPolicies.length == 0">
|
||||||
<th>{{:: 'name' | translate}}</th>
|
<th>{{:: 'name' | translate}}</th>
|
||||||
<th>{{:: 'description' | translate}}</th>
|
<th>{{:: 'description' | translate}}</th>
|
||||||
<th>{{:: 'actions' | translate}}</th>
|
<th width="20%">{{:: 'actions' | translate}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -85,7 +89,7 @@
|
||||||
<td data-ng-hide="historyBackOnSaveOrCancel"><a href="" data-ng-click="detailPolicy(policy)">{{policy.name}}</a></td>
|
<td data-ng-hide="historyBackOnSaveOrCancel"><a href="" data-ng-click="detailPolicy(policy)">{{policy.name}}</a></td>
|
||||||
<td data-ng-show="historyBackOnSaveOrCancel">{{policy.name}}</td>
|
<td data-ng-show="historyBackOnSaveOrCancel">{{policy.name}}</td>
|
||||||
<td>{{policy.description}}</td>
|
<td>{{policy.description}}</td>
|
||||||
<td class="kc-action-cell" ng-click="removePolicy(selectedPolicies, policy);">
|
<td class="kc-action-cell" ng-click="removePolicy(selectedPolicies, policy);" style="vertical-align: middle">
|
||||||
{{:: 'remove' | translate}}
|
{{:: 'remove' | translate}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -59,29 +59,33 @@
|
||||||
<div class="form-group clearfix">
|
<div class="form-group clearfix">
|
||||||
<label class="col-md-2 control-label" for="policies">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
<label class="col-md-2 control-label" for="policies">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input type="hidden" ui-select2="policiesUiSelect" id="policies" data-ng-change="selectPolicy(selectedPolicy);" data-ng-model="selectedPolicy" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..." />
|
<table class="table table-striped table-bordered" style="margin-top: 0px" id="selected-policies">
|
||||||
<p/>
|
|
||||||
<table class="table table-striped table-bordered" id="selected-policies">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="kc-table-actions" colspan="3">
|
<th class="kc-table-actions" colspan="2">
|
||||||
<div class="form-inline">
|
<div class="form-inline col-md-12" style="width: 107%">
|
||||||
<div class="form-group">
|
<div class="form-group" style="width: 100%">
|
||||||
|
<div class="input-group" style="width: 100%">
|
||||||
|
<input type="hidden" ui-select2="policiesUiSelect" id="policies" data-ng-change="selectPolicy(selectedPolicy);" data-ng-model="selectedPolicy" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..."/>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right">
|
</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<th class="kc-table-actions">
|
||||||
|
<div class="pull-right" style="width: 100%">
|
||||||
<select id="create-policy" class="form-control" ng-model="policyType"
|
<select id="create-policy" class="form-control" ng-model="policyType"
|
||||||
ng-options="p.name for p in policyProviders track by p.type"
|
ng-options="p.name for p in policyProviders track by p.type"
|
||||||
data-ng-change="addPolicy(policyType);">
|
data-ng-change="addPolicy(policyType);"
|
||||||
|
data-ng-hide="historyBackOnSaveOrCancel">
|
||||||
<option value="" disabled selected>{{:: 'authz-create-policy' | translate}}...</option>
|
<option value="" disabled selected>{{:: 'authz-create-policy' | translate}}...</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-hide="!selectedPolicies || selectedPolicies.length == 0">
|
<tr data-ng-hide="!selectedPolicies || selectedPolicies.length == 0">
|
||||||
<th>{{:: 'name' | translate}}</th>
|
<th>{{:: 'name' | translate}}</th>
|
||||||
<th>{{:: 'description' | translate}}</th>
|
<th>{{:: 'description' | translate}}</th>
|
||||||
<th>{{:: 'actions' | translate}}</th>
|
<th width="20%">{{:: 'actions' | translate}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -89,7 +93,7 @@
|
||||||
<td data-ng-hide="historyBackOnSaveOrCancel"><a href="" data-ng-click="detailPolicy(policy)">{{policy.name}}</a></td>
|
<td data-ng-hide="historyBackOnSaveOrCancel"><a href="" data-ng-click="detailPolicy(policy)">{{policy.name}}</a></td>
|
||||||
<td data-ng-show="historyBackOnSaveOrCancel">{{policy.name}}</td>
|
<td data-ng-show="historyBackOnSaveOrCancel">{{policy.name}}</td>
|
||||||
<td>{{policy.description}}</td>
|
<td>{{policy.description}}</td>
|
||||||
<td class="kc-action-cell" ng-click="removePolicy(selectedPolicies, policy);">
|
<td class="kc-action-cell" ng-click="removePolicy(selectedPolicies, policy);" style="vertical-align: middle">
|
||||||
{{:: 'remove' | translate}}
|
{{:: 'remove' | translate}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -35,16 +35,20 @@
|
||||||
<div class="form-group clearfix">
|
<div class="form-group clearfix">
|
||||||
<label class="col-md-2 control-label" for="policies">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
<label class="col-md-2 control-label" for="policies">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input type="hidden" ui-select2="policiesUiSelect" id="policies" data-ng-change="selectPolicy(selectedPolicy);" data-ng-model="selectedPolicy" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..." data-ng-required="!selectedPolicies || selectedPolicies.length == 0"/>
|
<table class="table table-striped table-bordered" style="margin-top: 0px" id="selected-policies">
|
||||||
<p/>
|
|
||||||
<table class="table table-striped table-bordered" id="selected-policies">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="kc-table-actions" colspan="3">
|
<th class="kc-table-actions" colspan="2">
|
||||||
<div class="form-inline">
|
<div class="form-inline col-md-12" style="width: 107%">
|
||||||
<div class="form-group">
|
<div class="form-group" style="width: 100%">
|
||||||
|
<div class="input-group" style="width: 100%">
|
||||||
|
<input type="hidden" ui-select2="policiesUiSelect" id="policies" data-ng-change="selectPolicy(selectedPolicy);" data-ng-model="selectedPolicy" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..." data-ng-required="!selectedPolicies || selectedPolicies.length == 0"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-right">
|
</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<th class="kc-table-actions">
|
||||||
|
<div class="pull-right" style="width: 100%">
|
||||||
<select id="create-policy" class="form-control" ng-model="policyType"
|
<select id="create-policy" class="form-control" ng-model="policyType"
|
||||||
ng-options="p.name for p in policyProviders track by p.type"
|
ng-options="p.name for p in policyProviders track by p.type"
|
||||||
data-ng-change="addPolicy(policyType);"
|
data-ng-change="addPolicy(policyType);"
|
||||||
|
@ -52,13 +56,12 @@
|
||||||
<option value="" disabled selected>{{:: 'authz-create-policy' | translate}}...</option>
|
<option value="" disabled selected>{{:: 'authz-create-policy' | translate}}...</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-hide="!selectedPolicies || selectedPolicies.length == 0">
|
<tr data-ng-hide="!selectedPolicies || selectedPolicies.length == 0">
|
||||||
<th>{{:: 'name' | translate}}</th>
|
<th>{{:: 'name' | translate}}</th>
|
||||||
<th>{{:: 'description' | translate}}</th>
|
<th>{{:: 'description' | translate}}</th>
|
||||||
<th>{{:: 'actions' | translate}}</th>
|
<th width="20%">{{:: 'actions' | translate}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -66,7 +69,7 @@
|
||||||
<td data-ng-hide="historyBackOnSaveOrCancel"><a href="" data-ng-click="detailPolicy(policy)">{{policy.name}}</a></td>
|
<td data-ng-hide="historyBackOnSaveOrCancel"><a href="" data-ng-click="detailPolicy(policy)">{{policy.name}}</a></td>
|
||||||
<td data-ng-show="historyBackOnSaveOrCancel">{{policy.name}}</td>
|
<td data-ng-show="historyBackOnSaveOrCancel">{{policy.name}}</td>
|
||||||
<td>{{policy.description}}</td>
|
<td>{{policy.description}}</td>
|
||||||
<td class="kc-action-cell" ng-click="removePolicy(selectedPolicies, policy);">
|
<td class="kc-action-cell" ng-click="removePolicy(selectedPolicies, policy);" style="vertical-align: middle">
|
||||||
{{:: 'remove' | translate}}
|
{{:: 'remove' | translate}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in a new issue