Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AAE-19604] fix unwanted notification error #9246

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import {
CardViewDateItemModel,
CardViewIntItemModel,
CardViewFloatItemModel,
NotificationService,
CardViewBoolItemModel,
CardViewDatetimeItemModel,
CardViewSelectItemModel,
CardViewSelectItemProperties
CardViewSelectItemProperties,
LogService
} from '@alfresco/adf-core';
import { ContentTestingModule } from '../../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
Expand All @@ -42,7 +42,7 @@ describe('PropertyGroupTranslatorService', () => {
let propertyGroup: OrganisedPropertyGroup;
let property: Property;
let propertyValues: { [key: string]: any };
let notificationService: NotificationService;
let logService: LogService;

beforeEach(() => {
TestBed.configureTestingModule({
Expand All @@ -51,7 +51,7 @@ describe('PropertyGroupTranslatorService', () => {
ContentTestingModule
]
});
notificationService = TestBed.inject(NotificationService);
logService = TestBed.inject(LogService);
service = TestBed.inject(PropertyGroupTranslatorService);

property = {
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('PropertyGroupTranslatorService', () => {
});

it('should log an error if unrecognised type is found', () => {
const showError = spyOn(notificationService, 'showError').and.stub();
const logServiceError = spyOn(logService, 'error').and.stub();

property.name = 'FAS:PLAGUE';
property.title = 'The Faro Plague';
Expand All @@ -149,7 +149,7 @@ describe('PropertyGroupTranslatorService', () => {
propertyGroups.push(Object.assign({}, propertyGroup));

service.translateToCardViewGroups(propertyGroups, propertyValues, null);
expect(showError).toHaveBeenCalledWith('Unknown type for mapping: daemonic:scorcher');
expect(logServiceError).toHaveBeenCalledWith('Unknown type for mapping: daemonic:scorcher');
});

it('should fall back to single-line property type if unrecognised type is found', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { Injectable, inject } from '@angular/core';
import { Injectable } from '@angular/core';
import {
CardViewItemProperties,
CardViewItem,
Expand All @@ -29,7 +29,7 @@ import {
MultiValuePipe,
AppConfigService,
DecimalNumberPipe,
NotificationService
LogService
} from '@alfresco/adf-core';
import { Property, CardViewGroup, OrganisedPropertyGroup } from '../interfaces/content-metadata.interfaces';
import { of } from 'rxjs';
Expand All @@ -51,12 +51,12 @@ export const RECOGNISED_ECM_TYPES = [D_TEXT, D_MLTEXT, D_DATE, D_DATETIME, D_INT
providedIn: 'root'
})
export class PropertyGroupTranslatorService {
private notificationService = inject(NotificationService);
valueSeparator: string;

constructor(private multiValuePipe: MultiValuePipe,
private decimalNumberPipe: DecimalNumberPipe,
private appConfig: AppConfigService) {
private appConfig: AppConfigService,
private logService: LogService) {
this.valueSeparator = this.appConfig.get<string>('content-metadata.multi-value-pipe-separator');
}

Expand Down Expand Up @@ -187,7 +187,7 @@ export class PropertyGroupTranslatorService {

private checkECMTypeValidity(ecmPropertyType: string) {
if (RECOGNISED_ECM_TYPES.indexOf(ecmPropertyType) === -1) {
this.notificationService.showError(`Unknown type for mapping: ${ecmPropertyType}`);
this.logService.error(`Unknown type for mapping: ${ecmPropertyType}`);
}
}

Expand Down
Loading