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

chore(release): dev to main #2129

Merged
merged 25 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
52ac8db
refactor: remove custom list view from knowledge base
RitvikSardana Dec 23, 2024
7922e15
refactor: escalation rules page
RitvikSardana Dec 23, 2024
d4b3e0f
fix: remove escalation rule page
RitvikSardana Dec 23, 2024
73622e3
fix: tsconfig
RitvikSardana Dec 23, 2024
26e509e
chore: code cleanup
RitvikSardana Dec 23, 2024
8f5e2da
fix: remove shitty list view
RitvikSardana Dec 23, 2024
921da06
chore: remove unnecessary pages and components
RitvikSardana Dec 23, 2024
39ab6a0
chore: update tsconfig
RitvikSardana Dec 23, 2024
5b8f0b3
refactor: notifications panel
RitvikSardana Dec 23, 2024
8fd4ad4
fix: list-view-builder api calls
RitvikSardana Dec 23, 2024
c078a67
fix: remove dependency of listManager
RitvikSardana Dec 23, 2024
f6d14cd
chore: remove unnecessary pages and components
RitvikSardana Dec 23, 2024
4153940
refactor: remove relevant functions and files of listManager
RitvikSardana Dec 23, 2024
70785f3
chore: code cleanup
RitvikSardana Dec 23, 2024
98c3335
Merge pull request #2111 from RitvikSardana/refactor-listview-2
RitvikSardana Dec 23, 2024
6a483e7
fix: only agents can access users api
RitvikSardana Dec 23, 2024
423d1aa
Merge pull request #2113 from RitvikSardana/get_users_permission
RitvikSardana Dec 23, 2024
a9b13db
fix: reload in list view builder
RitvikSardana Dec 26, 2024
91c681f
fix: only agents can access users api
RitvikSardana Dec 23, 2024
4bf42a1
fix: better ux on failure of email send
RitvikSardana Dec 30, 2024
ec07610
fix: remove rows from get_list_data
RitvikSardana Dec 30, 2024
938975f
fix: better way to set empty rows
RitvikSardana Dec 30, 2024
441d201
Merge pull request #2117 from RitvikSardana/listview-reload
RitvikSardana Dec 30, 2024
26732b8
fix: add build file for helpdesk docker image
RitvikSardana Jan 2, 2025
359f6c3
Merge pull request #2122 from RitvikSardana/docker-build
RitvikSardana Jan 2, 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 }}"
2 changes: 1 addition & 1 deletion desk/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { stopSession } from "@/telemetry";
import { Dialogs } from "frappe-ui";
useConfigStore();

