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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mazz/683
Browse files Browse the repository at this point in the history
Conflicts:
	pom.xml
  • Loading branch information
jmazzitelli committed Oct 8, 2015
2 parents 202370a + 732c776 commit 581e8bf
Show file tree
Hide file tree
Showing 32 changed files with 562 additions and 323 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,12 @@ angular.module('RedhatAccess.cases')
function () {
console.log('Unable to get tree data');
});
}
]);
}]
);

angular.module('RedhatAccess.cases').directive('rha403error', function () {
return {
templateUrl: '/support-403.html',
restrict: 'A'
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -5048,14 +5048,6 @@ angular.module('RedhatAccess.cases').controller('TypeSelect', [
});
}
]);
'use strict';
/*jshint unused:vars */
angular.module('RedhatAccess.cases').directive('rha403error', function () {
return {
templateUrl: 'cases/views/403.html',
restrict: 'A'
};
});

'use strict';
/*jshint unused:vars */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div class="row">
<div class="col-md-12" ng-controller="HawkularAccounts.OrganizationMembershipController as controller">
<ol class="breadcrumb">
<ol class="breadcrumb" ng-show="!controller.loading">
<li><a data-ng-href="/hawkular-ui/organizations">&laquo; All organizations</a></li>
</ol>

<h1 class="text-center">{{controller.organization.name}} Members</h1>
<h1 class="text-center" ng-show="!controller.loading">{{controller.organization.name}} Members</h1>

<div class="text-right" ng-show="controller.memberships.length && !controller.loading && controller.foundOrganization">
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="modal-header">
<button type="button" class="close" ng-click="cancel()">
<span class="pficon pficon-close"></span>
</button>
<h4 class="modal-title">Delete Organization</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p class="primary-message">
Are you sure you want to delete the organization <strong>{{organization.name}}</strong>?
</p>
<p>This action can't be undone.</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
<button type="button" class="btn btn-danger" ng-click="delete()">Delete</button>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="hk-organizations" ng-controller="HawkularAccounts.OrganizationsController">

<h1 class="text-center">Organizations</h1>
<h1 class="text-center" ng-show="!loading">Organizations</h1>

<div class="text-center hk-spinner-container-alone" ng-show="loading">
<div class="spinner spinner-lg"></div>
Expand Down Expand Up @@ -51,7 +51,12 @@ <h1>No organizations inside organization.</h1>
</a>
</td>
<td class="hk-actions-one">
<button type="button" class="btn btn-link" aria-label="Delete" ng-click="remove(organization)" data-toggle="tooltip" data-placement="top" data-original-title="Remove">
<button type="button"
class="btn btn-link"
tooltip-trigger
tooltip-placement="top"
tooltip="Remove"
ng-click="remove(organization)">
<i class="fa fa-trash-o"></i>
</button>
</td>
Expand All @@ -62,4 +67,4 @@ <h1>No organizations inside organization.</h1>
</div>
<!-- /col -->

</div>
</div>
50 changes: 50 additions & 0 deletions console/src/main/scripts/plugins/accounts/html/user-settings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<div class="hk-user-settings" ng-controller="HawkularAccounts.UserSettingsController as controller">

<div class="text-center hk-spinner-container-alone" ng-show="controller.loading">
<div class="spinner spinner-lg"></div>
<p class="hk-spinner-legend-below">Loading...</p>
</div>

<h1 class="text-center" ng-show="!controller.loading">User Settings</h1>
<form name="form" class="form-horizontal" ng-show="!controller.loading" novalidate>
<fieldset>
<legend>Alert Notifications</legend>
<p>Receive alert notifications on the following email.
<div class="form-group" ng-class="{'has-error': form.email.$error.emails}">
<label class="col-sm-3 control-label" for="email">Email
<a class="hk-btn-icon"
tabindex="0"
role="button"
tooltip-trigger
tooltip-placement="top"
tooltip="For multiple emails, separate by comma.">
<i class="fa fa-info-circle"></i>
</a>
</label>
<div class="col-sm-6">
<input
type="text"
name="email"
id="email"
class="form-control"
hawkular-emails
ng-model="controller.settings['hawkular.settings.emails']">
<span class="help-block" ng-show="form.email.$error.emails">
Please enter valid email addresses.
</span>

<span class="help-block" ng-show="!form.email.$error.emails">
Emails are valid.
</span>
</div>
</div>
</fieldset>
<div class="form-actions text-right" ng-show="!controller.loading">
<button type="button" class="btn btn-default">Cancel</button>
<button type="button" class="btn btn-primary" ng-disabled="!form.$valid" ng-click="controller.save()">
Save
</button>
</div>
</form>
</div>
<!-- /col -->
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;
}
}
10 changes: 10 additions & 0 deletions console/src/main/scripts/plugins/accounts/ts/accountsGlobals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ module HawkularAccounts {
failure?:(error:IErrorPayload) => void);
}

export interface IUserSettings {
id: string;
$update(options?:{},
success?:(success:IUserSettings) => void,
failure?:(error:IErrorPayload) => void);
$get(options?:{},
success?:(success:IUserSettings) => void,
failure?:(error:IErrorPayload) => void);
}

