Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: knowledge base & articles #2124

Draft
wants to merge 66 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
4d0e2d0
refactor: knowledge base
RitvikSardana Dec 31, 2024
5591410
fix: remove all components and pages related to kb
RitvikSardana Dec 31, 2024
5fa49e7
chore: article category cleanup
RitvikSardana Dec 31, 2024
b05ca7d
fix: common variable for text editor options
RitvikSardana Jan 1, 2025
b773be0
fix: change KB router name
RitvikSardana Jan 1, 2025
2aa8236
fix: add article resource
RitvikSardana Jan 1, 2025
2ccf503
fix: add breadcrumbs in new article page
RitvikSardana Jan 2, 2025
1c48531
fix: add edit article page
RitvikSardana Jan 2, 2025
1178a85
chore: code cleanup
RitvikSardana Jan 2, 2025
c81cf3d
fix: add edit article functionality
RitvikSardana Jan 2, 2025
7164441
fix: add action buttons for article edit mode
RitvikSardana Jan 3, 2025
3394dfc
fix: edit mode in single article view
RitvikSardana Jan 6, 2025
880f660
fix: handle article delete and is dirty logic
RitvikSardana Jan 6, 2025
e35a4a6
fix: add group by functionality in list view builder
RitvikSardana Jan 6, 2025
b62d783
fix(type): Article
RitvikSardana Jan 6, 2025
b4eca79
fix: add label value in link field options of group by
RitvikSardana Jan 6, 2025
af12a38
fix: auto adjust text area height based on content
RitvikSardana Jan 6, 2025
9feabd3
fix(ui): handle article count
RitvikSardana Jan 6, 2025
8f75702
fix: handle ts config and new file for api and resources
RitvikSardana Jan 6, 2025
373f902
fix: give context of group to dropdown action buttons
RitvikSardana Jan 6, 2025
7e301e2
fix: add functionality to create new category, delete category, and c…
RitvikSardana Jan 7, 2025
0fb24dd
fix: brand logo shape
RitvikSardana Jan 10, 2025
83c24e0
feat: move to category and create category
RitvikSardana Jan 10, 2025
e2fec37
fix: move to functionality in single article view
RitvikSardana Jan 10, 2025
e04fddc
fix(styles): show indent in rows
RitvikSardana Jan 11, 2025
1239b9e
fix(ux): category dialog field
RitvikSardana Jan 11, 2025
63ce184
fix: add delete articles bulk action
RitvikSardana Jan 11, 2025
c8bebc6
fix: add category selection while creating new article
RitvikSardana Jan 12, 2025
1364839
fix(styles): category selection
RitvikSardana Jan 12, 2025
87f4a03
fix: edit mode in query params
RitvikSardana Jan 13, 2025
5b7f803
fix: rename article page file name
RitvikSardana Jan 13, 2025
4239543
fix: add customer knowledge base
RitvikSardana Jan 13, 2025
d41d598
fix: article list view page
RitvikSardana Jan 14, 2025
3ebf673
fix(ui): category view & article view
RitvikSardana Jan 14, 2025
c7c597e
fix: select field quick filter
RitvikSardana Jan 14, 2025
bc9c479
fix: add search section in new kb of customer portal
RitvikSardana Jan 14, 2025
1295582
fix: utils to copy to clipboard
RitvikSardana Jan 14, 2025
cf97d62
fix: rename search article component
RitvikSardana Jan 14, 2025
7956389
chore: code cleanup
RitvikSardana Jan 14, 2025
fecde26
fix(ui): category & article card
RitvikSardana Jan 15, 2025
7514c8f
fix(ui): scroll issue in article header
RitvikSardana Jan 15, 2025
d83388d
fix(styles): category & article card view
RitvikSardana Jan 15, 2025
b43ec15
fix: add back article feedback
RitvikSardana Jan 15, 2025
4708741
fix(styles): feedback component
RitvikSardana Jan 15, 2025
1db4f30
fix: add back telemetry to article view
RitvikSardana Jan 15, 2025
412da2a
fix: remove dead code
RitvikSardana Jan 16, 2025
26ec9b8
fix: add back scroll into section functionality in article
RitvikSardana Jan 16, 2025
6197177
chore: capitalisation of Knowledge Base string
RitvikSardana Jan 16, 2025
26598ef
refactor: isCustomerPortal variable
RitvikSardana Jan 16, 2025
f3964cd
fix: handle not allowed articles on customer portal
RitvikSardana Jan 16, 2025
b865ccf
fix(ui): icon shade
RitvikSardana Jan 16, 2025
92663b8
fix: generic way to group by with external doctype
RitvikSardana Jan 16, 2025
3bee69b
fix: better way to delete category using hooks instead of API
RitvikSardana Jan 16, 2025
2c7651e
fix: change article category doctype from tree to normal
RitvikSardana Jan 16, 2025
331bac1
fix: patch for adding 'General' article category
RitvikSardana Jan 16, 2025
de31502
fix: update frappe ui
RitvikSardana Jan 16, 2025
8ab4c73
fix: remove unnecessary child doctypes
RitvikSardana Jan 16, 2025
e20267c
fix: add validation for general article category
RitvikSardana Jan 16, 2025
1ea4bc4
chore: code cleanup
RitvikSardana Jan 16, 2025
e3bd063
chore: code cleanup
RitvikSardana Jan 17, 2025
6bc5240
fix: undefined filters issue
RitvikSardana Jan 17, 2025
897927b
perf: cache articles page
RitvikSardana Jan 17, 2025
731161a
fix: handle general category, delete article/category & move to cate…
RitvikSardana Jan 17, 2025
0d435d5
chore: code cleanup
RitvikSardana Jan 17, 2025
a458c94
fix: remove dead code
RitvikSardana Jan 17, 2025
cb12572
chore: code cleanup
RitvikSardana Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
*.log
tags
node_modules
.vscode

