Skip to content

Commit 6a87237

Browse files
authored
HTM-1738: Configure feature type attachment attributes (#1056)
2 parents ba2cd2c + 24f2506 commit 6a87237

15 files changed

+580
-17
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import { AttributeSettingsModel } from './attribute-settings.model';
22
import { FeatureTypeTemplateModel } from './feature-type-template.model';
33

4+
export interface AttachmentAttributeModel {
5+
attributeName: string;
6+
mimeType: string | null;
7+
maxAttachmentSize: number | null;
8+
}
9+
410
export interface FeatureTypeSettingsModel {
511
template?: FeatureTypeTemplateModel;
612
attributeOrder?: string[];
713
hideAttributes?: string[];
814
readOnlyAttributes?: string[];
915
attributeSettings?: Record<string, AttributeSettingsModel>;
16+
attachmentAttributes?: AttachmentAttributeModel[];
1017
}

projects/admin-core/assets/locale/messages.admin-core.de.xlf

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,10 @@
706706
<source>Because this service requires authentication and is proxied, this service is not accessible without logging in. This is a security measure to prevent inadvertently exposing a layer with sensitive data to everyone.</source>
707707
<target>Da dieser Dienst eine Authentifizierung erfordert und über einen Proxy läuft, ist er ohne Anmeldung nicht zugänglich. Dies ist eine Sicherheitsmaßnahme, um zu verhindern, dass eine Ebene mit sensiblen Daten versehentlich für jeden freigegeben wird.</target>
708708
</trans-unit>
709+
<trans-unit id="admin-core.catalog.add-attachment-attribute-button" datatype="html">
710+
<source>Add Attachment Attribute</source>
711+
<target>Anhang-Attribut hinzufügen</target>
712+
</trans-unit>
709713
<trans-unit id="admin-core.catalog.add-feature-source" datatype="html">
710714
<source>Add feature source</source>
711715
<target>Featurequelle hinzufügen</target>
@@ -718,10 +722,30 @@
718722
<source>Add map service</source>
719723
<target>Kartendienst hinzufügen</target>
720724
</trans-unit>
725+
<trans-unit id="admin-core.catalog.attachment-attributes" datatype="html">
726+
<source>Attachment attributes</source>
727+
<target>Attachment attributes</target>
728+
</trans-unit>
721729
<trans-unit id="admin-core.catalog.attribute" datatype="html">
722730
<source>Attribute</source>
723731
<target>Attribute</target>
724732
</trans-unit>
733+
<trans-unit id="admin-core.catalog.attribute-name-duplicate-error" datatype="html">
734+
<source>Attribute name must be unique</source>
735+
<target>Der Attributname muss eindeutig sein.</target>
736+
</trans-unit>
737+
<trans-unit id="admin-core.catalog.attribute-name-header" datatype="html">
738+
<source>Attribute Name *</source>
739+
<target>Attributname *</target>
740+
</trans-unit>
741+
<trans-unit id="admin-core.catalog.attribute-name-placeholder" datatype="html">
742+
<source>Enter attribute name</source>
743+
<target>Attributname eingeben</target>
744+
</trans-unit>
745+
<trans-unit id="admin-core.catalog.attribute-name-required-error" datatype="html">
746+
<source>Attribute name is required</source>
747+
<target>Attributname ist erforderlich</target>
748+
</trans-unit>
725749
<trans-unit id="admin-core.catalog.attribute-reorder-hint" datatype="html">
726750
<source>Use the three bars and the end of the row to re-order attributes. Hold Ctrl / Cmd (Mac) to select multiple rows to re-order together</source>
727751
<target>Verwenden Sie die drei Balken am Ende der Zeile, um Attribute neu anzuordnen. Halten Sie Ctrl / Cmd (Mac) gedrückt, um mehrere Zeilen zusammen neu anzuordnen.</target>
@@ -1034,10 +1058,30 @@
10341058
<source>Available projections for this layer</source>
10351059
<target>Verfügbare Projektionen für diesen Ebene</target>
10361060
</trans-unit>
1061+
<trans-unit id="admin-core.catalog.max-size-header" datatype="html">
1062+
<source>Max Size (MB)</source>
1063+
<target>Max. Größe (MB)</target>
1064+
</trans-unit>
1065+
<trans-unit id="admin-core.catalog.max-size-min-error" datatype="html">
1066+
<source>Size must be positive</source>
1067+
<target>Größe muss positiv sein</target>
1068+
</trans-unit>
1069+
<trans-unit id="admin-core.catalog.max-size-placeholder" datatype="html">
1070+
<source>e.g. 2</source>
1071+
<target>z.B. 2</target>
1072+
</trans-unit>
10371073
<trans-unit id="admin-core.catalog.max-zoom-level" datatype="html">
10381074
<source>Maximum zoom level</source>
10391075
<target>Maximales Zoomniveau</target>
10401076
</trans-unit>
1077+
<trans-unit id="admin-core.catalog.mime-type-header" datatype="html">
1078+
<source>MIME Type</source>
1079+
<target>MIME-Typ</target>
1080+
</trans-unit>
1081+
<trans-unit id="admin-core.catalog.mime-type-placeholder" datatype="html">
1082+
<source>e.g. application/pdf</source>
1083+
<target>z.B. application/pdf</target>
1084+
</trans-unit>
10411085
<trans-unit id="admin-core.catalog.min-zoom-level" datatype="html">
10421086
<source>Minimum zoom level</source>
10431087
<target>Minimales Zoomniveau</target>

projects/admin-core/assets/locale/messages.admin-core.en.xlf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@
530530
<trans-unit id="admin-core.catalog.access-restriction-hint" datatype="html">
531531
<source>Because this service requires authentication and is proxied, this service is not accessible without logging in. This is a security measure to prevent inadvertently exposing a layer with sensitive data to everyone.</source>
532532
</trans-unit>
533+
<trans-unit id="admin-core.catalog.add-attachment-attribute-button" datatype="html">
534+
<source>Add Attachment Attribute</source>
535+
</trans-unit>
533536
<trans-unit id="admin-core.catalog.add-feature-source" datatype="html">
534537
<source>Add feature source</source>
535538
</trans-unit>
@@ -539,9 +542,24 @@
539542
<trans-unit id="admin-core.catalog.add-map-service" datatype="html">
540543
<source>Add map service</source>
541544
</trans-unit>
545+
<trans-unit id="admin-core.catalog.attachment-attributes" datatype="html">
546+
<source>Attachment attributes</source>
547+
</trans-unit>
542548
<trans-unit id="admin-core.catalog.attribute" datatype="html">
543549
<source>Attribute</source>
544550
</trans-unit>
551+
<trans-unit id="admin-core.catalog.attribute-name-duplicate-error" datatype="html">
552+
<source>Attribute name must be unique</source>
553+
</trans-unit>
554+
<trans-unit id="admin-core.catalog.attribute-name-header" datatype="html">
555+
<source>Attribute Name *</source>
556+
</trans-unit>
557+
<trans-unit id="admin-core.catalog.attribute-name-placeholder" datatype="html">
558+
<source>Enter attribute name</source>
559+
</trans-unit>
560+
<trans-unit id="admin-core.catalog.attribute-name-required-error" datatype="html">
561+
<source>Attribute name is required</source>
562+
</trans-unit>
545563
<trans-unit id="admin-core.catalog.attribute-reorder-hint" datatype="html">
546564
<source>Use the three bars and the end of the row to re-order attributes. Hold Ctrl / Cmd (Mac) to select multiple rows to re-order together</source>
547565
</trans-unit>
@@ -776,9 +794,24 @@
776794
<trans-unit id="admin-core.catalog.layer.crs" datatype="html">
777795
<source>Available projections for this layer</source>
778796
</trans-unit>
797+
<trans-unit id="admin-core.catalog.max-size-header" datatype="html">
798+
<source>Max Size (MB)</source>
799+
</trans-unit>
800+
<trans-unit id="admin-core.catalog.max-size-min-error" datatype="html">
801+
<source>Size must be positive</source>
802+
</trans-unit>
803+
<trans-unit id="admin-core.catalog.max-size-placeholder" datatype="html">
804+
<source>e.g. 2</source>
805+
</trans-unit>
779806
<trans-unit id="admin-core.catalog.max-zoom-level" datatype="html">
780807
<source>Maximum zoom level</source>
781808
</trans-unit>
809+
<trans-unit id="admin-core.catalog.mime-type-header" datatype="html">
810+
<source>MIME Type</source>
811+
</trans-unit>
812+
<trans-unit id="admin-core.catalog.mime-type-placeholder" datatype="html">
813+
<source>e.g. application/pdf</source>
814+
</trans-unit>
782815
<trans-unit id="admin-core.catalog.min-zoom-level" datatype="html">
783816
<source>Minimum zoom level</source>
784817
</trans-unit>

projects/admin-core/assets/locale/messages.admin-core.nl.xlf

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@
705705
<source>Because this service requires authentication and is proxied, this service is not accessible without logging in. This is a security measure to prevent inadvertently exposing a layer with sensitive data to everyone.</source>
706706
<target>Omdat deze service beveiligd is en geproxied wordt, is deze niet toegankelijk zonder in te loggen. Dit is een beveiligingsmaatregel om te voorkomen dat onbedoeld gevoelige lagen voor iedereen geopenbaard worden.</target>
707707
</trans-unit>
708+
<trans-unit id="admin-core.catalog.add-attachment-attribute-button" datatype="html">
709+
<source>Add Attachment Attribute</source>
710+
<target>Bijlage-attribuut toevoegen</target>
711+
</trans-unit>
708712
<trans-unit id="admin-core.catalog.add-feature-source" datatype="html">
709713
<source>Add feature source</source>
710714
<target>Feature source toevoegen</target>
@@ -717,10 +721,30 @@
717721
<source>Add map service</source>
718722
<target>Kaartservice toevoegen</target>
719723
</trans-unit>
724+
<trans-unit id="admin-core.catalog.attachment-attributes" datatype="html">
725+
<source>Attachment attributes</source>
726+
<target>Bijlage-attributen</target>
727+
</trans-unit>
720728
<trans-unit id="admin-core.catalog.attribute" datatype="html">
721729
<source>Attribute</source>
722730
<target>Attribuut</target>
723731
</trans-unit>
732+
<trans-unit id="admin-core.catalog.attribute-name-duplicate-error" datatype="html">
733+
<source>Attribute name must be unique</source>
734+
<target>Attribuutnaam moet uniek zijn</target>
735+
</trans-unit>
736+
<trans-unit id="admin-core.catalog.attribute-name-header" datatype="html">
737+
<source>Attribute Name *</source>
738+
<target>Attribuutnaam *</target>
739+
</trans-unit>
740+
<trans-unit id="admin-core.catalog.attribute-name-placeholder" datatype="html">
741+
<source>Enter attribute name</source>
742+
<target>Voer attribuutnaam in</target>
743+
</trans-unit>
744+
<trans-unit id="admin-core.catalog.attribute-name-required-error" datatype="html">
745+
<source>Attribute name is required</source>
746+
<target>Attribuutnaam is verplicht</target>
747+
</trans-unit>
724748
<trans-unit id="admin-core.catalog.attribute-reorder-hint" datatype="html">
725749
<source>Use the three bars and the end of the row to re-order attributes. Hold Ctrl / Cmd (Mac) to select multiple rows to re-order together</source>
726750
<target>Gebruik de drie streepjes aan het einde van de rij om attributen opnieuw te ordenen. Houd Ctrl / Cmd (Mac) ingedrukt om meerdere rijen samen opnieuw te ordenen.</target>
@@ -1033,10 +1057,30 @@
10331057
<source>Available projections for this layer</source>
10341058
<target>Beschikbare projecties voor deze laag</target>
10351059
</trans-unit>
1060+
<trans-unit id="admin-core.catalog.max-size-header" datatype="html">
1061+
<source>Max Size (MB)</source>
1062+
<target>Max. grootte (MB)</target>
1063+
</trans-unit>
1064+
<trans-unit id="admin-core.catalog.max-size-min-error" datatype="html">
1065+
<source>Size must be positive</source>
1066+
<target>Grootte moet positief zijn</target>
1067+
</trans-unit>
1068+
<trans-unit id="admin-core.catalog.max-size-placeholder" datatype="html">
1069+
<source>e.g. 2</source>
1070+
<target>bijv. 2</target>
1071+
</trans-unit>
10361072
<trans-unit id="admin-core.catalog.max-zoom-level" datatype="html">
10371073
<source>Maximum zoom level</source>
10381074
<target>Maximaal zoomniveau</target>
10391075
</trans-unit>
1076+
<trans-unit id="admin-core.catalog.mime-type-header" datatype="html">
1077+
<source>MIME Type</source>
1078+
<target>MIME-type</target>
1079+
</trans-unit>
1080+
<trans-unit id="admin-core.catalog.mime-type-placeholder" datatype="html">
1081+
<source>e.g. application/pdf</source>
1082+
<target>bijv. application/pdf</target>
1083+
</trans-unit>
10401084
<trans-unit id="admin-core.catalog.min-zoom-level" datatype="html">
10411085
<source>Minimum zoom level</source>
10421086
<target>Minimaal zoomniveau</target>

projects/admin-core/src/lib/catalog/catalog.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ import { FeatureTypeFormDialogComponent } from './feature-type-form-dialog/featu
4141
import { CatalogShortcutButtonsComponent } from './catalog-shortcut-buttons/catalog-shortcut-buttons.component';
4242
import { FeatureTypeTemplateComponent } from './feature-type-template/feature-type-template.component';
4343
import { ProjectionAvailabilityComponent } from './projection-availability/projection-availability.component';
44+
import {
45+
FeatureTypeAttachmentAttributesComponent,
46+
} from './feature-type-attachment-attributes/feature-type-attachment-attributes.component';
4447

4548

4649
@NgModule({
@@ -71,6 +74,7 @@ import { ProjectionAvailabilityComponent } from './projection-availability/proje
7174
FeatureSourceUsedDialogComponent,
7275
CatalogItemsInFolderDialogComponent,
7376
FeatureTypeAttributesComponent,
77+
FeatureTypeAttachmentAttributesComponent,
7478
CatalogShortcutButtonsComponent,
7579
FeatureTypeTemplateComponent,
7680
ProjectionAvailabilityComponent,
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.add-button-container {
2+
margin-bottom: 20px;
3+
}
4+
5+
.add-button-container button mat-icon {
6+
margin-right: 8px;
7+
}
8+
9+
.table-container {
10+
overflow-x: auto;
11+
margin-bottom: 20px;
12+
}
13+
14+
mat-header-cell {
15+
font-weight: bold;
16+
}
17+
18+
.table-container table mat-form-field {
19+
width: 100%;
20+
}
21+
22+
.mat-column-actions,
23+
.mat-column-label-actions,
24+
.mat-column-drag,
25+
.mat-column-label-drag {
26+
flex: 0 0 90px;
27+
}
28+
29+
.mat-column-maxAttachmentSize,
30+
.mat-column-label-maxAttachmentSize {
31+
flex: 0 0 200px;
32+
}
33+
34+
.drag-handle {
35+
cursor: move;
36+
user-select: none;
37+
}
38+
39+
40+
.cdk-drag-preview {
41+
box-sizing: border-box;
42+
border-radius: 4px;
43+
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
44+
0 8px 10px 1px rgba(0, 0, 0, 0.14),
45+
0 3px 14px 2px rgba(0, 0, 0, 0.12);
46+
opacity: 0.8;
47+
background: white;
48+
}
49+
50+
.cdk-drag-animating {
51+
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
52+
}
53+
54+
.cdk-drop-list-dragging .mat-mdc-row:not(.cdk-drag-placeholder) {
55+
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
56+
}
57+
58+
.cdk-drag-placeholder {
59+
opacity: 0;
60+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<div class="attachment-attributes-container">
2+
<form [formGroup]="attachmentForm">
3+
<div class="add-button-container">
4+
<button mat-flat-button color="primary" type="button" (click)="addAttribute()">
5+
<mat-icon svgIcon="plus"></mat-icon>
6+
<span i18n="@@admin-core.catalog.add-attachment-attribute-button">Add Attachment Attribute</span>
7+
</button>
8+
</div>
9+
10+
<div class="table-container" formArrayName="attributes">
11+
<table mat-table
12+
[dataSource]="dataSource"
13+
cdkDropList
14+
(cdkDropListDropped)="drop($event)"
15+
[cdkDropListDisabled]="dragDropDisabled()"
16+
[cdkDropListData]="dataSource.data">
17+
18+
<!-- Attribute Name Column -->
19+
<ng-container matColumnDef="attributeName">
20+
<mat-header-cell *matHeaderCellDef i18n="@@admin-core.catalog.attribute-name-header">Attribute Name *</mat-header-cell>
21+
<mat-cell *matCellDef="let element; let i = index">
22+
<mat-form-field [formGroupName]="i">
23+
<input matInput formControlName="attributeName" i18n-placeholder="@@admin-core.catalog.attribute-name-placeholder" placeholder="Enter attribute name">
24+
@if (attributes.at(i).get('attributeName')?.hasError('required')) {
25+
<mat-error i18n="@@admin-core.catalog.attribute-name-required-error">Attribute name is required</mat-error>
26+
}
27+
@if (attributes.at(i).get('attributeName')?.hasError('duplicate')) {
28+
<mat-error i18n="@@admin-core.catalog.attribute-name-duplicate-error">Attribute name must be unique</mat-error>
29+
}
30+
</mat-form-field>
31+
</mat-cell>
32+
</ng-container>
33+
34+
<!-- MIME Type Column -->
35+
<ng-container matColumnDef="mimeType">
36+
<mat-header-cell *matHeaderCellDef i18n="@@admin-core.catalog.mime-type-header">MIME Type</mat-header-cell>
37+
<mat-cell *matCellDef="let element; let i = index">
38+
<mat-form-field [formGroupName]="i">
39+
<input matInput formControlName="mimeType" i18n-placeholder="@@admin-core.catalog.mime-type-placeholder" placeholder="e.g. application/pdf">
40+
</mat-form-field>
41+
</mat-cell>
42+
</ng-container>
43+
44+
<!-- Max Attachment Size Column -->
45+
<ng-container matColumnDef="maxAttachmentSize">
46+
<mat-header-cell *matHeaderCellDef i18n="@@admin-core.catalog.max-size-header">Max Size (MB)</mat-header-cell>
47+
<mat-cell *matCellDef="let element; let i = index">
48+
<mat-form-field [formGroupName]="i">
49+
<input matInput type="number" formControlName="maxAttachmentSize" i18n-placeholder="@@admin-core.catalog.max-size-placeholder" placeholder="e.g. 2">
50+
@if (attributes.at(i).get('maxAttachmentSize')?.hasError('min')) {
51+
<mat-error i18n="@@admin-core.catalog.max-size-min-error">Size must be positive</mat-error>
52+
}
53+
</mat-form-field>
54+
</mat-cell>
55+
</ng-container>
56+
57+
<!-- Actions Column -->
58+
<ng-container matColumnDef="actions">
59+
<mat-header-cell *matHeaderCellDef></mat-header-cell>
60+
<mat-cell *matCellDef="let element; let i = index">
61+
<button mat-icon-button color="warn" type="button" (click)="removeAttribute(i)">
62+
<mat-icon svgIcon="trash_filled"></mat-icon>
63+
</button>
64+
</mat-cell>
65+
</ng-container>
66+
67+
<ng-container matColumnDef="drag">
68+
<mat-header-cell *matHeaderCellDef></mat-header-cell>
69+
<mat-cell *matCellDef="let element; let i = index">
70+
<mat-icon cdkDragHandle
71+
(mousedown)="dragDropDisabled.set(false)"
72+
(mouseup)="dragDropDisabled.set(true)"
73+
class="drag-handle"
74+
svgIcon="reorder"></mat-icon>
75+
</mat-cell>
76+
</ng-container>
77+
78+
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
79+
<mat-row *matRowDef="let row; columns: displayedColumns;" cdkDrag></mat-row>
80+
</table>
81+
</div>
82+
</form>
83+
</div>

0 commit comments

Comments
 (0)