Skip to content

Commit

Permalink
Merge pull request #537 from noi-techpark/development
Browse files Browse the repository at this point in the history
latest changes
  • Loading branch information
RudiThoeni authored Mar 5, 2024
2 parents 9aaa960 + eefabb3 commit bdca42c
Show file tree
Hide file tree
Showing 31 changed files with 328 additions and 100 deletions.
2 changes: 1 addition & 1 deletion databrowser/src/components/link/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later

export type Tone = 'primary' | 'text' | 'white';
export type Tone = 'primary' | 'text' | 'white' | 'none';

export type Variant = 'no-underline' | 'underline';
1 change: 1 addition & 0 deletions databrowser/src/components/link/useClassNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const toneClass: Record<Tone, string> = {
['primary']: 'text-green-500',
['text']: 'text-gray-900',
['white']: 'text-white',
['none']: '',
};

const variantClass: Record<Variant, string> = {
Expand Down
19 changes: 19 additions & 0 deletions databrowser/src/config/builder/tourism/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
PropertyConfig,
SubCategoryElement,
} from '../../../domain/datasets/config/types';
import { withOdhBaseUrl } from '../../utils';

export const sourceSubCategory = (): SubCategoryElement => ({
name: 'Source',
Expand All @@ -19,6 +20,24 @@ export const sourceSubCategory = (): SubCategoryElement => ({
],
});

export const sourceSubCategoryWithDistinct = (
mainentity: string
): SubCategoryElement => ({
name: 'Source',
properties: [
{
title: 'Source',
component: CellComponent.InputReferenceCell,
objectMapping: { value: 'Source' },
params: {
url: withOdhBaseUrl('/v1/Source?pagesize=-1&typelist=' + mainentity),
labelSelector: 'Name.{language}',
keySelector: 'Key',
},
},
],
});

export const sourceTableCell = (): PropertyConfig => ({
title: 'Source',
component: CellComponent.StringCell,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
locationCategory,
odhTagCategory,
shortnameCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
mainImageCell,
} from '../../builder/tourism';
import { mappingCategory } from '../../builder/tourism/mapping';
Expand Down Expand Up @@ -149,7 +149,7 @@ export const accommodationSharedView = ():
],
},
dataStatesSubCategory(),
sourceSubCategory(),
sourceSubCategoryWithDistinct('accommodation'),
],
},
{
Expand Down
4 changes: 2 additions & 2 deletions databrowser/src/config/tourism/article/article.sharedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
odhTagCategory,
seasonCategory,
shortnameCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
textInfoCategory,
} from '../../builder/tourism';
import { mappingCategory } from '../../builder/tourism/mapping';
Expand All @@ -36,7 +36,7 @@ export const articleSharedView = (): DetailViewConfig | EditViewConfig => ({
properties: [idReadOnlyCell()],
},
dataStatesSubCategory(),
sourceSubCategory(),
sourceSubCategoryWithDistinct('article'),
],
},
textInfoCategory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
locationCategoryDistrict,
odhTagCategory,
shortnameCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
textInfoCategory,
webcamCategory,
} from '../../builder/tourism';
Expand Down Expand Up @@ -65,7 +65,7 @@ export const districtSharedView = (): DetailViewConfig | EditViewConfig => ({
},
]),
},
sourceSubCategory(),
sourceSubCategoryWithDistinct('district'),
],
},
textInfoCategory(),
Expand Down
4 changes: 2 additions & 2 deletions databrowser/src/config/tourism/event/event.sharedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
imageGalleryCategory,
odhTagCategory,
shortnameWithLogoAndMainImageSubCategory,
sourceSubCategory,
sourceSubCategoryWithDistinct,
textInfoCategory,
licenseInfoCategory,
idReadOnlyCell,
Expand All @@ -41,7 +41,7 @@ export const eventSharedView = (): DetailViewConfig | EditViewConfig => ({
],
},
dataStatesSubCategory(),
sourceSubCategory(),
sourceSubCategoryWithDistinct('event'),
],
},
textInfoCategory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
licenseInfoCategory,
lastChangesCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
} from '../../builder/tourism';
import { publishedOnCell } from '../../builder/tourism/publishedOn';
import { withOdhBaseUrl } from '../../utils';
Expand Down Expand Up @@ -67,9 +68,18 @@ export const eventShortSharedView = (): DetailViewConfig | EditViewConfig => ({
},
{
name: 'Data states',
properties: [lastChangesCell(), publishedOnCell()],
properties: [
lastChangesCell(),
publishedOnCell(),
{
title: 'Active on Source',
component: CellComponent.ToggleCell,
objectMapping: { enabled: 'Active' },
},
],
},
sourceSubCategory(),
sourceSubCategoryWithDistinct('eventshort'),
],
},
{
Expand Down Expand Up @@ -109,6 +119,7 @@ export const eventShortSharedView = (): DetailViewConfig | EditViewConfig => ({
title: 'Room name',
component: CellComponent.StringCell,
objectMapping: { text: 'AnchorVenue' },
required: true,
},
{
title: 'Age From',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
mainImageCell,
odhTagCategory,
shortnameCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
textInfoCategory,
} from '../../builder/tourism';
import { withOdhBaseUrl } from '../../utils';
Expand Down Expand Up @@ -60,7 +60,7 @@ export const experienceAreaSharedView = ():
],
},
dataStatesSubCategory({ hasVisibleInSearch: true }),
sourceSubCategory(),
sourceSubCategoryWithDistinct('experiencearea'),
],
},
textInfoCategory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
odhTagCategory,
seasonCategory,
shortnameCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
textInfoCategory,
} from '../../builder/tourism';

