Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CloWM UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Monitor
Service Desk
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
Computational Metagenomics
CloWM
CloWM UI
Merge requests
!75
Resolve "Fetch S3 Object Meta information dynamically"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Fetch S3 Object Meta information dynamically"
feature/79-fetch-s3-object-meta-information-dynamically
into
development
Overview
0
Commits
1
Pipelines
0
Changes
6
Merged
Daniel Göbel
requested to merge
feature/79-fetch-s3-object-meta-information-dynamically
into
development
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
6
Expand
Closes
#79 (closed)
0
0
Merge request reports
Compare
development
development (base)
and
latest version
latest version
06fd123e
1 commit,
1 year ago
6 files
+
127
−
24
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
src/components/object-storage/modals/ObjectDetailModal.vue
+
84
−
13
Options
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
BootstrapModal
from
"
@/components/modals/BootstrapModal.vue
"
;
import
BootstrapModal
from
"
@/components/modals/BootstrapModal.vue
"
;
import
type
{
_Object
as
S3Object
}
from
"
@aws-sdk/client-s3
"
;
import
dayjs
from
"
dayjs
"
;
import
dayjs
from
"
dayjs
"
;
import
{
filesize
}
from
"
filesize
"
;
import
{
filesize
}
from
"
filesize
"
;
import
{
computed
,
onMounted
,
watch
,
reactive
}
from
"
vue
"
;
import
{
useS3ObjectStore
}
from
"
@/stores/s3objects
"
;
const
objectRepository
=
useS3ObjectStore
();
const
props
=
defineProps
<
{
const
props
=
defineProps
<
{
modalID
:
string
;
modalID
:
string
;
s3O
bject
:
S3Object
;
o
bject
Key
:
string
|
undefined
;
bucket
:
string
;
bucket
:
string
;
}
>
();
}
>
();
const
detailState
=
reactive
<
{
loading
:
boolean
;
error
:
boolean
;
}
>
({
loading
:
true
,
error
:
false
,
});
const
metaIdentifier
=
computed
<
string
>
(()
=>
{
return
props
.
bucket
+
"
/
"
+
props
.
objectKey
;
});
watch
(
props
,
(
newProps
)
=>
{
detailState
.
loading
=
true
;
if
(
newProps
.
objectKey
)
{
fetchMetaInfo
(
newProps
.
bucket
,
newProps
.
objectKey
);
}
});
function
fetchMetaInfo
(
bucket
:
string
,
key
:
string
)
{
detailState
.
loading
=
true
;
detailState
.
error
=
false
;
objectRepository
.
fetchS3ObjectMeta
(
bucket
,
key
,
()
=>
{
detailState
.
loading
=
false
;
})
.
catch
(()
=>
{
detailState
.
error
=
true
;
});
}
onMounted
(()
=>
{
if
(
props
.
objectKey
)
{
fetchMetaInfo
(
props
.
bucket
,
props
.
objectKey
);
}
});
</
script
>
</
script
>
<
template
>
<
template
>
@@ -30,32 +70,63 @@ const props = defineProps<{
@@ -30,32 +70,63 @@ const props = defineProps<{
</tr>
</tr>
<tr>
<tr>
<th
scope=
"row"
>
Name
</th>
<th
scope=
"row"
>
Name
</th>
<td>
{{
props
.
s3O
bject
.
Key
}}
</td>
<td>
{{
props
.
o
bjectKey
}}
</td>
</tr>
</tr>
<tr>
<tr>
<th
scope=
"row"
>
Size
</th>
<th
scope=
"row"
>
Size
</th>
<td>
<td
v-if=
"detailState.error"
>
N/A
</td>
<td
v-else-if=
"detailState.loading"
class=
"placeholder-glow"
>
<span
class=
"placeholder col-2"
></span>
</td>
<td
v-else
>
{{
{{
filesize
(
props
.
s3Object
.
Size
??
0
,
{
filesize
(
base
:
2
,
objectRepository
.
objectMetaMapping
[
metaIdentifier
]
standard
:
"
jedec
"
,
.
ContentLength
??
0
,
}
)
{
base
:
2
,
standard
:
"
jedec
"
,
}
,
)
}}
}}
<
/td
>
<
/td
>
<
/tr
>
<
/tr
>
<
tr
>
<
tr
>
<
th
scope
=
"
row
"
>
Timestamp
<
/th
>
<
th
scope
=
"
row
"
>
Timestamp
<
/th
>
<
td
>
<
td
v
-
if
=
"
detailState.error
"
>
N
/
A
<
/td
>
<
td
v
-
else
-
if
=
"
detailState.loading
"
class
=
"
placeholder-glow
"
>
<
span
class
=
"
placeholder col-6
"
><
/span
>
<
/td
>
<
td
v
-
else
>
{{
{{
dayjs
(
props
.
s3Object
.
LastModified
).
format
(
dayjs
(
"
YYYY-MM-DD HH:mm:ss
"
,
objectRepository
.
objectMetaMapping
[
metaIdentifier
]
)
.
LastModified
,
).
format
(
"
YYYY-MM-DD HH:mm:ss
"
)
}}
}}
<
/td
>
<
/td
>
<
/tr
>
<
/tr
>
<
tr
>
<
tr
>
<
th
scope
=
"
row
"
>
Content
Type
<
/th
>
<
th
scope
=
"
row
"
>
Content
Type
<
/th
>
<
td
>
binary
/
octet
-
stream
<
/td
>
<
td
v
-
if
=
"
detailState.error
"
>
N
/
A
<
/td
>
<
td
v
-
else
-
if
=
"
detailState.loading
"
class
=
"
placeholder-glow
"
>
<
span
class
=
"
placeholder col-5
"
><
/span
>
<
/td
>
<
td
v
-
else
>
{{
objectRepository
.
objectMetaMapping
[
metaIdentifier
].
ContentType
}}
<
/td
>
<
/tr
>
<
tr
>
<
th
scope
=
"
row
"
>
ETag
<
/th
>
<
td
v
-
if
=
"
detailState.error
"
>
N
/
A
<
/td
>
<
td
v
-
else
-
if
=
"
detailState.loading
"
class
=
"
placeholder-glow
"
>
<
span
class
=
"
placeholder col-10
"
><
/span
>
<
/td
>
<
td
v
-
else
>
{{
objectRepository
.
objectMetaMapping
[
metaIdentifier
].
ETag
}}
<
/td
>
<
/tr
>
<
/tr
>
<
/tbody
>
<
/tbody
>
<
/table
>
<
/table
>
Loading