Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
HAWKULAR-661 - Dropdown switch
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrohling committed Oct 8, 2015
1 parent fe83bda commit 348721c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
16 changes: 15 additions & 1 deletion console/src/main/scripts/plugins/accounts/less/accounts.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

@import "../../../libs/patternfly/components/bootstrap/less/variables.less";
@import "../../../libs/patternfly/components/bootstrap/less/mixins.less";
@import "../../../libs/patternfly/components/bootstrap/less/type.less";
@import "../../../libs/patternfly/components/bootstrap/less/dropdowns.less";
@import "../../../libs/patternfly/less/variables.less";


Expand Down Expand Up @@ -51,6 +53,18 @@ body.inactivity-modal-open #main, body.inactivity-modal-open .navbar, body.inact
font-size: ceil(@font-size-base * 4);
}

.selected-persona, .selected-persona .fa {
.bg-primary;
color: #fff !important;
}

.selected-persona:hover, .selected-persona:hover .fa {
color: #333 !important;
}

.icon-invisible {
visibility: hidden;
}

/*------------------------------------*\
SCREENS
Expand All @@ -60,4 +74,4 @@ body.inactivity-modal-open #main, body.inactivity-modal-open .navbar, body.inact

.hk-organizations .text-right .btn-primary {
margin-bottom: @grid-gutter-width/4;
}
}
7 changes: 0 additions & 7 deletions console/src/main/scripts/plugins/accounts/ts/persona.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ module HawkularAccounts {
$scope.loadPersonas = () => {
$scope.personas = HawkularAccount.Persona.query({},
() => {
$scope.personas = $scope.personas.filter((persona) => {
return persona.id !== $scope.currentPersona.id;
});
$scope.loading = false;
},
() => {
Expand All @@ -57,11 +54,7 @@ module HawkularAccounts {
};

$scope.switchPersona = (persona) => {
$scope.personas.push($scope.currentPersona);
$scope.currentPersona = persona;
$scope.personas = $scope.personas.filter((persona) => {
return persona.id !== $scope.currentPersona.id;
});
$log.info('Switching persona to (emit)');
$log.info(persona);
$scope.$emit('SwitchedPersona', persona);
Expand Down
9 changes: 8 additions & 1 deletion console/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,15 @@
{{currentPersona.name}} <b class="caret"></b>
</a>
<ul class="dropdown-menu" id="personaSwitcher">
<li class="text-muted">Use Hawkular as:</li>
<li ng-repeat="persona in personas">
<a href="#" ng-click="switchPersona(persona)">{{persona.name}}</a>
<a
href="#"
ng-click="switchPersona(persona)"
ng-class="{'selected-persona': persona.id === currentPersona.id}">
<i class="fa fa-check" ng-class="{'icon-invisible': persona.id !== currentPersona.id}"></i>
{{persona.name}}
</a>
</li>
<li class="divider" ng-show="personas.length"></li>
<li>
Expand Down

0 comments on commit 348721c

Please sign in to comment.