mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
chore: remove redundant code blocks from changes section
This commit is contained in:
@@ -1,54 +1,54 @@
|
||||
import { Injectable, Injector, Optional, SkipSelf } from '@angular/core';
|
||||
import { ActionHandler } from './action-handler.interface';
|
||||
import { FEATURE_ACTION_HANDLERS, ROOT_ACTION_HANDLERS } from './tokens';
|
||||
|
||||
@Injectable()
|
||||
export class CommandService {
|
||||
constructor(
|
||||
private injector: Injector,
|
||||
@Optional() @SkipSelf() private _parent: CommandService,
|
||||
) {}
|
||||
|
||||
async handleCommand<T>(command: string, data?: T): Promise<T> {
|
||||
const actions = this.getActions(command);
|
||||
|
||||
for (const action of actions) {
|
||||
const handler = this.getActionHandler(action);
|
||||
if (!handler) {
|
||||
console.error(
|
||||
'CommandService.handleCommand',
|
||||
'Action Handler does not exist',
|
||||
{ action },
|
||||
);
|
||||
throw new Error('Action Handler does not exist');
|
||||
}
|
||||
data = await handler.handler(data, this);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
getActions(command: string) {
|
||||
return command?.split('|') || [];
|
||||
}
|
||||
|
||||
getActionHandler(action: string): ActionHandler | undefined {
|
||||
const featureActionHandlers: ActionHandler[] = this.injector.get(
|
||||
FEATURE_ACTION_HANDLERS,
|
||||
[],
|
||||
);
|
||||
const rootActionHandlers: ActionHandler[] = this.injector.get(
|
||||
ROOT_ACTION_HANDLERS,
|
||||
[],
|
||||
);
|
||||
|
||||
let handler = [...featureActionHandlers, ...rootActionHandlers].find(
|
||||
(handler) => handler.action === action,
|
||||
);
|
||||
|
||||
if (this._parent && !handler) {
|
||||
handler = this._parent.getActionHandler(action);
|
||||
}
|
||||
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
import { Injectable, Injector, Optional, SkipSelf } from '@angular/core';
|
||||
import { ActionHandler } from './action-handler.interface';
|
||||
import { FEATURE_ACTION_HANDLERS, ROOT_ACTION_HANDLERS } from './tokens';
|
||||
|
||||
@Injectable()
|
||||
export class CommandService {
|
||||
constructor(
|
||||
private injector: Injector,
|
||||
@Optional() @SkipSelf() private _parent: CommandService,
|
||||
) {}
|
||||
|
||||
async handleCommand<T>(command: string, data: T): Promise<T> {
|
||||
const actions = this.getActions(command);
|
||||
|
||||
for (const action of actions) {
|
||||
const handler = this.getActionHandler(action);
|
||||
if (!handler) {
|
||||
console.error(
|
||||
'CommandService.handleCommand',
|
||||
'Action Handler does not exist',
|
||||
{ action },
|
||||
);
|
||||
throw new Error('Action Handler does not exist');
|
||||
}
|
||||
data = await handler.handler(data, this);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
getActions(command: string) {
|
||||
return command?.split('|') || [];
|
||||
}
|
||||
|
||||
getActionHandler(action: string): ActionHandler | undefined {
|
||||
const featureActionHandlers: ActionHandler[] = this.injector.get(
|
||||
FEATURE_ACTION_HANDLERS,
|
||||
[],
|
||||
);
|
||||
const rootActionHandlers: ActionHandler[] = this.injector.get(
|
||||
ROOT_ACTION_HANDLERS,
|
||||
[],
|
||||
);
|
||||
|
||||
let handler = [...featureActionHandlers, ...rootActionHandlers].find(
|
||||
(handler) => handler.action === action,
|
||||
);
|
||||
|
||||
if (this._parent && !handler) {
|
||||
handler = this._parent.getActionHandler(action);
|
||||
}
|
||||
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,10 @@ import { PrinterType, Printer } from '../../models';
|
||||
import { InfoButtonComponent } from '@isa/ui/buttons';
|
||||
import { NgIcon } from '@ng-icons/core';
|
||||
|
||||
// Mock Scandit modules to avoid loading external dependencies
|
||||
jest.mock('scandit-web-datacapture-core', () => ({}));
|
||||
jest.mock('scandit-web-datacapture-barcode', () => ({}));
|
||||
|
||||
describe('PrintButtonComponent', () => {
|
||||
let spectator: Spectator<PrintButtonComponent>;
|
||||
let printServiceMock: jest.Mocked<PrintService>;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
export * from './lib/facades';
|
||||
export * from './lib/constants';
|
||||
export * from './lib/models';
|
||||
export * from './lib/schemas';
|
||||
export * from './lib/resources';
|
||||
export * from './lib/helpers';
|
||||
export * from './lib/schemas';
|
||||
export * from './lib/services';
|
||||
export * from './lib/stores';
|
||||
|
||||
@@ -66,7 +66,7 @@ describe('TextInputDialogComponent', () => {
|
||||
});
|
||||
|
||||
it('should render the dialog message', () => {
|
||||
expect(spectator.query('[data-what="message"]')).toHaveText(
|
||||
expect(spectator.query('[data-which="dialog-message"]')).toHaveText(
|
||||
'Please enter your name',
|
||||
);
|
||||
});
|
||||
|
||||
77041
package-lock.json
generated
77041
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user