Skip to content

Commit

Permalink
Merge pull request #2059 from frappe/develop
Browse files Browse the repository at this point in the history
chore(release): dev to main
  • Loading branch information
RitvikSardana authored Nov 22, 2024
2 parents d3436c3 + b49c0c3 commit 77ad11c
Show file tree
Hide file tree
Showing 22 changed files with 264 additions and 213 deletions.
7 changes: 4 additions & 3 deletions desk/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
<RouterView class="antialiased" />
<Toasts />
<KeymapDialog />
<Dialogs />
</template>

<script setup lang="ts">
import { provide, ref, onMounted, onUnmounted } from "vue";
import { onMounted, onUnmounted } from "vue";
import { Toasts } from "frappe-ui";
import { createToast } from "@/utils";
import { useConfigStore } from "@/stores/config";
import KeymapDialog from "@/pages/KeymapDialog.vue";
import { stopSession } from "@/telemetry";
import { init as initTelemetry } from "@/telemetry";
import { init as initTelemetry, stopSession } from "@/telemetry";
import { Dialogs } from "frappe-ui";
useConfigStore();
onMounted(async () => {
Expand Down
2 changes: 2 additions & 0 deletions desk/src/components/CommentTextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
:editable="editable"
:mentions="agents"
@change="editable ? (newComment = $event) : null"
:extensions="[PreserveVideoControls]"
>
<template #bottom>
<div v-if="editable" class="flex flex-col gap-2">
Expand Down Expand Up @@ -102,6 +103,7 @@ import { AttachmentIcon } from "@/components/icons/";
import { AttachmentItem } from "@/components/";
import { useAgentStore } from "@/stores/agent";
import { useStorage } from "@vueuse/core";
import { PreserveVideoControls } from "@/tiptap-extensions";
const { agents: agentsList } = useAgentStore();
Expand Down
2 changes: 2 additions & 0 deletions desk/src/components/EmailEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:placeholder="placeholder"
:editable="editable"
@change="editable ? (newEmail = $event) : null"
:extensions="[PreserveVideoControls]"
>
<template #top>
<div class="mx-10 flex items-center gap-2 border-y py-2.5">
Expand Down Expand Up @@ -163,6 +164,7 @@ import {
CannedResponseSelectorModal,
} from "@/components";
import { AttachmentIcon, EmailIcon } from "@/components/icons";
import { PreserveVideoControls } from "@/tiptap-extensions";
const editorRef = ref(null);
const showCannedResponseSelectorModal = ref(false);
Expand Down
3 changes: 2 additions & 1 deletion desk/src/components/Settings/EmailAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const state: Reactive<EmailAccount> = reactive({
password: "",
api_key: "",
api_secret: "",
frappe_mail_site: "",
enable_incoming: false,
enable_outgoing: false,
default_incoming: false,
Expand Down Expand Up @@ -157,7 +158,7 @@ const addEmailRes = createResource({
},
});
const error = ref("");
const error = ref<string | undefined>();
function createEmailAccount() {
error.value = validateInputs(state, selectedService.value.custom);
if (error.value) return;
Expand Down
6 changes: 4 additions & 2 deletions desk/src/components/Settings/EmailEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const state = reactive({
api_key: props.accountData?.api_key || null,
api_secret: props.accountData?.api_secret || null,
password: props.accountData?.password || null,
frappe_mail_site: props.accountData?.frappe_mail_site || "",
enable_incoming: props.accountData.enable_incoming || false,
enable_outgoing: props.accountData.enable_outgoing || false,
default_outgoing: props.accountData.default_outgoing || false,
Expand All @@ -135,7 +136,7 @@ const fields = computed(() => {
return popularProviderFields;
});
const error = ref("");
const error = ref<string | undefined>();
const loading = ref(false);
async function updateAccount() {
error.value = validateInputs(state, isCustomService.value);
Expand Down Expand Up @@ -189,7 +190,8 @@ const isDirty = computed(() => {
state.enable_incoming !== props.accountData.enable_incoming ||
state.enable_outgoing !== props.accountData.enable_outgoing ||
state.default_outgoing !== props.accountData.default_outgoing ||
state.default_incoming !== props.accountData.default_incoming
state.default_incoming !== props.accountData.default_incoming ||
state.frappe_mail_site !== props.accountData.frappe_mail_site
);
});
Expand Down
6 changes: 6 additions & 0 deletions desk/src/components/Settings/emailConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ export const popularProviderFields = [

export const customProviderFields = [
...fixedFields,
{
label: "Frappe Mail Site",
name: "frappe_mail_site",
type: "text",
placeholder: "https://frappemail.com",
},
{
label: "API Key",
name: "api_key",
Expand Down
1 change: 0 additions & 1 deletion desk/src/components/ViewControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
</div>
</FadedScrollableDiv>
<div class="grow"></div>
<div class="-ml-2 h-[70%] border-l" />

<div class="flex items-center gap-2">
<Button :label="'Refresh'" @click="emit('event:reload')">
Expand Down
2 changes: 1 addition & 1 deletion desk/src/components/layouts/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div class="mb-4" v-if="!isCustomerPortal">
<div
v-if="notificationStore.unread"
class="absolute z-20 h-1.5 w-1.5 translate-x-6 translate-y-1 rounded-full bg-blue-400"
class="absolute z-20 h-1.5 w-1.5 translate-x-6 translate-y-1 rounded-full bg-blue-400 left-1"
theme="gray"
variant="solid"
/>
Expand Down
35 changes: 21 additions & 14 deletions desk/src/pages/TicketCustomer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</template>
<template #right-header>
<Button
v-if="showResolveButton"
v-if="ticket.data.status !== 'Closed'"
label="Close"
theme="gray"
variant="solid"
Expand Down Expand Up @@ -70,6 +70,8 @@ import { createToast } from "@/utils";
import { LayoutHeader } from "@/components";
import TicketCustomerSidebar from "@/components/ticket/TicketCustomerSidebar.vue";
import { useScreenSize } from "@/composables/screen";
import { useConfigStore } from "@/stores/config";
import { confirmDialog } from "frappe-ui";
interface P {
ticketId: string;
}
Expand Down Expand Up @@ -126,10 +128,22 @@ function handleClose() {
if (showFeedback.value) {
showFeedbackDialog.value = true;
} else {
setValue.submit({ fieldname: "status", value: "Closed" });
showConfirmationDialog();
}
}
function showConfirmationDialog() {
confirmDialog({
title: "Close Ticket",
message: "Are you sure you want to close this ticket?",
onConfirm: ({ hideDialog }: { hideDialog: Function }) => {
ticket.data.status = "Closed";
setValue.submit({ fieldname: "status", value: "Closed" });
hideDialog();
},
});
}
const setValue = createResource({
url: "frappe.client.set_value",
debounce: 300,
Expand Down Expand Up @@ -157,21 +171,14 @@ const breadcrumbs = computed(() => {
return items;
});
const showReopenButton = computed(
() => ticket.data.status === "Resolved" && !ticket.data.feedback
);
const showResolveButton = computed(() =>
["Open", "Replied"].includes(ticket.data.status)
);
const showEditor = computed(() => ticket.data.status !== "Closed");
// this handles whether the ticket was raised and then was closed without any reply from the agent.
const { isFeedbackMandatory } = useConfigStore();
const showFeedback = computed(() => {
return ticket.data?.communications?.some((c) => {
if (c.sender !== ticket.data.raised_by) {
return true;
}
});
const hasAgentCommunication = ticket.data?.communications?.some(
(c) => c.sender !== ticket.data.raised_by
);
return hasAgentCommunication && isFeedbackMandatory;
});
</script>
17 changes: 11 additions & 6 deletions desk/src/pages/TicketNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@
</div>
<!-- existing fields -->
<div class="flex flex-col" :class="subject.length >= 2 && 'gap-5'">
<FormControl
v-model="subject"
type="text"
label="Subject*"
placeholder="A short description"
/>
<div class="flex flex-col gap-2">
<span class="block text-sm text-gray-700">
Subject
<span class="place-self-center text-red-500"> * </span>
</span>
<FormControl
v-model="subject"
type="text"
placeholder="A short description"
/>
</div>
<TicketNewArticles v-if="isCustomerPortal" :search="subject" />
<div v-if="isCustomerPortal">
<h4
Expand Down
4 changes: 4 additions & 0 deletions desk/src/stores/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const useConfigStore = defineStore("config", () => {
const preferKnowledgeBase = computed(
() => !!parseInt(config.value.prefer_knowledge_base)
);
const isFeedbackMandatory = computed(
() => !!parseInt(config.value.is_feedback_mandatory)
);

socket.on("helpdesk:settings-updated", () => configRes.reload());

Expand All @@ -29,5 +32,6 @@ export const useConfigStore = defineStore("config", () => {
preferKnowledgeBase,
isSetupComplete,
skipEmailWorkflow,
isFeedbackMandatory,
};
});
1 change: 1 addition & 0 deletions desk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export interface EmailAccount {
api_key?: string;
api_secret?: string;
password?: string;
frappe_mail_site?: string;
enable_outgoing?: boolean;
enable_incoming?: boolean;
default_outgoing?: boolean;
Expand Down
1 change: 1 addition & 0 deletions helpdesk/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def get_config():
"prefer_knowledge_base",
"setup_complete",
"skip_email_workflow",
"is_feedback_mandatory",
]
res = frappe.get_value(doctype="HD Settings", fieldname=fields, as_dict=True)
return res
8 changes: 5 additions & 3 deletions helpdesk/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ def create_email_account(data):
**service_config,
}
)
email_doc.append(
"imap_folder", {"append_to": "HD Ticket", "folder_name": "INBOX"}
)
if service == "Frappe Mail":
email_doc.api_key = data.get("api_key")
email_doc.api_secret = data.get("api_secret")
email_doc.frappe_mail_site = data.get("frappe_mail_site")
email_doc.append_to = "HD Ticket"
else:
email_doc.append(
"imap_folder", {"append_to": "HD Ticket", "folder_name": "INBOX"}
)
email_doc.password = data.get("password")
# validate whether the credentials are correct
email_doc.get_incoming_server()
Expand Down
14 changes: 3 additions & 11 deletions helpdesk/helpdesk/doctype/hd_agent/hd_agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"user",
"agent_name",
"user_image",
"is_active",
"groups"
"is_active"
],
"fields": [
{
Expand All @@ -35,12 +34,6 @@
"in_list_view": 1,
"label": "Is Active"
},
{
"fieldname": "groups",
"fieldtype": "Table",
"label": "Groups",
"options": "HD Team Item"
},
{
"fetch_from": "user.user_image",
"fieldname": "user_image",
Expand All @@ -51,7 +44,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-07-24 22:31:23.178626",
"modified": "2024-11-11 17:30:22.859253",
"modified_by": "Administrator",
"module": "Helpdesk",
"name": "HD Agent",
Expand Down Expand Up @@ -95,6 +88,5 @@
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "agent_name",
"track_changes": 1
"title_field": "agent_name"
}
Loading

0 comments on commit 77ad11c

Please sign in to comment.