remove recent items implementation from profile page (#222)

* remove recent items implementation from profile page

* remove call recent items data
pull/3759/head
Leonel Matos 2020-01-14 18:02:53 -04:00 committed by Yamel Senih
parent f728e4eb43
commit a1b5f44098
4 changed files with 1 additions and 86 deletions

View File

@ -88,7 +88,6 @@ export default {
})
this.$router.addRoutes(response)
})
this.$store.dispatch('getRecentItemsFromServer')
})
this.$router.push({ path: '/' })
},

View File

@ -1,79 +0,0 @@
<template>
<div class="block">
<el-timeline>
<el-timeline-item
v-for="(item, index) of recentItems"
:key="index"
placement="top"
type="primary"
size="large"
:timestamp="translateDate(item.updated)"
>
<el-card @click.native="redirect(item)">
<h4>
{{ item.displayName }}
<el-tag v-show="checkOpened(item.menuUuid)">{{ $t('notifications.opened') }}</el-tag>
</h4>
<p>{{ item.description }}</p>
</el-card>
</el-timeline-item>
</el-timeline>
</div>
</template>
<script>
export default {
name: 'RecentItems',
data() {
return {
recentItems: []
}
},
computed: {
getterRecentItems() {
return this.$store.getters.getRecentItems
},
cachedViews() {
return this.$store.getters.cachedViews
}
},
mounted() {
this.getRecentItems()
this.subscribeChanges()
},
methods: {
checkOpened(uuid) {
return this.cachedViews.includes(uuid)
},
redirect(item) {
if (!this.isEmptyValue(item.uuidRecord)) {
this.$router.push({ name: item.menuUuid, query: { action: item.uuidRecord, tabParent: 0 }})
} else {
this.$router.push({ name: item.menuUuid })
}
},
getRecentItems() {
var items = this.getterRecentItems
if (items === undefined || items.length < 1) {
this.$store.dispatch('getRecentItemsFromServer')
.then(response => {
this.recentItems = response
})
} else {
this.recentItems = items
}
},
subscribeChanges() {
this.$store.subscribe((mutation, state) => {
// The mutation comes in the format of `{ type, payload }`.
if (mutation.type === 'setRecentItems') {
this.recentItems = this.getterRecentItems
}
})
},
translateDate(value) {
return this.$d(new Date(value), 'long', this.language)
}
}
}
</script>

View File

@ -119,7 +119,6 @@ export default {
})
this.$router.addRoutes(response)
})
this.$store.dispatch('getRecentItemsFromServer')
})
},
changeLanguage(languageValue) {

View File

@ -13,9 +13,6 @@
<el-tab-pane :label="$t('profile.role')" name="role">
<role />
</el-tab-pane>
<el-tab-pane :label="$t('profile.recentItems')" name="recentItems">
<recent-items />
</el-tab-pane>
</el-tabs>
</el-card>
</el-col>
@ -28,12 +25,11 @@
<script>
import { mapGetters } from 'vuex'
import UserCard from './components/UserCard'
import RecentItems from '@/views/profile/components/recentItems'
import Role from '@/views/profile/components/role'
export default {
name: 'Profile',
components: { UserCard, Role, RecentItems },
components: { UserCard, Role },
data() {
return {
user: {},