Skip to main content
Version: 20.05

Params

There are two types of params that can be used within a Workspaces configuration: currentUser and date.

currentUser

The currentUser param is passed to all Workspaces configurations, it's value will be set on runtime reflecting the current logged in user.

Usage:

src/configs/custom/process.ts

import { ConfigCurrentSpace } from '@transact-open-ux/workspaces/dist/types';

export const processConfig = ({ currentUser }: any): ConfigCurrentSpace => ({
...
views: [
...
{
label: 'Unassigned',
properties: [
'$taskSla',
'$appId',
'$primaryName',
'$product',
'$appAge',
'$currentQueue',
'$currentTask',
'$taskCreated',
'$assigned',
'$formLastModified',
],
filterBy: {
$assigned: currentUser,
},
sortOrder: 'desc',
sortBy: '$appAge',
},
...
],
...
});

export default processConfig;

date

The date param is helper function tha parse dates written in natural language. It's useful for Architects that needs to define relative dates.

FORMAT is a natural language string representing a specific day and/or time. Below are some example formats.

  • A specific day - 'today', 'Sunday, January 15th 2012', '8/25/1978', '8-25-1978', '8.25.1978', '2012-12-31', '2016-Mar-18', 'June 3rd, 2005', '1 Dec. 2016'
  • A relative day - 'in half a year', 'two weeks from today', 'the end of next week', 'four days after Monday', 'two days after tomorrow', 'March 15th of last year', 'next Tuesday', 'next week Thursday'
  • A specific day in a month or year - 'the 4th of July', 'the 15th', 'the end of February', 'the last day of February', 'the beginning of this month', 'the 2nd Tuesday of November', '22 August', 'the first day of 2013'
  • A specific or relative week, month or year - 'next week', 'April 2012', '5-2002', 'last year', 'five years ago'
  • A relative time - 'in 30 minutes', 'half an hour ago', 'an hour from now'
  • A specific or relative day and time - '3pm Wednesday', 'yesterday at 4pm', '6:30pm in three days', 'next Saturday at 10am'
  • A timestamp - 'now', '17760523T024508+0830', '1997-07-16T19:20:30+01:00', '08-25-1978 11:42:32.488am', 'Wed, 03 Jul 2008 08:00:00 EST'

Usage:

src/configs/custom/global.ts

import { ConfigGlobal } from '@transact-open-ux/workspaces/dist/types';

export const globalConfig = ({ date }: any): ConfigGlobal => ({
...
mappings: {
...
$appSubmitted: {
label: 'App submitted',
dataIndex: 'job.timeCreated',
type: 'date',
sorter: true,
filter: {
type: 'daterangepicker',
options: {
minDate: date('1 month ago'),
maxDate: date('now'),
},
},
},
...
},
...
});

export default globalConfig;