From 74dd5fbb986f243a3fd5e5b3a44583258d09439d Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Tue, 25 Aug 2020 11:38:21 +0300 Subject: [PATCH 1/4] Change formatting --- .../models/ace/service-completion.models.ts | 172 +++++++++--------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts index 63bc4cd938..7de5ba6d18 100644 --- a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts +++ b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts @@ -24,7 +24,7 @@ export const alarmDataHref = 'Alarm data query'; -export const attributeScopeHref ='Attribute scope'; +export const attributeScopeHref = 'Attribute scope'; export const entityTypeHref = 'EntityType'; @@ -32,7 +32,7 @@ export const pageDataHref = 'DeviceInfo'; -export const assetInfoHref = 'AssetInfo' +export const assetInfoHref = 'AssetInfo'; export const entityViewInfoHref = 'EntityViewInfo'; @@ -84,15 +84,15 @@ export const stateParamsHref = 'Alias info'; -export const entityAliasFilterHref = 'Entity alias filter' +export const entityAliasFilterHref = 'Entity alias filter'; -export const entityAliasFilterResultHref = 'Entity alias filter result' +export const entityAliasFilterResultHref = 'Entity alias filter result'; -export const importEntityDataHref = 'Import entity data' +export const importEntityDataHref = 'Import entity data'; -export const importEntitiesResultInfoHref = 'Import entities result info' +export const importEntitiesResultInfoHref = 'Import entities result info'; -export const customDialogComponentHref = 'CustomDialogComponent' +export const customDialogComponentHref = 'CustomDialogComponent'; export const pageLinkArg: FunctionArg = { name: 'pageLink', @@ -885,7 +885,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'userId', type: 'string', description: 'Id of the user'}, requestConfigArg ], - return:observableReturnTypeVariable('string') + return: observableReturnTypeVariable('string') }, sendActivationEmail: { description: 'Send activation email', @@ -1033,7 +1033,7 @@ export const serviceCompletions: TbEditorCompletions = { args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, {name: 'attributeScope', type: attributeScopeHref, description: 'Atribute scope'}, - {name: 'keys', type:`Array<string>`, description: 'Array of the keys'}, + {name: 'keys', type: `Array<string>`, description: 'Array of the keys'}, requestConfigArg ], return: observableArrayReturnType(attributeDataHref) @@ -1055,10 +1055,10 @@ export const serviceCompletions: TbEditorCompletions = { args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, {name: 'timeseries', type: `Array<${attributeDataHref}>>`, description: 'Array of the timeseries'}, - {name: 'deleteAllDataForKeys', type: 'boolean',optional: true, description: 'Delete all data for keys'}, + {name: 'deleteAllDataForKeys', type: 'boolean', optional: true, description: 'Delete all data for keys'}, requestConfigArg ], - return:observableReturnTypeVariable('any') + return: observableReturnTypeVariable('any') }, saveEntityAttributes: { description: 'Save entity attributes', @@ -1080,7 +1080,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'timeseries', type: `Array<attributeDataHref>`, description: 'Array of the timeseries'}, requestConfigArg ], - return:observableReturnTypeVariable('any') + return: observableReturnTypeVariable('any') }, } }, @@ -1098,7 +1098,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'entityId', type: 'string', description: 'Id of the entity'}, requestConfigArg ], - return:observableBaseDataReturnType(entityIdHref) + return: observableBaseDataReturnType(entityIdHref) }, getEntities: { description: 'Get entities by ids', @@ -1108,7 +1108,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'entityIds', type: `Array<string>`, description: 'Ids of the entities'}, requestConfigArg ], - return:observableArrayBaseDataReturnType(entityIdHref) + return: observableArrayBaseDataReturnType(entityIdHref) }, getEntitiesByNameFilter: { description: 'Get entities by name filter', @@ -1117,10 +1117,10 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'entityType', type: entityTypeHref, description: 'Entity type'}, {name: 'entityNameFilter', type: 'string', description: 'Name filter of the entity'}, {name: 'pageSize', type: 'number', description: 'Size of the page'}, - {name: 'subType', type: 'string',optional: true, description: 'Subtype'}, + {name: 'subType', type: 'string', optional: true, description: 'Subtype'}, requestConfigArg ], - return:observableArrayBaseDataReturnType(entityIdHref) + return: observableArrayBaseDataReturnType(entityIdHref) }, findEntityDataByQuery: { description: 'Find entity data by query', @@ -1130,7 +1130,7 @@ export const serviceCompletions: TbEditorCompletions = { requestConfigArg ], - return:observablePageDataReturnType(entityDataHref) + return: observablePageDataReturnType(entityDataHref) }, findAlarmDataByQuery: { description: 'Find alarm data by query', @@ -1139,7 +1139,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'query', type: alarmDataQueryHref, description: 'Query'}, requestConfigArg ], - return:observablePageDataReturnType(alarmDataHref) + return: observablePageDataReturnType(alarmDataHref) }, findEntityInfosByFilterAndName: { description: 'Find entity infos by filter and name', @@ -1149,7 +1149,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'searchText', type: 'string', description: 'Search text'}, requestConfigArg ], - return:observablePageDataReturnType(entityInfoHref) + return: observablePageDataReturnType(entityInfoHref) }, findSingleEntityInfoByEntityFilter: { description: 'Find single entity infos by filter of the entity ', @@ -1159,56 +1159,56 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'searchText', type: 'string', description: 'search text'}, requestConfigArg ], - return:observableReturnType(entityInfoHref) + return: observableReturnType(entityInfoHref) }, getAliasFilterTypesByEntityTypes: { description: 'Get alias filter types by entity type', meta: 'function', args: [ - {name: 'entityTypes', type:`Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'}, + {name: 'entityTypes', type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'}, {name: 'searchText', type: 'string', description: 'Search text'} ], - return:{ - type:`Array<${aliasFilterTypeHref}$gt;`, - description:`Array of ${aliasFilterTypeHref} objects` + return: { + type: `Array<${aliasFilterTypeHref}$gt;`, + description: `Array of ${aliasFilterTypeHref} objects` } }, filterAliasByEntityTypes: { description: 'Filter alias by entity type', meta: 'function', args: [ - {name: 'entityAlias', type:entityAliasHref, description: 'Alias of the entity'}, - {name: 'entityTypes', type:`Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'} + {name: 'entityAlias', type: entityAliasHref, description: 'Alias of the entity'}, + {name: 'entityTypes', type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'} ], - return:{ - type:'boolean', - description:`Returns boolean variable based on the filter` + return: { + type: 'boolean', + description: `Returns boolean variable based on the filter` } }, prepareAllowedEntityTypesList: { description: 'Prepare allowed types of the entity list', meta: 'function', args: [ - {name: 'allowedEntityTypes', type:`Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'}, - {name: 'useAliasEntityTypes', type:'boolean', description: 'Use alias entity types'}, + {name: 'allowedEntityTypes', type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'}, + {name: 'useAliasEntityTypes', type: 'boolean', description: 'Use alias entity types'}, ], - return:{ - type:`Array<${entityTypeHref}|${aliasEntityTypeHref}>`, - description:`Returns entity types array` + return: { + type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, + description: `Returns entity types array` } }, getEntityKeys: { description: 'Get entity keys by id', meta: 'function', args: [ - {name: 'entityId', type:entityIdHref, description: 'id of the entity'}, - {name: 'query', type:'string', description: 'Query'}, - {name: 'type', type:dataKeyTypeHref, description: 'Query'}, + {name: 'entityId', type: entityIdHref, description: 'id of the entity'}, + {name: 'query', type: 'string', description: 'Query'}, + {name: 'type', type: dataKeyTypeHref, description: 'Query'}, requestConfigArg ], - return:{ - type:`Observable<Array<string>>`, - description:`An Observable of string variable.` + return: { + type: `Observable<Array<string>>`, + description: `An Observable of string variable.` } // observableArrayReturnType('string') }, @@ -1216,71 +1216,71 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Create database from subscriptions info', meta: 'function', args: [ - {name: 'subscriptionsInfo', type:'array', description: 'Subscriptions info'} + {name: 'subscriptionsInfo', type: 'array', description: 'Subscriptions info'} ], - return:{ - type:`Array<${dataSourceHref}>`, - description:`Array of ${dataSourceHref} objects` + return: { + type: `Array<${dataSourceHref}>`, + description: `Array of ${dataSourceHref} objects` } }, createAlarmSourceFromSubscriptionInfo: { description: 'Create alarm source from subscriptions info', meta: 'function', args: [ - {name: 'subscriptionInfo', type:subscriptionInfoHref, description: 'Subscription info'} + {name: 'subscriptionInfo', type: subscriptionInfoHref, description: 'Subscription info'} ], - return:{ - type:`${dataSourceHref}`, - description:`${dataSourceHref} object` + return: { + type: `${dataSourceHref}`, + description: `${dataSourceHref} object` } }, resolveAlias: { description: 'Resolve alias', meta: 'function', args: [ - {name: 'entityAlias', type:entityAliasHref, description: 'Alias of the entity'}, - {name: 'stateParams', type:stateParamsHref, description: 'State params'}, + {name: 'entityAlias', type: entityAliasHref, description: 'Alias of the entity'}, + {name: 'stateParams', type: stateParamsHref, description: 'State params'}, ], - return:observableReturnType(aliasInfoHref) + return: observableReturnType(aliasInfoHref) }, resolveAliasFilter: { description: 'Resolve alias filter', meta: 'function', args: [ - {name: 'filter', type:entityAliasFilterHref, description: 'Entity alias filter'}, - {name: 'stateParams', type:stateParamsHref, description: 'State params'}, + {name: 'filter', type: entityAliasFilterHref, description: 'Entity alias filter'}, + {name: 'stateParams', type: stateParamsHref, description: 'State params'}, ], - return:observableReturnType(entityAliasFilterResultHref) + return: observableReturnType(entityAliasFilterResultHref) }, checkEntityAlias: { description: 'Check entity alias', meta: 'function', args: [ - {name: 'entityAlias', type:entityAliasHref, description: 'Alias of the entity'}, + {name: 'entityAlias', type: entityAliasHref, description: 'Alias of the entity'}, ], - return:observableReturnTypeVariable('boolean') + return: observableReturnTypeVariable('boolean') // observableReturnType('boolean') }, saveEntityParameters: { description: 'Save entity parameters', meta: 'function', args: [ - {name: 'entityType', type:entityTypeHref, description: 'Entity type'}, - {name: 'entityData', type:importEntityDataHref, description: 'Data of the entity'}, - {name: 'update', type:'boolean', description: 'Update'}, + {name: 'entityType', type: entityTypeHref, description: 'Entity type'}, + {name: 'entityData', type: importEntityDataHref, description: 'Data of the entity'}, + {name: 'update', type: 'boolean', description: 'Update'}, requestConfigArg ], - return:observableReturnType(importEntitiesResultInfoHref) + return: observableReturnType(importEntitiesResultInfoHref) }, saveEntityData: { description: 'Save entity data', meta: 'function', args: [ - {name: 'entityId', type:entityIdHref, description: 'Id of the entity'}, - {name: 'entityData', type:importEntityDataHref, description: 'Data of the entity'}, + {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, + {name: 'entityData', type: importEntityDataHref, description: 'Data of the entity'}, requestConfigArg ], - return:observableReturnTypeVariable('any') + return: observableReturnTypeVariable('any') // observableReturnType('any') }, @@ -1296,54 +1296,54 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Confirm', meta: 'function', args: [ - {name: 'title', type:'string', description: 'Title'}, - {name: 'message', type:'string', description: 'Message'}, - {name: 'cancel', type:'string',optional: true, description: 'Cancel'}, - {name: 'ok', type:'string',optional: true, description: 'Ok'}, - {name: 'fullscreen', type:'boolean',optional: true, description: 'Fullscreen'}, + {name: 'title', type: 'string', description: 'Title'}, + {name: 'message', type: 'string', description: 'Message'}, + {name: 'cancel', type: 'string', optional: true, description: 'Cancel'}, + {name: 'ok', type: 'string', optional: true, description: 'Ok'}, + {name: 'fullscreen', type: 'boolean', optional: true, description: 'Fullscreen'}, ], - return:observableReturnTypeVariable('boolean') + return: observableReturnTypeVariable('boolean') }, alert: { description: 'Alert', meta: 'function', args: [ - {name: 'title', type:'string', description: 'Title'}, - {name: 'message', type:'string', description: 'Message'}, - {name: 'ok', type:'string',optional: true, description: 'Ok'}, - {name: 'fullscreen', type:'boolean',optional: true, description: 'Fullscreen'}, + {name: 'title', type: 'string', description: 'Title'}, + {name: 'message', type: 'string', description: 'Message'}, + {name: 'ok', type: 'string', optional: true, description: 'Ok'}, + {name: 'fullscreen', type: 'boolean', optional: true, description: 'Fullscreen'}, ], - return:observableReturnTypeVariable('boolean') + return: observableReturnTypeVariable('boolean') }, colorPicker: { description: 'Color picker', meta: 'function', args: [ - {name: 'color', type:'string', description: 'Сolor'}, + {name: 'color', type: 'string', description: 'Сolor'}, ], - return:observableReturnTypeVariable('string') + return: observableReturnTypeVariable('string') }, materialIconPicker: { description: 'Material icon picker', meta: 'function', args: [ - {name: 'icon', type:'string', description: 'Icon'}, + {name: 'icon', type: 'string', description: 'Icon'}, ], - return:observableReturnTypeVariable('string') + return: observableReturnTypeVariable('string') }, forbidden: { description: 'Forbidden', meta: 'function', args: [ ], - return:observableReturnTypeVariable('boolean') + return: observableReturnTypeVariable('boolean') }, todo: { description: 'To do', meta: 'function', args: [ ], - return:observableReturnTypeVariable('any') + return: observableReturnTypeVariable('any') }, } }, @@ -1352,16 +1352,16 @@ export const serviceCompletions: TbEditorCompletions = { 'See CustomDialogService for API reference.', meta: 'service', type: 'CustomDialogService', - children:{ + children: { customDialog: { description: 'Custom Dialog', meta: 'function', args: [ - {name: 'template', type:'string', description: 'Template'}, - {name: 'controller', type:customDialogComponentHref, description: 'Controller'}, - {name: 'data', type:'any', description: 'Data'}, + {name: 'template', type: 'string', description: 'Template'}, + {name: 'controller', type: customDialogComponentHref, description: 'Controller'}, + {name: 'data', type: 'any', description: 'Data'}, ], - return:observableReturnTypeVariable('any') + return: observableReturnTypeVariable('any') }, } }, @@ -1389,4 +1389,4 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'service', type: 'DomSanitizer' } -} +}; From 156f7d6ae74d6172f80e94c164948ffc4daf3c06 Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Tue, 25 Aug 2020 17:16:09 +0300 Subject: [PATCH 2/4] Correct mistakes in descriptions --- .../models/ace/service-completion.models.ts | 85 +++++++++---------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts index 7de5ba6d18..fb7a6a9b46 100644 --- a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts +++ b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts @@ -362,7 +362,7 @@ export const serviceCompletions: TbEditorCompletions = { type: 'AssetService', children: { getTenantAssetInfos: { - description: 'Get tenant asset', + description: 'Get tenant assets', meta: 'function', args: [ pageLinkArg, @@ -530,7 +530,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Get entity view info by id', meta: 'function', args: [ - {name: 'entityViewId', type: 'string', description: 'Id of the entities view'}, + {name: 'entityViewId', type: 'string', description: 'Id of the entity view'}, requestConfigArg ], return: observableReturnType(entityViewInfoHref) @@ -575,7 +575,7 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'customerId', type: 'string', description: 'Id of the customer'}, - {name: 'entityViewId', type: 'string', description: 'Id of the entity viewId'}, + {name: 'entityViewId', type: 'string', description: 'Id of the entity view'}, requestConfigArg ], return: observableReturnType(entityViewHref) @@ -596,7 +596,7 @@ export const serviceCompletions: TbEditorCompletions = { { name: 'query', type: 'AssetSearchQuery', - description: 'Asset search query object' + description: 'Entity view search query object' }, requestConfigArg ], @@ -655,7 +655,7 @@ export const serviceCompletions: TbEditorCompletions = { type: 'DashboardService', children: { getTenantDashboards: { - description: 'Get tenant dashboard', + description: 'Get tenant dashboards', meta: 'function', args: [ pageLinkArg, @@ -664,7 +664,7 @@ export const serviceCompletions: TbEditorCompletions = { return: observablePageDataReturnType(dashboardInfoHref) }, getTenantDashboardsByTenantId: { - description: 'Get tenant dashboards by id', + description: 'Get dashboards by tenant id', meta: 'function', args: [ {name: 'tenantId', type: 'string', description: 'Id of the tenant'}, @@ -673,7 +673,7 @@ export const serviceCompletions: TbEditorCompletions = { return: observablePageDataReturnType(dashboardInfoHref) }, getCustomerDashboards: { - description: 'Get customer dashboard by id', + description: 'Get dashboards by customer id', meta: 'function', args: [ {name: 'customerId', type: 'string', description: 'Id of the customer'}, @@ -713,7 +713,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Delete dashboard by id', meta: 'function', args: [ - {name: 'dashboardId', type: 'string', description: 'Id of the entity view'}, + {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'}, requestConfigArg ], return: observableVoid() @@ -757,7 +757,7 @@ export const serviceCompletions: TbEditorCompletions = { return: observableReturnType(dashboardHref) }, updateDashboardCustomers: { - description: 'Update dashboard by id', + description: 'Update customers assigned to dashboard by ids', meta: 'function', args: [ {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'}, @@ -767,7 +767,7 @@ export const serviceCompletions: TbEditorCompletions = { return: observableReturnType(dashboardHref) }, addDashboardCustomers: { - description: 'Add dashboard customers by ids', + description: 'Assign (Add) customers to dashboard by ids', meta: 'function', args: [ {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'}, @@ -777,7 +777,7 @@ export const serviceCompletions: TbEditorCompletions = { return: observableReturnType(dashboardHref) }, removeDashboardCustomers: { - description: 'Remove dashboard customers dy ids', + description: 'Unassign (Remove) customers from dashboard by ids', meta: 'function', args: [ {name: 'dashboardId', type: 'string', description: 'Id of the dashboard'}, @@ -798,7 +798,7 @@ export const serviceCompletions: TbEditorCompletions = { } }, getServerTimeDiff: { - description: 'remove dashboard customers ', + description: 'Get time difference', meta: 'function', args: [ ], @@ -822,7 +822,7 @@ export const serviceCompletions: TbEditorCompletions = { return: observablePageDataReturnType(userHref) }, getTenantAdmins: { - description: 'Get tenant admins by id', + description: 'Get tenant admins by id', meta: 'function', args: [ {name: 'tenantId', type: 'string', description: 'Id of the tenant'}, @@ -832,10 +832,10 @@ export const serviceCompletions: TbEditorCompletions = { return: observablePageDataReturnType(userHref) }, getCustomerUsers: { - description: 'Get customer users by id', + description: 'Get customer users by id', meta: 'function', args: [ - {name: 'customerId', type: 'string', description: 'id of the customer'}, + {name: 'customerId', type: 'string', description: 'Id of the customer'}, pageLinkArg, requestConfigArg ], @@ -845,7 +845,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Get user by id', meta: 'function', args: [ - {name: 'userId', type: 'string', description: 'id of the user'}, + {name: 'userId', type: 'string', description: 'Id of the user'}, requestConfigArg ], return: observableReturnType(userHref) @@ -928,7 +928,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Delete relations by entity id', meta: 'function', args: [ - {name: 'entityId', type: entityIdHref, description: 'Id to the entity'}, + {name: 'entityId', type: entityIdHref, description: 'Entity Id'}, {name: 'relationType', type: 'string', description: 'Relation type'}, requestConfigArg ], @@ -1005,7 +1005,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Find by query', meta: 'function', args: [ - {name: 'query', type: entityRelationsQueryHref, description: 'Query'}, + {name: 'query', type: entityRelationsQueryHref, description: 'Entity relations query'}, requestConfigArg ], return: observableArrayReturnType(entityRelationHref) @@ -1014,7 +1014,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Find info by query', meta: 'function', args: [ - {name: 'query', type: entityRelationsQueryHref, description: 'Query'}, + {name: 'query', type: entityRelationsQueryHref, description: 'Entity relations query'}, requestConfigArg ], return: observableArrayReturnType(entityRelationInfoHref) @@ -1032,7 +1032,7 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, - {name: 'attributeScope', type: attributeScopeHref, description: 'Atribute scope'}, + {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'}, {name: 'keys', type: `Array<string>`, description: 'Array of the keys'}, requestConfigArg ], @@ -1043,7 +1043,7 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, - {name: 'attributeScope', type: attributeScopeHref, description: 'Atribute scope'}, + {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'}, {name: 'attributes', type: `array<${attributeDataHref}>`, description: 'Array of the attributes'}, requestConfigArg ], @@ -1115,7 +1115,7 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'entityType', type: entityTypeHref, description: 'Entity type'}, - {name: 'entityNameFilter', type: 'string', description: 'Name filter of the entity'}, + {name: 'entityNameFilter', type: 'string', description: 'Name filter for the entity'}, {name: 'pageSize', type: 'number', description: 'Size of the page'}, {name: 'subType', type: 'string', optional: true, description: 'Subtype'}, requestConfigArg @@ -1126,8 +1126,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Find entity data by query', meta: 'function', args: [ - {name: 'query', type: entityDataQueryHref, description: 'Query'}, - + {name: 'query', type: entityDataQueryHref, description: 'Entity data query'}, requestConfigArg ], return: observablePageDataReturnType(entityDataHref) @@ -1136,7 +1135,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Find alarm data by query', meta: 'function', args: [ - {name: 'query', type: alarmDataQueryHref, description: 'Query'}, + {name: 'query', type: alarmDataQueryHref, description: 'Alarm data query'}, requestConfigArg ], return: observablePageDataReturnType(alarmDataHref) @@ -1145,24 +1144,24 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Find entity infos by filter and name', meta: 'function', args: [ - {name: 'filter', type: entityFilterHref, description: 'Filter of the entity'}, + {name: 'filter', type: entityFilterHref, description: 'Filter for the entities'}, {name: 'searchText', type: 'string', description: 'Search text'}, requestConfigArg ], return: observablePageDataReturnType(entityInfoHref) }, findSingleEntityInfoByEntityFilter: { - description: 'Find single entity infos by filter of the entity ', + description: 'Find single entity infos by filter', meta: 'function', args: [ - {name: 'filter', type: entityFilterHref, description: 'Filter of the entity'}, - {name: 'searchText', type: 'string', description: 'search text'}, + {name: 'filter', type: entityFilterHref, description: 'Filter for the entity'}, + {name: 'searchText', type: 'string', description: 'Search text'}, requestConfigArg ], return: observableReturnType(entityInfoHref) }, getAliasFilterTypesByEntityTypes: { - description: 'Get alias filter types by entity type', + description: 'Get alias filter types by entity types', meta: 'function', args: [ {name: 'entityTypes', type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'}, @@ -1174,7 +1173,7 @@ export const serviceCompletions: TbEditorCompletions = { } }, filterAliasByEntityTypes: { - description: 'Filter alias by entity type', + description: 'Filter alias by entity types', meta: 'function', args: [ {name: 'entityAlias', type: entityAliasHref, description: 'Alias of the entity'}, @@ -1186,7 +1185,7 @@ export const serviceCompletions: TbEditorCompletions = { } }, prepareAllowedEntityTypesList: { - description: 'Prepare allowed types of the entity list', + description: 'Prepare allowed entity types list', meta: 'function', args: [ {name: 'allowedEntityTypes', type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'}, @@ -1201,19 +1200,18 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Get entity keys by id', meta: 'function', args: [ - {name: 'entityId', type: entityIdHref, description: 'id of the entity'}, - {name: 'query', type: 'string', description: 'Query'}, - {name: 'type', type: dataKeyTypeHref, description: 'Query'}, + {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, + {name: 'query', type: 'string', description: 'Key name starts with'}, + {name: 'type', type: dataKeyTypeHref, description: 'Datakey type'}, requestConfigArg ], return: { type: `Observable<Array<string>>`, - description: `An Observable of string variable.` + description: `An Observable of array of string variables.` } - // observableArrayReturnType('string') }, createDatasourcesFromSubscriptionsInfo: { - description: 'Create database from subscriptions info', + description: 'Create datasources from subscriptions info', meta: 'function', args: [ {name: 'subscriptionsInfo', type: 'array', description: 'Subscriptions info'} @@ -1238,7 +1236,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Resolve alias', meta: 'function', args: [ - {name: 'entityAlias', type: entityAliasHref, description: 'Alias of the entity'}, + {name: 'entityAlias', type: entityAliasHref, description: 'Entity alias'}, {name: 'stateParams', type: stateParamsHref, description: 'State params'}, ], return: observableReturnType(aliasInfoHref) @@ -1256,17 +1254,16 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Check entity alias', meta: 'function', args: [ - {name: 'entityAlias', type: entityAliasHref, description: 'Alias of the entity'}, + {name: 'entityAlias', type: entityAliasHref, description: 'Entity alias'}, ], return: observableReturnTypeVariable('boolean') - // observableReturnType('boolean') }, saveEntityParameters: { description: 'Save entity parameters', meta: 'function', args: [ {name: 'entityType', type: entityTypeHref, description: 'Entity type'}, - {name: 'entityData', type: importEntityDataHref, description: 'Data of the entity'}, + {name: 'entityData', type: importEntityDataHref, description: 'Entity data'}, {name: 'update', type: 'boolean', description: 'Update'}, requestConfigArg ], @@ -1277,12 +1274,10 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, - {name: 'entityData', type: importEntityDataHref, description: 'Data of the entity'}, + {name: 'entityData', type: importEntityDataHref, description: 'Entity data'}, requestConfigArg ], return: observableReturnTypeVariable('any') - - // observableReturnType('any') }, } }, From f7b867a10c20da79991c6c1e9f81b6a0132d329f Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Tue, 25 Aug 2020 19:47:43 +0300 Subject: [PATCH 3/4] Correct services arguments --- .../models/ace/service-completion.models.ts | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts index fb7a6a9b46..87301900c0 100644 --- a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts +++ b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts @@ -135,21 +135,20 @@ export function observableArrayReturnType(objectType: string): FunctionArgType { }; } -export function observableBaseDataReturnType(objectType: string): FunctionArgType { +export function observableBaseDataReturnType(): FunctionArgType { return { - type: `Observable<${baseDataHref}<${objectType}>>`, - description: `An Observable of page result as a ${baseDataHref} holding array of ${objectType} objects.` + type: `Observable<${baseDataHref}<${entityIdHref}>>`, + description: `An Observable of ${baseDataHref} object.` }; } -export function observableArrayBaseDataReturnType(objectType: string): FunctionArgType { +export function observableArrayBaseDataReturnType(): FunctionArgType { return { - type: `Observable<Array<${baseDataHref}<${objectType}>>>`, - description: `An Observable of page result as a ${baseDataHref} holding array of ${objectType} objects.` + type: `Observable<Array<${baseDataHref}<${entityIdHref}>>>`, + description: `An Observable of array of ${baseDataHref} objects.` }; } - export function observablePageDataReturnType(objectType: string): FunctionArgType { return { type: `Observable<${pageDataHref}<${objectType}>>`, @@ -157,8 +156,6 @@ export function observablePageDataReturnType(objectType: string): FunctionArgTyp }; } - - export const serviceCompletions: TbEditorCompletions = { deviceService: { description: 'Device Service API
' + @@ -668,7 +665,8 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'tenantId', type: 'string', description: 'Id of the tenant'}, - pageLinkArg + pageLinkArg, + requestConfigArg ], return: observablePageDataReturnType(dashboardInfoHref) }, @@ -729,7 +727,7 @@ export const serviceCompletions: TbEditorCompletions = { return: observableReturnType(dashboardHref) }, unassignDashboardFromCustomer: { - description: 'Unassign dashboard from any customer', + description: 'Unassign dashboard from specific customer', meta: 'function', args: [ {name: 'customerId', type: 'string', description: 'Id of the customer'}, @@ -784,7 +782,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'customerIds', type: `Array<string>`, description: 'Id of the customers'}, requestConfigArg ], - return: observableArrayReturnType(dashboardHref) + return: observableReturnType(dashboardHref) }, getPublicDashboardLink: { description: 'Get public dashboard link', @@ -855,6 +853,7 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'user', type: userHref, description: 'User object to save'}, + {name: 'sendActivationMail', type: 'boolean', description: 'Send activation email', optional: true}, requestConfigArg ], return: observableReturnType(userHref) @@ -876,7 +875,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'userCredentialsEnabled', type: 'boolean', description: 'User credentials enabled'}, requestConfigArg ], - return: observableReturnType(userHref) + return: observableReturnTypeVariable('any') }, getActivationLink: { description: 'Get activation link by id', @@ -929,7 +928,6 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'entityId', type: entityIdHref, description: 'Entity Id'}, - {name: 'relationType', type: 'string', description: 'Relation type'}, requestConfigArg ], return: observableVoid() @@ -1044,7 +1042,7 @@ export const serviceCompletions: TbEditorCompletions = { args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'}, - {name: 'attributes', type: `array<${attributeDataHref}>`, description: 'Array of the attributes'}, + {name: 'attributes', type: `array<${attributeDataHref}>`, description: 'Array of the attributes data'}, requestConfigArg ], return: observableReturnTypeVariable('any') @@ -1054,7 +1052,7 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, - {name: 'timeseries', type: `Array<${attributeDataHref}>>`, description: 'Array of the timeseries'}, + {name: 'timeseries', type: `Array<${attributeDataHref}>>`, description: 'Array of the timeseries data'}, {name: 'deleteAllDataForKeys', type: 'boolean', optional: true, description: 'Delete all data for keys'}, requestConfigArg ], @@ -1066,7 +1064,7 @@ export const serviceCompletions: TbEditorCompletions = { args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, {name: 'attributeScope', type: attributeScopeHref, description: 'Attribute scope'}, - {name: 'attributes', type: 'Array<${attributeDataHref}>>', description: 'Array of the attributes'}, + {name: 'attributes', type: 'Array<${attributeDataHref}>>', description: 'Array of the attributes data'}, requestConfigArg ], return: observableReturnTypeVariable('any') @@ -1077,7 +1075,7 @@ export const serviceCompletions: TbEditorCompletions = { args: [ {name: 'entityId', type: entityIdHref, description: 'Id of the entity'}, {name: 'timeseriesScope', type: 'string', description: 'Timeseries scope'}, - {name: 'timeseries', type: `Array<attributeDataHref>`, description: 'Array of the timeseries'}, + {name: 'timeseries', type: `Array<attributeDataHref>`, description: 'Array of the timeseries data'}, requestConfigArg ], return: observableReturnTypeVariable('any') @@ -1098,7 +1096,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'entityId', type: 'string', description: 'Id of the entity'}, requestConfigArg ], - return: observableBaseDataReturnType(entityIdHref) + return: observableBaseDataReturnType() }, getEntities: { description: 'Get entities by ids', @@ -1108,7 +1106,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'entityIds', type: `Array<string>`, description: 'Ids of the entities'}, requestConfigArg ], - return: observableArrayBaseDataReturnType(entityIdHref) + return: observableArrayBaseDataReturnType() }, getEntitiesByNameFilter: { description: 'Get entities by name filter', @@ -1120,7 +1118,7 @@ export const serviceCompletions: TbEditorCompletions = { {name: 'subType', type: 'string', optional: true, description: 'Subtype'}, requestConfigArg ], - return: observableArrayBaseDataReturnType(entityIdHref) + return: observableArrayBaseDataReturnType() }, findEntityDataByQuery: { description: 'Find entity data by query', @@ -1155,7 +1153,6 @@ export const serviceCompletions: TbEditorCompletions = { meta: 'function', args: [ {name: 'filter', type: entityFilterHref, description: 'Filter for the entity'}, - {name: 'searchText', type: 'string', description: 'Search text'}, requestConfigArg ], return: observableReturnType(entityInfoHref) @@ -1164,8 +1161,7 @@ export const serviceCompletions: TbEditorCompletions = { description: 'Get alias filter types by entity types', meta: 'function', args: [ - {name: 'entityTypes', type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'}, - {name: 'searchText', type: 'string', description: 'Search text'} + {name: 'entityTypes', type: `Array<${entityTypeHref}|${aliasEntityTypeHref}>`, description: 'Entity types'} ], return: { type: `Array<${aliasFilterTypeHref}$gt;`, @@ -1354,7 +1350,7 @@ export const serviceCompletions: TbEditorCompletions = { args: [ {name: 'template', type: 'string', description: 'Template'}, {name: 'controller', type: customDialogComponentHref, description: 'Controller'}, - {name: 'data', type: 'any', description: 'Data'}, + {name: 'data', type: 'any', description: 'Data', optional: true}, ], return: observableReturnTypeVariable('any') }, From e5e103be98957937a585b1d28be28f469898605a Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 26 Aug 2020 15:04:26 +0300 Subject: [PATCH 4/4] Improve toast panel --- .../components/snack-bar-component.html | 2 +- .../components/snack-bar-component.scss | 27 ++++ .../app/shared/components/toast.directive.ts | 143 +++++++++--------- 3 files changed, 97 insertions(+), 75 deletions(-) diff --git a/ui-ngx/src/app/shared/components/snack-bar-component.html b/ui-ngx/src/app/shared/components/snack-bar-component.html index 53f23fcf8a..573166fd1e 100644 --- a/ui-ngx/src/app/shared/components/snack-bar-component.html +++ b/ui-ngx/src/app/shared/components/snack-bar-component.html @@ -25,5 +25,5 @@ 'info-toast': notification.type === 'info' }">
- + diff --git a/ui-ngx/src/app/shared/components/snack-bar-component.scss b/ui-ngx/src/app/shared/components/snack-bar-component.scss index 6ef4191efb..8b211bffce 100644 --- a/ui-ngx/src/app/shared/components/snack-bar-component.scss +++ b/ui-ngx/src/app/shared/components/snack-bar-component.scss @@ -16,6 +16,33 @@ :host { display: inline-block; pointer-events: all; + &.toast-panel { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 1000; + display: flex; + &.left { + justify-content: flex-start; + } + &.right { + justify-content: flex-end; + } + &.top { + align-items: flex-start; + } + &.bottom { + align-items: flex-end; + } + &.h-center { + justify-content: center; + } + &.v-center { + align-items: center; + } + } .tb-toast { box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12); color: #fff; diff --git a/ui-ngx/src/app/shared/components/toast.directive.ts b/ui-ngx/src/app/shared/components/toast.directive.ts index 1d59b86a54..fb704c74db 100644 --- a/ui-ngx/src/app/shared/components/toast.directive.ts +++ b/ui-ngx/src/app/shared/components/toast.directive.ts @@ -16,9 +16,9 @@ import { AfterViewInit, ChangeDetectorRef, - Component, ComponentRef, + Component, ComponentFactoryResolver, ComponentRef, Directive, - ElementRef, + ElementRef, HostBinding, Inject, Input, NgZone, @@ -34,8 +34,7 @@ import { BreakpointObserver } from '@angular/cdk/layout'; import { MediaBreakpoints } from '@shared/models/constants'; import { MatButton } from '@angular/material/button'; import Timeout = NodeJS.Timeout; -import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; -import { ComponentPortal, PortalInjector } from '@angular/cdk/portal'; +import { PortalInjector } from '@angular/cdk/portal'; @Directive({ selector: '[tb-toast]' @@ -49,7 +48,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy { private hideNotificationSubscription: Subscription = null; private snackBarRef: MatSnackBarRef = null; - private overlayRef: OverlayRef; private toastComponentRef: ComponentRef; private currentMessage: NotificationMessage = null; @@ -58,7 +56,7 @@ export class ToastDirective implements AfterViewInit, OnDestroy { constructor(private elementRef: ElementRef, private viewContainerRef: ViewContainerRef, private notificationService: NotificationService, - private overlay: Overlay, + private componentFactoryResolver: ComponentFactoryResolver, private snackBar: MatSnackBar, private ngZone: NgZone, private breakpointObserver: BreakpointObserver, @@ -104,9 +102,11 @@ export class ToastDirective implements AfterViewInit, OnDestroy { if (this.snackBarRef) { this.snackBarRef.dismiss(); } - - const position = this.overlay.position(); - let panelClass = ['tb-toast-panel']; + if (this.toastComponentRef) { + this.viewContainerRef.detach(0); + this.toastComponentRef.destroy(); + } + let panelClass = ['tb-toast-panel', 'toast-panel']; if (notificationMessage.panelClass) { if (typeof notificationMessage.panelClass === 'string') { panelClass.push(notificationMessage.panelClass); @@ -114,46 +114,35 @@ export class ToastDirective implements AfterViewInit, OnDestroy { panelClass = panelClass.concat(notificationMessage.panelClass); } } - const overlayConfig = new OverlayConfig({ - panelClass, - backdropClass: 'cdk-overlay-transparent-backdrop', - hasBackdrop: false, - disposeOnNavigation: true - }); - let originX; - let originY; const horizontalPosition = notificationMessage.horizontalPosition || 'left'; const verticalPosition = notificationMessage.verticalPosition || 'top'; if (horizontalPosition === 'start' || horizontalPosition === 'left') { - originX = 'start'; + panelClass.push('left'); } else if (horizontalPosition === 'end' || horizontalPosition === 'right') { - originX = 'end'; + panelClass.push('right'); } else { - originX = 'center'; + panelClass.push('h-center'); } if (verticalPosition === 'top') { - originY = 'top'; + panelClass.push('top'); } else { - originY = 'bottom'; + panelClass.push('bottom'); } - const connectedPosition: ConnectedPosition = { - originX, - originY, - overlayX: originX, - overlayY: originY - }; - overlayConfig.positionStrategy = position.flexibleConnectedTo(this.elementRef) - .withPositions([connectedPosition]); - this.overlayRef = this.overlay.create(overlayConfig); + + const componentFactory = this.componentFactoryResolver.resolveComponentFactory(TbSnackBarComponent); const data: ToastPanelData = { - notification: notificationMessage + notification: notificationMessage, + panelClass, + destroyToastComponent: () => { + this.viewContainerRef.detach(0); + this.toastComponentRef.destroy(); + } }; const injectionTokens = new WeakMap([ - [MAT_SNACK_BAR_DATA, data], - [OverlayRef, this.overlayRef] + [MAT_SNACK_BAR_DATA, data] ]); const injector = new PortalInjector(this.viewContainerRef.injector, injectionTokens); - this.toastComponentRef = this.overlayRef.attach(new ComponentPortal(TbSnackBarComponent, this.viewContainerRef, injector)); + this.toastComponentRef = this.viewContainerRef.createComponent(componentFactory, 0, injector); this.cd.detectChanges(); if (notificationMessage.duration && notificationMessage.duration > 0) { @@ -173,7 +162,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy { clearTimeout(this.dismissTimeout); this.dismissTimeout = null; } - this.overlayRef = null; this.toastComponentRef = null; this.currentMessage = null; }); @@ -181,43 +169,45 @@ export class ToastDirective implements AfterViewInit, OnDestroy { } private showSnackBar(notificationMessage: NotificationMessage, isGtSm: boolean) { - const data: ToastPanelData = { - notification: notificationMessage, - parent: this.elementRef - }; - const config: MatSnackBarConfig = { - horizontalPosition: notificationMessage.horizontalPosition || 'left', - verticalPosition: !isGtSm ? 'bottom' : (notificationMessage.verticalPosition || 'top'), - viewContainerRef: this.viewContainerRef, - duration: notificationMessage.duration, - panelClass: notificationMessage.panelClass, - data - }; this.ngZone.run(() => { if (this.snackBarRef) { this.snackBarRef.dismiss(); } + const data: ToastPanelData = { + notification: notificationMessage, + parent: this.elementRef, + panelClass: [], + destroyToastComponent: () => {} + }; + const config: MatSnackBarConfig = { + horizontalPosition: notificationMessage.horizontalPosition || 'left', + verticalPosition: !isGtSm ? 'bottom' : (notificationMessage.verticalPosition || 'top'), + viewContainerRef: this.viewContainerRef, + duration: notificationMessage.duration, + panelClass: notificationMessage.panelClass, + data + }; this.snackBarRef = this.snackBar.openFromComponent(TbSnackBarComponent, config); - }); - if (notificationMessage.duration && notificationMessage.duration > 0 && notificationMessage.forceDismiss) { - if (this.dismissTimeout !== null) { - clearTimeout(this.dismissTimeout); - this.dismissTimeout = null; - } - this.dismissTimeout = setTimeout(() => { - if (this.snackBarRef) { - this.snackBarRef.instance.actionButton._elementRef.nativeElement.click(); + if (notificationMessage.duration && notificationMessage.duration > 0 && notificationMessage.forceDismiss) { + if (this.dismissTimeout !== null) { + clearTimeout(this.dismissTimeout); + this.dismissTimeout = null; } - this.dismissTimeout = null; - }, notificationMessage.duration); - } - this.snackBarRef.afterDismissed().subscribe(() => { - if (this.dismissTimeout !== null) { - clearTimeout(this.dismissTimeout); - this.dismissTimeout = null; + this.dismissTimeout = setTimeout(() => { + if (this.snackBarRef) { + this.snackBarRef.instance.actionButton._elementRef.nativeElement.click(); + } + this.dismissTimeout = null; + }, notificationMessage.duration); } - this.snackBarRef = null; - this.currentMessage = null; + this.snackBarRef.afterDismissed().subscribe(() => { + if (this.dismissTimeout !== null) { + clearTimeout(this.dismissTimeout); + this.dismissTimeout = null; + } + this.snackBarRef = null; + this.currentMessage = null; + }); }); } @@ -235,8 +225,9 @@ export class ToastDirective implements AfterViewInit, OnDestroy { } ngOnDestroy(): void { - if (this.overlayRef) { - this.overlayRef.dispose(); + if (this.toastComponentRef) { + this.viewContainerRef.detach(0); + this.toastComponentRef.destroy(); } if (this.notificationSubscription) { this.notificationSubscription.unsubscribe(); @@ -250,6 +241,8 @@ export class ToastDirective implements AfterViewInit, OnDestroy { interface ToastPanelData { notification: NotificationMessage; parent?: ElementRef; + panelClass: string[]; + destroyToastComponent: () => void; } import { @@ -288,6 +281,11 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { @ViewChild('actionButton', {static: true}) actionButton: MatButton; + @HostBinding('class') + get panelClass(): string[] { + return this.data.panelClass; + } + private parentEl: HTMLElement; private snackBarContainerEl: HTMLElement; private parentScrollSubscription: Subscription = null; @@ -305,9 +303,7 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { private data: ToastPanelData, private elementRef: ElementRef, @Optional() - private snackBarRef: MatSnackBarRef, - @Optional() - private overlayRef: OverlayRef) { + private snackBarRef: MatSnackBarRef) { this.animationState = !!this.snackBarRef ? 'default' : 'opened'; this.notification = data.notification; } @@ -319,9 +315,8 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { this.snackBarContainerEl.style.position = 'absolute'; this.updateContainerRect(); this.updatePosition(this.snackBarRef.containerInstance.snackBarConfig); - const snackBarComponent = this; this.parentScrollSubscription = onParentScrollOrWindowResize(this.parentEl).subscribe(() => { - snackBarComponent.updateContainerRect(); + this.updateContainerRect(); }); } } @@ -373,7 +368,7 @@ export class TbSnackBarComponent implements AfterViewInit, OnDestroy { const isFadeOut = (toState as ToastAnimationState) === 'closing'; const itFinished = this.animationState === 'closing'; if (isFadeOut && itFinished) { - this.overlayRef.dispose(); + this.data.destroyToastComponent(); } } }