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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
Computational Metagenomics
CloWM
CloWM UI
Merge requests
!79
Resolve "Display workflow execution parameters"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Display workflow execution parameters"
feature/83-display-workflow-execution-parameters
into
development
Overview
0
Commits
1
Pipelines
0
Changes
3
Merged
Daniel Göbel
requested to merge
feature/83-display-workflow-execution-parameters
into
development
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
3
Expand
Closes
#83 (closed)
0
0
Merge request reports
Viewing commit
d5513593
Show latest version
3 files
+
234
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
Verified
d5513593
Add modal to show workflow execution parameters
· d5513593
Daniel Göbel
authored
1 year ago
#83
src/components/workflows/modals/ParameterModal.vue
0 → 100644
+
184
−
0
Options
<
script
setup
lang=
"ts"
>
import
BootstrapModal
from
"
@/components/modals/BootstrapModal.vue
"
;
import
{
computed
,
onMounted
,
reactive
,
watch
}
from
"
vue
"
;
import
{
useWorkflowExecutionStore
}
from
"
@/stores/workflowExecutions
"
;
import
type
{
RouteParamsRaw
}
from
"
vue-router
"
;
import
{
Modal
}
from
"
bootstrap
"
;
import
{
useRouter
}
from
"
vue-router
"
;
import
FontAwesomeIcon
from
"
@/components/FontAwesomeIcon.vue
"
;
import
{
useWorkflowStore
}
from
"
@/stores/workflows
"
;
const
workflowRepository
=
useWorkflowStore
();
const
executionRepository
=
useWorkflowExecutionStore
();
const
router
=
useRouter
();
let
parameterModal
:
Modal
|
null
=
null
;
const
props
=
defineProps
<
{
modalID
:
string
;
executionId
?:
string
;
}
>
();
const
parameterState
=
reactive
<
{
loading
:
boolean
;
error
:
boolean
;
}
>
({
loading
:
false
,
error
:
false
,
});
const
workflowName
=
computed
<
string
>
(()
=>
{
if
(
props
.
executionId
)
{
const
execution
=
executionRepository
.
executionMapping
[
props
.
executionId
];
if
(
execution
?.
workflow_id
!=
undefined
&&
execution
?.
workflow_version_id
!=
undefined
)
{
return
(
workflowRepository
.
getName
(
execution
.
workflow_id
)
+
"
@
"
+
workflowRepository
.
getName
(
execution
.
workflow_version_id
)
);
}
}
return
""
;
});
function
fetchWorkflowExecutionParameters
(
executionId
?:
string
)
{
parameterState
.
error
=
false
;
if
(
executionId
!=
undefined
)
{
parameterState
.
loading
=
true
;
executionRepository
.
fetchExecutionParameters
(
executionId
)
.
catch
(()
=>
{
parameterState
.
error
=
true
;
})
.
finally
(()
=>
{
parameterState
.
loading
=
false
;
});
}
}
function
handleBucketLinkClick
(
s3String
:
string
)
{
parameterModal
?.
hide
();
router
.
push
({
name
:
"
bucket
"
,
params
:
getS3LinkParameters
(
s3String
),
});
}
function
getS3LinkParameters
(
s3String
:
string
):
RouteParamsRaw
{
const
pathComponents
=
s3String
.
slice
(
5
).
split
(
"
/
"
);
const
s3File
=
pathComponents
.
length
>
1
&&
pathComponents
[
pathComponents
.
length
-
1
].
includes
(
"
.
"
);
return
{
bucketName
:
pathComponents
[
0
],
subFolders
:
pathComponents
.
slice
(
1
,
s3File
?
-
1
:
undefined
),
};
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function
isBucketLink
(
value
:
any
):
boolean
{
if
(
typeof
value
===
"
string
"
)
{
return
value
.
startsWith
(
"
s3://
"
);
}
return
false
;
}
watch
(
()
=>
props
.
executionId
,
(
newId
,
oldId
)
=>
{
if
(
newId
!=
oldId
)
{
fetchWorkflowExecutionParameters
(
newId
);
}
},
);
onMounted
(()
=>
{
fetchWorkflowExecutionParameters
(
props
.
executionId
);
parameterModal
=
Modal
.
getOrCreateInstance
(
"
#
"
+
props
.
modalID
);
});
</
script
>
<
template
>
<bootstrap-modal
:modalID=
"modalID"
:static-backdrop=
"false"
modal-label=
"Workflow Execution Parameters Modal"
>
<template
v-slot:header
>
Workflow Execution Parameters
<b>
{{
workflowName
}}
</b>
</
template
>
<
template
v-slot:body
>
<div
v-if=
"parameterState.error"
class=
"text-center fs-4 mt-5"
>
<font-awesome-icon
icon=
"fa-solid fa-magnifying-glass"
class=
"mb-3 fs-0"
style=
"color: var(--bs-secondary)"
/>
<p>
Workflow Execution
<i>
{{
props
.
executionId
}}
</i>
not found
</p>
</div>
<table
v-else-if=
"props.executionId"
class=
"table table-hover"
>
<caption
class=
"placeholder-glow"
>
<span
v-if=
"parameterState.loading"
class=
"placeholder col-1"
></span>
<template
v-else
>
{{
Object
.
keys
(
executionRepository
.
parameters
[
props
.
executionId
])
.
length
}}
</
template
>
Parameters
</caption>
<tbody>
<
template
v-if=
"parameterState.loading"
>
<tr
v-for=
"n in 6"
:key=
"n"
>
<th
scope=
"row"
style=
"width: 20%"
class=
"placeholder-glow"
>
<div
class=
"placeholder col-12"
></div>
</th>
<td
class=
"placeholder-glow"
>
<div
class=
"placeholder col-8"
></div>
</td>
</tr>
</
template
>
<
template
v-else
>
<tr
v-for=
"(value, name) in executionRepository.parameters[
props.executionId
]"
:key=
"name"
>
<th
scope=
"row"
style=
"width: 10%"
class=
"text-end"
>
<b>
{{
name
}}
</b>
</th>
<td>
<router-link
v-if=
"isBucketLink(value)"
:to=
"
{
name: 'bucket',
params: getS3LinkParameters(value),
}"
@click.prevent="handleBucketLinkClick(value)"
>
{{
value
}}
</router-link>
<template
v-else
>
{{
value
}}
</
template
>
</td>
</tr>
</template>
</tbody>
</table>
</template>
<
template
v-slot:footer
>
<button
type=
"button"
class=
"btn btn-secondary"
data-bs-dismiss=
"modal"
>
Close
</button>
</
template
>
</bootstrap-modal>
</template>
<
style
scoped
></
style
>
Loading