feat: Show last active portal articles when sidebar portal icon is clicked (#5616)
This commit is contained in:
parent
6c048626d0
commit
ee520bdf98
5 changed files with 56 additions and 4 deletions
|
@ -39,7 +39,7 @@ const primaryMenuItems = accountId => [
|
|||
label: 'HELP_CENTER.TITLE',
|
||||
featureFlag: 'help_center',
|
||||
toState: frontendURL(`accounts/${accountId}/portals`),
|
||||
toStateName: 'list_all_portals',
|
||||
toStateName: 'default_portal_articles',
|
||||
roles: ['administrator'],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@ import HelpCenterSidebar from '../components/Sidebar/Sidebar.vue';
|
|||
import CommandBar from 'dashboard/routes/dashboard/commands/commandbar.vue';
|
||||
import WootKeyShortcutModal from 'dashboard/components/widgets/modal/WootKeyShortcutModal';
|
||||
import NotificationPanel from 'dashboard/routes/dashboard/notifications/components/NotificationPanel';
|
||||
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||
import portalMixin from '../mixins/portalMixin';
|
||||
import AddCategory from '../pages/categories/AddCategory';
|
||||
|
||||
|
@ -72,7 +73,7 @@ export default {
|
|||
PortalPopover,
|
||||
AddCategory,
|
||||
},
|
||||
mixins: [portalMixin],
|
||||
mixins: [portalMixin, uiSettingsMixin],
|
||||
data() {
|
||||
return {
|
||||
isSidebarOpen: false,
|
||||
|
@ -231,7 +232,13 @@ export default {
|
|||
},
|
||||
updated() {
|
||||
const slug = this.$route.params.portalSlug;
|
||||
if (slug) this.lastActivePortalSlug = slug;
|
||||
if (slug) {
|
||||
this.lastActivePortalSlug = slug;
|
||||
this.updateUISettings({
|
||||
last_active_portal_slug: slug,
|
||||
last_active_locale_code: this.selectedLocaleInPortal,
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleResize() {
|
||||
|
|
|
@ -188,13 +188,15 @@
|
|||
<script>
|
||||
import thumbnail from 'dashboard/components/widgets/Thumbnail';
|
||||
import LocaleItemTable from './PortalListItemTable';
|
||||
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||
import alertMixin from 'shared/mixins/alertMixin';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
thumbnail,
|
||||
LocaleItemTable,
|
||||
},
|
||||
mixins: [alertMixin],
|
||||
mixins: [alertMixin, uiSettingsMixin],
|
||||
props: {
|
||||
portal: {
|
||||
type: Object,
|
||||
|
@ -274,6 +276,10 @@ export default {
|
|||
this.alertMessage = this.$t(
|
||||
'HELP_CENTER.PORTAL.PORTAL_SETTINGS.DELETE_PORTAL.API.DELETE_SUCCESS'
|
||||
);
|
||||
this.updateUISettings({
|
||||
last_active_portal_slug: undefined,
|
||||
last_active_locale_code: undefined,
|
||||
});
|
||||
} catch (error) {
|
||||
this.alertMessage =
|
||||
error?.message ||
|
||||
|
|
|
@ -21,12 +21,20 @@ const EditCategory = () => import('./pages/categories/EditCategory');
|
|||
const ListCategoryArticles = () =>
|
||||
import('./pages/articles/ListCategoryArticles');
|
||||
const ListAllArticles = () => import('./pages/articles/ListAllArticles');
|
||||
const DefaultPortalArticles = () =>
|
||||
import('./pages/articles/DefaultPortalArticles');
|
||||
const NewArticle = () => import('./pages/articles/NewArticle');
|
||||
const EditArticle = () => import('./pages/articles/EditArticle');
|
||||
|
||||
const portalRoutes = [
|
||||
{
|
||||
path: getPortalRoute(''),
|
||||
name: 'default_portal_articles',
|
||||
roles: ['administrator', 'agent'],
|
||||
component: DefaultPortalArticles,
|
||||
},
|
||||
{
|
||||
path: getPortalRoute('all'),
|
||||
name: 'list_all_portals',
|
||||
roles: ['administrator', 'agent'],
|
||||
component: ListAllPortals,
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<template>
|
||||
<div>Loading...</div>
|
||||
</template>
|
||||
<script>
|
||||
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||
|
||||
export default {
|
||||
mixins: [uiSettingsMixin],
|
||||
mounted() {
|
||||
const {
|
||||
last_active_portal_slug: lastActivePortalSlug,
|
||||
last_active_locale_code: lastActiveLocaleCode,
|
||||
} = this.uiSettings || {};
|
||||
|
||||
if (lastActivePortalSlug)
|
||||
this.$router.push({
|
||||
name: 'list_all_locale_articles',
|
||||
params: {
|
||||
portalSlug: lastActivePortalSlug,
|
||||
locale: lastActiveLocaleCode,
|
||||
},
|
||||
replace: true,
|
||||
});
|
||||
else
|
||||
this.$router.push({
|
||||
name: 'list_all_portals',
|
||||
replace: true,
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue