Skip to content

Commit

Permalink
Merge pull request #626 from noi-techpark/feature/optimizationstags
Browse files Browse the repository at this point in the history
improving tag views
  • Loading branch information
RudiThoeni authored Oct 17, 2024
2 parents 95b8724 + b59a0b3 commit f359d07
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 44 deletions.
26 changes: 17 additions & 9 deletions databrowser/src/config/builder/tourism/echargingdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const echargingdataCategory = (
label_006: 'fault',
value_007: 'PLANNED',
label_007: 'planned',
editable: 'false',
readonly: 'true',
},
},
{
Expand All @@ -52,6 +54,8 @@ export const echargingdataCategory = (
label_002: 'private',
value_003: 'PRIVATE_WITHPUBLICACCESS',
label_003: 'private with public access',
editable: 'false',
readonly: 'true',
},
},
{
Expand All @@ -61,6 +65,9 @@ export const echargingdataCategory = (
enabled:
'AdditionalProperties.EchargingDataProperties.ChargingStationAccessible',
},
params: {
readonly: 'true',
},
},
{
title: 'Access type information',
Expand All @@ -78,13 +85,14 @@ export const echargingdataCategory = (
},
{
title: 'Charging plugs types',
component: CellComponent.ArrayEditableCell,
arrayMapping: {
targetPropertyName: 'items',
pathToParent:
component: CellComponent.ArrayCell,
objectMapping: {
items:
'AdditionalProperties.EchargingDataProperties.ChargingPistolTypes',
},
required: false,
params: {
separator: ', ',
},
},
],
},
Expand Down Expand Up @@ -189,14 +197,14 @@ export const echargingdataCategory = (
},
},
{
title: 'Width (m)',
title: 'Width (cm)',
component: CellComponent.StringCell,
objectMapping: {
text: 'AdditionalProperties.EchargingDataProperties.CarParkingSpaceNextToEachOther.Width',
},
},
{
title: 'Length (m)',
title: 'Length (cm)',
component: CellComponent.StringCell,
objectMapping: {
text: 'AdditionalProperties.EchargingDataProperties.CarParkingSpaceNextToEachOther.Length',
Expand Down Expand Up @@ -257,14 +265,14 @@ export const echargingdataCategory = (
},
},
{
title: 'Width (m)',
title: 'Width (cm)',
component: CellComponent.StringCell,
objectMapping: {
text: 'AdditionalProperties.EchargingDataProperties.CarParkingSpaceBehindEachOther.Width',
},
},
{
title: 'Length (m)',
title: 'Length (cm)',
component: CellComponent.StringCell,
objectMapping: {
text: 'AdditionalProperties.EchargingDataProperties.CarParkingSpaceBehindEachOther.Length',
Expand Down
9 changes: 6 additions & 3 deletions databrowser/src/config/builder/tourism/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
import { withOdhBaseUrl } from '../../utils';

export const tagCell = (mainentity?: string): PropertyConfig => {
const filterParam = mainentity == null ? '' : `?mainentity=${mainentity}`;
const filterParam =
mainentity == null
? ''
: `?validforentity=${mainentity}&fields=Id,TagName&pagesize=0`;
const url = withOdhBaseUrl('/v1/Tag') + filterParam;

return {
Expand All @@ -26,8 +29,8 @@ export const tagCell = (mainentity?: string): PropertyConfig => {

export const tagCategory = (mainentity?: string): DetailElements => {
return {
name: 'Tags (v2)',
slug: 'Tags (v2)',
name: 'Tags',
slug: 'Tags',
subcategories: [
{
name: '',
Expand Down
5 changes: 4 additions & 1 deletion databrowser/src/config/tourism/article/article.sharedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const articleSharedView = (): DetailViewConfig | EditViewConfig => ({
url: withOdhBaseUrl('/v1/ODHTag?mainentity=article'),
keySelector: 'Id',
labelSelector: 'TagName.{language}',
editable: 'false',
},
},
{
Expand All @@ -109,7 +110,9 @@ export const articleSharedView = (): DetailViewConfig | EditViewConfig => ({
pathToParent: 'TagIds',
},
params: {
url: withOdhBaseUrl('/v1/Tag?validforentity=article'),
url: withOdhBaseUrl(
'/v1/Tag?validforentity=article&fields=Id,TagName&pagesize=0'
),
keySelector: 'Id',
labelSelector: 'TagName.{language}',
},
Expand Down
64 changes: 33 additions & 31 deletions databrowser/src/config/tourism/eventShort/eventShort.sharedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
sourceSubCategoryWithDistinct,
licenseInfoCategory,
mappingCategory,
tagCategory,
} from '../../builder/tourism';
import { publishedOnCell } from '../../builder/tourism/publishedOn';
import { videoItemsCategory } from '../../builder/tourism/video';
Expand Down Expand Up @@ -142,36 +143,36 @@ export const eventShortSharedView = (): DetailViewConfig | EditViewConfig => ({
},
required: true,
},
{
title: 'Technology Fields',
component: CellComponent.TagReferenceCell,
arrayMapping: {
targetPropertyName: 'tags',
pathToParent: 'TechnologyFields',
},
params: {
url: withOdhBaseUrl(
'/v1/EventShortTypes?type=TechnologyFields'
),
labelSelector: 'TypeDesc.{language}',
keySelector: 'Key',
unique: 'true',
},
},
{
title: 'Tagging Fields',
component: CellComponent.TagReferenceCell,
arrayMapping: {
targetPropertyName: 'tags',
pathToParent: 'CustomTagging',
},
params: {
url: withOdhBaseUrl('/v1/EventShortTypes?type=CustomTagging'),
labelSelector: 'TypeDesc.{language}',
keySelector: 'Key',
unique: 'true',
},
},
// {
// title: 'Technology Fields',
// component: CellComponent.TagReferenceCell,
// arrayMapping: {
// targetPropertyName: 'tags',
// pathToParent: 'TechnologyFields',
// },
// params: {
// url: withOdhBaseUrl(
// '/v1/EventShortTypes?type=TechnologyFields'
// ),
// labelSelector: 'TypeDesc.{language}',
// keySelector: 'Key',
// unique: 'true',
// },
// },
// {
// title: 'Tagging Fields',
// component: CellComponent.TagReferenceCell,
// arrayMapping: {
// targetPropertyName: 'tags',
// pathToParent: 'CustomTagging',
// },
// params: {
// url: withOdhBaseUrl('/v1/EventShortTypes?type=CustomTagging'),
// labelSelector: 'TypeDesc.{language}',
// keySelector: 'Key',
// unique: 'true',
// },
// },
{
title: 'Room Management',
component: CellComponent.EditRoomBookedCell,
Expand All @@ -197,6 +198,7 @@ export const eventShortSharedView = (): DetailViewConfig | EditViewConfig => ({
},
],
},
tagCategory('eventshort'),
imageGalleryCategory(),
videoItemsCategory(),
eventDocumentCategory(),
Expand All @@ -217,7 +219,7 @@ export const eventShortSharedView = (): DetailViewConfig | EditViewConfig => ({
],
},
{
name: 'Deprecated',
name: '',
properties: [
{
title: 'Active',
Expand Down

0 comments on commit f359d07

Please sign in to comment.