File

projects/netgrif-components-core/src/lib/utility/tests/test-config.ts

Extends

ConfigurationService

Index

Methods

Constructor

constructor()

Methods

Public get
get()
Inherited from ConfigurationService

Calls to this method should be avoided as creating a deep copy of the configuration has a large overhead

a deep copy of the entire configuration object

Public getAsync
getAsync()
Inherited from ConfigurationService
Public getConfigurationSubtree
getConfigurationSubtree(pathSegments: Array)
Inherited from ConfigurationService

Calling this method with an empty array as argument is equivalent to calling the get() method.

Parameters :
Name Type Optional Description
pathSegments Array<string> No

the keys specifying the path trough the configuration that should be accessed

Returns : any | undefined

a deep copy of a specified subsection of the configuration object, or undefined if such subsection doesn't exist. Calling this method with an empty array as argument is equivalent to calling the [get()]{

Public getConfigurationSubtreeByPath
getConfigurationSubtreeByPath(path: string)
Inherited from ConfigurationService
Parameters :
Name Type Optional
path string No
Returns : any | undefined
Public getDatafieldConfiguration
getDatafieldConfiguration()
Inherited from ConfigurationService
Returns : | undefined

the appropriate template configuration for data fields, or undefined if such configuration is not present.

Public getOnLoginPath
getOnLoginPath()
Inherited from ConfigurationService

Otherwise, undefined is returned.

Returns : string | undefined