// specialized payloads, requests and responses
export interface IDataPayload {
message: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ module HawkularAccounts {

.when(
'/hawkular-ui/invitation/accept/:token',
{templateUrl: builder.join(HawkularAccounts.templatePath, 'organization-accept-invitation.html')});
{templateUrl: builder.join(HawkularAccounts.templatePath, 'organization-accept-invitation.html')})

.when(
'/hawkular-ui/settings',
{templateUrl: builder.join(HawkularAccounts.templatePath, 'user-settings.html')});
}]);

_module.run(['$rootScope', '$log', '$modal', '$document', 'userDetails',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ module HawkularAccounts {
this.$scope.$emit('OrganizationLoaded');
},
(error:IErrorPayload) => {
this.NotificationsService.warning('Organization not found.');
this.$log.warn(`Error while loading the organization: ${error.data.message}`);
this.loading = false;
}
Expand All @@ -122,8 +121,8 @@ module HawkularAccounts {
this.$log.debug(`Finished loading members. Size: ${this.memberships.length}`);
},
(error:IErrorPayload) => {
this.NotificationsService.info('List of organizations could NOT be retrieved.');
this.$log.warn(`List of organizations could NOT be retrieved: ${error.data.message}`);
this.NotificationsService.error('List of memberships could NOT be retrieved.');
this.$log.warn(`List of memberships could NOT be retrieved: ${error.data.message}`);
this.loading = false;
}
);
Expand Down
46 changes: 35 additions & 11 deletions console/src/main/scripts/plugins/accounts/ts/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module HawkularAccounts {
});

createFormModal.result.then((organization) => {
NotificationsService.info(`Organization ${organization.name} created`);
NotificationsService.success(`Organization successfully created`);
$scope.organizations.unshift(organization);
}, (type, error) => {
if (type === 'error') {
Expand All @@ -68,17 +68,28 @@ module HawkularAccounts {
};

$scope.remove = (organization) => {
organization.$remove().then(
() => {
NotificationsService.info(`Organization ${organization.name} removed`);
$scope.$emit('OrganizationRemoved');
$scope.organizations.splice($scope.organizations.indexOf(organization), 1);
}, (error) => {
$log.warn('Error while trying to remove organization');
$log.warn(error);
NotificationsService.info(`Failed to remove the organization ${organization.name}: ${error.data.message}`);
var removeOrgModal = $modal.open({
controller: 'HawkularAccounts.OrganizationRemoveController',
templateUrl: 'plugins/accounts/html/organization-remove-modal.html',
resolve: {
organization: () => organization
}
);
});

removeOrgModal.result.then(() => {
organization.$remove().then(
() => {
NotificationsService.success(`Organization successfully deleted`);
$scope.$emit('OrganizationRemoved');
$scope.organizations.splice($scope.organizations.indexOf(organization), 1);
}, (error) => {
$log.warn('Error while trying to remove organization');
$log.warn(error);
let message = error.data.message;
NotificationsService.error(`Failed to remove the organization ${organization.name}: ${message}`);
}
);
});
};

$scope.load();
Expand Down Expand Up @@ -113,4 +124,17 @@ module HawkularAccounts {
$log.debug('Trying to persist the organization');
};
}]);

export var OrganizationRemoveController = _module.controller('HawkularAccounts.OrganizationRemoveController', [
'$scope', '$modalInstance', 'organization', ($scope, $modalInstance, organization) => {
$scope.organization = organization;

$scope.cancel = () => {
$modalInstance.dismiss('cancel');
};

$scope.delete = () => {
$modalInstance.close();
};
}]);
}
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
67 changes: 67 additions & 0 deletions console/src/main/scripts/plugins/accounts/ts/settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
///
/// Copyright 2015 Red Hat, Inc. and/or its affiliates
/// and other contributors as indicated by the @author tags.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

/// <reference path='accountsPlugin.ts'/>

module HawkularAccounts {
export class UserSettingsController {
public static $inject = ['$log',
'HawkularAccount',
'NotificationsService'
];

// backend data related to this controller
public settings:IUserSettings;

// state control, for easier UI consumption
public loading:boolean;

constructor(private $log:ng.ILogService,
private HawkularAccount:any,
private NotificationsService:INotificationsService) {

this.loadData();
}
public loadData():void {
this.loading = true;
this.loadSettings();
}

public loadSettings():void {
this.settings = this.HawkularAccount.Settings.get({},
(settings:IUserSettings) => {
this.loading = false;
},
(error:IErrorPayload) => {
this.NotificationsService.warning('User settings could not be loaded.');
this.$log.warn(`Error while loading the organization: ${error.data.message}`);
this.loading = false;
}
);
}

public save():void {
this.settings.$update({}, (settings:IUserSettings) => {
this.NotificationsService.success('User settings successfully updated.');
}, (error:IErrorPayload) => {
this.NotificationsService.error('User settings could not be updated.');
});
}
}

_module.controller('HawkularAccounts.UserSettingsController', UserSettingsController);
}

0 comments on commit 581e8bf

Please sign in to comment.