Skip to content

Commit

Permalink
remove logs and delete option at users table
Browse files Browse the repository at this point in the history
  • Loading branch information
sortiz committed Oct 15, 2021
1 parent acfb872 commit fc225bc
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ define(['../../module'], function(controllers) {
}

$onInit() {
console.log("this.scope");
console.log(this.scope);
}
}
controllers.controller('policiesCtrl', Policies)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ define([
$dateDiffService,
$mdDialog
) {

console.log($scope);
/**
* Init variables
*/
Expand Down Expand Up @@ -514,6 +516,22 @@ define([
$rootScope.$broadcast('editXmlFile', { target: group })
}

// SECURITY SECTION FOR USERS
$scope.showConfirmRemoveSecurityUser = (ev, user) => {
$scope.removingUser =
$scope.removingUser === user.username ? null : user.username
}
$scope.cancelRemoveSecurityUser = () => {
$scope.removingUser = null
}
$scope.editSecurityUser = user => {
$scope.$emit('openGroupFromList', { user })
}
$scope.confirmRemoveSecurityUser = async user => {
console.log(user);
}
// END SECURITY SECTION FOR USERS

$scope.showConfirmRemoveGroup = (ev, group) => {
$scope.removingGroup =
$scope.removingGroup === group.name ? null : group.name
Expand All @@ -535,7 +553,7 @@ define([
$scope.editGroup = group => {
$scope.$emit('openGroupFromList', { group })
}

$scope.confirmRemoveAgent = async agent => {
try {
const group = instance.path.split('/').pop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
ng-class="sortValue === (key.value || key) ? (sortDir ? 'fa-sort-asc' : 'fa-sort-desc') : 'fa-sort'"
aria-hidden="true"></i>
</th>
<th ng-if="(path === '/security/policies' || path === '/agents' || (path === '/groups' && adminMode) || (isLookingGroup() && adminMode)) "
<th ng-if="(path === '/security/users' || path === '/security/roles' || path === '/security/policies' || path === '/agents' || (path === '/groups' && adminMode) || (isLookingGroup() && adminMode)) "
class="wz-text-left wz-nowrap"
ng-class="{'col-lg-2': path !== '/agents', 'col-lg-1': path === '/agents'} && getWitdh(key.value || key)">
Actions</th>
Expand Down Expand Up @@ -201,51 +201,87 @@
</div>
</td>
</td>
<!-- SECURITY SECTION USERS-->
<td ng-if="path === '/security/users'" ng-click="$event.stopPropagation()"
class="cursor-default action-btn-td" class="wz-text-truncatable">
<wz-svg ng-if="removingUser !== item.username && item.username !== 'default'"
ng-click="showConfirmRemoveSecurityUser($event, item); $event.stopPropagation()" icon="trash" color="#396e3e"
svg-tooltip="Remove this item"></wz-svg>
<wz-svg ng-if="removingUser !== item.username" ng-click="editSecurityUser(item); $event.stopPropagation()" icon="pencil"
color="#396e3e" svg-tooltip="Edit this user configuration">
</wz-svg>

<span class="wz-padding-left-8" ng-if="removingUser !== item.username && item.username === 'default'">-</span>
<div ng-if="removingUser === item.username && item.username !== 'default'">
<div layout="row" ng-if="path === '/security/users'">
<span class="euiToastHeader__title font-size-12">User {{item.username}} will be removed</span>
</div>
<div layout="row" ng-if="path === '/security/users'">
<md-button class="cancelBtn" type="button" ng-click="cancelRemoveSecurityUser()"><i aria-hidden='true'
class='fa fa-fw fa-close'></i>
Cancel</md-button>
<md-button class="agreeBtn" type="button" ng-click="confirmRemoveSecurityUser(item.username)"><i aria-hidden='true'
class='fa fa-fw fa-check'></i> Confirm</md-button>
</div>
</div>
<td ng-if="isLookingGroup() " ng-click="$event.stopPropagation()"
class="cursor-default action-btn-td">
<wz-svg ng-if="removingUser !== item.username"
ng-click="showConfirmRemoveAgentFromGroup($event, item); $event.stopPropagation()" icon="trash"
color="#396e3e" svg-tooltip="Remove agent">
</wz-svg>

<div ng-if="removingUser === item.username" class="confirmEmbedBubble">
<div layout="row">
<span class="font-size-12 wz-padding-left-8">The agent {{item.id}} will be removed from
this group</span>
</div>
<div layout="row">
<md-button class="cancelBtn" type="button" ng-click="cancelRemoveSecurityUser()"><i aria-hidden='true'
class='fa fa-fw fa-close'></i>
Cancel</md-button>
<md-button class="agreeBtn" type="button" ng-click="confirmRemoveSecurityUser(item.username)"><i aria-hidden='true'
class='fa fa-fw fa-check'></i> Confirm</md-button>
</div>
</div>
</td>
</td>
<!-- END SECTION USERS -->

<!-- security -->
<td ng-if="(path === '/security/users' || path === '/security/roles' || path === '/security/policies')" ng-click="$event.stopPropagation()"
<!-- SECURITY FOR POLICIES AND ROLES-->
<td ng-if="(path === '/security/roles' || path === '/security/policies')" ng-click="$event.stopPropagation()"
class="cursor-default action-btn-td" class="wz-text-truncatable">
<wz-svg ng-if="(removingGroup !== item.name && item.name !== 'default') || (removingGroup !== item.username && item.username !== 'default')"
<wz-svg ng-if="removingGroup !== item.name && item.name !== 'default'"
ng-click="showConfirmRemoveGroup($event, item); $event.stopPropagation()" icon="trash" color="#396e3e"
svg-tooltip="Remove this group"></wz-svg>
svg-tooltip="Remove this item"></wz-svg>
<wz-svg ng-if="removingGroup !== item.name" ng-click="editGroup(item); $event.stopPropagation()" icon="pencil"
color="#396e3e" svg-tooltip="Edit this group configuration">
color="#396e3e" svg-tooltip="Edit this item configuration">
</wz-svg>

<span class="wz-padding-left-8" ng-if="removingGroup !== item.name && item.name === 'default'">-</span>
<div ng-if="removingGroup === item.name && item.name !== 'default'">
<div ng-if="(removingGroup === item.name && item.name !== 'default')">
<!-- check for data to display -->
<div layout="row" ng-if="(path === '/security/users')">
<span class="euiToastHeader__title font-size-12">User {{item.username}} will be removed</span>
</div>
<div layout="row" ng-if="(path === '/security/roles')">
<div layout="row" ng-if="path === '/security/roles'">
<span class="euiToastHeader__title font-size-12">Role {{item.name}} will be removed</span>
</div>
<div layout="row" ng-if="(path === '/security/policies')">
<div layout="row" ng-if="path === '/security/policies'">
<span class="euiToastHeader__title font-size-12">Policy {{item.name}} will be removed</span>
</div>

<div layout="row">
<md-button class="cancelBtn" type="button" ng-click="cancelRemoveGroup()"><i aria-hidden='true'
class='fa fa-fw fa-close'></i>
Cancel</md-button>
<md-button class="agreeBtn" type="button" ng-click="confirmRemoveGroup(item.name)"><i aria-hidden='true'
class='fa fa-fw fa-check'></i> Confirm</md-button>
</div>
</div>

<td ng-if="isLookingGroup() " ng-click="$event.stopPropagation()"
class="cursor-default action-btn-td">
<wz-svg ng-if="removingAgent !== item.id"
ng-click="showConfirmRemoveAgentFromGroup($event, item); $event.stopPropagation()" icon="trash"
color="#396e3e" svg-tooltip="Remove entry">
</wz-svg>

<div ng-if="removingAgent === item.id" class="confirmEmbedBubble">
<div ng-if="(path === '/security/policies' || path === '/security/roles')" class="confirmEmbedBubble">
<div layout="row">
<span class="font-size-12 wz-padding-left-8">The agent {{item.id}} will be removed from
<span class="font-size-12 wz-padding-left-8">{{item.id}} will be removed from
this group</span>
</div>
<div layout="row">
<div layout="row" ng-if="(path === '/security/policies' || path === '/security/roles')">
<md-button class="cancelBtn" type="button" ng-click="cancelRemoveAgent()"><i aria-hidden='true'
class='fa fa-fw fa-close'></i>
Cancel</md-button>
Expand All @@ -255,7 +291,8 @@
</div>
</td>
</td>
<!-- end security -->
<!-- END SECURITY FOR POLICIES AND ROLES -->


</tr>
</tbody>
Expand Down

0 comments on commit fc225bc

Please sign in to comment.