-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RES-1953 When a group has no events, on the Fixometer page, make it clearer how they can add data #700
Merged
Merged
RES-1953 When a group has no events, on the Fixometer page, make it clearer how they can add data #700
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
96d18a0
Convert Add Data modal to Vue.
edwh 4273293
Handle Add Group modal when no events for group.
edwh cafa8e6
Switch from ANY_VALUE to MAX to allow use with MariaDB.
edwh e44279e
Handle no groups. Not all events showing. Select first event/group.
edwh 81c2ed0
Remove pliers from modal title.
edwh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<template> | ||
<b-modal | ||
id="addData" | ||
v-model="showModal" | ||
no-stacking | ||
no-body | ||
size="md" | ||
title-class="w-100 p-0" | ||
header-class="p-0" | ||
body-class="p-0" | ||
title-tag="h2" | ||
> | ||
<template slot="modal-title"> | ||
{{ __('devices.add_data_title') }} | ||
<hr class="hr-dashed mb-25 mt-10"> | ||
</template> | ||
<div> | ||
{{ __('devices.add_data_description') }} | ||
</div> | ||
<b-alert v-if="!groups.length && !fetching" show variant="warning" class="mt-2"> | ||
{{ __('groups.follow_group_first') }} | ||
</b-alert> | ||
<div v-else> | ||
<label for="items_cat" class="mt-2">{{ __('devices.add_data_group') }}:</label> | ||
<b-select v-model="groupId" :options="groupOptions" id="group_member" /> | ||
<b-alert v-if="groupId && !events.length && !fetching" variant="warning" class="mt-2" show> | ||
{{ __('groups.create_event_first') }} | ||
</b-alert> | ||
<div v-else> | ||
<label for="items_cat" class="mt-2">{{ __('devices.add_data_event') }}:</label> | ||
<b-select :disabled="fetching" v-model="eventId" :options="eventOptions" id="events" /> | ||
</div> | ||
</div> | ||
<template slot="modal-footer"> | ||
<b-button v-if="!groups.length && !fetching" href="/group" variant="primary"> | ||
{{ __('dashboard.see_all_groups') }} | ||
</b-button> | ||
<b-button v-else-if="groupId && !events.length && !fetching" variant="primary" size="sm" @click="createEvent" :disabled="!groupId"> | ||
{{ __('events.create_event') }} | ||
</b-button> | ||
<b-button v-else variant="primary" size="sm" @click="gotoEvent"> | ||
{{ __('devices.add_data_action_button') }} | ||
</b-button> | ||
</template> | ||
</b-modal> | ||
</template> | ||
<script> | ||
import moment from 'moment' | ||
export default { | ||
data: function() { | ||
return { | ||
showModal: false, | ||
groupId: null, | ||
eventId: null, | ||
fetching: false, | ||
} | ||
}, | ||
computed: { | ||
groups() { | ||
let groups = this.$store.getters['groups/list'] | ||
return groups ? groups.sort((a, b) => { | ||
return a.name.localeCompare(b.name) | ||
}) : [] | ||
}, | ||
events() { | ||
const events = Object.values(this.$store.getters['events/getAll']) | ||
return events.sort((a,b) => new moment(b.start).unix() - new moment(a.start).unix()) | ||
}, | ||
groupOptions() { | ||
return this.groups.map(g => { | ||
return { | ||
value: g.idgroups, | ||
text: g.name | ||
} | ||
}) | ||
}, | ||
eventOptions() { | ||
return this.events.map(e => { | ||
return { | ||
value: e.id, | ||
text: new moment(e.start).format('DD MMM YY') + ' / ' + e.title | ||
} | ||
}) | ||
}, | ||
}, | ||
watch: { | ||
groupId: { | ||
immediate: true, | ||
handler: async function (newVal) { | ||
if (newVal) { | ||
this.fetching = true | ||
await this.$store.dispatch('events/clear') | ||
await this.$store.dispatch('events/fetchByGroup', { | ||
id: newVal | ||
}) | ||
await this.$nextTick() | ||
if (this.events.length) { | ||
this.eventId = this.events[0].id | ||
} | ||
this.fetching = false | ||
} | ||
} | ||
} | ||
}, | ||
methods: { | ||
show() { | ||
this.showModal = true | ||
if (this.groups.length) { | ||
this.groupId = this.groups[0].idgroups | ||
} | ||
}, | ||
hide() { | ||
this.showModal = false | ||
}, | ||
gotoEvent() { | ||
if (this.eventId) { | ||
window.location = '/party/view/' + this.eventId + '#devices-section' | ||
} | ||
}, | ||
createEvent() { | ||
window.location = '/party/create/' + this.groupId | ||
}, | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So long,
fixometer.js
!