timeline for board and cards and small other fixes
Signed-off-by: Jakob <jakob.roehrl@web.de>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
<div>
|
||||
<div v-for="entry in boardActivity" :key="entry.activity_id">
|
||||
<img :src="entry.icon">
|
||||
{{ entry.activity_id }}
|
||||
{{ entry.subject }}
|
||||
{{ getTime(entry.datetime) }}
|
||||
</div>
|
||||
@@ -28,14 +27,15 @@ export default {
|
||||
return {
|
||||
isLoading: false,
|
||||
params: {
|
||||
limit: 50,
|
||||
since: 0
|
||||
type: 'deck',
|
||||
since: 0,
|
||||
object_id: this.board.id
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
boardActivity: 'boardActivity'
|
||||
boardActivity: 'activity'
|
||||
})
|
||||
},
|
||||
created() {
|
||||
@@ -44,7 +44,7 @@ export default {
|
||||
methods: {
|
||||
loadBoardActivity() {
|
||||
this.isLoading = true
|
||||
this.$store.dispatch('loadBoardActivity', this.params).then(response => {
|
||||
this.$store.dispatch('loadActivity', this.params).then(response => {
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</multiselect>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="section-wrapper">
|
||||
<div v-tooltip="t('deck', 'Assign to users')" class="section-label icon-group"><span class="hidden-visually">{{ t('deck', 'Assign to users') }}</span></div>
|
||||
<div class="section-details">
|
||||
@@ -77,7 +77,12 @@
|
||||
</button>
|
||||
</AppSidebarTab>
|
||||
<AppSidebarTab :order="2" name="Timeline" icon="icon-activity">
|
||||
this is the activity tab
|
||||
<div v-for="entry in cardActivity" :key="entry.activity_id">
|
||||
<img :src="entry.icon">
|
||||
{{ entry.subject }}
|
||||
{{ getTime(entry.datetime) }}
|
||||
</div>
|
||||
<button @click="loadMore">Load More</button>
|
||||
</AppSidebarTab>
|
||||
</app-sidebar>
|
||||
</template>
|
||||
@@ -122,13 +127,20 @@ export default {
|
||||
toolbar: false
|
||||
},
|
||||
lastModifiedRelative: null,
|
||||
lastCreatedRemative: null
|
||||
lastCreatedRemative: null,
|
||||
params: {
|
||||
type: 'filter',
|
||||
since: 0,
|
||||
object_type: 'deck_card',
|
||||
object_id: this.id
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
currentBoard: state => state.currentBoard,
|
||||
assignableUsers: state => state.assignableUsers
|
||||
assignableUsers: state => state.assignableUsers,
|
||||
cardActivity: 'activity'
|
||||
}),
|
||||
currentCard() {
|
||||
return this.$store.getters.cardById(this.id)
|
||||
@@ -172,6 +184,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
setInterval(this.updateRelativeTimestamps, 10000)
|
||||
this.loadCardActivity()
|
||||
},
|
||||
destroyed() {
|
||||
clearInterval(this.updateRelativeTimestamps)
|
||||
@@ -230,6 +243,22 @@ export default {
|
||||
}
|
||||
this.$store.dispatch('removeLabel', data)
|
||||
},
|
||||
loadCardActivity() {
|
||||
this.isLoading = true
|
||||
this.$store.dispatch('loadActivity', this.params).then(response => {
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
getTime(timestamp) {
|
||||
return OC.Util.relativeModifiedDate(timestamp)
|
||||
},
|
||||
loadMore() {
|
||||
let array = Object.values(this.cardActivity)
|
||||
let aId = (array[array.length - 1].activity_id)
|
||||
|
||||
this.params.since = aId
|
||||
this.loadCardActivity()
|
||||
},
|
||||
clickAddNewAttachmment() {
|
||||
|
||||
}
|
||||
|
||||
@@ -92,6 +92,11 @@ export default new Router({
|
||||
return {
|
||||
id: parseInt(route.params.id, 10)
|
||||
}
|
||||
},
|
||||
sidebar: (route) => {
|
||||
return {
|
||||
id: parseInt(route.params.id, 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -55,7 +55,7 @@ export default new Vuex.Store({
|
||||
sharees: [],
|
||||
assignableUsers: [],
|
||||
boardFilter: BOARD_FILTERS.ALL,
|
||||
boardActivity: []
|
||||
activity: []
|
||||
},
|
||||
getters: {
|
||||
boards: state => {
|
||||
@@ -64,8 +64,8 @@ export default new Vuex.Store({
|
||||
sharees: state => {
|
||||
return state.sharees
|
||||
},
|
||||
boardActivity: state => {
|
||||
return state.boardActivity
|
||||
activity: state => {
|
||||
return state.activity
|
||||
},
|
||||
noneArchivedBoards: state => {
|
||||
return state.boards.filter(board => {
|
||||
@@ -144,8 +144,13 @@ export default new Vuex.Store({
|
||||
state.sharees = shareesUsersAndGroups.users
|
||||
state.sharees.push(...shareesUsersAndGroups.groups)
|
||||
},
|
||||
setBoardActivity(state, boardActivity) {
|
||||
state.boardActivity.push(...boardActivity)
|
||||
setActivity(state, activity) {
|
||||
activity.forEach(element => {
|
||||
if (element.subject_rich[1].board.id === state.currentBoard.id) {
|
||||
state.activity.push(element)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
setAssignableUsers(state, users) {
|
||||
state.assignableUsers = users
|
||||
@@ -275,13 +280,20 @@ export default new Vuex.Store({
|
||||
commit('setSharees', response.data.ocs.data)
|
||||
})
|
||||
},
|
||||
loadBoardActivity({ commit }, obj) {
|
||||
loadActivity({ commit }, obj) {
|
||||
const params = new URLSearchParams()
|
||||
params.append('format', 'json')
|
||||
params.append('limit', obj.limit)
|
||||
params.append('type', 'deck')
|
||||
params.append('since', obj.since)
|
||||
axios.get(OC.linkToOCS('apps/activity/api/v2/activity') + 'deck', { params }).then((response) => {
|
||||
commit('setBoardActivity', response.data.ocs.data)
|
||||
params.append('object_type', obj.object_type)
|
||||
params.append('object_id', obj.object_id)
|
||||
|
||||
let keyword = 'deck'
|
||||
if (obj.type === 'filter') {
|
||||
keyword = 'filter'
|
||||
}
|
||||
axios.get(OC.linkToOCS('apps/activity/api/v2/activity') + keyword, { params }).then((response) => {
|
||||
commit('setActivity', response.data.ocs.data)
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user