08f1e2b273
* wip * refactor world state * allow resource to be reloaded when the server is updated * fix #9242 * fix event listeners * remove un-needed code * add tests for asyncResourceFactory reloadOnAppVersionChange * fix double cron notifications and party members showing up in the header after a party invitation is accepted * remove console.log * do not send vm info to loggly due to circular dependency + fix typo * fix #12181 * do not load invites multiple times in members modal * add hover to challenge member count * groups: load members only on demand * minor ui fixes * choose class: fix vue duplicate key warning * minor ui fixes * challanges: load members on demand * add loading spinner * change loading mechanism * fix loading gryphon issues * reduce code duplication
144 lines
3.8 KiB
Vue
144 lines
3.8 KiB
Vue
<template>
|
|
<b-modal
|
|
id="broken-task-modal"
|
|
title="Broken Challenge"
|
|
size="sm"
|
|
:hide-footer="true"
|
|
>
|
|
<div
|
|
v-if="brokenChallengeTask && brokenChallengeTask.challenge"
|
|
class="modal-body"
|
|
>
|
|
<div
|
|
v-if="brokenChallengeTask.challenge.broken === 'TASK_DELETED'
|
|
|| brokenChallengeTask.challenge.broken === 'CHALLENGE_TASK_NOT_FOUND'"
|
|
>
|
|
<h2>{{ $t('brokenTask') }}</h2>
|
|
<div>
|
|
<button
|
|
class="btn btn-primary"
|
|
@click="unlink('keep')"
|
|
>
|
|
{{ $t('keepIt') }}
|
|
</button>
|
|
<button
|
|
class="btn btn-danger"
|
|
@click="removeTask(obj)"
|
|
>
|
|
{{ $t('removeIt') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div v-if="brokenChallengeTask.challenge.broken === 'CHALLENGE_DELETED'">
|
|
<h2>{{ $t('brokenChallenge') }}</h2>
|
|
<div>
|
|
<button
|
|
class="btn btn-primary"
|
|
@click="unlink('keep-all')"
|
|
>
|
|
{{ $t('keepThem') }}
|
|
</button>
|
|
<button
|
|
class="btn btn-danger"
|
|
@click="unlink('remove-all')"
|
|
>
|
|
{{ $t('removeThem') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div v-if="brokenChallengeTask.challenge.broken === 'CHALLENGE_CLOSED'">
|
|
<h2 v-html="$t('challengeCompleted', {user: brokenChallengeTask.challenge.winner})"></h2>
|
|
<div>
|
|
<button
|
|
class="btn btn-primary"
|
|
@click="unlink('keep-all')"
|
|
>
|
|
{{ $t('keepThem') }}
|
|
</button>
|
|
<button
|
|
class="btn btn-danger"
|
|
@click="unlink('remove-all')"
|
|
>
|
|
{{ $t('removeThem') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<!-- @TODO: I ported this over, but do we use it anymore?-->
|
|
<!--div(v-if='brokenChallengeTask.challenge.broken
|
|
=== "UNSUBSCRIBED"')p {{ $t('unsubChallenge') }}
|
|
p
|
|
a(@click="unlink('keep-all')") {{ $t('keepThem') }}
|
|
| |
|
|
a(@click="unlink('remove-all')") {{ $t('removeThem') }}-->
|
|
</div>
|
|
</b-modal>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.modal-body {
|
|
padding-bottom: 2em;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
import { mapActions } from '@/libs/store';
|
|
import notifications from '@/mixins/notifications';
|
|
|
|
export default {
|
|
mixins: [notifications],
|
|
data () {
|
|
return {
|
|
brokenChallengeTask: {},
|
|
};
|
|
},
|
|
mounted () {
|
|
this.$root.$on('handle-broken-task', task => {
|
|
this.brokenChallengeTask = { ...task };
|
|
this.$root.$emit('bv::show::modal', 'broken-task-modal');
|
|
});
|
|
},
|
|
beforeDestroy () {
|
|
this.$root.$off('handle-broken-task');
|
|
},
|
|
methods: {
|
|
...mapActions({
|
|
destroyTask: 'tasks:destroy',
|
|
unlinkOneTask: 'tasks:unlinkOneTask',
|
|
unlinkAllTasks: 'tasks:unlinkAllTasks',
|
|
}),
|
|
async unlink (keepOption) {
|
|
if (keepOption.indexOf('-all') !== -1) {
|
|
await this.unlinkAllTasks({
|
|
challengeId: this.brokenChallengeTask.challenge.id,
|
|
keep: keepOption,
|
|
});
|
|
|
|
await this.$store.dispatch('tasks:fetchUserTasks', { forceLoad: true });
|
|
|
|
if (this.brokenChallengeTask.type === 'todo') {
|
|
await this.$store.dispatch('tasks:fetchCompletedTodos', { forceLoad: true });
|
|
}
|
|
|
|
this.close();
|
|
return;
|
|
}
|
|
|
|
this.unlinkOneTask({
|
|
task: this.brokenChallengeTask,
|
|
keep: keepOption,
|
|
});
|
|
this.close();
|
|
},
|
|
removeTask () {
|
|
if (!window.confirm('Are you sure you want to delete this task?')) return;
|
|
this.destroyTask(this.brokenChallengeTask);
|
|
this.close();
|
|
},
|
|
close () {
|
|
this.$store.state.brokenChallengeTask = {};
|
|
this.$root.$emit('bv::hide::modal', 'broken-task-modal');
|
|
},
|
|
},
|
|
};
|
|
</script>
|