# Distribution / packaging
.Python
Expand Down
7 changes: 6 additions & 1 deletion desk/src/components/BrandLogo.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template>
<Avatar v-if="config.brandLogo" size="xl" :image="config.brandLogo" />
<img
v-if="config.brandLogo"
:src="config.brandLogo"
alt="Brand Logo"
class="h-8 w-8 shrink-0 object-cover"
/>
<HDLogo v-else class="h-8 w-8 shrink-0 rounded" />
</template>

Expand Down
39 changes: 1 addition & 38 deletions desk/src/components/CommentTextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ import { AttachmentItem } from "@/components/";
import { useAgentStore } from "@/stores/agent";
import { useStorage } from "@vueuse/core";
import { PreserveVideoControls } from "@/tiptap-extensions";
import { textEditorMenuButtons } from "@/utils";

const { agents: agentsList } = useAgentStore();

Expand Down Expand Up @@ -163,42 +164,4 @@ async function submitComment() {

comment.submit();
}

const textEditorMenuButtons = [
"Paragraph",
["Heading 2", "Heading 3", "Heading 4", "Heading 5", "Heading 6"],
"Separator",
"Bold",
"Italic",
"Separator",
"Bullet List",
"Numbered List",
"Separator",
"Align Left",
"Align Center",
"Align Right",
"FontColor",
"Separator",
"Image",
"Video",
"Link",
"Blockquote",
"Code",
"Horizontal Rule",
[
"InsertTable",
"AddColumnBefore",
"AddColumnAfter",
"DeleteColumn",
"AddRowBefore",
"AddRowAfter",
"DeleteRow",
"MergeCells",
"SplitCell",
"ToggleHeaderColumn",
"ToggleHeaderRow",
"ToggleHeaderCell",
"DeleteTable",
],
];
</script>
40 changes: 40 additions & 0 deletions desk/src/components/DiscardButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<Button :label="label" @click="handleDiscard" />
</template>

<script setup lang="ts">
import { confirmDialog } from "frappe-ui";

const emit = defineEmits<{
(event: "discard"): void;
}>();

const {
label = "Discard",
hideDialog = false,
title = "Discard?",
message = "Are you sure you want to discard this?",
} = defineProps<{
label?: string;
hideDialog?: boolean;
title?: string;
message?: string;
}>();

function handleDiscard() {
if (hideDialog) {
emit("discard");
return;
}
confirmDialog({
title: title,
message: message,
onConfirm: ({ hideDialog }: { hideDialog: Function }) => {
emit("discard");
hideDialog();
},
});
}
</script>

