Skip to content

Commit

Permalink
#79 :: Dynamic Filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-korchak committed Jul 26, 2021
1 parent e2adad8 commit 59e8020
Show file tree
Hide file tree
Showing 157 changed files with 4,009 additions and 475 deletions.
117 changes: 117 additions & 0 deletions README.DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#Spline UI Development Guide

---

##Application structure

- All shared stuff placed in the `/ui/projects` and separated into 4 main categories/libraries:

- ###spline-api

Represents DTO layer for the Spline consumer API.

- ###spline-utils

Generic stuff, which can be reused in any application. There cannot be any dependency on any other part of the application.

- ###spline-common

Generic UI related components/modules. These components can be reused in other applications. It can have dependencies on spline-utils.

- ###spline-shared

Spline UI application specific stuff. Smarter components/containers which need to be shared between application modules.
It can have dependencies on spline-utils, spline-common, spline-api.


- Feature modules placed in the `/ui/src/modules`

Each module can depend on any shared library from `/ui/projects`, but cannot have any dependencies on any other module from `/ui/src/modules` or `/ui/src/app`.


- AppModule, from `/ui/src/app` defines the skeleton of the application, it is a glue for the feature modules. It defines the application layout and routing, but it cannot have any dependencies on feature modules except routing definitions. It can be depended only on stuff from /ui/projects.

---

##The structure of shared libraries


```
library-name
main
src
public-api.ts
assets
i18n
library-name
en.json
styles
library-name
...
index.scss
library-name.scss
secondary-endpoint
src
public-api.ts
assets
i18n
library-name.secondary-endpoint
en.json
styles
library-name.secondary-endpoint
...
index.scss
library-name.secondary-endpoint.scss
package.json
package.json
```

- Each library has the main and secondary entry points:

- Main entry point directory structure (all code in the directory `main` & the package.json should be at the level of the `main` directory)

```
library-name
main
assets
styles
src
public-api.ts
package.json
```

