Skip to content

Commit

Permalink
Merged in feature/SHIBUI-1332 (pull request #344)
Browse files Browse the repository at this point in the history
SHIBUI-1332 Implemented filter component
  • Loading branch information
rmathis committed Jul 29, 2019
2 parents b6dfeef + 25dc5a5 commit 95e22a8
Show file tree
Hide file tree
Showing 70 changed files with 1,214 additions and 319 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"properties": {
"entityAttributesFilterTargetType": {
"title": "",
"title": "label.filter-target-type",
"type": "string",
"default": "ENTITY",
"oneOf": [
Expand All @@ -71,6 +71,7 @@
]
},
"value": {
"title": "label.filter-target-value",
"type": "array",
"buttons": [
{
Expand Down
13 changes: 13 additions & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ action.copy=Copy
action.choose-file=Choose File
action.search-by=Search By
action.preview=Preview
action.preview-xml=Preview XML
action.select-metadata-filter-type=Select a metadata filter type
action.add-authentication-method=Add Authentication Method
action.move-up=Move Up
Expand All @@ -51,6 +52,9 @@ action.manage-filters=Manage Filters
action.version-history=Version History
action.options=Options
action.xml=XML
action.manage=Manage
action.close=Close
action.back-to-top=Back to Top

value.enabled=Enabled
value.disabled=Disabled
Expand Down Expand Up @@ -239,7 +243,11 @@ label.filter-name=Filter Name
label.filter-enabled=Filter Enabled
label.filter-target=FilterTarget
label.filter-type=Filter Type
label.filter-target-type=Filter Target Type
label.filter-target-value=Filter Target Value
label.target=Filter Target
label.option=Option
label.options=Options
label.value=Value
label.binding-type=Binding Type
label.sign-assertion=Sign Assertions
Expand All @@ -261,6 +269,8 @@ label.make-default=Make Default
label.metadata-provider-name-dashboard-display-only=Metadata Provider Name (Dashboard Display Only)
label.default-authentication-methods=Default Authentication Method(s)
label.new-of-type=New { type }
label.filters=Filters
label.attributes=Attributes

label.metadata-filter-name=Metadata Filter Name (Dashboard Display Only)
label.filter-enable=Enable this Filter?
Expand Down Expand Up @@ -458,6 +468,9 @@ message.required-for-regex=Required for Regex
message.file-doesnt-exist=The requested file to be processed does not exist on the server.
message.database-constraint=There was a database constraint problem processing the request. Check the request to ensure that fields that must be unique are truly unique.

message.no-filters=No Filters
message.no-filters-added=No filters have been added to this Metadata Provider

tooltip.entity-id=Entity ID
tooltip.service-provider-name=Service Provider Name (Dashboard Display Only)
tooltip.force-authn=Disallows use (or reuse) of authentication results and login flows that don\u0027t provide a real-time proof of user presence in the login process
Expand Down
48 changes: 13 additions & 35 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ui/src/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const routes: Routes = [

@NgModule({
imports: [RouterModule.forRoot(routes, {
preloadingStrategy: PreloadAllModules
preloadingStrategy: PreloadAllModules,
scrollOffset: [0, 64]
})],
exports: [RouterModule]
})
Expand Down
35 changes: 35 additions & 0 deletions ui/src/app/core/reducer/configuration.reducer.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { reducer } from './configuration.reducer';
import * as fromConfiguration from './configuration.reducer';
import * as actions from '../action/configuration.action';

describe('Configuration Reducer', () => {
const initialState: fromConfiguration.ConfigState = {
roles: []
};

describe('undefined action', () => {
it('should return the default state', () => {
const result = reducer(undefined, {} as any);
expect(result).toEqual(initialState);
});
});

describe('Role Load Request', () => {
it('should set fetching to true', () => {
const action = new actions.LoadRoleSuccess(['ADMIN']);
const result = reducer(initialState, action);
expect(result).toEqual(
{
...initialState,
roles: ['ADMIN']
}
);
});
});

describe('selector functions', () => {
it('should return the roles from state', () => {
expect(fromConfiguration.getRoles(initialState)).toEqual([]);
});
});
});
18 changes: 17 additions & 1 deletion ui/src/app/core/reducer/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ describe('Core index reducers', () => {
version: fromVersion.initialState as fromVersion.VersionState,
config: fromConfig.initialState as fromConfig.ConfigState
};

describe('getUserStateFn function', () => {
it('should return the user state', () => {
expect(fromIndex.getUserStateFn(state)).toEqual(state.user);
Expand All @@ -21,4 +20,21 @@ describe('Core index reducers', () => {
expect(fromIndex.getVersionStateFn(state)).toEqual(state.version);
});
});
describe('getConfigStateFn function', () => {
it('should return the config state', () => {
expect(fromIndex.getConfigStateFn(state)).toEqual(state.config);
});
});
describe('filterRolesFn', () => {
it('should return the roles that are not `non roles`', () => {
expect(fromIndex.filterRolesFn(['ROLE_ADMIN', 'ROLE_NONE'])).toEqual(['ROLE_ADMIN']);
});
});
describe('isUserAdminFn', () => {
it('should check if the provided user has the ROLE_ADMIN role', () => {
expect(fromIndex.isUserAdminFn({role: 'ROLE_ADMIN'})).toBe(true);
expect(fromIndex.isUserAdminFn({role: 'ROLE_USER'})).toBe(false);
expect(fromIndex.isUserAdminFn(null)).toBe(false);
});
});
});
2 changes: 1 addition & 1 deletion ui/src/app/core/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const getVersionLoading = createSelector(getVersionState, fromVersion.get
export const getVersionError = createSelector(getVersionState, fromVersion.getVersionError);

export const filterRolesFn = (roles: string[]) => roles.filter(r => r !== 'ROLE_NONE');
export const isUserAdminFn = (user) => user ? user.role === 'ROLE_ADMIN' : null;
export const isUserAdminFn = (user) => user ? user.role === 'ROLE_ADMIN' : false;

export const getConfigState = createSelector(getCoreFeature, getConfigStateFn);
export const getRoles = createSelector(getConfigState, fromConfig.getRoles);
Expand Down
27 changes: 1 addition & 26 deletions ui/src/app/metadata/configuration/action/configuration.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { Schema } from '../model/schema';
import { Wizard } from '../../../wizard/model';

export enum ConfigurationActionTypes {
LOAD_METADATA_REQUEST = '[Metadata Configuration] Load Metadata Request',
LOAD_METADATA_SUCCESS = '[Metadata Configuration] Load Metadata Success',
LOAD_METADATA_ERROR = '[Metadata Configuration] Load Metadata Error',

LOAD_SCHEMA_REQUEST = '[Metadata Configuration] Load Schema Request',
LOAD_SCHEMA_SUCCESS = '[Metadata Configuration] Load Schema Success',
LOAD_SCHEMA_ERROR = '[Metadata Configuration] Load Schema Error',
Expand All @@ -26,24 +22,6 @@ export enum ConfigurationActionTypes {
CLEAR = '[Metadata Configuration] Clear'
}

export class LoadMetadataRequest implements Action {
readonly type = ConfigurationActionTypes.LOAD_METADATA_REQUEST;

constructor(public payload: { id: string, type: string }) { }
}

export class LoadMetadataSuccess implements Action {
readonly type = ConfigurationActionTypes.LOAD_METADATA_SUCCESS;

constructor(public payload: Metadata) { }
}

export class LoadMetadataError implements Action {
readonly type = ConfigurationActionTypes.LOAD_METADATA_ERROR;

constructor(public payload: any) { }
}

export class LoadSchemaRequest implements Action {
readonly type = ConfigurationActionTypes.LOAD_SCHEMA_REQUEST;

Expand Down Expand Up @@ -83,7 +61,7 @@ export class LoadXmlError implements Action {
export class SetMetadata implements Action {
readonly type = ConfigurationActionTypes.SET_METADATA;

constructor(public payload: Metadata) { }
constructor(public payload: { id: string, type: string }) { }
}

export class SetDefinition implements Action {
Expand Down Expand Up @@ -113,9 +91,6 @@ export class ClearConfiguration implements Action {
}

export type ConfigurationActionsUnion =
| LoadMetadataRequest
| LoadMetadataSuccess
| LoadMetadataError
| LoadSchemaRequest
| LoadSchemaSuccess
| LoadSchemaError
Expand Down
Loading

0 comments on commit 95e22a8

Please sign in to comment.