Skip to content

Commit d69ab98

Browse files
committed
Add item-assets and render extensions plugins
1 parent b73bd2c commit d69ab98

File tree

6 files changed

+575
-15
lines changed

6 files changed

+575
-15
lines changed

packages/data-plugins/lib/collections/core.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ export class PluginCore extends Plugin {
1313
editSchema(): SchemaFieldObject {
1414
return {
1515
type: 'root',
16-
// required: [
17-
// 'id',
18-
// 'description',
19-
// 'license',
20-
// 'spatial',
21-
// 'temporal',
22-
// 'links'
23-
// ],
16+
required: [
17+
'id',
18+
'description',
19+
'license',
20+
'spatial',
21+
'temporal',
22+
'links'
23+
],
2424
properties: {
2525
...fieldIf(this.isNew, 'id', {
2626
label: 'Collection ID',
@@ -37,14 +37,23 @@ export class PluginCore extends Plugin {
3737
keywords: {
3838
type: 'array',
3939
label: 'Keywords',
40+
'ui:widget': 'tagger',
4041
items: {
4142
label: 'Keyword',
4243
type: 'string'
4344
}
4445
},
4546
license: {
4647
label: 'License',
47-
type: 'string'
48+
type: 'string',
49+
'ui:widget': 'tagger',
50+
enum: [
51+
['Apache-2.0', 'Apache License 2.0'],
52+
['MIT', 'MIT License'],
53+
['GPL-3.0', 'GNU General Public License v3.0'],
54+
['BSD-3-Clause', 'BSD 3-Clause License'],
55+
['MPL-2.0', 'Mozilla Public License 2.0']
56+
]
4857
},
4958
providers: {
5059
type: 'array',
@@ -127,7 +136,7 @@ export class PluginCore extends Plugin {
127136
minItems: 1,
128137
items: {
129138
type: 'object',
130-
// required: ['rel', 'href'],
139+
required: ['rel', 'href'],
131140
properties: {
132141
href: {
133142
label: 'URL',
@@ -182,7 +191,7 @@ export class PluginCore extends Plugin {
182191
label: 'Assets',
183192
items: {
184193
type: 'object',
185-
// required: ['id', 'href'],
194+
required: ['id', 'href'],
186195
properties: {
187196
id: {
188197
label: 'Id',
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { Plugin, SchemaFieldObject } from '@stac-manager/data-core';
2+
import { array2Object, object2Array } from '../utils';
3+
4+
export class PluginItemAssets extends Plugin {
5+
name = 'Item Assets';
6+
7+
editSchema(): SchemaFieldObject {
8+
return {
9+
type: 'root',
10+
properties: {
11+
item_assets: {
12+
type: 'array',
13+
label: 'Item Assets',
14+
minItems: 1,
15+
items: {
16+
type: 'object',
17+
required: ['id'],
18+
properties: {
19+
id: {
20+
label: 'Item Asset ID',
21+
type: 'string'
22+
},
23+
type: {
24+
label: 'Type',
25+
type: 'string'
26+
},
27+
title: {
28+
label: 'Title',
29+
type: 'string'
30+
},
31+
description: {
32+
label: 'Description',
33+
type: 'string'
34+
},
35+
roles: {
36+
label: 'Roles',
37+
type: 'array',
38+
'ui:widget': 'tagger',
39+
items: {
40+
label: 'Role',
41+
type: 'string',
42+
enum: [
43+
['thumbnail', 'Thumbnail'],
44+
['overview', 'Overview'],
45+
['data', 'Data'],
46+
['metadata', 'Metadata']
47+
]
48+
}
49+
}
50+
}
51+
}
52+
}
53+
}
54+
};
55+
}
56+
57+
enterData(data: any = {}) {
58+
return {
59+
item_assets: object2Array(data.item_assets, 'id')
60+
};
61+
}
62+
63+
exitData(data: any) {
64+
return {
65+
item_assets: array2Object(data.item_assets, 'id')
66+
};
67+
}
68+
}

0 commit comments

Comments
 (0)