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

Commit

Permalink
HAWKULAR-921 - Minor UI tweaks for Organizations management
Browse files Browse the repository at this point in the history
  • Loading branch information
jpkrohling committed Feb 3, 2016
1 parent 1e93ada commit 1c81d52
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>No organizations available.</h1>
<thead>
<tr>
<th>Name</th>
<th></th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
Expand All @@ -46,8 +46,18 @@ <h1>No organizations available.</h1>
<td class="hk-actions-one">
<button type="button"
class="btn btn-default"
ng-disabled="controller.joinRequestsToSubmit[organization.id] === PersistenceState.PERSISTING"
ng-click="controller.joinRequest(organization)">
Join
<span ng-show="controller.joinRequestsToSubmit[organization.id] === PersistenceState.PERSISTING">
<i class="fa fa-spinner fa-spin"></i>
</span>
<span ng-show="controller.joinRequestsToSubmit[organization.id] === PersistenceState.SUCCESS">
<i class="fa fa-check"></i>
</span>
<span ng-show="controller.joinRequestsToSubmit[organization.id] === PersistenceState.ERROR">
<i class="fa fa-exclamation"></i>
</span>
</button>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ <h2>Your join requests</h2>
<tr ng-repeat="joinRequest in controller.joinRequests">
<td>{{joinRequest.organization.name}}</td>
<td>{{joinRequest.createdAt | date:'medium'}}</td>
<td><span class="label label-default">{{joinRequest.status}}</span></td>
<td>
<span class="label label-default" ng-show="joinRequest.status != 'REJECTED'">
{{joinRequest.status}}
</span>
<span class="label label-danger" ng-show="joinRequest.status == 'REJECTED'">
{{joinRequest.status}}
</span>
</td>
</tr>
</tbody>
</table>
Expand All @@ -68,6 +75,7 @@ <h2>Your organization memberships</h2>
<thead>
<tr>
<th>Name</th>
<th>Visibility</th>
<th>&nbsp;</th>
</tr>
</thead>
Expand All @@ -78,6 +86,10 @@ <h2>Your organization memberships</h2>
{{organization.name}}
</a>
</td>
<td>
<span ng-show="organization.visibility === 'PRIVATE'">Private</span>
<span ng-hide="organization.visibility === 'PRIVATE'">Users can apply</span>
</td>
<td class="hk-actions-one">
<button type="button"
class="btn btn-link"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module HawkularAccounts {
public organizations: Array<IOrganization>;
public loading: boolean = true;
public isOrganization: boolean = false;
public joinRequestsToSubmit: { [id: string]: PersistenceState; } = {};

constructor(private $rootScope: any,
private $scope: any,
Expand Down Expand Up @@ -72,10 +73,13 @@ module HawkularAccounts {
})
.result
.then(() => {
this.joinRequestsToSubmit[organization.id] = PersistenceState.PERSISTING;
joinRequest.$save({}, () => {
this.joinRequestsToSubmit[organization.id] = PersistenceState.SUCCESS;
this.NotificationsService.success('Join request successfully submitted.');
this.organizations.splice(this.organizations.indexOf(organization), 1);
}, (error: IErrorPayload) => {
this.joinRequestsToSubmit[organization.id] = PersistenceState.ERROR;
let message = `Failed to send join request to the organization ${organization.name}: ${error.data.message}`;
this.$log.warn(message);
this.NotificationsService.error(message);
Expand Down

0 comments on commit 1c81d52

Please sign in to comment.