- Secondary entry point directory structure (package.json should be inside the secondary endpoint directive)
```
library-name
secondary-endpoint
assets
styles
src
public-api.ts
package.json
```
- All SCSS files should be placed in the relevant `styles` directory instead of styles definition directly in the component with `styleUrls` property.
- All i18n files should be placed in the relevant i18n directory.
---
Copyright 2020 ABSA Group Limited
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.
22 changes: 10 additions & 12 deletions ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 ABSA Group Limited
* Copyright 2021 ABSA Group Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,7 +51,7 @@ module.exports = {
],
'rules': {
'import/newline-after-import': ['error', {'count': 2}],
'@typescript-eslint/no-use-before-define': ['error', {'functions': false}],
'@typescript-eslint/no-use-before-define': ['warn', {functions: false, classes: false}],
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-explicit-any': 0,
Expand All @@ -70,12 +70,7 @@ module.exports = {
}
],
'@typescript-eslint/no-namespace': 0,
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
"allowExpressions": true
}
],
'@typescript-eslint/explicit-function-return-type': 0,
'no-inner-declarations': 0,
'max-lines': 0,
'brace-style': [
Expand Down Expand Up @@ -119,15 +114,15 @@ module.exports = {
'error',
{
'type': 'attribute',
'prefix': 'spline',
'prefix': ['spline', 'app'],
'style': 'camelCase'
}
],
'@angular-eslint/component-selector': [
'error',
{
'type': 'element',
'prefix': 'spline',
'prefix': ['spline', 'app'],
'style': 'kebab-case'
}
],
Expand Down Expand Up @@ -186,7 +181,11 @@ module.exports = {
'@angular-eslint/no-outputs-metadata-property': 'error',
'@angular-eslint/use-lifecycle-interface': 'warn',
'@angular-eslint/use-pipe-transform-interface': 'error',
'@typescript-eslint/prefer-regexp-exec': 0,
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'warn',

}
},
{
Expand All @@ -198,7 +197,6 @@ module.exports = {
'@angular-eslint/template'
],
'rules': {
'@angular-eslint/template/banana-in-a-box': 'error',
'@angular-eslint/template/no-negated-async': 'error'
}
}
Expand Down
11 changes: 11 additions & 0 deletions ui/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@
"input": "projects/spline-common/dynamic-table/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "projects/spline-common/dynamic-filter/main/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "projects/spline-common/dynamic-filter/filter-controls/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "projects/spline-shared/main/assets",
Expand Down Expand Up @@ -122,6 +132,7 @@
"projects/spline-common/dynamic-table/styles",
"projects/spline-common/graph/styles",
"projects/spline-common/layout/styles",
"projects/spline-common/dynamic-filter/main/styles",
"projects/spline-shared/main/styles",
"projects/spline-shared/attributes/styles",
"projects/spline-shared/expression/styles",
Expand Down
4 changes: 4 additions & 0 deletions ui/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ module.exports = {
'^spline-common\/layout$': __dirname + '/projects/spline-common/layout/src/public-api',
'/spline-common\/dynamic-table/': __dirname + '/projects/spline-common/dynamic-table/src/public-api',
'^spline-common\/dynamic-table$': __dirname + '/projects/spline-common/dynamic-table/src/public-api',
'/spline-common\/dynamic-filter\/filter-controls/': __dirname + '/projects/spline-common/dynamic-filter/filter-controls/src/public-api',
'^spline-common\/dynamic-filter\/filter-controls$': __dirname + '/projects/spline-common/dynamic-filter/filter-controls/src/public-api',
'/spline-common\/dynamic-filter/': __dirname + '/projects/spline-common/dynamic-filter/main/src/public-api',
'^spline-common\/dynamic-filter$': __dirname + '/projects/spline-common/dynamic-filter/main/src/public-api',
'/spline-shared/': __dirname + '/projects/spline-shared/main/src/public-api',
'^spline-shared$': __dirname + '/projects/spline-shared/main/src/public-api',
'/spline-shared\/attributes/': __dirname + '/projects/spline-shared/attributes/src/public-api',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import { HttpParams } from '@angular/common/http'
import { DEFAULT_PAGE_LIMIT, PageQueryParams, QueryPager, QuerySorter } from 'spline-utils'

import { DataSourceWriteMode } from '../data-source'

import { ExecutionEventField } from './execution-event.models'


Expand All @@ -29,6 +31,7 @@ export namespace ExecutionEventsQuery {
dataSourceUri?: string
asAtTime?: number
applicationId?: string
writeMode?: DataSourceWriteMode[]
}

export type QueryParams = PageQueryParams<QueryFilter, ExecutionEventField>
Expand All @@ -44,6 +47,7 @@ export namespace ExecutionEventsQuery {
dataSourceUri?: string
asAtTime?: number
applicationId?: string
append?: boolean
}

export function toQueryParamsDto(queryParams: QueryParams): QueryParamsDto {
Expand Down Expand Up @@ -77,6 +81,13 @@ export namespace ExecutionEventsQuery {
dataSourceUri: queryFilter?.dataSourceUri,
asAtTime: queryFilter?.asAtTime,
applicationId: queryFilter?.applicationId,
append: queryFilter?.writeMode
? (
queryFilter.writeMode?.length === 1
? queryFilter.writeMode[0] === DataSourceWriteMode.Append
: undefined // there are just 2 options for now, if we have specified 2 options it means we want to see all items
)
: undefined
}
}

Expand Down
36 changes: 36 additions & 0 deletions ui/projects/spline-common/dynamic-filter/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2021 ABSA Group Limited
*
* 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.
*/

module.exports = {
'rules': {
'@angular-eslint/directive-selector': [
'error',
{
'type': 'attribute',
'prefix': ['dynamic-filter', 'filter', 'df'],
'style': 'camelCase'
}
],
'@angular-eslint/component-selector': [
'error',
{
'type': 'element',
'prefix': ['dynamic-filter', 'filter', 'df'],
'style': 'kebab-case'
}
]
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"COMMON" : {
"DF" : {
"FILTER_CONTROLS" : {
"SELECT": {
"LABEL__ALL_SELECTED": "Any"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"ngPackage": {
"lib": {
"entryFile": "src/public-api.ts"
}
},
"peerDependencies": {
"@angular/common": "~10.1.0",
"@angular/core": "^10.1.0",
"@angular/material": "^11.0.4",
"spline-common": "^0.0.1",
"spline-common/dynamic-table": "^0.0.1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2021 ABSA Group Limited
*
* 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.
*/

import 'jest-preset-angular'
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
~ Copyright 2021 ABSA Group Limited
~
~ 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.
-->

<spline-date-filter [label]="model.label"
[icon]="model.icon ? model.icon : defaultIcon"
[maxDate]="model.bounds?.dateTo"
[minDate]="model.bounds?.dateFrom"
[value]="model.value$ | async"
(valueChanged$)="onDateFilterChanged($event)">

</spline-date-filter>
Loading

0 comments on commit 59e8020

Please sign in to comment.