- sortDetails
+ step
- any
+ string
@@ -923,7 +1010,7 @@
@@ -937,74 +1024,27 @@
-
-
- Protected
-
- Async
- initComponent
-
-
-
-
-
-
-
- initComponent()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns : Promise<void>
-
-
-
-
-
-
-
-
-
-
-
+
- Public
+ Private
Async
- initStep
-
+ getAllItemsGroupedByRecordType
+
- initStep(stepName: string , evaluateStepName: string , recordType: string , packageType: string , startIndex: number )
+ getAllItemsGroupedByRecordType(sortGroupBy: SortGroupBy[] , stepName: string , startIndex: number , packageType: string , sortByString: string , filterFileds: any , filterString: any , filterMode: any )
-
+
@@ -1024,6 +1064,18 @@
+
+ sortGroupBy
+
+ SortGroupBy[]
+
+
+
+ No
+
+
+
+
stepName
@@ -1037,9 +1089,9 @@
- evaluateStepName
+ startIndex
- string
+ number
@@ -1049,7 +1101,7 @@
- recordType
+ packageType
string
@@ -1061,7 +1113,7 @@
- packageType
+ sortByString
string
@@ -1073,9 +1125,33 @@
- startIndex
+ filterFileds
- number
+ any
+
+
+
+ No
+
+
+
+
+
+ filterString
+
+ any
+
+
+
+ No
+
+
+
+
+
+ filterMode
+
+ any
@@ -1088,7 +1164,7 @@
-
Returns : any
+
Returns : unknown
@@ -1102,27 +1178,27 @@
-
+
- Public
+ Private
Async
- initView
-
+ getAllItemsGroupedByRelationships
+
- initView(recordType: string )
+ getAllItemsGroupedByRelationships(items: any , sortGroupBy: SortGroupBy[] )
-
+
@@ -1143,9 +1219,21 @@
- recordType
+ items
- string
+ any
+
+
+
+ No
+
+
+
+
+
+ sortGroupBy
+
+ SortGroupBy[]
@@ -1158,7 +1246,7 @@
-
Returns : any
+
Returns : unknown
@@ -1172,27 +1260,26 @@
-
+
- Public
- Async
- pageChanged
-
+ Private
+ getFilters
+
- pageChanged(event: PageChangedEvent, step: string )
+ getFilters(type: string )
-
+
@@ -1213,19 +1300,7 @@
- event
-
- PageChangedEvent
-
-
-
- No
-
-
-
-
-
- step
+ type
string
@@ -1240,7 +1315,7 @@
-
Returns : any
+
Returns : {}
@@ -1254,26 +1329,26 @@
-
+
- Private
- runTemplate
-
+ Public
+ getFilterSearchDisplayed
+
- runTemplate(templateString: string , imports: object )
+ getFilterSearchDisplayed(step: any )
-
+
@@ -1294,21 +1369,9 @@
- templateString
-
- string
-
-
-
- No
-
-
-
-
-
- imports
+ step
- object
+ any
@@ -1321,7 +1384,7 @@
@@ -1335,27 +1398,26 @@
-
+
Public
- Async
- sortChanged
-
+ getFilterSearchString
+
- sortChanged(data: any )
+ getFilterSearchString(step: any )
-
+
@@ -1376,7 +1438,7 @@
- data
+ step
any
@@ -1391,7 +1453,7 @@
@@ -1405,26 +1467,26 @@
-
+
Private
- updateSortMap
-
+ getFirstFilter
+
- updateSortMap(sortData: any )
+ getFirstFilter(type: string )
-
+
@@ -1445,9 +1507,9 @@
- sortData
+ type
- any
+ string
@@ -1460,7 +1522,1143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Private
+ getFirstTextFilter
+
+
+
+
+
+
+
+ getFirstTextFilter()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ getIsSearching
+
+
+
+
+
+
+
+ getIsSearching(step: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ step
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Private
+ getSortString
+
+
+
+
+
+
+
+ getSortString(sortDetails: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ sortDetails
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ getTextFilters
+
+
+
+
+
+
+
+ getTextFilters()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns : {}
+
+
+
+
+
+
+
+
+
+
+
+
+ Protected
+
+ Async
+ initComponent
+
+
+
+
+
+
+
+ initComponent()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns : Promise<void>
+
+
+
+
+
+
+
+
+
+
+
+
+ Private
+ initSortConfig
+
+
+
+
+
+
+
+ initSortConfig(step: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ step
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ Async
+ initStep
+
+
+
+
+
+
+
+ initStep(stepName: string , evaluateStepName: string , recordType: string , packageType: string , startIndex: number )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ stepName
+
+ string
+
+
+
+ No
+
+
+
+
+
+ evaluateStepName
+
+ string
+
+
+
+ No
+
+
+
+
+
+ recordType
+
+ string
+
+
+
+ No
+
+
+
+
+
+ packageType
+
+ string
+
+
+
+ No
+
+
+
+
+
+ startIndex
+
+ number
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Private
+ initStepTableConfig
+
+
+
+
+
+
+
+ initStepTableConfig(recordType: string , step: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ recordType
+
+ string
+
+
+
+ No
+
+
+
+
+
+ step
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ Async
+ initView
+
+
+
+
+
+
+
+ initView(recordType: string )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ recordType
+
+ string
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Private
+ Async
+ initWorkflowSteps
+
+
+
+
+
+
+
+ initWorkflowSteps(recordType: string )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ recordType
+
+ string
+
+
+
+ No
+
+
+
+
+
+
+
+
+ Returns : unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ Async
+ pageChanged
+
+
+
+
+
+
+
+ pageChanged(event: PageChangedEvent, step: string )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ event
+
+ PageChangedEvent
+
+
+
+ No
+
+
+
+
+
+ step
+
+ string
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ Async
+ resetFilterAndSearch
+
+
+
+
+
+
+
+ resetFilterAndSearch(step: string , e: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ step
+
+ string
+
+
+
+ No
+
+
+
+
+
+ e
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Private
+ runTemplate
+
+
+
+
+
+
+
+ runTemplate(templateString: string , imports: object )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ templateString
+
+ string
+
+
+
+ No
+
+
+
+
+
+ imports
+
+ object
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ setFilterField
+
+
+
+
+
+
+
+ setFilterField(filterField: FilterField , e: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ filterField
+
+ FilterField
+
+
+
+ No
+
+
+
+
+
+ e
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public
+ Async
+ sortChanged
+
+
+
+
+
+
+
+ sortChanged(data: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ data
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Private
+ updateSortMap
+
+
+
+
+
+
+
+ updateSortMap(sortData: any )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters :
+
+
+
+
+ Name
+ Type
+ Optional
+
+
+
+
+ sortData
+
+ any
+
+
+
+ No
+
+
+
+
+
+
+
+
@@ -1730,7 +2928,7 @@
-
+
@@ -1761,7 +2959,7 @@
+
+
+
+
+
+
+ defaultRowLevelRules
+
+
+
+
+
+
+ Type : any
+
+
+
+
+
+ Default value : {}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ enableSort
+
+
+
+
+
+
+ Type : boolean
+
+
+
+
+
+ Default value : true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ filterFieldName
+
+
+
+
+
+
+ Type : string
+
+
+
+
+
+ Default value : 'Title'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ filterFieldPath
+
+
+
+
+
+
+ Type : string
+
+
+
+
+
+ Default value : 'metadata.title'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ filterSearchString
+
+
+
+
+
+
+ Type : any
+
+
+
+
+
+ Default value : {}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ formatRules
+
+
+
+
+
+
+ Type : FormatRules
+
+
+
+
+
+ Default value : this.defaultFormatRules
+
+
+
+
+
@@ -2163,27 +3562,27 @@
-
+
- enableSort
-
+ groupRowConfig
+
- Type : boolean
+ Type : object
- Default value : true
+ Default value : {}
-
+
@@ -2194,10 +3593,10 @@
-
+
- formatRules
-
+ groupRowRules
+
@@ -2214,7 +3613,7 @@
-
+
@@ -2225,16 +3624,47 @@
-
+
- groupRowConfig
-
+ hideWorkflowStepTitle
+
- Type : object
+ Type : boolean
+
+
+
+
+
+ Default value : false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isFilterSearchDisplayed
+
+
+
+
+
+
+ Type : any
@@ -2245,7 +3675,7 @@
-
+
@@ -2256,10 +3686,10 @@
-
+
- groupRowRules
-
+ isSearching
+
@@ -2276,7 +3706,7 @@
-
+
@@ -2302,7 +3732,7 @@
-
+
@@ -2333,7 +3763,7 @@
-
+
@@ -2364,7 +3794,7 @@
-
+
@@ -2390,7 +3820,7 @@
-
+
@@ -2421,7 +3851,7 @@
-
+
@@ -2452,7 +3882,7 @@
-
+
@@ -2478,7 +3908,7 @@
-
+
@@ -2509,7 +3939,7 @@
-
+
@@ -2540,7 +3970,7 @@
-
+
@@ -2571,7 +4001,7 @@
-
+
@@ -2602,7 +4032,7 @@
-
+
@@ -2633,7 +4063,7 @@
-
+
@@ -2837,10 +4267,11 @@
import { Component, Inject, ElementRef } from '@angular/core';
import { PageChangedEvent } from 'ngx-bootstrap/pagination';
-import { BaseComponent, UtilityService, LoggerService, TranslationService, RecordService, PlanTable, UserService, ConfigService } from '@researchdatabox/portal-ng-common';
+import { BaseComponent, UtilityService, LoggerService, TranslationService, RecordService, PlanTable, UserService, ConfigService, FormatRules, SortGroupBy, QueryFilter, FilterField } from '@researchdatabox/portal-ng-common';
import { get as _get, set as _set, isEmpty as _isEmpty, isUndefined as _isUndefined, trim as _trim, isNull as _isNull, orderBy as _orderBy, map as _map, find as _find, indexOf as _indexOf, isArray as _isArray, forEach as _forEach, join as _join, first as _first } from 'lodash-es';
import { LoDashTemplateUtilityService } from 'projects/researchdatabox/portal-ng-common/src/lib/lodash-template-utility.service';
+import * as _ from 'lodash';
@Component({
selector: 'dashboard',
@@ -2865,8 +4296,15 @@
rulesService: object;
currentUser: object = {};
enableSort: boolean = true;
-
- defaultTableConfig = [
+ filterFieldName: string = 'Title';
+ filterFieldPath: string = 'metadata.title';
+ defaultFilterField: FilterField = { name: this.filterFieldName, path: this.filterFieldPath };
+ filterSearchString: any = {};
+ hideWorkflowStepTitle: boolean = false;
+ isFilterSearchDisplayed: any = {};
+ isSearching: any = {};
+
+ defaultRowConfig = [
{
title: 'Record Title',
variable: 'metadata.title',
@@ -2927,14 +4365,29 @@
sortFields = ['metaMetadata.lastSaveDate', 'metaMetadata.createdOn', 'metadata.title', 'metadata.contributor_ci.text_full_name', 'metadata.contributor_data_manager.text_full_name'];
- defaultFormatRules: any = {
- filterBy: [], //filterBase can only have two values user or record
+ defaultFormatRules: FormatRules = {
+ filterBy: {}, //filterBase can only have two values user or record
filterWorkflowStepsBy: [], //values: empty array (all) or a list with particular types i.e. [ 'draft', 'finalised' ]
+ recordTypeFilterBy: '',
+ queryFilters: {
+ rdmp: [
+ {
+ filterType: 'text',
+ filterFields: [
+ {
+ name: 'Title',
+ path: 'metadata.title'
+ }
+ ]
+ }
+ ]
+ },
sortBy: 'metaMetadata.lastSaveDate:-1',
groupBy: '', //values: empty (not grouped any order), groupedByRecordType, groupedByRelationships
sortGroupBy: [], //values: as many levels as required?
+ hideWorkflowStepTitleForRecordType: []
};
- formatRules: any = {};
+ formatRules: FormatRules = this.defaultFormatRules;
defaultGroupRowConfig = {};
groupRowConfig = {};
@@ -2994,15 +4447,13 @@
public async initView(recordType: string) {
- //console.log('----------------------- initView -------------------------- '+this.dashboardTypeSelected);
this.formatRules = this.defaultFormatRules;
this.rowLevelRules = this.defaultRowLevelRules;
this.groupRowConfig = this.defaultGroupRowConfig;
this.groupRowRules = this.defaultGroupRowRules;
- let dashboardType: any = await this.recordService.getDashboardType(this.dashboardTypeSelected);
- let formatRules = _get(dashboardType, 'formatRules');
- let startIndex = 1;
+ let dashboardTypeConfig: any = await this.recordService.getDashboardType(this.dashboardTypeSelected);
+ let formatRules: FormatRules = _get(dashboardTypeConfig, 'formatRules');
if (!_isUndefined(formatRules) && !_isNull(formatRules) && !_isEmpty(formatRules)) {
//global format rules from dashboardtype.js config
this.formatRules = formatRules;
@@ -3013,6 +4464,48 @@
recordType = recordTypeFilterBy;
}
+ for(let recType of formatRules.hideWorkflowStepTitleForRecordType) {
+ if(recType == recordType) {
+ this.hideWorkflowStepTitle = true;
+ }
+ }
+
+ let steps = await this.initWorkflowSteps(recordType);
+
+ let startIndex = 1;
+ for (let step of steps) {
+
+ this.initStepTableConfig(recordType, step);
+
+ this.initSortConfig(step);
+
+ this.workflowSteps.push(step);
+
+ let packageType = '';
+ let stepName = '';
+ let evaluateStepName = '';
+ if (this.dashboardTypeSelected == 'consolidated') {
+ packageType = '';
+ stepName = '';
+ evaluateStepName = _get(step, 'name');
+ recordType = _get(step, 'config.baseRecordType');
+ } else if (this.dashboardTypeSelected == 'workspace') {
+ stepName = '';
+ packageType = this.packageType;
+ evaluateStepName = _get(step, 'name');
+ recordType = '';
+ } else {
+ packageType = '';
+ stepName = _get(step, 'name');
+ evaluateStepName = stepName;
+ }
+
+ await this.initStep(stepName, evaluateStepName, recordType, packageType, startIndex);
+ }
+ }
+
+ private async initWorkflowSteps(recordType: string) {
+
let beforeFilterSteps: any = await this.recordService.getWorkflowSteps(recordType);
let filterWorkflowStepsBy = _get(this.formatRules, 'filterWorkflowStepsBy');
@@ -3032,87 +4525,62 @@
steps = beforeFilterSteps;
}
steps = _orderBy(steps, ['config.displayIndex'], ['asc']);
+ return steps;
+ }
- for (let step of steps) {
-
- this.workflowSteps.push(step);
- // console.log('----------------------- step -------------------------- '+step.config.workflow.stageLabel);
- let stepTableConfig = this.defaultTableConfig;
- if (_isEmpty(this.defaultTableConfig[0].title)) {
- this.defaultTableConfig[0].title = `${recordType}-title` || 'Title';
- // console.log('----------------------- title -------------------------- '+this.defaultTableConfig[0].title);
- }
- if (!_isUndefined(_get(step, 'config.dashboard'))
- && !_isUndefined(_get(step, 'config.dashboard.table'))) {
-
- if (!_isUndefined(_get(step, 'config.dashboard.table.rowConfig'))) {
- stepTableConfig = _get(step, 'config.dashboard.table.rowConfig');
- this.sortFields = _map(_get(step, 'config.dashboard.table.rowConfig'), (config) => { return config.variable });
- }
+ private initStepTableConfig(recordType: string, step: any) {
- if (!_isUndefined(_get(step, 'config.dashboard.table.rowRulesConfig'))) {
- this.rowLevelRules = _get(step, 'config.dashboard.table.rowRulesConfig');
- console.log(JSON.stringify(this.rowLevelRules));
- }
+ let stepRowConfig = this.defaultRowConfig;
- if (!_isUndefined(_get(step, 'config.dashboard.table.groupRowConfig'))) {
- this.groupRowConfig = _get(step, 'config.dashboard.table.groupRowConfig');
- }
+ if (_isEmpty(this.defaultRowConfig[0].title)) {
+ this.defaultRowConfig[0].title = `${recordType}-title` || 'Title';
+ }
- if (!_isUndefined(_get(step, 'config.dashboard.table.groupRowRulesConfig'))) {
- this.groupRowRules = _get(step, 'config.dashboard.table.groupRowRulesConfig');
- }
+ if (!_isUndefined(_get(step, 'config.dashboard'))
+ && !_isUndefined(_get(step, 'config.dashboard.table'))) {
- //formtatRules override at step level from workflow.js config
- if (!_isUndefined(_get(step, 'config.dashboard.table.formatRules'))) {
- this.formatRules = _get(step, 'config.dashboard.table.formatRules');
- }
+ if (!_isUndefined(_get(step, 'config.dashboard.table.rowConfig'))) {
+ stepRowConfig = _get(step, 'config.dashboard.table.rowConfig');
+ this.sortFields = _map(_get(step, 'config.dashboard.table.rowConfig'), (config) => { return config.variable; });
}
- this.tableConfig[step.name] = stepTableConfig;
- this.sortMap[step.name] = {};
- for (let rowConfig of stepTableConfig) {
- this.sortMap[step.name][rowConfig.variable] = {
- sort: rowConfig.initialSort
- };
+ if (!_isUndefined(_get(step, 'config.dashboard.table.rowRulesConfig'))) {
+ this.rowLevelRules = _get(step, 'config.dashboard.table.rowRulesConfig');
}
-
- if(this.dashboardTypeSelected == 'consolidated') {
- this.enableSort = false;
- } else {
- this.enableSort = true;
+
+ if (!_isUndefined(_get(step, 'config.dashboard.table.groupRowConfig'))) {
+ this.groupRowConfig = _get(step, 'config.dashboard.table.groupRowConfig');
}
- if(this.dashboardTypeSelected == 'consolidated') {
- this.enableSort = false;
- } else {
- this.enableSort = true;
+ if (!_isUndefined(_get(step, 'config.dashboard.table.groupRowRulesConfig'))) {
+ this.groupRowRules = _get(step, 'config.dashboard.table.groupRowRulesConfig');
}
- let packageType = '';
- let stepName = '';
- let evaluateStepName = '';
- if (this.dashboardTypeSelected == 'consolidated') {
- packageType = '';
- stepName = '';
- evaluateStepName = _get(step, 'name');
- recordType = _get(step, 'config.baseRecordType');
- } else if (this.dashboardTypeSelected == 'workspace') {
- stepName = '';
- packageType = this.packageType;
- evaluateStepName = _get(step, 'name');
- recordType = '';
- } else {
- packageType = '';
- stepName = _get(step, 'name');
- evaluateStepName = stepName;
+ //formtatRules override at step level from workflow.js config
+ if (!_isUndefined(_get(step, 'config.dashboard.table.formatRules'))) {
+ this.formatRules = _get(step, 'config.dashboard.table.formatRules');
}
+ }
- await this.initStep(stepName, evaluateStepName, recordType, packageType, startIndex);
+ this.tableConfig[step.name] = stepRowConfig;
+ }
+
+ private initSortConfig(step: any) {
+
+ let stepRowConfig: any[] = this.tableConfig[step.name];
+
+ this.sortMap[step.name] = {};
- // console.log('-------------------------------------------------');
- // console.log(JSON.stringify(this.records));
- // console.log('-------------------------------------------------');
+ for (let columnConfig of stepRowConfig) {
+ this.sortMap[step.name][columnConfig.variable] = {
+ sort: columnConfig.initialSort
+ };
+ }
+
+ if (this.dashboardTypeSelected == 'consolidated') {
+ this.enableSort = false;
+ } else {
+ this.enableSort = true;
}
}
@@ -3140,7 +4608,6 @@
sortByString = sortBy;
}
- //TODO getRecords defaults to 10 perhaps add another param to set?
let stagedRecords = await this.recordService.getRecords(recordType, stepName, startIndex, packageType, sortByString, filterFileds, filterString, filterMode);
let planTable: PlanTable;
@@ -3155,68 +4622,12 @@
let sortGroupBy = _get(this.formatRules, 'sortGroupBy');
if (groupBy == 'groupedByRelationships' && !_isUndefined(sortGroupBy) && !_isEmpty(sortGroupBy)) {
- for (let item of items) {
- let oid = _get(item, 'oid');
- let itemsAfterApplyInnerGroupFormatRules = [];
-
- let itemsGroupRelated: any = await this.recordService.getRelatedRecords(oid);
- let sortItems = _get(itemsGroupRelated, 'items');
- let totalSortItems = sortItems.length;
- let countHerarchyLevels = sortGroupBy.length;
-
- for (let j = 0; j < totalSortItems; j++) {
- let parentTreeNodeOid = oid;
- for (let i = 0; i < countHerarchyLevels; i++) {
- let rule = _find(sortGroupBy, function (o) {
- if (_get(o, 'rowLevel') == i) {
- return o;
- }
- });
- let compareField = _get(rule, 'compareField');
- let compareFieldValue = _get(rule, 'compareFieldValue');
- let relatedTo = _get(rule, 'relatedTo');
-
- for (let sortItem of sortItems) {
- let relatedToOid = _get(sortItem, relatedTo);
- let foundParent = relatedToOid == parentTreeNodeOid;
- let foundRecord = _get(sortItem, compareField) == compareFieldValue;
- let foundTopLevelParent = relatedTo == '';
- if (foundRecord && (foundParent || foundTopLevelParent)) {
- let currentOid = _get(sortItem, 'oid');
- let rowExists = _find(itemsAfterApplyInnerGroupFormatRules, ['oid', currentOid]);
- if (_isUndefined(rowExists)) {
- itemsAfterApplyInnerGroupFormatRules.push(sortItem);
- if ((i + 1) < countHerarchyLevels) {
- parentTreeNodeOid = currentOid;
- break;
- }
- }
- }
- }
- }
- }
- if (!_isEmpty(itemsAfterApplyInnerGroupFormatRules)) {
- _set(itemsGroupRelated, 'items', itemsAfterApplyInnerGroupFormatRules);
- }
+ allItemsByGroup = await this.getAllItemsGroupedByRelationships(items, sortGroupBy);
- allItemsByGroup.push(itemsGroupRelated);
- }
} else if (groupBy == 'groupedByRecordType' && !_isUndefined(sortGroupBy) && !_isEmpty(sortGroupBy)) {
- let countHerarchyLevels = sortGroupBy.length;
- for (let i = 0; i < countHerarchyLevels; i++) {
-
- let rule = _find(sortGroupBy, function (o) {
- if (_get(o, 'rowLevel') == i) {
- return o;
- }
- });
- let compareFieldValue = _get(rule, 'compareFieldValue');
- let itemsGroupRelated: any = await this.recordService.getRecords(compareFieldValue, stepName, startIndex, packageType, sortByString, filterFileds, filterString, filterMode);
-
- allItemsByGroup.push(itemsGroupRelated);
- }
+ allItemsByGroup = await this.getAllItemsGroupedByRecordType(sortGroupBy, stepName, startIndex, packageType, sortByString, filterFileds, filterString, filterMode);
}
let pageNumber = _get(stagedRecords, 'currentPage');
@@ -3233,11 +4644,90 @@
} else {
planTable = this.evaluatePlanTableColumns({}, {}, {}, evaluateStepName, stagedRecords);
+
+ if (this.dashboardTypeSelected == 'standard') {
+ let filter: FilterField = this.getFirstTextFilter();
+ this.filterFieldName = filter.name;
+ this.filterFieldPath = filter.path;
+ }
}
this.records[evaluateStepName] = planTable;
}
+ private async getAllItemsGroupedByRecordType(sortGroupBy: SortGroupBy[], stepName: string, startIndex: number, packageType: string, sortByString: string, filterFileds: any, filterString: any, filterMode: any) {
+ let allItemsByGroup: any[] = [];
+ let countHerarchyLevels = sortGroupBy.length;
+ for (let i = 0; i < countHerarchyLevels; i++) {
+
+ let rule = _find(sortGroupBy, function (o) {
+ if (_get(o, 'rowLevel') == i) {
+ return true;
+ }
+ return false;
+ });
+ let compareFieldValue = _get(rule, 'compareFieldValue', '');
+ let itemsGroupRelated: any = await this.recordService.getRecords(compareFieldValue, stepName, startIndex, packageType, sortByString, filterFileds, filterString, filterMode);
+
+ allItemsByGroup.push(itemsGroupRelated);
+ }
+
+ return allItemsByGroup;
+ }
+
+ private async getAllItemsGroupedByRelationships(items: any, sortGroupBy: SortGroupBy[]) {
+ let allItemsByGroup: any[] = [];
+ for (let item of items) {
+ let oid = _get(item, 'oid');
+ let itemsAfterApplyInnerGroupFormatRules = [];
+
+ let itemsGroupRelated: any = await this.recordService.getRelatedRecords(oid);
+ let sortItems = _get(itemsGroupRelated, 'items');
+ let totalSortItems = sortItems.length;
+ let countHerarchyLevels = sortGroupBy.length;
+
+ for (let j = 0; j < totalSortItems; j++) {
+ let parentTreeNodeOid = oid;
+ for (let i = 0; i < countHerarchyLevels; i++) {
+ let rule = _find(sortGroupBy, function (o) {
+ if (_get(o, 'rowLevel') == i) {
+ return true;
+ }
+ return false;
+ });
+ let compareField = _get(rule, 'compareField', '');
+ let compareFieldValue = _get(rule, 'compareFieldValue', '');
+ let relatedTo = _get(rule, 'relatedTo', '');
+
+ for (let sortItem of sortItems) {
+ let relatedToOid = _get(sortItem, relatedTo);
+ let foundParent = relatedToOid == parentTreeNodeOid;
+ let foundRecord = _get(sortItem, compareField) == compareFieldValue;
+ let foundTopLevelParent = relatedTo == '';
+ if (foundRecord && (foundParent || foundTopLevelParent)) {
+ let currentOid = _get(sortItem, 'oid');
+ let rowExists = _find(itemsAfterApplyInnerGroupFormatRules, ['oid', currentOid]);
+ if (_isUndefined(rowExists)) {
+ itemsAfterApplyInnerGroupFormatRules.push(sortItem);
+ if ((i + 1) < countHerarchyLevels) {
+ parentTreeNodeOid = currentOid;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (!_isEmpty(itemsAfterApplyInnerGroupFormatRules)) {
+ _set(itemsGroupRelated, 'items', itemsAfterApplyInnerGroupFormatRules);
+ }
+
+ allItemsByGroup.push(itemsGroupRelated);
+ }
+ return allItemsByGroup;
+ }
+
public evaluatePlanTableColumns(groupRowConfig: any, groupRowRules: any, rowLevelRulesConfig: any, stepName: string, stagedOrGroupedRecords: any): PlanTable {
let recordRows: any = [];
@@ -3279,14 +4769,11 @@
let record: any = {};
+ let stepRowConfig: any[] = this.tableConfig[stepName];
- let stepTableConfig = _isEmpty(this.tableConfig[stepName]) ? this.defaultTableConfig : this.tableConfig[stepName];
-
- for (let rowConfig of stepTableConfig) {
-
-
- const templateRes = this.runTemplate(rowConfig.template, imports)
- record[rowConfig.variable] = templateRes;
+ for (let columnConfig of stepRowConfig) {
+ const templateRes = this.runTemplate(columnConfig.template, imports)
+ record[columnConfig.variable] = templateRes;
}
recordRows.push(record);
}
@@ -3322,15 +4809,12 @@
_set(imports, 'portal', this.portal);
_set(imports, 'translationService', this.translationService);
-
-
let record: any = {};
- let stepTableCOnfig = _isEmpty(this.tableConfig[stepName]) ? this.defaultTableConfig : this.tableConfig[stepName];
-
- for (let rowConfig of stepTableCOnfig) {
+ let stepRowConfig = this.tableConfig[stepName];
- const templateRes = this.runTemplate(rowConfig.template, imports);
- record[rowConfig.variable] = templateRes;
+ for (let columnConfig of stepRowConfig) {
+ const templateRes = this.runTemplate(columnConfig.template, imports);
+ record[columnConfig.variable] = templateRes;
}
recordRows.push(record);
}
@@ -3342,9 +4826,6 @@
return planTable;
}
-
-
-
public evaluateRowLevelRules(rulesConfig: any, metadata: any, metaMetadata: any, workflow: any, oid: string, ruleSetName: string) {
let res: any;
@@ -3358,7 +4839,6 @@
_set(imports, 'portal', this.portal);
_set(imports, 'translationService', this.translationService);
-
let ruleSetConfig = _find(rulesConfig, ['ruleSetName', ruleSetName]);
if (!_isUndefined(ruleSetConfig)) {
@@ -3375,7 +4855,6 @@
let evaluateRulesTemplate = _get(rule, 'evaluateRulesTemplate');
_set(imports, 'name', name);
-
let evaluatedAction = '';
let action = _get(rule, 'action');
@@ -3441,9 +4920,7 @@
_set(imports, 'oid', oid);
_set(imports, 'name', name);
-
-
- const result = this.runTemplate(evaluateRulesTemplate, imports)
+ const result = this.runTemplate(evaluateRulesTemplate, imports);
if (result == 'true') {
results.push(result);
} else if (mode == 'all') {
@@ -3487,7 +4964,7 @@
if (this.dashboardTypeSelected == 'workspace') {
stagedRecords = await this.recordService.getRecords('', '', 1, this.dashboardTypeSelected, sortString);
} else {
- stagedRecords = await this.recordService.getRecords(this.recordType, data.step, 1, '', sortString);
+ stagedRecords = await this.recordService.getRecords(this.recordType, data.step, 1, '', sortString,this.filterFieldPath,this.getFilterSearchString(data.step));
}
let planTable: PlanTable = this.evaluatePlanTableColumns({}, {}, {}, data.step, stagedRecords);
@@ -3499,9 +4976,10 @@
}
private updateSortMap(sortData: any) {
- let stepTableConfig = this.tableConfig[sortData.step];
- for (let rowConfig of stepTableConfig) {
- this.sortMap[sortData.step][rowConfig.variable] = { sort: rowConfig.noSort };
+
+ let stepRowConfig: any[] = this.tableConfig[sortData.step];
+ for (let columnConfig of stepRowConfig) {
+ this.sortMap[sortData.step][columnConfig.variable] = { sort: columnConfig.noSort };
}
this.sortMap[sortData.step][sortData.variable] = { sort: sortData.sort };
@@ -3512,7 +4990,7 @@
let sortDetails = this.sortMap[step];
if (this.dashboardTypeSelected == 'standard') {
- let stagedRecords = await this.recordService.getRecords(this.recordType, step, event.page, '', this.getSortString(sortDetails));
+ let stagedRecords = await this.recordService.getRecords(this.recordType, step, event.page, '', this.getSortString(sortDetails),this.filterFieldPath,this.getFilterSearchString(step));
let planTable: PlanTable = this.evaluatePlanTableColumns({}, {}, {}, step, stagedRecords);
this.records[step] = planTable;
} else if (this.dashboardTypeSelected == 'workspace') {
@@ -3556,6 +5034,99 @@
return 'metaMetadata.lastSaveDate:-1';
}
+ private getFirstFilter(type:string): FilterField {
+ try {
+ let queryFilters: QueryFilter[] = this.formatRules.queryFilters[this.recordType];
+ for(let queryFilter of queryFilters) {
+ if(queryFilter.filterType == type) {
+ for(let filterField of queryFilter.filterFields) {
+ return filterField;
+ }
+ }
+ }
+ return this.defaultFilterField;
+ } catch(error) {
+ return this.defaultFilterField;
+ }
+ }
+
+ private getFilters(type:string) {
+ let filterFields: FilterField[] = [];
+ let queryFilters: QueryFilter[] = this.formatRules.queryFilters[this.recordType];
+ for(let queryFilter of queryFilters) {
+ if(queryFilter.filterType == type) {
+ for(let filterField of queryFilter.filterFields) {
+ filterFields.push(filterField);
+ }
+ }
+ }
+ return filterFields;
+ }
+
+ private getFirstTextFilter(): FilterField {
+ return this.getFirstFilter('text');
+ }
+
+ public getTextFilters() {
+ return this.getFilters('text');
+ }
+
+ public getFilterSearchDisplayed(step: any): boolean {
+ let filterDisplayed = _.get(this.isFilterSearchDisplayed,step,'');
+ if(filterDisplayed == 'filterDisplayed') {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public getIsSearching(step: any): boolean {
+ let searching = _.get(this.isSearching,step,'');
+ if(searching == 'searching') {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public getFilterSearchString(step: any): string {
+ let filterString = _.get(this.filterSearchString,step,'');
+ return filterString;
+ }
+
+ public async filterChanged(step: string) {
+
+ if (this.dashboardTypeSelected == 'standard') {
+ this.isSearching[step] = 'searching';
+ this.isFilterSearchDisplayed[step] = 'filterDisplayed';
+ let sortDetails = this.sortMap[step];
+ let stagedRecords = await this.recordService.getRecords(this.recordType, step, 1, '', this.getSortString(sortDetails),this.filterFieldPath,this.getFilterSearchString(step));
+ let planTable: PlanTable = this.evaluatePlanTableColumns({}, {}, {}, step, stagedRecords);
+ this.records[step] = planTable;
+ this.isSearching[step] = '';
+ }
+ }
+
+ public async resetFilterAndSearch(step: string, e: any) {
+ if (this.dashboardTypeSelected == 'standard') {
+ this.setFilterField(this.getFirstTextFilter(), e);
+ this.isSearching[step] = 'searching';
+ let sortDetails = this.sortMap[step];
+ this.filterSearchString[step] = '';
+ let stagedRecords = await this.recordService.getRecords(this.recordType, step, 1, '', this.getSortString(sortDetails),this.filterFieldPath,this.getFilterSearchString(step));
+ let planTable: PlanTable = this.evaluatePlanTableColumns({}, {}, {}, step, stagedRecords);
+ this.records[step] = planTable;
+ this.isSearching[step] = '';
+ }
+ }
+
+ public setFilterField(filterField:FilterField, e: any) {
+ if (e) {
+ e.preventDefault();
+ }
+ this.filterFieldName = filterField.name;
+ this.filterFieldPath = filterField.path;
+ }
}
@@ -3567,12 +5138,32 @@
<div *ngIf="isReady">
<ng-container>
<div *ngFor="let workflowStep of workflowSteps">
- <h2 *ngIf="workflowSteps.length > 1 && (dashboardTypeSelected == 'standard' || dashboardTypeSelected == 'consolidated')" [innerHTML]="'dashboard-heading' | i18next: {stage: workflowStep.config.workflow.stageLabel, recordTypeName: typeLabel}">
- </h2>
- <h2 *ngIf="workflowSteps.length == 1 && (dashboardTypeSelected == 'standard' || dashboardTypeSelected == 'consolidated')" [innerHTML]="'dashboard-heading-one-step' | i18next: {recordTypeName: typeLabel}">
- </h2>
+ <div class="d-flex flex-row">
+ <div *ngIf="workflowSteps.length > 1 && (dashboardTypeSelected == 'standard' || dashboardTypeSelected == 'consolidated')" class="col-md-4">
+ <h2>{{ 'dashboard-heading' | i18next: {stage: workflowStep.config.workflow.stageLabel, recordTypeName: typeLabel} }}</h2>
+ </div>
+ <div *ngIf="workflowSteps.length == 1 && !hideWorkflowStepTitle && (dashboardTypeSelected == 'standard' || dashboardTypeSelected == 'consolidated')" class="col-md-4">
+ <h2>{{ 'dashboard-heading-one-step' | i18next: {recordTypeName: typeLabel} }}</h2>
+ </div>
+ <ng-container *ngIf="dashboardTypeSelected == 'standard' && (records[workflowStep.config.workflow.stage].totalItems > 0 || (records[workflowStep.config.workflow.stage].totalItems <= 0 && getFilterSearchDisplayed(workflowStep.config.workflow.stage)))">
+ <div class="col-md-8">
+ <div class="d-flex flex-row mt-4">
+ <button class="btn btn-primary dropdown-toggle" type='button' data-bs-toggle="dropdown" aria-expanded="false" >Filter by {{ filterFieldName }}</button>
+ <ul class="dropdown-menu">
+ <li *ngFor="let filter of getTextFilters()"><a class="dropdown-item" href="#" (click)="setFilterField(filter, $event)">Filter by {{ filter.name }}</a></li>
+ <li><hr class="dropdown-divider"></li>
+ <li><a class="dropdown-item" href="#" (click)="resetFilterAndSearch(workflowStep.config.workflow.stage, $event)">{{ 'record-search-reset' | i18next }}</a></li>
+ </ul>
+ <input type="text" class="form-control" [(ngModel)]="filterSearchString[workflowStep.config.workflow.stage]" placeholder="{{ 'record-search-basic-search-placeholder' | i18next}}" (keyup.enter)="filterChanged(workflowStep.config.workflow.stage)" aria-describedby="basic-search-addon" autofocus>
+ <button class="btn btn-primary" type='button' aria-expanded="false" [disabled]="getIsSearching(workflowStep.config.workflow.stage) || getFilterSearchString(workflowStep.config.workflow.stage) == ''" (click)="filterChanged(workflowStep.config.workflow.stage)">{{ 'record-search-basic-search' | i18next }}</button>
+ </div>
+ </div>
+ <div class="col-md-4"></div>
+ </ng-container>
+ </div>
<div *ngIf="records[workflowStep.config.workflow.stage] != null">
- <div *ngIf="records[workflowStep.config.workflow.stage].totalItems <= 0" class="padding-bottom-10" [innerHTML]="'no-records' | i18next: {stage: workflowStep.config.workflow.stageLabel.toLowerCase(), recordTypeName: typeLabel.toLowerCase()}">
+ <div *ngIf="records[workflowStep.config.workflow.stage].totalItems <= 0" class="padding-bottom-10" >
+ {{ 'no-records' | i18next: {stage: workflowStep.config.workflow.stageLabel.toLowerCase(), recordTypeName: typeLabel.toLowerCase()} }}
</div>
<div *ngIf="records[workflowStep.config.workflow.stage].totalItems > 0">
<table class="table">
@@ -3624,8 +5215,8 @@
diff --git a/components/ExportComponent.html b/components/ExportComponent.html
index 5024d7c4a8..49128ecc03 100644
--- a/components/ExportComponent.html
+++ b/components/ExportComponent.html
@@ -1720,7 +1720,7 @@
diff --git a/components/FormBaseComponent.html b/components/FormBaseComponent.html
index 63dc51f19c..8effcece05 100644
--- a/components/FormBaseComponent.html
+++ b/components/FormBaseComponent.html
@@ -170,7 +170,7 @@ File
diff --git a/components/FormComponent.html b/components/FormComponent.html
index 7a54249779..c9fd4159d3 100644
--- a/components/FormComponent.html
+++ b/components/FormComponent.html
@@ -1158,7 +1158,7 @@
diff --git a/components/FormFieldWrapperComponent.html b/components/FormFieldWrapperComponent.html
index b470e72120..522f4c406f 100644
--- a/components/FormFieldWrapperComponent.html
+++ b/components/FormFieldWrapperComponent.html
@@ -488,7 +488,7 @@
diff --git a/components/LocalAuthComponent.html b/components/LocalAuthComponent.html
index 92e01ce75d..3351be0d9e 100644
--- a/components/LocalAuthComponent.html
+++ b/components/LocalAuthComponent.html
@@ -1275,7 +1275,7 @@
diff --git a/components/ManageRolesComponent.html b/components/ManageRolesComponent.html
index e9a35581c0..b34818d49d 100644
--- a/components/ManageRolesComponent.html
+++ b/components/ManageRolesComponent.html
@@ -1973,7 +1973,7 @@
diff --git a/components/ManageUsersComponent.html b/components/ManageUsersComponent.html
index 8e918d98f8..5d4d739ac6 100644
--- a/components/ManageUsersComponent.html
+++ b/components/ManageUsersComponent.html
@@ -3481,7 +3481,7 @@
diff --git a/components/ObjectTypeComponent.html b/components/ObjectTypeComponent.html
new file mode 100644
index 0000000000..1d2c37e1df
--- /dev/null
+++ b/components/ObjectTypeComponent.html
@@ -0,0 +1,330 @@
+
+
+
+
+
+ ReDBox Portal - NG2 Apps
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Components
+
+ ObjectTypeComponent
+
+
+
+
+
+
File
+
+
+
+
+
+
Extends
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
import { Component } from '@angular/core';
+import { FieldType } from '@ngx-formly/core';
+@Component({
+ selector: 'formly-object-type',
+ template: `
+ <div class="mb-3">
+ <legend *ngIf="props.label">{{ props.label }}</legend>
+ <p *ngIf="props.description">{{ props.description }}</p>
+ <div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
+ <formly-validation-message [field]="field"></formly-validation-message>
+ </div>
+ <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
+ </div>
+ `, })
+export class ObjectTypeComponent extends FieldType { }
+
+
+
+
+
+
+
+
+ Legend
+
+
+
+
+
Html element with directive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
results matching " "
+
+
+
+
No results matching " "
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/RecordTableComponent.html b/components/RecordTableComponent.html
index 1a2ab95e52..c36e830d47 100644
--- a/components/RecordTableComponent.html
+++ b/components/RecordTableComponent.html
@@ -1520,7 +1520,7 @@
diff --git a/components/ReportComponent.html b/components/ReportComponent.html
index de6303ed27..9614b26b9b 100644
--- a/components/ReportComponent.html
+++ b/components/ReportComponent.html
@@ -1963,7 +1963,7 @@
diff --git a/components/SortComponent.html b/components/SortComponent.html
index 36aaf84ec0..66e63cdcd6 100644
--- a/components/SortComponent.html
+++ b/components/SortComponent.html
@@ -493,7 +493,7 @@
diff --git a/components/TextAreaComponent.html b/components/TextAreaComponent.html
index bd53c87e69..d81fe0025b 100644
--- a/components/TextAreaComponent.html
+++ b/components/TextAreaComponent.html
@@ -8,1003 +8,78 @@
-
-
+
+
+
-
-