the value stored in the [onLoginRedirect]{

Public getOnLogoutPath
getOnLogoutPath()
Inherited from ConfigurationService

If not and the deprecated attribute logoutRedirect is defined then its value is returned. Otherwise, undefined is returned.

Returns : string | undefined

the value stored in the [onLogoutRedirect]{

Public getPathsByView
getPathsByView(layout: string)
Inherited from ConfigurationService

Get all URLs/paths of views with specified layout.

Parameters :
Name Type Optional Description
layout string No

Search views with this layout

Returns : Array<string>

Paths with prefixed '/' of all views with specified layout, empty array otherwise.

Public getServicesConfiguration
getServicesConfiguration()
Inherited from ConfigurationService

the services configuration, or undefined if such configuration is not present.

Public getToLoginPath
getToLoginPath()
Inherited from ConfigurationService

If not and the deprecated attribute loginRedirect is defined then its value is returned. Otherwise, undefined is returned.

Returns : string | undefined

the value stored in the [toLoginRedirect]{

Public getViewByPath
getViewByPath(viewConfigPath: string)
Inherited from ConfigurationService

Get view configuration from nae.json for view at given config path.

Parameters :
Name Type Optional Description
viewConfigPath string No

configuration path to the requested view. No leading backslash.

Returns : View | undefined

requested configuration if it exists. undefined otherwise.

Public getViewByUrl
getViewByUrl(url: string)
Inherited from ConfigurationService

Get view configuration from nae.json for view at given url.

Parameters :
Name Type Optional Description
url string No

to the requested view. Necessary backslash.

Returns : View | undefined

requested configuration if it exists. undefined otherwise.

Protected resolveEndpointURLs
resolveEndpointURLs()
Inherited from ConfigurationService

Resolves the URL addresses of backend endpoints based on the provided configuration.

If the URLs begin with either http://, or https:// the provided URL will be used.

If not, then the URLs are considered to be relative to the location of the frontend application and it's URL will be used as the base path. /api is appended automatically.

Returns : void
Public resolveProvidersEndpoint
resolveProvidersEndpoint(endpointKey: string)
Inherited from ConfigurationService
Parameters :
Name Type Optional Description
endpointKey string No

the attribute name of the endpoint address in nae.json

Returns : string

the endpoint address or undefined if such endpoint is not defined in nae.json

Protected resolveURL
resolveURL(configURL: string)
Inherited from ConfigurationService

Resolves a single URL address.

If the URL begins with either http://, or https:// the provided URL will be used.

If not, then the URL is considered to be relative to the location of the frontend application and it's URL will be used as the base path. /api is appended automatically.

Parameters :
Name Type Optional Description
configURL string No

value from the configuration file

Returns : string

the resolved URL

import {ConfigurationService} from '../../configuration/configuration.service';

export class TestConfigurationService extends ConfigurationService {
    constructor() {
        super({
            extends: 'nae-default',
            providers: {
                auth: {
                    address: 'http://localhost:8080/api/',
                    authentication: 'Basic',
                    endpoints: {
                        login: 'auth/login',
                        logout: 'auth/logout',
                        signup: 'auth/signup',
                        changePassword: 'auth/changePassword',
                        verification: 'auth/verify',
                        verify: 'auth/token/verify',
                        invite: 'auth/invite',
                        reset: 'auth/reset',
                        recover: '/auth/recover'
                    },
                    sessionBearer: 'X-Auth-Token',
                    sessionTimeoutEnabled: false,
                    sessionTimeout: 900
                },
                resources: [
                    {
                        name: 'case',
                        address: 'http://localhost:8080/api/',
                        format: 'hal',
                        openApi: 'https://swagger.io'
                    },
                    {
                        name: 'task',
                        address: 'http://localhost:8080/api/',
                        format: 'json'
                    },
                    {
                        name: 'petrinet',
                        address: 'http://localhost:8080/api/',
                        format: 'json'
                    },
                    {
                        name: 'user',
                        address: 'http://localhost:8080/api/',
                        format: 'json'
                    },
                    {
                        name: 'dashboard',
                        address: 'http://localhost:8080/api/',
                        format: 'json'
                    },
                    {
                        name: 'impersonation',
                        address: 'http://localhost:8080/api/',
                        format: 'json'
                    }
                ]
            },
            views: {
                dashboard: {
                    layout: {
                        name: 'dashboard',
                        params: {
                            columns: 4,
                            cards: [
                                {
                                    type: 'count',
                                    title: 'All tasks',
                                    resourceType: 'Task',
                                    filter: {},
                                    layout: {
                                        x: 0,
                                        y: 0,
                                        rows: 1,
                                        cols: 1
                                    }
                                },
                                {
                                    type: 'iframe',
                                    url: 'https://netgrif.com/',
                                    layout: {
                                        x: 2,
                                        y: 0,
                                        rows: 2,
                                        cols: 2
                                    }
                                },
                                {
                                    type: 'count',
                                    title: 'All cases',
                                    resourceType: 'Case',
                                    filter: {},
                                    layout: {
                                        x: 1,
                                        y: 1,
                                        rows: 1,
                                        cols: 1
                                    }
                                }, {
                                    type: 'pie',
                                    title: 'Custom',
                                    resourceType: 'case',
                                    query: {
                                        aggs: {
                                            result: {
                                                terms: {
                                                    field: 'dataSet.text.value.keyword'
                                                }
                                            }
                                        }
                                    },
                                    filter: {},
                                    layout: {
                                        x: 0,
                                        y: 1,
                                        rows: 1,
                                        cols: 1
                                    }
                                }, {
                                    type: 'bar',
                                    title: 'Custom',
                                    resourceType: 'case',
                                    query: {aggs: {result: {terms: {field: 'dataSet.text.value.keyword'}}}},
                                    xAxisLabel: 'Country',
                                    yAxisLabel: 'Population',
                                    filter: {},
                                    layout: {
                                        x: 2,
                                        y: 1,
                                        rows: 1,
                                        cols: 1
                                    }
                                }, {
                                    type: 'line',
                                    title: 'Custom',
                                    resourceType: 'case',
                                    query: {
                                        aggs: {
                                            result1: {terms: {field: 'dataSet.text.value.keyword'}},
                                            result2: {terms: {field: 'dataSet.text.value.keyword'}}
                                        }
                                    },
                                    xAxisLabel: 'Country',
                                    yAxisLabel: 'Population',
                                    filter: {},
                                    layout: {
                                        x: 0,
                                        y: 2,
                                        rows: 1,
                                        cols: 1
                                    }
                                }, {
                                    type: 'lineargauge',
                                    title: 'Custom',
                                    resourceType: 'case',
                                    query: {aggs: {types_count: {value_count: {field: 'dataSet.text.value.keyword'}}}},
                                    xAxisLabel: 'Country',
                                    yAxisLabel: 'Population',
                                    units: 'cases',
                                    filter: {},
                                    layout: {
                                        x: 1,
                                        y: 2,
                                        rows: 1,
                                        cols: 1
                                    }
                                }, {
                                    type: 'default',
                                    layout: {
                                        x: 2,
                                        y: 2,
                                        rows: 1,
                                        cols: 1
                                    }
                                }
                            ]
                        },
                        componentName: 'MyDashboard'
                    },
                    access: 'private',
                    navigation: {
                        title: 'Dashboard',
                        icon: 'dashboard'
                    },
                    routing: {
                        path: 'comp-dashboard'
                    }
                },
                cases: {
                    layout: {
                        name: 'emptyView',
                        params: {
                            allowedNets: []
                        }
                    },
                    access: 'private',
                    navigation: {
                        title: 'Cases',
                        icon: 'settings'
                    },
                    routing: {
                        path: 'cases'
                    },
                    children: {
                        some_cases: {
                            layout: {
                                name: 'emptyView'
                            },
                            access: 'private',
                            navigation: {
                                icon: 'account_circle'
                            },
                            routing: {
                                path: 'some_cases'
                            },
                            children: {
                                some_specifics: {
                                    layout: {
                                        name: 'emptyView'
                                    },
                                    access: 'private',
                                    navigation: true,
                                    routing: {
                                        path: 'some_specifics'
                                    }
                                }
                            }
                        }
                    }
                },
                task: {
                    layout: {
                        name: 'emptyView',
                        params: {
                            allowedNets: []
                        }
                    },
                    access: 'private',
                    navigation: {
                        title: 'Tasks',
                        icon: 'assignment'
                    },
                    routing: {
                        path: 'task'
                    },
                    children: {
                        some_tasks: {
                            layout: {
                                name: 'emptyView'
                            },
                            access: 'private',
                            navigation: false,
                            routing: {
                                path: 'some_tasks'
                            },
                            children: {
                                some_specifics: {
                                    layout: {
                                        name: 'emptyView'
                                    },
                                    access: 'private',
                                    navigation: true,
                                    routing: {
                                        path: 'some_specifics'
                                    }
                                }
                            }
                        }
                    }
                }
            },
            theme: {
                name: 'example-classico',
                pallets: {
                    light: {
                        primary: {
                            50: '',
                            100: '',
                            200: '',
                            300: '',
                            400: '',
                            500: '',
                            600: '',
                            700: '',
                            800: '',
                            900: '',
                            A100: '',
                            A200: '',
                            A400: '',
                            A700: '',
                            contrast: {
                                light: [
                                    '300',
                                    '400',
                                    '500',
                                    '600',
                                    '700',
                                    '800',
                                    '900'
                                ],
                                dark: [
                                    '50',
                                    '100',
                                    '200'
                                ]
                            }
                        },
                        secondary: {
                            50: '',
                            100: '',
                            200: '',
                            300: '',
                            400: '',
                            500: '',
                            600: '',
                            700: '',
                            800: '',
                            900: '',
                            A100: '',
                            A200: '',
                            A400: '',
                            A700: '',
                            contrast: {
                                light: [
                                    '300',
                                    '400',
                                    '500',
                                    '600',
                                    '700',
                                    '800',
                                    '900'
                                ],
                                dark: [
                                    '50',
                                    '100',
                                    '200'
                                ]
                            }
                        },
                        warn: {
                            50: '',
                            100: '',
                            200: '',
                            300: '',
                            400: '',
                            500: '',
                            600: '',
                            700: '',
                            800: '',
                            900: '',
                            A100: '',
                            A200: '',
                            A400: '',
                            A700: '',
                            contrast: {
                                light: [
                                    '300',
                                    '400',
                                    '500',
                                    '600',
                                    '700',
                                    '800',
                                    '900'
                                ],
                                dark: [
                                    '50',
                                    '100',
                                    '200'
                                ]
                            }
                        }
                    },
                    dark: {
                        primary: 'blue',
                        secondary: 'pink'
                    }
                }
            },
            assets: [
                '../../../assets'
            ],
            filters: {
                'all-cases': {
                    title: 'All Cases',
                    type: 'Case',
                    access: 'public',
                    body: [],
                    mergeOperator: 'AND'
                },
                'all-tasks': {
                    title: 'All Tasks',
                    type: 'Task',
                    access: 'public',
                    body: {}
                },
                'some-tasks': {
                    title: 'All Tasks',
                    type: 'Task',
                    access: 'public',
                    body: [{}],
                    mergeOperator: 'AND'
                }
            },
            i18n: [
                'sk-SK',
                'en-US'
            ],
            services: {
                log: {
                    logWithDate: true,
                    serializeExtraParams: true,
                    includeLogLevel: true,
                    publishers: [
                        'console',
                        'localStorage'
                    ]
                },
                auth: {
                    loginRedirect: 'login'
                },
                legal: {
                    termsOfService: 'https://netgrif.com/',
                    privacyPolicy: 'https://netgrif.com/'
                },
                groupNavigation: {
                    groupNavigationRoute: 'config-route'
                }
            }
        });
    }
}

result-matching ""

    No results matching ""