This commit is contained in:
j3d1 2024-07-13 17:28:38 +02:00
parent e005d6fb6f
commit d6182f8b31
11 changed files with 440 additions and 184 deletions

View file

@ -0,0 +1,47 @@
<template>
<button @click.stop="handleClick" :disabled="disabled">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"
:class="{'d-none': !disabled}"></span>
<span class="ml-2" :class="{'d-none': !disabled}">In Progress...</span>
<span :class="{'d-none': disabled}"><slot></slot></span>
</button>
</template>
<script>
export default {
name: 'AsyncButton',
data() {
return {
disabled: false,
};
},
props: {
task: {
type: Function,
required: true,
},
},
methods: {
async handleClick() {
console.log("AsyncButton.handleClick() called");
if (this.task && typeof this.task === 'function') {
this.disabled = true;
try {
await this.task();
} catch (e) {
console.error(e);
} finally {
this.disabled = false;
}
}
},
}
};
</script>
<style scoped>
.spinner-border {
vertical-align: -0.125em;
}
</style>

View file

@ -0,0 +1,29 @@
<template>
<form class="form-inline">
<input
class="form-control w-100"
type="search"
placeholder="Search"
aria-label="Search"
v-model="search_query"
@input="searchEventItems(search_query)"
>
</form>
</template>
<script>
import {mapActions} from "vuex";
export default {
name: 'SearchBox',
data() {
return {
search_query: ''
}
},
methods: {
...mapActions(['searchEventItems']),
}
};
</script>