Skip to content

Commit

Permalink
refactor: clean up router (#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssiyad committed Apr 5, 2023
1 parent 11e1245 commit d1e033c
Show file tree
Hide file tree
Showing 51 changed files with 398 additions and 417 deletions.
2 changes: 1 addition & 1 deletion desk/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "frappe-ui-frontend",
"name": "helpdesk-ui",
"private": true,
"version": "0.0.0",
"scripts": {
Expand Down
14 changes: 7 additions & 7 deletions desk/src/components/desk/SideBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,28 @@ const menuOptions = [
label: "Dashboard",
icon_: IconDashboard,
to: {
path: "/helpdesk/dashboard",
name: "Dashboard",
},
},
{
label: "Tickets",
icon_: IconTicket,
to: {
path: "/helpdesk/tickets",
name: "DeskTickets",
},
},
{
label: "Customers",
icon_: IconCustomer,
to: {
path: "/helpdesk/customers",
name: "Customers",
},
},
{
label: "Contacts",
icon_: IconContact,
to: {
path: "/helpdesk/contacts",
name: "Contacts",
},
},
];
Expand All @@ -163,14 +163,14 @@ const footerOptions = [
label: "Knowledge Base",
icon_: IconKnowledgeBase,
to: {
path: "/helpdesk/kb",
name: "DeskKBHome",
},
},
{
label: "Settings",
icon_: IconSettings,
to: {
path: "/helpdesk/settings",
name: "Settings",
},
},
];
Expand All @@ -187,7 +187,7 @@ const profileSettings = [
label: "Customer portal",
icon: "users",
handler: () => {
window.open("/helpdesk/my-tickets", "_blank");
window.open("/my-tickets", "_blank");
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions desk/src/components/desk/customers/CustomerInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
>
<div class="w-[30%]">
<router-link
:to="`/helpdesk/contacts/${contact.name}`"
:to="`/contacts/${contact.name}`"
>
{{ contact.first_name }}
{{
Expand Down Expand Up @@ -411,7 +411,7 @@ export default {
url: "frappe.client.rename_doc",
onSuccess: (res) => {
this.$router.push({
path: `/helpdesk/customers/${res}`,
path: `/customers/${res}`,
})
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default {
url: "frappe.client.insert",
onSuccess: (doc) => {
this.$router.push(
`/helpdesk/settings/canned_responses/${doc.name}`
`/settings/canned_responses/${doc.name}`
)
},
onError: (err) => {
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/desk/global/AddNewTicketTypeDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default {
return {
url: "frappe.client.insert",
onSuccess: (doc) => {
this.$router.push(`/helpdesk/ticket_types`)
this.$router.push(`/ticket_types`)
},
}
},
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/desk/global/NewCustomerDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default {
return {
url: "frappe.client.insert",
onSuccess: (doc) => {
this.$router.push(`/helpdesk/customers`)
this.$router.push(`/customers`)
},
}
},
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/desk/kb/ArticleDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="font-semibold">Details</div>
<div class="border-b w-full"></div>
<router-link
:to="`/helpdesk/knowledge-base/articles/${article.name}`"
:to="`/knowledge-base/articles/${article.name}`"
target="_blank"
v-if="article.published_on"
class="flex flex-row justify-between items-center"
Expand Down
12 changes: 6 additions & 6 deletions desk/src/components/desk/settings/SettingsSideBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@ export default {
{
label: "Agents",
pageName: "Agents",
route: "/helpdesk/settings/agents",
route: "/settings/agents",
},
{
label: "Teams",
pageName: "Teams",
route: "/helpdesk/settings/teams",
route: "/settings/teams",
},
{
label: "Ticket Types",
pageName: "TicketTypes",
route: "/helpdesk/settings/ticket_types",
route: "/settings/ticket_types",
},
{
label: "Support Policies",
pageName: "SlaPolicies",
route: "/helpdesk/settings/sla",
route: "/settings/sla",
},
{
label: "Canned Responses",
pageName: "CannedResponses",
route: "/helpdesk/settings/canned_response",
route: "/settings/canned_response",
},
{
label: "Email Accounts",
pageName: "Emails",
route: "/helpdesk/settings/emails",
route: "/settings/emails",
},
],
}
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/desk/settings/agents/AgentListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/>
</div>
<router-link
:to="`/helpdesk/settings/agents/${agent.name}`"
:to="`/settings/agents/${agent.name}`"
class="w-full group flex items-center"
>
<div class="sm:w-5/12 truncate pr-10">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ListManager
ref="miniTicketList"
:options="{
doctype: 'Ticket',
doctype: 'HD Ticket',
fields: [
'_assign',
'status',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="shrink-0 h-[72px] py-[22px] flow-root px-[16px]">
<div class="float-left">
<router-link
:to="`/helpdesk/settings/canned_response`"
:to="`/settings/canned_response`"
class="my-1 text-[12px] text-gray-600 stroke-gray-600 flex flex-row items-center space-x-1 hover:text-gray-700 hover:stroke-gray-700 select-none"
role="button"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/>
</div>
<router-link
:to="`/helpdesk/settings/canned_responses/${canned_response.name}`"
:to="`/settings/canned_responses/${canned_response.name}`"
class="w-full group flex items-center"
>
<div class="sm:w-10/12 truncate pr-10">
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/desk/settings/emails/EmailListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<div class="w-full group flex items-center">
<router-link
:to="`/helpdesk/settings/emails/${emailAccount.name}`"
:to="`/settings/emails/${emailAccount.name}`"
class="sm:w-4/12"
>
{{ emailAccount.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
<div class="w-full group flex items-center">
<router-link
:to="`/helpdesk/settings/sla/${policy.name}`"
:to="`/settings/sla/${policy.name}`"
class="sm:w-10/12 truncate pr-10 flex flex-row items-center space-x-2"
>
<div>
Expand Down
6 changes: 3 additions & 3 deletions desk/src/components/desk/settings/teams/TeamInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="flow-root h-[72px] shrink-0 py-[22px] px-[16px]">
<div class="float-left">
<router-link
:to="`/helpdesk/settings/teams`"
:to="`/settings/teams`"
class="my-1 flex select-none flex-row items-center space-x-1 stroke-gray-600 text-[12px] text-gray-600 hover:stroke-gray-700 hover:text-gray-700"
role="button"
>
Expand Down Expand Up @@ -194,7 +194,7 @@ export default {
url: "frappe.client.insert",
onSuccess: (res) => {
this.$router.push({
path: `/helpdesk/settings/teams/${res.name}`,
path: `/settings/teams/${res.name}`,
});
this.$toast({
Expand Down Expand Up @@ -233,7 +233,7 @@ export default {
})
.then(() => {
this.$router.push({
path: `/helpdesk/settings/teams/${title}`,
path: `/settings/teams/${title}`,
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="shrink-0 h-[72px] py-[22px] flow-root px-[16px]">
<div class="float-left">
<router-link
:to="`/helpdesk/settings/ticket_types`"
:to="`/settings/ticket_types`"
class="my-1 text-[12px] text-gray-600 stroke-gray-600 flex flex-row items-center space-x-1 hover:text-gray-700 hover:stroke-gray-700 select-none"
role="button"
>
Expand Down Expand Up @@ -184,7 +184,7 @@ export default {
url: "frappe.client.rename_doc",
onSuccess: (res) => {
this.$router.push({
path: `/helpdesk/settings/ticket_types/${res}`,
path: `/settings/ticket_types/${res}`,
})
},
}
Expand All @@ -194,7 +194,7 @@ export default {
url: "frappe.client.insert",
onSuccess: (res) => {
this.$router.push({
path: `/helpdesk/settings/ticket_types/${res.name}`,
path: `/settings/ticket_types/${res.name}`,
})
},
}
Expand Down
4 changes: 2 additions & 2 deletions desk/src/components/desk/ticket/InfoPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@
v-if="index <= maxCount"
:to="
index < maxCount
? `/helpdesk/tickets/${_ticket.name}`
: `/helpdesk/tickets/?contact=${JSON.stringify(
? `/tickets/${_ticket.name}`
: `/tickets/?contact=${JSON.stringify(
['is', ticket.contact]
)}`
"
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/desk/tickets/NewTicketDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
url: 'helpdesk.extends.client.get_list',
inputMap: (query) => {
return {
doctype: 'Ticket Type',
doctype: 'HD Ticket Type',
pluck: 'name',
filters: [['name', 'like', `%${query}%`]],
};
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/global/kb/ArticleCard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<router-link :to="`/helpdesk/knowledge-base/articles/${article.name}`">
<router-link :to="`/knowledge-base/articles/${article.name}`">
<div
class="group rounded-[6px] shadow-md bg-white p-5 w-full flex flex-row justify-between items-center hover:bg-gray-50"
>
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/global/kb/ArticleMiniList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- TODO: <FeatherIcon v-if="editMode" name="plus" class="w-4 cursor-pointer my-auto bg-gray-50 hover:bg-gray-100 rounded" /> -->
<p v-if="editMode" class="text-base text-gray-500">
( add articles from
<router-link class="underline" :to="{ path: '/helpdesk/kb/articles' }"
<router-link class="underline" :to="{ path: '/kb/articles' }"
>here</router-link
>
)
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/global/kb/EditableBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default {
resources: {
articles() {
if (this.activeTab == "Articles") {
this.$router.push({ path: "/helpdesk/kb/articles" })
this.$router.push({ path: "/kb/articles" })
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions desk/src/components/global/kb/LayoutSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<router-link
:title="'Articles'"
:to="{
path: '/helpdesk/kb/articles',
path: '/kb/articles',
}"
>
<FeatherIcon
Expand All @@ -30,7 +30,7 @@
</div>
<router-link
:title="'Toggle Web view'"
:to="{ path: '/helpdesk/kb' }"
:to="{ path: '/kb' }"
>
<FeatherIcon
role="button"
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/global/kb/SearchSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
>
<router-link
:to="{
path: `/helpdesk/knowledge-base/${
path: `/knowledge-base/${
result.doctype === 'Article'
? 'articles'
: 'categories'
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/global/ticket_list_item/Subject.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<router-link
:to="{
path: `/helpdesk/tickets/${ticket.name}`,
path: `/tickets/${ticket.name}`,
}"
role="button"
class="line-clamp-1 hover:text-gray-900 text-gray-600"
Expand Down
12 changes: 6 additions & 6 deletions desk/src/components/portal/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ export default {
}
// Add "Create a Ticket" option on the navbar if not already present
const newTicketRoutes = [
"/helpdesk/my-tickets",
"/helpdesk/my-tickets/",
"/helpdesk/my-tickets/new",
"/helpdesk/my-tickets/new/",
"/my-tickets",
"/my-tickets/",
"/my-tickets/new",
"/my-tickets/new/",
]
const currentRouteIsNewTicket = () => {
for (let route of newTicketRoutes) {
Expand All @@ -136,7 +136,7 @@ export default {
if (!currentRouteIsNewTicket() && !newTicketRouteExists()) {
parentItems.push({
label: "Create a Ticket",
url: "/helpdesk/my-tickets",
url: "/my-tickets",
children: [],
})
}
Expand All @@ -154,7 +154,7 @@ export default {
label: "Logout",
handler: () => {
this.authStore.logout()
window.location.href = "/helpdesk/login"
window.location.href = "/login"
},
},
]
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/portal/ticket/Conversations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default {
},
mounted() {
this.$socket.on("list_update", (data) => {
if (data["doctype"] == "Ticket" && data["name"] == this.ticketId) {
if (data["doctype"] == "HD Ticket" && data["name"] == this.ticketId) {
this.$resources.conversations.fetch()
}
})
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/portal/tickets/TicketList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
:key="ticket.name"
class="space-y-4"
>
<router-link :to="`/helpdesk/my-tickets/${ticket.name}`">
<router-link :to="`/my-tickets/${ticket.name}`">
<div
class="px-1 rounded hover:bg-slate-50 cursor-pointer"
>
Expand Down
Loading

0 comments on commit d1e033c

Please sign in to comment.