NIFIREG-30 - Cleanup some styles and add success coasters when creating a new user, group, or bucket

This closes #65.

Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
Scott Aslan 2017-12-22 00:36:45 -05:00 коммит произвёл Bryan Bende
Родитель 57e80fc6a8
Коммит c9c5f6d791
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A0DDA9ED50711C39
19 изменённых файлов: 94 добавлений и 74 удалений

Просмотреть файл

@ -207,8 +207,6 @@
<include>
@fluid-design-system/dist/platform/core/common/styles/css/*
</include>
<include>@fluid-design-system/dist/platform/core/dialogs/**/*</include>
<include>@fluid-design-system/dist/platform/core/snackbars/**/*</include>
<include>@fluid-design-system/dist/platform/core/LICENSE.md</include>
<!-- font-awesome -->
<include>font-awesome/css/font-awesome.css</include>

Просмотреть файл

@ -27,6 +27,7 @@ var ngRouter = require('@angular/router');
* @constructor
*/
function NfRegistryAdministration(nfRegistryService, router) {
//Services
this.router = router;
this.nfRegistryService = nfRegistryService;
};

Просмотреть файл

@ -35,12 +35,14 @@ var $ = require('jquery');
* @constructor
*/
function NfRegistryAddUserToGroups(nfRegistryApi, tdDataTableService, nfRegistryService, matDialogRef, fdsSnackBarService, data) {
//Services
this.dataTableService = tdDataTableService;
this.snackBarService = fdsSnackBarService;
this.nfRegistryService = nfRegistryService;
this.nfRegistryApi = nfRegistryApi;
this.dialogRef = matDialogRef;
this.data = data;
// local state
//make an independent copy of the groups for sorting and selecting within the scope of this component
this.groups = $.extend(true, [], this.nfRegistryService.groups);
this.filteredUserGroups = [];
@ -106,7 +108,7 @@ NfRegistryAddUserToGroups.prototype = {
var newUserGroupsData = this.groups;
for (var i = 0; i < this.userGroupsSearchTerms.length; i++) {
newUserGroupsData = this.nfRegistryService.filterData(newUserGroupsData, this.userGroupsSearchTerms[i], true);
newUserGroupsData = this.dataTableService.filterData(newUserGroupsData, this.userGroupsSearchTerms[i], true);
}
newUserGroupsData = this.dataTableService.sortData(newUserGroupsData, sortBy, sortOrder);

Просмотреть файл

@ -19,19 +19,24 @@ var ngCore = require('@angular/core');
var NfRegistryService = require('nifi-registry/services/nf-registry.service.js');
var NfRegistryApi = require('nifi-registry/services/nf-registry.api.js');
var ngMaterial = require('@angular/material');
var fdsSnackBarsModule = require('@fluid-design-system/snackbars');
/**
* NfRegistryAddUser constructor.
*
* @param nfRegistryApi The api service.
* @param nfRegistryService The nf-registry.service module.
* @param fdsSnackBarService The FDS snack bar service module.
* @param matDialogRef The angular material dialog ref.
* @constructor
*/
function NfRegistryAddUser(nfRegistryApi, nfRegistryService, matDialogRef) {
function NfRegistryAddUser(nfRegistryApi, nfRegistryService, fdsSnackBarService, matDialogRef) {
// Services
this.snackBarService = fdsSnackBarService;
this.nfRegistryService = nfRegistryService;
this.nfRegistryApi = nfRegistryApi;
this.dialogRef = matDialogRef;
// local state
this.keepDialogOpen = false;
};
@ -53,6 +58,15 @@ NfRegistryAddUser.prototype = {
if (self.keepDialogOpen !== true) {
self.dialogRef.close();
}
self.snackBarService.openCoaster({
title: 'Success',
message: 'User has been added.',
verticalPosition: 'bottom',
horizontalPosition: 'right',
icon: 'fa fa-check-circle-o',
color: '#1EB475',
duration: 3000
});
} else {
self.dialogRef.close();
}
@ -76,6 +90,7 @@ NfRegistryAddUser.annotations = [
NfRegistryAddUser.parameters = [
NfRegistryApi,
NfRegistryService,
fdsSnackBarsModule.FdsSnackBarService,
ngMaterial.MatDialogRef
];

Просмотреть файл

@ -28,10 +28,16 @@ describe('NfRegistryAddUser Component isolated unit tests', function () {
beforeEach(function () {
nfRegistryService = new NfRegistryService();
nfRegistryApi = new NfRegistryApi();
comp = new NfRegistryAddUser(nfRegistryApi, nfRegistryService, {
close: function () {
}
});
comp = new NfRegistryAddUser(nfRegistryApi,
nfRegistryService,
{
openCoaster: function () {
}
},
{
close: function () {
}
});
// Spy
spyOn(nfRegistryApi, 'addUser').and.callFake(function () {

Просмотреть файл

@ -35,12 +35,14 @@ var $ = require('jquery');
* @constructor
*/
function NfRegistryAddUsersToGroup(nfRegistryApi, tdDataTableService, nfRegistryService, matDialogRef, fdsSnackBarService, data) {
//Services
this.dataTableService = tdDataTableService;
this.snackBarService = fdsSnackBarService;
this.nfRegistryService = nfRegistryService;
this.nfRegistryApi = nfRegistryApi;
this.dialogRef = matDialogRef;
this.data = data;
// local state
//make an independent copy of the users for sorting and selecting within the scope of this component
this.users = $.extend(true, [], this.nfRegistryService.users);
this.filteredUsers = [];
@ -100,7 +102,7 @@ NfRegistryAddUsersToGroup.prototype = {
var newUsersData = this.users;
for (var i = 0; i < this.usersSearchTerms.length; i++) {
newUsersData = this.nfRegistryService.filterData(newUsersData, this.usersSearchTerms[i], true);
newUsersData = this.dataTableService.filterData(newUsersData, this.usersSearchTerms[i], true);
}
newUsersData = this.dataTableService.sortData(newUsersData, sortBy, sortOrder);

Просмотреть файл

@ -19,19 +19,24 @@ var ngCore = require('@angular/core');
var NfRegistryService = require('nifi-registry/services/nf-registry.service.js');
var NfRegistryApi = require('nifi-registry/services/nf-registry.api.js');
var ngMaterial = require('@angular/material');
var fdsSnackBarsModule = require('@fluid-design-system/snackbars');
/**
* NfRegistryCreateNewGroup constructor.
*
* @param nfRegistryApi The api service.
* @param fdsSnackBarService The FDS snack bar service module.
* @param nfRegistryService The nf-registry.service module.
* @param matDialogRef The angular material dialog ref.
* @constructor
*/
function NfRegistryCreateNewGroup(nfRegistryApi, nfRegistryService, matDialogRef) {
function NfRegistryCreateNewGroup(nfRegistryApi, fdsSnackBarService, nfRegistryService, matDialogRef) {
// Services
this.snackBarService = fdsSnackBarService;
this.nfRegistryService = nfRegistryService;
this.nfRegistryApi = nfRegistryApi;
this.dialogRef = matDialogRef;
// local state
this.keepDialogOpen = false;
};
@ -54,6 +59,15 @@ NfRegistryCreateNewGroup.prototype = {
if (self.keepDialogOpen !== true) {
self.dialogRef.close();
}
self.snackBarService.openCoaster({
title: 'Success',
message: 'Group has been added.',
verticalPosition: 'bottom',
horizontalPosition: 'right',
icon: 'fa fa-check-circle-o',
color: '#1EB475',
duration: 3000
});
} else {
self.dialogRef.close();
}
@ -76,6 +90,7 @@ NfRegistryCreateNewGroup.annotations = [
NfRegistryCreateNewGroup.parameters = [
NfRegistryApi,
fdsSnackBarsModule.FdsSnackBarService,
NfRegistryService,
ngMaterial.MatDialogRef
];

Просмотреть файл

@ -28,10 +28,15 @@ describe('NfRegistryCreateNewGroup Component isolated unit tests', function () {
beforeEach(function () {
nfRegistryService = new NfRegistryService();
nfRegistryApi = new NfRegistryApi();
comp = new NfRegistryCreateNewGroup(nfRegistryApi, nfRegistryService, {
close: function () {
}
});
comp = new NfRegistryCreateNewGroup(nfRegistryApi, {
openCoaster: function () {
}
},
nfRegistryService,
{
close: function () {
}
});
// Spy
spyOn(nfRegistryApi, 'createNewGroup').and.callFake(function () {

Просмотреть файл

@ -38,6 +38,7 @@ var NfRegistryCreateNewGroup = require('nifi-registry/components/administration/
* @constructor
*/
function NfRegistryUsersAdministration(nfRegistryApi, nfStorage, nfRegistryService, activatedRoute, fdsDialogService, matDialog) {
// Services
this.route = activatedRoute;
this.nfStorage = nfStorage;
this.nfRegistryService = nfRegistryService;

Просмотреть файл

@ -39,6 +39,7 @@ var NfRegistryAddUserToGroups = require('nifi-registry/components/administration
* @constructor
*/
function NfRegistryManageUser(nfRegistryApi, nfRegistryService, tdDataTableService, fdsDialogService, fdsSnackBarService, activatedRoute, router, matDialog) {
// local state
this.filteredUserGroups = [];
this.userGroupsSearchTerms = [];
this._username = '';
@ -464,7 +465,7 @@ NfRegistryManageUser.prototype = {
var newUserGroupsData = this.nfRegistryService.user.userGroups || [];
for (var i = 0; i < this.userGroupsSearchTerms.length; i++) {
newUserGroupsData = this.filterData(newUserGroupsData, this.userGroupsSearchTerms[i], true);
newUserGroupsData = this.dataTableService.filterData(newUserGroupsData, this.userGroupsSearchTerms[i], true);
}
newUserGroupsData = this.dataTableService.sortData(newUserGroupsData, sortBy, sortOrder);

Просмотреть файл

@ -37,6 +37,7 @@ var fdsSnackBarsModule = require('@fluid-design-system/snackbars');
* @constructor
*/
function NfRegistryAddPolicyToBucket(nfRegistryApi, tdDataTableService, fdsSnackBarService, nfRegistryService, activatedRoute, matDialogRef, data) {
// local state
this.users = [];
this.groups = [];
this.userOrGroup = {};
@ -115,7 +116,7 @@ NfRegistryAddPolicyToBucket.prototype = {
var newUserGroupsData = this.groups;
for (var i = 0; i < this.userGroupsSearchTerms.length; i++) {
newUserGroupsData = this.nfRegistryService.filterData(newUserGroupsData, this.userGroupsSearchTerms[i], true);
newUserGroupsData = this.dataTableService.filterData(newUserGroupsData, this.userGroupsSearchTerms[i], true);
}
newUserGroupsData = this.dataTableService.sortData(newUserGroupsData, sortBy, sortOrder);
@ -124,7 +125,7 @@ NfRegistryAddPolicyToBucket.prototype = {
var newUsersData = this.users;
for (var i = 0; i < this.usersSearchTerms.length; i++) {
newUsersData = this.nfRegistryService.filterData(newUsersData, this.usersSearchTerms[i], true);
newUsersData = this.dataTableService.filterData(newUsersData, this.usersSearchTerms[i], true);
}
newUsersData = this.dataTableService.sortData(newUsersData, sortBy, sortOrder);

Просмотреть файл

@ -18,19 +18,24 @@ var ngCore = require('@angular/core');
var NfRegistryService = require('nifi-registry/services/nf-registry.service.js');
var NfRegistryApi = require('nifi-registry/services/nf-registry.api.js');
var ngMaterial = require('@angular/material');
var fdsSnackBarsModule = require('@fluid-design-system/snackbars');
/**
* NfRegistryCreateBucket constructor.
*
* @param nfRegistryApi The api service.
* @param fdsSnackBarService The FDS snack bar service module.
* @param nfRegistryService The nf-registry.service module.
* @param matDialogRef The angular material dialog ref.
* @constructor
*/
function NfRegistryCreateBucket(nfRegistryApi, nfRegistryService, matDialogRef) {
function NfRegistryCreateBucket(nfRegistryApi, fdsSnackBarService, nfRegistryService, matDialogRef) {
// Services
this.snackBarService = fdsSnackBarService;
this.nfRegistryService = nfRegistryService;
this.nfRegistryApi = nfRegistryApi;
this.dialogRef = matDialogRef;
// local state
this.keepDialogOpen = false;
};
@ -52,6 +57,15 @@ NfRegistryCreateBucket.prototype = {
if (self.keepDialogOpen !== true) {
self.dialogRef.close();
}
self.snackBarService.openCoaster({
title: 'Success',
message: 'Bucket has been added.',
verticalPosition: 'bottom',
horizontalPosition: 'right',
icon: 'fa fa-check-circle-o',
color: '#1EB475',
duration: 3000
});
} else {
self.dialogRef.close();
}
@ -74,6 +88,7 @@ NfRegistryCreateBucket.annotations = [
NfRegistryCreateBucket.parameters = [
NfRegistryApi,
fdsSnackBarsModule.FdsSnackBarService,
NfRegistryService,
ngMaterial.MatDialogRef
];

Просмотреть файл

@ -28,10 +28,14 @@ describe('NfRegistryCreateBucket Component isolated unit tests', function () {
beforeEach(function () {
nfRegistryService = new NfRegistryService();
nfRegistryApi = new NfRegistryApi();
comp = new NfRegistryCreateBucket(nfRegistryApi, nfRegistryService, {
close: function () {
}
});
comp = new NfRegistryCreateBucket(nfRegistryApi, {
openCoaster: function () {
}
},
nfRegistryService, {
close: function () {
}
});
// Spy
spyOn(nfRegistryApi, 'createBucket').and.callFake(function () {

Просмотреть файл

@ -34,6 +34,7 @@ var ngMaterial = require('@angular/material');
* @constructor
*/
function NfRegistryWorkflowAdministration(nfRegistryApi, nfStorage, nfRegistryService, activatedRoute, matDialog) {
// Services
this.route = activatedRoute;
this.nfStorage = nfStorage;
this.nfRegistryService = nfRegistryService;

Просмотреть файл

@ -51,7 +51,6 @@ function NfRegistryManageBucket(nfRegistryApi, nfRegistryService, tdDataTableSer
this.userIdentitiesWithPolicies = [];
this.groupIdentitiesWithPolicies = [];
// Services
this.nfRegistryService = nfRegistryService;
this.route = activatedRoute;

Просмотреть файл

@ -25,6 +25,7 @@ var nfRegistryAnimations = require('nifi-registry/nf-registry.animations.js');
* @constructor
*/
function NfRegistryExplorer(nfRegistryService) {
//Services
this.nfRegistryService = nfRegistryService;
};

Просмотреть файл

@ -839,53 +839,6 @@ describe('NfRegistry Service w/ Angular testing utils', function () {
expect(nfRegistryService.getAutoCompleteDroplets).toHaveBeenCalled();
});
it('should filter droplets by `type:flow` (demonstrate ability to do advanced searching of a droplet by a property `name:value` pair).', function () {
//Setup the nfRegistryService state for this test
nfRegistryService.dropletsSearchTerms = ['type:FLOW'];
nfRegistryService.droplets = [{
'identifier': '2e04b4fb-9513-47bb-aa74-1ae34616bfdc',
'name': 'Flow #1',
'description': 'This is flow #1',
'bucketIdentifier': '2f7f9e54-dc09-4ceb-aa58-9fe581319cdc',
'createdTimestamp': 1505931890999,
'modifiedTimestamp': 1505931890999,
'type': 'FLOW',
'snapshotMetadata': null,
'link': {
'params': {
'rel': 'self'
},
'href': 'flows/2e04b4fb-9513-47bb-aa74-1ae34616bfdc'
}
}, {
'identifier': '5d04b4fb-9513-47bb-aa74-1ae34616bfdc',
'name': 'Flow #2',
'description': 'This is not a flow #2',
'bucketIdentifier': '3g7f9e54-dc09-4ceb-aa58-9fe581319cdc',
'createdTimestamp': 1505931890999,
'modifiedTimestamp': 1505931890999,
'type': 'something',
'snapshotMetadata': null,
'link': {
'params': {
'rel': 'self'
},
'href': 'flows/5d04b4fb-9513-47bb-aa74-1ae34616bfdc'
}
}];
//Spy
spyOn(nfRegistryService, 'getAutoCompleteDroplets');
// The function to test
nfRegistryService.filterDroplets();
//assertions
expect(nfRegistryService.filteredDroplets.length).toBe(1);
expect(nfRegistryService.filteredDroplets[0].name).toBe('Flow #1');
expect(nfRegistryService.getAutoCompleteDroplets).toHaveBeenCalled();
});
it('should execute a `delete` action on a bucket.', function () {
// from the root injector
var dialogService = ngCoreTesting.TestBed.get(fdsDialogsModule.FdsDialogService);

Просмотреть файл

@ -19,8 +19,8 @@
position: absolute;
top: 79px;
left: 50px;
right: 20px;
bottom: 20px;
right: 50px;
bottom: 50px;
background: white;
}

Просмотреть файл

@ -19,8 +19,8 @@
position: absolute;
top: 79px;
left: 50px;
right: 20px;
bottom: 20px;
right: 50px;
bottom: 50px;
background: white;
}