Expand Down Expand Up @@ -91,7 +91,7 @@ export const gastronomySharedView = (): EditViewConfig | DetailViewConfig => ({
],
},
dataStatesSubCategory({ hasVisibleInSearch: true }),
sourceSubCategory(),
sourceSubCategoryWithDistinct('gastronomy'),
],
},
textInfoCategory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
idReadOnlyCell,
shortnameCell,
dataStatesSubCategory,
sourceSubCategoryWithDistinct,
} from '../../builder/tourism';
import { DEFAULT_DATE_FORMAT } from '../../utils';

Expand All @@ -36,6 +37,7 @@ export const measuringPointSharedView = ():
],
},
dataStatesSubCategory(),
sourceSubCategoryWithDistinct('measuringpoint'),
],
},
{
Expand Down
93 changes: 65 additions & 28 deletions databrowser/src/config/tourism/metaData/metaData.sharedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
idReadOnlyCell,
shortnameCell,
imageGalleryCategory,
licenseInfoCategory,
} from '../../builder/tourism';
import { withOdhBaseUrl } from '../../utils';

Expand Down Expand Up @@ -44,19 +45,6 @@ export const metaDataSharedView = (): DetailViewConfig | EditViewConfig => ({
),
},
},
{
title: 'Category',
component: CellComponent.CustomDataArrayCell,
arrayMapping: {
targetPropertyName: 'listItems',
pathToParent: 'Category',
},
params: {
url: withOdhBaseUrl(
'/v1/Distinct?odhtype=odhmetadata&fields=Category.[*]&rawsort=Category.[*]&getasarray=true'
),
},
},
{
title: 'Data Provider',
component: CellComponent.CustomDataArrayCell,
Expand All @@ -75,6 +63,33 @@ export const metaDataSharedView = (): DetailViewConfig | EditViewConfig => ({
component: CellComponent.ToggleCell,
objectMapping: { enabled: 'Deprecated' },
},
],
},
{
name: 'IDs',
properties: [idReadOnlyCell()],
},
{
name: 'Count',
properties: [
{
title: 'Count',
component: CellComponent.JsonCell,
objectMapping: { data: 'RecordCount' },
params: { usePreformatted: 'true' },
},
],
},
],
},
{
name: 'Api data',
slug: 'api-data',
subcategories: [
{
name: '',
properties: [
shortnameCell({ required: true }),
{
title: 'Base URL',
component: CellComponent.SelectWithOptionsCell,
Expand Down Expand Up @@ -110,11 +125,47 @@ export const metaDataSharedView = (): DetailViewConfig | EditViewConfig => ({
objectMapping: { text: 'ApiUrl' },
params: { readonly: 'true' },
},
{
title: 'Output',
component: CellComponent.DictionaryCell,
objectMapping: {
dictitems: 'Output',
},
},
{
title: 'Swagger URL',
component: CellComponent.UrlCell,
objectMapping: { text: 'SwaggerUrl' },
},
{
title: 'Type',
component: CellComponent.StringCell,
objectMapping: { text: 'Type' },
},
],
},
],
},
{
name: 'Additional data',
slug: 'additional-data',
subcategories: [
{
name: 'General data',
properties: [
{
title: 'Category',
component: CellComponent.CustomDataArrayCell,
arrayMapping: {
targetPropertyName: 'listItems',
pathToParent: 'Category',
},
params: {
url: withOdhBaseUrl(
'/v1/Distinct?odhtype=odhmetadata&fields=Category.[*]&rawsort=Category.[*]&getasarray=true'
),
},
},
{
title: 'Tags',
component: CellComponent.TagReferenceCell,
Expand All @@ -130,23 +181,9 @@ export const metaDataSharedView = (): DetailViewConfig | EditViewConfig => ({
},
],
},
{
name: 'IDs',
properties: [idReadOnlyCell()],
},
{
name: 'Count',
properties: [
{
title: 'Count',
component: CellComponent.JsonCell,
objectMapping: { data: 'RecordCount' },
params: { usePreformatted: 'true' },
},
],
},
],
},
imageGalleryCategory(),
licenseInfoCategory(),
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
mainImageCell,
odhTagCategory,
shortnameCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
textInfoCategory,
} from '../../builder/tourism';

Expand Down Expand Up @@ -67,7 +67,7 @@ export const metaRegionSharedView = (): DetailViewConfig | EditViewConfig => ({
],
},
dataStatesSubCategory({ hasVisibleInSearch: true }),
sourceSubCategory(),
sourceSubCategoryWithDistinct('metaregion'),
],
},
textInfoCategory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
odhTagCategory,
regionIdCell,
shortnameCell,
sourceSubCategory,
sourceSubCategoryWithDistinct,
textInfoCategory,
webcamCategory,
} from '../../builder/tourism';
Expand Down Expand Up @@ -85,7 +85,7 @@ export const municipalitySharedView = ():
],
},
dataStatesSubCategory({ hasVisibleInSearch: true }),
sourceSubCategory(),
sourceSubCategoryWithDistinct('municipality'),
],
},
textInfoCategory(),
Expand Down
Loading

0 comments on commit bdca42c

Please sign in to comment.