Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Mirador annotations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IIIF
Mirador
Mirador annotations
Commits
36735c58
Commit
36735c58
authored
Feb 5, 2024
by
Anthony
Browse files
Options
Downloads
Patches
Plain Diff
WIP saving
parent
8a00a2e9
No related branches found
No related tags found
1 merge request
!10
Draft: MigratingAnnotationCreation to MUI5.
Pipeline
#1913
failed
Feb 5, 2024
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/AnnotationCreation.js
+4
-2
4 additions, 2 deletions
src/AnnotationCreation.js
src/AnnotationCreationUtils.js
+17
-19
17 additions, 19 deletions
src/AnnotationCreationUtils.js
with
21 additions
and
21 deletions
src/AnnotationCreation.js
+
4
−
2
View file @
36735c58
...
@@ -21,7 +21,7 @@ import { secondsToHMS } from './utils';
...
@@ -21,7 +21,7 @@ import { secondsToHMS } from './utils';
import
AnnotationFormContent
from
'
./annotationForm/AnnotationFormContent
'
;
import
AnnotationFormContent
from
'
./annotationForm/AnnotationFormContent
'
;
import
AnnotationFormTime
from
'
./annotationForm/AnnotationFormTime
'
;
import
AnnotationFormTime
from
'
./annotationForm/AnnotationFormTime
'
;
import
{
import
{
geomFromAnnoTarget
,
getSvg
,
saveAnnotation
,
timeFromAnnoTarget
,
geomFromAnnoTarget
,
getJPG
,
getSvg
,
saveAnnotation
,
timeFromAnnoTarget
,
}
from
'
./AnnotationCreationUtils
'
;
}
from
'
./AnnotationCreationUtils
'
;
import
AnnotationFormOverlay
from
'
./annotationForm/AnnotationFormOverlay/AnnotationFormOverlay.js
'
;
import
AnnotationFormOverlay
from
'
./annotationForm/AnnotationFormOverlay/AnnotationFormOverlay.js
'
;
...
@@ -338,10 +338,12 @@ function AnnotationCreation(props) {
...
@@ -338,10 +338,12 @@ function AnnotationCreation(props) {
}
=
state
;
}
=
state
;
// TODO rename variable for better comprenhension
// TODO rename variable for better comprenhension
const
svg
=
await
getSvg
(
props
.
windowId
);
const
svg
=
await
getSvg
(
props
.
windowId
);
// const jpg = await getJPG(props.windowId);
const
drawingImageExport
=
svg
;
const
t
=
(
tstart
&&
tend
)
?
`
${
tstart
}
,
${
tend
}
`
:
null
;
const
t
=
(
tstart
&&
tend
)
?
`
${
tstart
}
,
${
tend
}
`
:
null
;
const
body
=
{
value
:
(
!
textBody
.
length
&&
t
)
?
`
${
secondsToHMS
(
tstart
)}
->
${
secondsToHMS
(
tend
)}
`
:
textBody
};
const
body
=
{
value
:
(
!
textBody
.
length
&&
t
)
?
`
${
secondsToHMS
(
tstart
)}
->
${
secondsToHMS
(
tend
)}
`
:
textBody
};
saveAnnotation
(
canvases
,
config
,
receiveAnnotation
,
annotation
,
body
,
t
,
xywh
,
image
,
drawingStateSerialized
,
svg
,
tags
);
saveAnnotation
(
canvases
,
config
,
receiveAnnotation
,
annotation
,
body
,
t
,
xywh
,
image
,
drawingStateSerialized
,
drawingImageExport
,
tags
);
props
.
closeCompanionWindow
(
'
annotationCreation
'
,
{
props
.
closeCompanionWindow
(
'
annotationCreation
'
,
{
id
,
id
,
...
...
This diff is collapsed.
Click to expand it.
src/AnnotationCreationUtils.js
+
17
−
19
View file @
36735c58
...
@@ -5,6 +5,7 @@ import WebAnnotation from './WebAnnotation';
...
@@ -5,6 +5,7 @@ import WebAnnotation from './WebAnnotation';
//const fileUploaderUrl = 'https://scene-uploads.tetras-libre.fr/upload';
//const fileUploaderUrl = 'https://scene-uploads.tetras-libre.fr/upload';
const
fileUploaderUrl
=
'
http://localhost:3000/upload
'
;
const
fileUploaderUrl
=
'
http://localhost:3000/upload
'
;
const
fileReaderUrl
=
'
http://localhost:3000/static/
'
;
/** Extract time information from annotation target */
/** Extract time information from annotation target */
export
function
timeFromAnnoTarget
(
annotarget
)
{
export
function
timeFromAnnoTarget
(
annotarget
)
{
...
@@ -61,32 +62,30 @@ export async function getSvg(windowId) {
...
@@ -61,32 +62,30 @@ export async function getSvg(windowId) {
return
svg
;
return
svg
;
}
}
export
function
saveAnnotation
(
canvases
,
config
,
receiveAnnotation
,
annotation
,
body
,
t
,
xywh
,
image
,
drawingStateSerialized
,
svg
,
tags
)
{
export
async
function
getJPG
(
windowId
)
{
const
dumbAnnotation
=
{
const
stage
=
window
.
Konva
.
stages
.
find
((
s
)
=>
s
.
attrs
.
id
===
windowId
);
type
:
'
Annotation
'
,
const
jpg
=
await
stage
.
toImage
({
mimeType
:
'
image/jpeg
'
,
quality
:
1
});
motivation
:
'
commenting
'
,
console
.
log
(
'
JPG:
'
,
jpg
);
body
:
{
return
jpg
;
id
:
'
https://files.tetras-libre.fr/dev/Hakanai/media/02_HKN-couv.jpg
'
,
}
type
:
'
Image
'
,
format
:
'
image/jpg
'
,
export
async
function
saveAnnotation
(
canvases
,
config
,
receiveAnnotation
,
annotation
,
body
,
t
,
xywh
,
image
,
drawingStateSerialized
,
drawingImageExport
,
tags
)
{
},
console
.
log
(
'
Send file :
'
,
drawingImageExport
);
target
:
'
https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/canvas#xywh=0,0,301,400&t=0,1000
'
,
const
filename
=
await
sendFile
(
drawingImageExport
);
};
console
.
log
(
'
Send file :
'
,
svg
);
const
filename
=
sendFile
(
svg
);
canvases
.
forEach
(
async
(
canvas
)
=>
{
canvases
.
forEach
(
async
(
canvas
)
=>
{
const
storageAdapter
=
config
.
annotation
.
adapter
(
canvas
.
id
);
const
storageAdapter
=
config
.
annotation
.
adapter
(
canvas
.
id
);
const
anno
=
{
const
anno
=
{
body
:
{
body
:
{
id
:
filename
,
id
:
fileReaderUrl
+
filename
,
type
:
'
Image
'
,
type
:
'
Image
'
,
format
:
'
image/
jpg
'
,
format
:
'
image/
svg+xml
'
,
value
:
body
.
value
,
value
:
body
.
value
,
},
},
drawingState
:
drawingStateSerialized
,
drawingState
:
drawingStateSerialized
,
id
:
(
annotation
&&
annotation
.
id
)
||
`
${
uuid
()}
`
,
id
:
(
annotation
&&
annotation
.
id
)
||
`
${
uuid
()}
`
,
motivation
:
'
commenting
'
,
motivation
:
'
painting
'
,
target
:
`
${
canvas
.
id
}
#xywh=0,0,640,360&t=0,1000',`
,
type
:
'
Annotation
'
,
type
:
'
Annotation
'
,
};
};
...
@@ -109,8 +108,6 @@ const sendFile = async (fileContent) => {
...
@@ -109,8 +108,6 @@ const sendFile = async (fileContent) => {
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
blob
);
formData
.
append
(
'
file
'
,
blob
);
formData
.
append
(
'
filename
'
,
filename
);
try
{
try
{
...
@@ -124,6 +121,7 @@ const sendFile = async (fileContent) => {
...
@@ -124,6 +121,7 @@ const sendFile = async (fileContent) => {
console
.
log
(
'
File Uploaded
'
,
response
.
data
);
console
.
log
(
'
File Uploaded
'
,
response
.
data
);
return
response
.
data
.
file
.
filename
;
return
response
.
data
.
file
.
filename
;
}
catch
(
error
)
{
}
catch
(
error
)
{
return
''
;
console
.
error
(
'
Error uploading file:
'
,
error
);
console
.
error
(
'
Error uploading file:
'
,
error
);
}
}
};
};
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