Skip to content

Commit

Permalink
Merge pull request #2129 from frappe/develop
Browse files Browse the repository at this point in the history
chore(release): dev to main
  • Loading branch information
RitvikSardana authored Jan 5, 2025
2 parents 3a29875 + 359f6c3 commit 2a9ea1a
Show file tree
Hide file tree
Showing 49 changed files with 356 additions and 1,664 deletions.
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

0 comments on commit 2a9ea1a

Please sign in to comment.