onMounted(async () => {
onMounted(() => {
window.addEventListener("online", () => {
createToast({
title: "You are now online",
Expand Down
12 changes: 11 additions & 1 deletion desk/src/components/EmailEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,15 @@ import {
TextEditorFixedMenu,
createResource,
} from "frappe-ui";
import { validateEmail } from "@/utils";
import { createToast, validateEmail } from "@/utils";
import {
MultiSelectInput,
AttachmentItem,
CannedResponseSelectorModal,
} from "@/components";
import { AttachmentIcon, EmailIcon } from "@/components/icons";
import { PreserveVideoControls } from "@/tiptap-extensions";
import { useError } from "@/composables/error";

const editorRef = ref(null);
const showCannedResponseSelectorModal = ref(false);
Expand Down Expand Up @@ -242,6 +243,15 @@ function submitMail() {
emit("submit");
loading.value = false;
},
onError: (err) => {
loading.value = false;
createToast({
title: err.exc_type,
text: err.messages[0],
icon: "x",
iconClasses: "text-red-500",
});
},
});

sendMail.submit();
Expand Down
139 changes: 85 additions & 54 deletions desk/src/components/ListViewBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
>
<QuickFilters v-if="!isMobileView" />
<div class="flex items-center gap-2" v-if="!isMobileView">
<Reload @click="reload" :loding="list.loading" />
<Reload @click="reload" :loading="list.loading" />
<Filter :default_filters="defaultParams.filters" />
<SortBy :hide-label="isMobileView" />
</div>
Expand All @@ -21,54 +21,55 @@
</FadedScrollableDiv>

<!-- List View -->
<slot v-bind="{ list }">
<ListView
v-if="list.data?.data.length > 0"
class="flex-1"
:columns="columns"
:rows="rows"
row-key="name"
:options="{
selectable: true,
showTooltip: true,
resizeColumn: false,
onRowClick: (row: Object) => emit('rowClick', row['name']),
emptyState,
}"
>
<ListHeader class="sm:mx-5 mx-3">
<ListHeaderItem
v-for="column in columns"
:key="column.key"
:item="column"
@columnWidthUpdated="(width) => console.log(width)"
/>
</ListHeader>
<ListRows class="sm:mx-5 mx-3">
<ListRow
v-for="row in rows"
:key="row.name"
v-slot="{ idx, column, item }"
:row="row"
class="truncate text-base"
>
<ListRowItem :item="item" :row="row" :column="column">
<!-- TODO: filters on click of other columns -->
<!-- and not on first column, it should emit the event -->
<div v-if="idx === 0" class="truncate">
{{ item }}
</div>
<div v-else-if="column.type === 'Datetime'">
{{ dayjs.tz(item).fromNow() }}
</div>
<div v-else class="truncate">
{{ item }}
</div>
</ListRowItem>
</ListRow>
</ListRows>
</ListView>
</slot>
<ListView
v-if="list.data?.data.length > 0"
class="flex-1"
:columns="columns"
:rows="rows"
row-key="name"
:options="{
selectable: props.options.selectable ?? true ,
showTooltip: true,
resizeColumn: false,
onRowClick: (row: Object) => emit('rowClick', row['name']),
emptyState,
}"
>
<ListHeader class="sm:mx-5 mx-3">
<ListHeaderItem
v-for="column in columns"
:key="column.key"
:item="column"
@columnWidthUpdated="(width) => console.log(width)"
/>
</ListHeader>
<ListRows class="sm:mx-5 mx-3">
<ListRow
v-for="row in rows"
:key="row.name"
v-slot="{ idx, column, item }"
:row="row"
class="truncate text-base"
>
<ListRowItem :item="item" :row="row" :column="column">
<!-- TODO: filters on click of other columns -->
<!-- and not on first column, it should emit the event -->
<div v-if="idx === 0" class="truncate">
{{ item }}
</div>
<div v-else-if="column.type === 'Datetime'">
{{ dayjs.tz(item).fromNow() }}
</div>
<div v-else-if="column.type === 'status'">
<Badge v-bind="handleStatusColor(item)" />
</div>
<div v-else class="truncate">
{{ item }}
</div>
</ListRowItem>
</ListRow>
</ListRows>
</ListView>

<!-- List Footer -->
<div
Expand Down Expand Up @@ -109,13 +110,16 @@ import {
ListRow,
ListHeader,
ListHeaderItem,
Badge,
} from "frappe-ui";

import { Filter, SortBy, QuickFilters } from "@/components/view-controls";
import { dayjs } from "@/dayjs";
import FadedScrollableDiv from "./FadedScrollableDiv.vue";
import Reload from "./view-controls/Reload.vue";
import { useScreenSize } from "@/composables/screen";
import EmptyState from "./EmptyState.vue";
import { BadgeStatus } from "@/types";

interface P {
options: {
Expand All @@ -126,6 +130,9 @@ interface P {
icon?: HTMLElement | string;
title: string;
};
hideViewControls?: boolean;
selectable?: boolean;
statusMap?: Record<string, BadgeStatus>;
};
}

Expand All @@ -134,7 +141,15 @@ interface E {
(event: "rowClick", row: any): void;
}

const props = defineProps<P>();
const props = withDefaults(defineProps<P>(), {
options: () => {
return {
doctype: "",
hideViewControls: false,
selectable: true,
};
},
});

const emit = defineEmits<E>();
const { isMobileView } = useScreenSize();
Expand Down Expand Up @@ -190,10 +205,21 @@ function handleColumnConfig(column) {
return column;
}

const statusMap: Record<string, BadgeStatus> = props.options
.statusMap as Record<string, BadgeStatus>;
function handleStatusColor(status: "Published" | "Draft"): BadgeStatus {
if (!statusMap)
return {
label: status,
theme: "gray",
};
return statusMap[status];
}

const filterableFields = createResource({
url: "helpdesk.api.doc.get_filterable_fields",
cache: ["DocField", props.options.doctype],
auto: true,
auto: !props.options.hideViewControls,
params: {
doctype: props.options.doctype,
append_assign: true,
Expand All @@ -212,15 +238,15 @@ const filterableFields = createResource({

const sortableFields = createResource({
url: "helpdesk.api.doc.sort_options",
auto: true,
auto: !props.options.hideViewControls,
params: {
doctype: props.options.doctype,
},
});

const quickFilters = createResource({
url: "helpdesk.api.doc.get_quick_filters",
auto: true,
auto: !props.options.hideViewControls,
params: {
doctype: props.options.doctype,
},
Expand All @@ -232,7 +258,12 @@ const quickFilters = createResource({
});

const showViewControls = computed(() => {
return filterableFields.data && sortableFields.data && quickFilters.data;
return (
!props.options.hideViewControls &&
filterableFields.data &&
sortableFields.data &&
quickFilters.data
);
});

const listViewData = reactive({
Expand Down
16 changes: 7 additions & 9 deletions desk/src/components/desk/global/NewContactDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
ErrorMessage,
createResource,
Autocomplete,
createListResource,
} from "frappe-ui";
import zod from "zod";

Expand Down Expand Up @@ -141,20 +142,17 @@ const open = computed({
},
});

const customerResource = createResource({
url: "helpdesk.extends.client.get_list",
params: {
doctype: "HD Customer",
fields: ["name", "customer_name"],
},
const customerResource = createListResource({
doctype: "HD Customer",
fields: ["name"],
cache: "customers",
transform: (data) => {
let allData = data.map((option) => {
return data.map((option) => {
return {
label: option.name,
value: option.customer_name,
value: option.name,
};
});
return allData;
},
auto: true,
});
Expand Down
1 change: 0 additions & 1 deletion desk/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export { default as AttachmentItem } from "./AttachmentItem.vue";
export { default as CommandPalette } from "./command-palette/CP.vue";
export { default as HCard } from "./HCard.vue";
export { default as ListView } from "./list-view/LV.vue";
export { default as NestedPopover } from "./NestedPopover.vue";
export { default as Notifications } from "./notifications/Notifications.vue";
export { default as PageTitle } from "./PageTitle.vue";
Expand Down
Loading
Loading