<style scoped></style>
40 changes: 1 addition & 39 deletions desk/src/components/EmailEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ import {
TextEditorFixedMenu,
createResource,
} from "frappe-ui";
import { createToast, validateEmail } from "@/utils";
import { createToast, validateEmail, textEditorMenuButtons } from "@/utils";
import {
MultiSelectInput,
AttachmentItem,
Expand Down Expand Up @@ -298,44 +298,6 @@ function addToReply(
.run();
}

const textEditorMenuButtons = [
"Paragraph",
["Heading 2", "Heading 3", "Heading 4", "Heading 5", "Heading 6"],
"Separator",
"Bold",
"Italic",
"Separator",
"Bullet List",
"Numbered List",
"Separator",
"Align Left",
"Align Center",
"Align Right",
"FontColor",
"Separator",
"Image",
"Video",
"Link",
"Blockquote",
"Code",
"Horizontal Rule",
[
"InsertTable",
"AddColumnBefore",
"AddColumnAfter",
"DeleteColumn",
"AddRowBefore",
"AddRowAfter",
"DeleteRow",
"MergeCells",
"SplitCell",
"ToggleHeaderColumn",
"ToggleHeaderRow",
"ToggleHeaderCell",
"DeleteTable",
],
];

const editor = computed(() => {
return editorRef.value.editor;
});
Expand Down
23 changes: 0 additions & 23 deletions desk/src/components/HCard.vue

This file was deleted.

109 changes: 109 additions & 0 deletions desk/src/components/ListRows.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<template>
<div class="mx-3 h-full overflow-y-auto sm:mx-5" v-if="showGroupedRows">
<div v-for="group in groupedRows" :key="group.group">
<ListGroupHeader :group="group">
<div
class="my-2 flex items-center gap-2 text-base font-medium text-ink-gray-8 justify-between w-full mr-1"
>
<div class="flex items-center gap-2 w-full">
<component v-if="group.icon" :is="group.icon" />
<div
v-if="group.group.label != ''"
class="flex items-center gap-1 w-full"
>
<span>{{ group.group.label }}</span>
<span class="text-xs text-ink-gray-5"
>{{
group.rows.length +
" Article" +
(group.rows.length > 1 ? "s" : "")
}}
</span>
</div>
</div>
<Dropdown :options="actions(group)" v-if="groupByActions.length > 0">
<Button variant="ghost">
<template #icon>
<IconMoreHorizontal class="h-4 w-4" />
</template>
</Button>
</Dropdown>
</div>
</ListGroupHeader>
<ListGroupRows :group="group" id="list-rows" class="!mt-0">
<ListRow
v-for="row in group.rows"
:key="row.name"
v-slot="{ idx, column, item }"
:row="row"
class="truncate text-base row"
>
<slot v-bind="{ idx, column, item, row }" />
</ListRow>
</ListGroupRows>
</div>
</div>
<ListRows class="mx-3 sm:mx-5" v-else id="list-rows">
<ListRow
v-for="row in groupedRows"
:key="row.name"
v-slot="{ idx, column, item }"
:row="row"
class="truncate text-base"
>
<slot v-bind="{ idx, column, item, row }" />
</ListRow>
</ListRows>
</template>

<script setup>
import { ref, computed, watch } from "vue";
import {
ListRows,
ListRow,
ListGroupHeader,
ListGroupRows,
Dropdown,
Button,
} from "frappe-ui";

import IconMoreHorizontal from "~icons/lucide/more-horizontal";
const props = defineProps({
rows: {
type: Array,
required: true,
},
groupByActions: {
type: Array,
default: () => [],
},
});

const groupedRows = ref(props.rows);

const actions = (group) => {
let _actions = props.groupByActions.map((action) => {
return {
...action,
onClick: () => action.onClick(group),
};
});
if (group.group.label == "General") {
_actions = _actions.filter((action) => action.label === "Add New Article");
}
return _actions;
};

watch(
() => props.rows,
(val) => (groupedRows.value = val)
);

let showGroupedRows = computed(() => {
return props.rows.every(
(row) => row.group && row.rows && Array.isArray(row.rows)
);
});
</script>

<style></style>
Loading
Loading