Skip to main content

Version: 22.04

Params

There are two types of params that can be used within Workspaces configuration:

currentUser

The currentUser param is passed to all Workspaces configurations. Its value is set at runtime, reflecting the current logged in user.

Example

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 a helper function that parse dates written in natural language. It's useful for architects that need to define relative dates.

date takes a single argument, a natural language format 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'

Example

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;