Skip to content

Commit

Permalink
chore(frontend): Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nagyszabi committed Oct 3, 2024
1 parent 695bc23 commit a1368fd
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('NorthDetailComponent', () => {
oibusId: 'id',
oibusName: 'name'
};
const testTransformerDtos: TransformerDTO[] = [
const testTransformerDtos: Array<TransformerDTO> = [
{
id: 't1',
name: 'transformer 1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h4 class="modal-title" [translate]="'transformers.edit-transformer-modal.' + mo
<div class="form-group">
<label class="form-label" for="name" translate="transformers.name"></label>
<input formControlName="name" id="name" class="form-control" />
<val-errors controlName="name"></val-errors>
<val-errors controlName="name" />
</div>
</div>

Expand All @@ -20,7 +20,7 @@ <h4 class="modal-title" [translate]="'transformers.edit-transformer-modal.' + mo
<div class="form-group">
<label class="form-label" for="fileRegex" translate="transformers.fileRegex"></label>
<input formControlName="fileRegex" id="fileRegex" class="form-control" />
<val-errors controlName="fileRegex"></val-errors>
<val-errors controlName="fileRegex" />
</div>
</div>
}
Expand All @@ -31,20 +31,20 @@ <h4 class="modal-title" [translate]="'transformers.edit-transformer-modal.' + mo
<div class="form-group">
<label class="form-label" for="description" translate="transformers.description"></label>
<input formControlName="description" id="description" class="form-control" />
<val-errors controlName="description"></val-errors>
<val-errors controlName="description" />
</div>
</div>

<div class="row">
<oib-code-block key="tranformer-code-block" formControlName="code" contentType="javascript" />
<val-errors controlName="code"></val-errors>
<val-errors controlName="code" />
</div>
</form>
</div>
}
<div class="modal-footer">
<div class="btn-group">
<oib-save-button form="form" [state]="state"></oib-save-button>
<oib-save-button form="form" [state]="state" />
<button type="button" class="btn btn-cancel" (click)="cancel()" translate="common.cancel" id="cancel-button"></button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const testManifest: NorthConnectorManifest = {
]
} as NorthConnectorManifest;

const testTransformerDtos: TransformerDTO[] = [
const testTransformerDtos: Array<TransformerDTO> = [
{
id: 't1',
name: 'transformer 1',
Expand All @@ -42,7 +42,7 @@ const testTransformerDtos: TransformerDTO[] = [
const mockVoid = '' as any;

@Component({
template: `<oib-north-transformers [transformersManifest]="manifest.transformers" [northId]="northId"></oib-north-transformers>`,
template: `<oib-north-transformers [transformersManifest]="manifest.transformers" [northId]="northId" />`,
standalone: true,
imports: [NorthTransformersComponent]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { EditTransformerModalComponent } from './edit-transformer-modal/edit-tra
import { NotificationService } from '../../shared/notification.service';
import { forkJoin } from 'rxjs';

type Selectable<TValue = any> = { value: TValue; selected: boolean };
interface Selectable<TValue = any> {
value: TValue;
selected: boolean;
}
export type TableState = Array<{
input: string;
outputs: Array<Selectable<string>>;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/services/north-connector.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ describe('NorthConnectorService', () => {
});

it('should get transformers for a North', () => {
const mockTransformers: TransformerDTO[] = [
const mockTransformers: Array<TransformerDTO> = [
{ id: 'transformer1', name: 'Transformer 1' } as TransformerDTO,
{ id: 'transformer2', name: 'Transformer 2' } as TransformerDTO
];
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/app/services/transformer.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('TransformerService', () => {

describe('list', () => {
it('should get all transformers', () => {
const mockTransformers: TransformerDTO[] = [
const mockTransformers: Array<TransformerDTO> = [
{ id: '1', name: 'Transformer 1' } as TransformerDTO,
{ id: '2', name: 'Transformer 2' } as TransformerDTO
];
Expand All @@ -38,7 +38,7 @@ describe('TransformerService', () => {
});

it('should get transformers for a north connector', () => {
const mockTransformers: TransformerDTO[] = [{ id: '1', name: 'North Transformer' } as TransformerDTO];
const mockTransformers: Array<TransformerDTO> = [{ id: '1', name: 'North Transformer' } as TransformerDTO];
const northId = 'north1';

service.list({}, { northId }).subscribe(transformers => {
Expand All @@ -50,7 +50,7 @@ describe('TransformerService', () => {
});

it('should get transformers for a south connector', () => {
const mockTransformers: TransformerDTO[] = [{ id: '1', name: 'South Transformer' } as TransformerDTO];
const mockTransformers: Array<TransformerDTO> = [{ id: '1', name: 'South Transformer' } as TransformerDTO];
const southId = 'south1';

service.list({}, { southId }).subscribe(transformers => {
Expand All @@ -62,7 +62,7 @@ describe('TransformerService', () => {
});

it('should get transformers for a history query with north connector type', () => {
const mockTransformers: TransformerDTO[] = [{ id: '1', name: 'History North Transformer' } as TransformerDTO];
const mockTransformers: Array<TransformerDTO> = [{ id: '1', name: 'History North Transformer' } as TransformerDTO];
const historyId = 'history1';
const connectorType = 'north';

Expand All @@ -75,7 +75,7 @@ describe('TransformerService', () => {
});

it('should get transformers for a history query with south connector type', () => {
const mockTransformers: TransformerDTO[] = [{ id: '1', name: 'History South Transformer' } as TransformerDTO];
const mockTransformers: Array<TransformerDTO> = [{ id: '1', name: 'History South Transformer' } as TransformerDTO];
const historyId = 'history1';
const connectorType = 'south';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Component, Input, TemplateRef, ViewChild } from '@angular/core';

@Component({
selector: 'oib-rich-select-option',
template: '<ng-template><ng-content></ng-content></ng-template>',
template: '<ng-template><ng-content /></ng-template>',
standalone: true
})
export class RichSelectOptionComponent {
@ViewChild(TemplateRef, { static: true }) contentTemplateRef!: TemplateRef<any>;
@Input() selectable: boolean = true;
@Input() selectable = true;

@Input() value: any;
@Input() label = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
>
<!-- Option has custom content -->
<div class="rich-content-wrapper" #richContentWrapper>
<ng-container *ngTemplateOutlet="option.contentTemplateRef"></ng-container>
<ng-container *ngTemplateOutlet="option.contentTemplateRef" />
</div>

<!-- Option does not have custom content, just showing label -->
Expand Down
12 changes: 6 additions & 6 deletions shared/model/north-connector.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ interface NorthConnectorManifestBase<THandlesItems = boolean, TInputTypes extend
transformers?: Array<NorthTransformerDefinition<TInputTypes>>;
settings: Array<OibFormControl>;
}
export type NorthTransformerDefinition<TInputTypes extends string = string> = {
export interface NorthTransformerDefinition<TInputTypes extends string = string> {
type: 'standard' | 'custom';
inputType: OIBusContent['type'];
outputType: TInputTypes;
};
export type NorthInputDataDefinition<TInputTypes extends string = string> = {
}
export interface NorthInputDataDefinition<TInputTypes extends string = string> {
type: TInputTypes;
data: Joi.Schema;
};
export type NorthInputData<TInputTypes extends string = string> = {
}
export interface NorthInputData<TInputTypes extends string = string> {
type: TInputTypes;
data: any;
};
}

// When modes.items is set to true, require an items definition
export type NorthConnectorManifest<THandlesItems = boolean, TInputTypes extends string = string> = THandlesItems extends true
Expand Down

0 comments on commit a1368fd

Please sign in to comment.