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 33 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f871846
refactor: knowledge base
RitvikSardana Dec 31, 2024
ab83d97
fix: remove all components and pages related to kb
RitvikSardana Dec 31, 2024
4c44a95
chore: article category cleanup
RitvikSardana Dec 31, 2024
145234e
fix: common variable for text editor options
RitvikSardana Jan 1, 2025
eac095c
fix: change KB router name
RitvikSardana Jan 1, 2025
a285a75
fix: add article resource
RitvikSardana Jan 1, 2025
721dd3a
fix: add build file for helpdesk docker image
RitvikSardana Jan 2, 2025
f85c058
fix: add breadcrumbs in new article page
RitvikSardana Jan 2, 2025
4faaf03
fix: add edit article page
RitvikSardana Jan 2, 2025
773d6c4
chore: code cleanup
RitvikSardana Jan 2, 2025
b1ffa54
fix: add edit article functionality
RitvikSardana Jan 2, 2025
2611ffd
fix: add action buttons for article edit mode
RitvikSardana Jan 3, 2025
ac23c0c
fix: edit mode in single article view
RitvikSardana Jan 6, 2025
db3f05a
fix: handle article delete and is dirty logic
RitvikSardana Jan 6, 2025
ecea93c
fix: add group by functionality in list view builder
RitvikSardana Jan 6, 2025
d51eb03
fix(type): Article
RitvikSardana Jan 6, 2025
d5e46b1
fix: add label value in link field options of group by
RitvikSardana Jan 6, 2025
06fb127
fix: auto adjust text area height based on content
RitvikSardana Jan 6, 2025
ffadbdc
fix(ui): handle article count
RitvikSardana Jan 6, 2025
db741c4
fix: handle ts config and new file for api and resources
RitvikSardana Jan 6, 2025
296b7c2
fix: give context of group to dropdown action buttons
RitvikSardana Jan 6, 2025
d675cfe
fix: add functionality to create new category, delete category, and c…
RitvikSardana Jan 7, 2025
7fdfc6e
fix: brand logo shape
RitvikSardana Jan 10, 2025
5155935
feat: move to category and create category
RitvikSardana Jan 10, 2025
12e20d6
fix: move to functionality in single article view
RitvikSardana Jan 10, 2025
7d76250
fix(styles): show indent in rows
RitvikSardana Jan 11, 2025
8a85419
fix(ux): category dialog field
RitvikSardana Jan 11, 2025
5879a43
fix: add delete articles bulk action
RitvikSardana Jan 11, 2025
65cb0a3
fix: add category selection while creating new article
RitvikSardana Jan 12, 2025
320efa9
fix(styles): category selection
RitvikSardana Jan 12, 2025
f52cb30
fix: edit mode in query params
RitvikSardana Jan 13, 2025
6186f60
fix: rename article page file name
RitvikSardana Jan 13, 2025
7858d30
fix: add customer knowledge base
RitvikSardana Jan 13, 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
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Container Image
on:
workflow_dispatch:
push:
branches:
- main
tags:
- "*"

jobs:
build:
name: Build

runs-on: ubuntu-latest

strategy:
matrix:
arch: [amd64, arm64]

steps:
- name: Checkout Entire Repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/${{ matrix.arch }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set Branch
run: |
export APPS_JSON='[{"url": "https://github.com/frappe/helpdesk","branch": "main"}]'
echo "APPS_JSON_BASE64=$(echo $APPS_JSON | base64 -w 0)" >> $GITHUB_ENV
echo "FRAPPE_BRANCH=version-15" >> $GITHUB_ENV

- name: Set Image Tag
run: |
echo "IMAGE_TAG=stable" >> $GITHUB_ENV

- uses: actions/checkout@v4
with:
repository: frappe/frappe_docker
path: builds

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
context: builds
file: builds/images/layered/Containerfile
tags: >
ghcr.io/${{ github.repository }}:${{ github.ref_name }},
ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }}
build-args: |
"FRAPPE_BRANCH=${{ env.FRAPPE_BRANCH }}"
"APPS_JSON_BASE64=${{ env.APPS_JSON_BASE64 }}"
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
120 changes: 120 additions & 0 deletions desk/src/components/ListRows.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<template>
<div class="mx-3 mt-2 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 == ''">
{{ "General" }}
<span class="text-xs text-ink-gray-6"
>{{
group.rows.length +
" Article" +
(group.rows.length > 1 ? "s" : "")
}}
</span>
</div>
<div v-else class="flex items-center gap-1 w-full">
<span>{{ group.group.label }}</span>
<span class="text-xs text-ink-gray-6"
>{{
group.rows.length +
" Article" +
(group.rows.length > 1 ? "s" : "")
}}
</span>
</div>
</div>
<Dropdown
:options="actions(group)"
v-if="groupByActions.length > 0 && group.group.label != ''"
>
<Button variant="ghost">
<template #icon>
<IconMoreHorizontal class="h-4 w-4" />
</template>
</Button>
</Dropdown>
</div>
</ListGroupHeader>
<ListGroupRows :group="group" id="list-rows">
<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) => {
const _actions = props.groupByActions.map((action) => {
return {
...action,
onClick: () => action.onClick(group),
};
});
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>
.row > button > span > div > :nth-child(-n + 2) > * {
margin-left: 20px;
}
</style>
Loading
Loading