Skip to content
Snippets Groups Projects
Commit d1a8b55d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-530 -> OZG-566 create file-shared lib; impl loading Attachments after vorgang loaded

parent 60fbf392
Branches
Tags
No related merge requests found
Showing
with 184 additions and 27 deletions
......@@ -512,6 +512,31 @@
}
}
}
},
"file-shared": {
"projectType": "library",
"root": "libs/file-shared",
"sourceRoot": "libs/file-shared/src",
"prefix": "goofy-client",
"architect": {
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/file-shared/src/**/*.ts",
"libs/file-shared/src/**/*.html"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/file-shared"],
"options": {
"jestConfig": "libs/file-shared/jest.config.js",
"passWithNoTests": true
}
}
}
}
},
"cli": {
......
......@@ -14,5 +14,6 @@ module.exports = {
'<rootDir>/libs/command-shared',
'<rootDir>/libs/wiedervorlage-shared',
'<rootDir>/libs/wiedervorlage',
'<rootDir>/libs/file-shared',
],
};
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"parserOptions": { "project": ["libs/file-shared/tsconfig.*?.json"] },
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "goofy-client",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{ "type": "element", "prefix": "goofy-client", "style": "kebab-case" }
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
]
}
# file-shared
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test file-shared` to execute the unit tests.
module.exports = {
displayName: 'file-shared',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},
},
},
coverageDirectory: '../../coverage/libs/file-shared',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],
};
export * from './lib/file-shared.module';
export * from './lib/file.linkrel';
export * from './lib/file.model';
import { TestBed } from '@angular/core/testing';
import { FileSharedModule } from './file-shared.module';
describe('FileSharedModule', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [FileSharedModule],
}).compileComponents();
});
it('should create', () => {
expect(FileSharedModule).toBeDefined();
});
});
\ No newline at end of file
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@NgModule({
imports: [CommonModule],
})
export class FileSharedModule {}
export enum FileLinkRel {
DOWNLOAD = 'download'
}
export enum FileListLinkRel {
FILE_LIST = 'fileList'
}
\ No newline at end of file
import { ListResource } from '@goofy-client/tech-shared';
import { Resource } from '@ngxp/rest';
export interface File {
name: string,
size: number
}
export interface FileResource extends File, Resource { }
export interface FileListResource extends ListResource { }
\ No newline at end of file
import 'jest-preset-angular';
import { FileListLinkRel } from '@goofy-client/file-shared';
import * as faker from 'faker';
import { File, FileResource } from '../src/lib/tech.model';
import { toResource } from './resource';
import { toResource } from 'libs/tech-shared/test/resource';
import { times } from 'lodash-es';
import { File, FileListResource, FileResource } from '../src/lib/file.model';
export function createFile(): File {
return {
......@@ -17,3 +18,9 @@ export function createFileResource(linkRelations: string[] = []): FileResource {
export function createFileResources(linkRelations: string[] = []): FileResource[] {
return times(10, () => toResource(createFileResource(), [...linkRelations]));
}
export function createFileListResource(linkRelations: string[] = []): FileListResource {
return toResource({}, [...linkRelations], {
[FileListLinkRel.FILE_LIST]: createFileResources()
})
}
\ No newline at end of file
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"include": ["**/*.ts"]
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
import { Resource } from '@ngxp/rest';
export interface ApiError {
issues: Issue[]
}
......@@ -15,14 +13,3 @@ export interface IssueParam {
name: string,
value: string;
}
export interface File {
name: string,
size: number
}
export enum FileLinkRel {
DOWNLOAD = 'download'
}
export interface FileResource extends File, Resource { }
<div class="files" *ngIf="vorgangWithEingang | hasLink: linkRel.ATTACHMENTS; else emptyAnhaenge">
<goofy-client-file *ngFor="let file of files" [fileResource]="file"></goofy-client-file>
</div>
<ng-template #emptyAnhaenge>
<p>keine Anhänge vorhanden</p>
</ng-template>
<div class="file" [matTooltip]="fileResource.name">
<mat-icon>file_present</mat-icon>
<span class="name">{{ fileResource.name }}</span>
<span class="size" [innerHTML]="fileResource.size | fileSize"></span>
</div>
<goofy-client-file *ngFor="let file of (attachmentList | toEmbeddedResources: fileListRel.FILE_LIST)" [file]="file"></goofy-client-file>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment