Skip to content

Commit

Permalink
Add prop for additional actions to StacAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jul 13, 2024
1 parent 22f66db commit 87e9489
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/internal/StacAsset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<li class="badge action copy" @click.prevent.stop="copyURL($event, asset.href)">
<span class="icon">📋</span> Copy URL
</li>
<template v-for="action in actions">
<li v-if="!action.show || action.show(asset)" :key="action.label" class="badge action" @click.prevent.stop="action.click($event, asset)">
<span class="icon" v-if="action.icon">{{ action.icon }}</span> {{ action.label }}
</li>
</template>
</ul>
<Description v-if="asset.description" :description="asset.description" :compact="true" />
<StacFields type="Asset" :metadata="asset" :ignore="ignore" title="" :context="context" headingTag="h5" />
Expand Down Expand Up @@ -46,6 +51,15 @@ export default {
context: {
type: Object,
default: () => ({})
},
actions: {
// Array of objects with the following properties:
// - label (string)
// - icon (optional, string)
// - show (optional, function(asset) -> boolean)
// - click (function(event, asset) -> void)
type: Array,
default: () => []
}
},
data() {
Expand Down

0 comments on commit 87e9489

Please sign in to comment.