Skip to content

Commit ed3e836

Browse files
authored
Merge pull request #409 from Strongminds/feature/KITOSUDV-1012-localreference
Feature/kitosudv 1012 localreference
2 parents 6fbd76f + 06a4d69 commit ed3e836

4 files changed

Lines changed: 60 additions & 9 deletions

File tree

Presentation.Web/app/components/it-system/it-system-overview.controller.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,27 @@
306306
.withSourceValueEchoRendering()
307307
.withContentOverflow()
308308
.withSourceValueEchoExcelOutput())
309+
.withColumn(builder =>
310+
builder
311+
.withDataSourceName("LocalReferenceTitle")
312+
.withTitle("Lokal Reference")
313+
.withId("ReferenceId")
314+
.withStandardWidth(150)
315+
.withFilteringOperation(Utility.KendoGrid.KendoGridColumnFiltering.Contains)
316+
.withContentAlignment(Utility.KendoGrid.KendoColumnAlignment.Left)
317+
.withRendering(dataItem => Helpers.RenderFieldsHelper.renderReference(dataItem.LocalReferenceTitle, dataItem.LocalReferenceUrl))
318+
.withExcelOutput(dataItem => Helpers.ExcelExportHelper.renderReference(dataItem.LocalReferenceTitle, dataItem.LocalReferenceUrl)))
319+
.withColumn(builder =>
320+
builder
321+
.withDataSourceName("LocalReferenceDocumentId")
322+
.withTitle("Dokument ID / Sagsnr.")
323+
.withId("folderref")
324+
.withStandardWidth(150)
325+
.withFilteringOperation(Utility.KendoGrid.KendoGridColumnFiltering.Contains)
326+
.withInitialVisibility(false)
327+
.withContentAlignment(Utility.KendoGrid.KendoColumnAlignment.Center)
328+
.withSourceValueEchoRendering()
329+
.withSourceValueEchoExcelOutput())
309330
.withColumn(builder =>
310331
builder
311332
.withDataSourceName("ItSystemRightsHolderName")
@@ -316,7 +337,6 @@
316337
.withSourceValueEchoRendering()
317338
.withSourceValueEchoExcelOutput());
318339

319-
320340
//Launch kendo grid
321341
launcher.launch();
322342
}

Presentation.Web/app/helpers/RenderFieldsHelper.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@
1414

1515
static renderReference(referenceTitle: string, referenceUrl: string) {
1616
if (referenceTitle === null || _.isUndefined(referenceTitle)) {
17-
if (Utility.Validation.isValidExternalReference(referenceUrl)) {
18-
return `<a target="_blank" style="float:left;" href="${referenceUrl}">${referenceUrl}</a>`;
19-
} else {
20-
return RenderFieldsHelper.noValueFallback;
21-
}
17+
referenceTitle = referenceUrl;
2218
}
2319
if (Utility.Validation.isValidExternalReference(referenceUrl)) {
2420
return `<a target="_blank" style="float:left;" href="${referenceUrl}">${referenceTitle}</a>`;
2521
}
26-
return referenceTitle;
22+
return referenceTitle || this.noValueFallback;
2723
}
2824

2925
static renderReferenceUrl(reference: Models.Reference.IOdataReference) {

Presentation.Web/app/models/it-system-usage/it-system-usage-overview-readmodel.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,8 @@
3030
ItSystemBusinessTypeId: number | null;
3131
ItSystemBusinessTypeName: string | null;
3232
ItSystemTaskRefs: IItSystemUsageOverviewTaskRefReadModel[];
33+
LocalReferenceDocumentId: string | null;
34+
LocalReferenceUrl: string | null;
35+
LocalReferenceTitle: string | null;
3336
}
3437
}

Presentation.Web/app/utility/kendoGridLauncher.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ module Kitos.Utility.KendoGrid {
3535
optionalContext?: any;
3636
}
3737

38+
export enum KendoColumnAlignment {
39+
Left,
40+
Right,
41+
Center
42+
}
43+
3844
export interface IKendoGridColumnBuilder<TDataSource> {
3945
withId(id: string): IKendoGridColumnBuilder<TDataSource>;
4046
withDataSourceName(name: string): IKendoGridColumnBuilder<TDataSource>;
@@ -50,11 +56,11 @@ module Kitos.Utility.KendoGrid {
5056
withContentOverflow(): IKendoGridColumnBuilder<TDataSource>;
5157
withExcelOutput(excelOutput: (source: TDataSource) => string): IKendoGridColumnBuilder<TDataSource>;
5258
withSourceValueEchoExcelOutput(): IKendoGridColumnBuilder<TDataSource>;
59+
withContentAlignment(alignment: KendoColumnAlignment): IKendoGridColumnBuilder<TDataSource>;
5360
build(): IExtendedKendoGridColumn<TDataSource>;
5461
}
5562

5663
class KendoGridColumnBuilder<TDataSource> implements IKendoGridColumnBuilder<TDataSource> {
57-
5864
private standardWidth: number = 200;
5965
private dataSourceName: string = null;
6066
private title: string = null;
@@ -69,6 +75,12 @@ module Kitos.Utility.KendoGrid {
6975
private visible = true;
7076
private dataSourceType: KendoGridColumnDataSourceType = null;
7177
private contentOverflow : boolean | null = null;
78+
private contentAlignment : KendoColumnAlignment | null = null;
79+
80+
withContentAlignment(alignment: KendoColumnAlignment): IKendoGridColumnBuilder<TDataSource> {
81+
this.contentAlignment = alignment;
82+
return this;
83+
}
7284

7385
withContentOverflow(): IKendoGridColumnBuilder<TDataSource> {
7486
this.contentOverflow = true;
@@ -263,8 +275,28 @@ module Kitos.Utility.KendoGrid {
263275
const attributes = {
264276
"data-element-type": `${this.id}KendoObject`
265277
};
278+
279+
const classes : string[] = [];
266280
if (this.contentOverflow) {
267-
attributes["class"] = "might-overflow";
281+
classes.push("might-overflow");
282+
}
283+
if (this.contentAlignment != null) {
284+
switch (this.contentAlignment) {
285+
case KendoColumnAlignment.Left:
286+
classes.push("text-left");
287+
break;
288+
case KendoColumnAlignment.Right:
289+
classes.push("text-right");
290+
break;
291+
case KendoColumnAlignment.Center:
292+
classes.push("text-center");
293+
break;
294+
default:
295+
throw `Unsupported alignment type:${this.contentAlignment}`;
296+
}
297+
}
298+
if (classes.length > 0) {
299+
attributes["class"] = classes.join(" ");
268300
}
269301
return {
270302
field: this.dataSourceName,

0 commit comments

Comments
 (0)