Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
dashboard
Commits
16958fd5
Commit
16958fd5
authored
10 months ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
fix: validate image license requirements
refs
#244
parent
585fd48e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/images/ImagePickerDialog.vue
+41
-31
41 additions, 31 deletions
src/components/images/ImagePickerDialog.vue
with
41 additions
and
31 deletions
src/components/images/ImagePickerDialog.vue
+
41
−
31
View file @
16958fd5
...
@@ -5,46 +5,48 @@
...
@@ -5,46 +5,48 @@
:title=
"t('imagePicker.title')"
:title=
"t('imagePicker.title')"
class=
"tw-w-screen md:tw-w-[700px]"
class=
"tw-w-screen md:tw-w-[700px]"
>
>
<div
<form
:id=
"id"
@
submit.prevent.stop=
"submit($event as SubmitEvent)"
>
v-if=
"!selectedImage && !showBrowser"
<div
class=
"tw-flex tw-flex-wrap tw-items-center tw-gap-3"
v-if=
"!selectedImage && !showBrowser"
>
class=
"tw-flex tw-flex-wrap tw-items-center tw-gap-3"
<ImageUploader
class=
"tw-grow md:tw-grow-0"
@
input=
"setImage"
/>
<button
v-if=
"imageStore.count > 0"
type=
"button"
class=
"btn btn-default tw-grow md:tw-grow-0"
@
click.stop=
"showBrowser = true"
>
>
<icon-system-uicons-search
/>
<ImageUploader
class=
"tw-grow md:tw-grow-0"
@
input=
"setImage"
/>
{{
t
(
'
imagePicker.browseImages
'
)
}}
<button
</button>
v-if=
"imageStore.count > 0"
<button
type=
"button"
v-if=
"currentImage"
class=
"btn btn-default tw-grow md:tw-grow-0"
type=
"button"
@
click.stop=
"showBrowser = true"
class=
"btn btn-default tw-grow md:tw-grow-0"
>
@
click.stop=
"selectedImage = currentImage"
<icon-system-uicons-search
/>
>
{{
t
(
'
imagePicker.browseImages
'
)
}}
<icon-system-uicons-pen
/>
</button>
{{
t
(
'
imagePicker.editCurrentImage
'
)
}}
<button
</button>
v-if=
"currentImage"
</div>
type=
"button"
class=
"btn btn-default tw-grow md:tw-grow-0"
@
click.stop=
"selectedImage = currentImage"
>
<icon-system-uicons-pen
/>
{{
t
(
'
imagePicker.editCurrentImage
'
)
}}
</button>
</div>
<AAlert
v-if=
"error"
is-error
aria-live=
"assertive"
class=
"tw-mb-3"
>
<AAlert
v-if=
"error"
is-error
aria-live=
"assertive"
class=
"tw-mb-3"
>
{{
error
.
message
}}
{{
error
.
message
}}
</AAlert>
</AAlert>
<ImageBrowser
v-if=
"showBrowser"
@
input=
"setImage"
/>
<ImageBrowser
v-if=
"showBrowser"
@
input=
"setImage"
/>
<ImageEditor
v-if=
"selectedImage"
v-model=
"selectedImage"
:disabled=
"isSaving"
/>
<ImageEditor
v-if=
"selectedImage"
v-model=
"selectedImage"
:disabled=
"isSaving"
/>
</form>
<template
v-if=
"showBrowser || selectedImage"
#footer
>
<template
v-if=
"showBrowser || selectedImage"
#footer
>
<div
class=
"tw-flex tw-gap-x-3"
>
<div
class=
"tw-flex tw-gap-x-3"
>
<button
<button
v-if=
"selectedImage"
v-if=
"selectedImage"
:disabled=
"isSaving"
:disabled=
"isSaving"
type=
"button"
type=
"submit"
:form=
"id"
class=
"btn btn-primary"
class=
"btn btn-primary"
@
click.stop=
"selectedImage && saveAndSelectImage(selectedImage)"
>
>
<icon-system-uicons-loader
v-if=
"isSaving"
class=
"tw-animate-spin"
/>
<icon-system-uicons-loader
v-if=
"isSaving"
class=
"tw-animate-spin"
/>
<template
v-if=
"isSelectedImageNew"
>
{{
t
(
'
imagePicker.useImage
'
)
}}
</
template
>
<template
v-if=
"isSelectedImageNew"
>
{{
t
(
'
imagePicker.useImage
'
)
}}
</
template
>
...
@@ -77,7 +79,7 @@ import { APIResponseError } from '@rokoli/bnb/drf'
...
@@ -77,7 +79,7 @@ import { APIResponseError } from '@rokoli/bnb/drf'
import
{
computed
,
ref
}
from
'
vue
'
import
{
computed
,
ref
}
from
'
vue
'
import
{
useI18n
}
from
'
@/i18n
'
import
{
useI18n
}
from
'
@/i18n
'
import
{
Image
,
NewImage
,
useImage
,
useImageStore
}
from
'
@/stores/images
'
import
{
Image
,
NewImage
,
useImage
,
useImageStore
}
from
'
@/stores/images
'
import
{
useAsyncFunction
}
from
'
@/util
'
import
{
useAsyncFunction
,
useId
}
from
'
@/util
'
import
{
useCopy
}
from
'
@/form
'
import
{
useCopy
}
from
'
@/form
'
import
ADialog
from
'
../generic/ADialog.vue
'
import
ADialog
from
'
../generic/ADialog.vue
'
import
ImageBrowser
from
'
./ImageBrowser.vue
'
import
ImageBrowser
from
'
./ImageBrowser.vue
'
...
@@ -96,6 +98,7 @@ const emit = defineEmits<{
...
@@ -96,6 +98,7 @@ const emit = defineEmits<{
const
{
t
}
=
useI18n
()
const
{
t
}
=
useI18n
()
const
imageStore
=
useImageStore
()
const
imageStore
=
useImageStore
()
const
localIsOpen
=
useCopy
(()
=>
props
.
isOpen
,
{
save
:
(
isOpen
)
=>
emit
(
'
show
'
,
isOpen
)
})
const
localIsOpen
=
useCopy
(()
=>
props
.
isOpen
,
{
save
:
(
isOpen
)
=>
emit
(
'
show
'
,
isOpen
)
})
const
id
=
useId
(
'
image-form
'
)
const
error
=
ref
<
Error
>
()
const
error
=
ref
<
Error
>
()
const
showBrowser
=
ref
(
false
)
const
showBrowser
=
ref
(
false
)
const
selectedImage
=
ref
<
Image
|
NewImage
|
null
>
(
null
)
const
selectedImage
=
ref
<
Image
|
NewImage
|
null
>
(
null
)
...
@@ -141,6 +144,13 @@ const { isProcessing: isSaving, fn: saveAndSelectImage } = useAsyncFunction(
...
@@ -141,6 +144,13 @@ const { isProcessing: isSaving, fn: saveAndSelectImage } = useAsyncFunction(
},
},
)
)
async
function
submit
(
event
:
SubmitEvent
)
{
if
(
!
selectedImage
.
value
)
return
const
form
=
event
.
target
as
HTMLFormElement
if
(
!
form
.
checkValidity
())
return
await
saveAndSelectImage
(
selectedImage
.
value
)
}
function
setImage
(
image
:
Image
|
NewImage
|
null
)
{
function
setImage
(
image
:
Image
|
NewImage
|
null
)
{
selectedImage
.
value
=
image
selectedImage
.
value
=
image
showBrowser
.
value
=
false
showBrowser
.
value
=
false
...
...
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