Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sanity Exhibition Nansen
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
Utstillinger
Sanity Exhibition Nansen
Commits
2a46a368
Commit
2a46a368
authored
3 years ago
by
Tarje.Lavik
Browse files
Options
Downloads
Patches
Plain Diff
Fix error when parsing label langs
parent
418bfae3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
studio/plugins/import-tool/src/kulturnav/apis/getDocument.js
+10
-4
10 additions, 4 deletions
studio/plugins/import-tool/src/kulturnav/apis/getDocument.js
studio/plugins/import-tool/src/kulturnav/apis/index.js
+8
-8
8 additions, 8 deletions
studio/plugins/import-tool/src/kulturnav/apis/index.js
with
18 additions
and
12 deletions
studio/plugins/import-tool/src/kulturnav/apis/getDocument.js
+
10
−
4
View file @
2a46a368
import
{
nanoid
}
from
'
nanoid
'
import
{
nanoid
}
from
'
nanoid
'
import
{
mapLanguage
}
from
'
../../shared/mapLanguage
'
import
{
mapTypes
}
from
'
../../shared/mapTypes
'
const
getLabel
=
(
item
)
=>
{
const
{
caption
,
properties
}
=
item
const
{
[
'
*
'
]:
k
,
...
restCaption
}
=
caption
const
{
[
'
*
'
]:
k2
,
...
restName
}
=
properties
[
'
entity.name
'
][
0
].
value
console
.
log
(
restCaption
,
restName
)
return
{
label
:
{
_type
:
"
LocaleString
"
,
...
item
.
c
aption
??
''
,
...
item
.
properties
[
'
entity.name
'
][
0
]?.
valu
e
??
''
...
restC
aption
??
''
,
...
restNam
e
??
''
,
}
}
}
...
...
@@ -85,7 +91,7 @@ export const getDocument = (item) => {
...
getDescription
(
desc
)
]
}),
...(
item
.
entityType
!=
'
Concept
'
&&
{
hasType
:
mapTypes
([
item
.
entityType
])}),
...(
item
.
entityType
!=
'
Concept
'
&&
{
hasType
:
mapTypes
([
item
.
entityType
])
}),
// Which dataset does this belongs?
...(
item
.
properties
[
'
entity.dataset
'
]
&&
{
inDataset
:
{
...
...
This diff is collapsed.
Click to expand it.
studio/plugins/import-tool/src/kulturnav/apis/index.js
+
8
−
8
View file @
2a46a368
import
{
nanoid
}
from
'
nanoid
'
import
{
nanoid
}
from
'
nanoid
'
import
{
getDocument
}
from
'
./getDocument
'
import
sanityClient
from
'
part:@sanity/base/client
'
const
client
=
sanityClient
.
withConfig
({
apiVersion
:
'
2021-03-25
'
})
const
client
=
sanityClient
.
withConfig
({
apiVersion
:
'
2021-03-25
'
})
const
createDoc
=
async
(
doc
,
importTo
)
=>
{
if
(
!
doc
)
return
{
success
:
false
}
if
(
!
doc
)
return
{
success
:
false
}
let
importDoc
=
doc
if
(
importTo
)
{
importDoc
.
_type
=
importTo
if
(
importTo
)
{
importDoc
.
_type
=
importTo
}
const
transaction
=
client
.
transaction
()
...
...
@@ -29,7 +29,7 @@ const createDoc = async (doc, importTo) => {
export
const
chooseItem
=
async
(
item
,
importTo
)
=>
{
const
doc
=
getDocument
(
item
)
console
.
log
(
importTo
)
//
console.log(importTo)
/* TODO
Important to include iiif manifest in asset metadata as the asset could be reused else where in the dataset */
/* const assetMeta = {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment