feat: Show last active portal articles when sidebar portal icon is clicked (#5616)
This commit is contained in:
committed by
GitHub
parent
6c048626d0
commit
ee520bdf98
@@ -39,7 +39,7 @@ const primaryMenuItems = accountId => [
|
|||||||
label: 'HELP_CENTER.TITLE',
|
label: 'HELP_CENTER.TITLE',
|
||||||
featureFlag: 'help_center',
|
featureFlag: 'help_center',
|
||||||
toState: frontendURL(`accounts/${accountId}/portals`),
|
toState: frontendURL(`accounts/${accountId}/portals`),
|
||||||
toStateName: 'list_all_portals',
|
toStateName: 'default_portal_articles',
|
||||||
roles: ['administrator'],
|
roles: ['administrator'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ import HelpCenterSidebar from '../components/Sidebar/Sidebar.vue';
|
|||||||
import CommandBar from 'dashboard/routes/dashboard/commands/commandbar.vue';
|
import CommandBar from 'dashboard/routes/dashboard/commands/commandbar.vue';
|
||||||
import WootKeyShortcutModal from 'dashboard/components/widgets/modal/WootKeyShortcutModal';
|
import WootKeyShortcutModal from 'dashboard/components/widgets/modal/WootKeyShortcutModal';
|
||||||
import NotificationPanel from 'dashboard/routes/dashboard/notifications/components/NotificationPanel';
|
import NotificationPanel from 'dashboard/routes/dashboard/notifications/components/NotificationPanel';
|
||||||
|
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||||
import portalMixin from '../mixins/portalMixin';
|
import portalMixin from '../mixins/portalMixin';
|
||||||
import AddCategory from '../pages/categories/AddCategory';
|
import AddCategory from '../pages/categories/AddCategory';
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ export default {
|
|||||||
PortalPopover,
|
PortalPopover,
|
||||||
AddCategory,
|
AddCategory,
|
||||||
},
|
},
|
||||||
mixins: [portalMixin],
|
mixins: [portalMixin, uiSettingsMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isSidebarOpen: false,
|
isSidebarOpen: false,
|
||||||
@@ -231,7 +232,13 @@ export default {
|
|||||||
},
|
},
|
||||||
updated() {
|
updated() {
|
||||||
const slug = this.$route.params.portalSlug;
|
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: {
|
methods: {
|
||||||
handleResize() {
|
handleResize() {
|
||||||
|
|||||||
@@ -188,13 +188,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import thumbnail from 'dashboard/components/widgets/Thumbnail';
|
import thumbnail from 'dashboard/components/widgets/Thumbnail';
|
||||||
import LocaleItemTable from './PortalListItemTable';
|
import LocaleItemTable from './PortalListItemTable';
|
||||||
|
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
thumbnail,
|
thumbnail,
|
||||||
LocaleItemTable,
|
LocaleItemTable,
|
||||||
},
|
},
|
||||||
mixins: [alertMixin],
|
mixins: [alertMixin, uiSettingsMixin],
|
||||||
props: {
|
props: {
|
||||||
portal: {
|
portal: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -274,6 +276,10 @@ export default {
|
|||||||
this.alertMessage = this.$t(
|
this.alertMessage = this.$t(
|
||||||
'HELP_CENTER.PORTAL.PORTAL_SETTINGS.DELETE_PORTAL.API.DELETE_SUCCESS'
|
'HELP_CENTER.PORTAL.PORTAL_SETTINGS.DELETE_PORTAL.API.DELETE_SUCCESS'
|
||||||
);
|
);
|
||||||
|
this.updateUISettings({
|
||||||
|
last_active_portal_slug: undefined,
|
||||||
|
last_active_locale_code: undefined,
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.alertMessage =
|
this.alertMessage =
|
||||||
error?.message ||
|
error?.message ||
|
||||||
|
|||||||
@@ -21,12 +21,20 @@ const EditCategory = () => import('./pages/categories/EditCategory');
|
|||||||
const ListCategoryArticles = () =>
|
const ListCategoryArticles = () =>
|
||||||
import('./pages/articles/ListCategoryArticles');
|
import('./pages/articles/ListCategoryArticles');
|
||||||
const ListAllArticles = () => import('./pages/articles/ListAllArticles');
|
const ListAllArticles = () => import('./pages/articles/ListAllArticles');
|
||||||
|
const DefaultPortalArticles = () =>
|
||||||
|
import('./pages/articles/DefaultPortalArticles');
|
||||||
const NewArticle = () => import('./pages/articles/NewArticle');
|
const NewArticle = () => import('./pages/articles/NewArticle');
|
||||||
const EditArticle = () => import('./pages/articles/EditArticle');
|
const EditArticle = () => import('./pages/articles/EditArticle');
|
||||||
|
|
||||||
const portalRoutes = [
|
const portalRoutes = [
|
||||||
{
|
{
|
||||||
path: getPortalRoute(''),
|
path: getPortalRoute(''),
|
||||||
|
name: 'default_portal_articles',
|
||||||
|
roles: ['administrator', 'agent'],
|
||||||
|
component: DefaultPortalArticles,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: getPortalRoute('all'),
|
||||||
name: 'list_all_portals',
|
name: 'list_all_portals',
|
||||||
roles: ['administrator', 'agent'],
|
roles: ['administrator', 'agent'],
|
||||||
component: ListAllPortals,
|
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>
|
||||||
Reference in New Issue
Block a user