Update deps, ticket edit updates
This commit is contained in:
parent
aa453954ed
commit
2d892779bf
19 changed files with 1753 additions and 7776 deletions
|
|
@ -1,6 +1,6 @@
|
|||
"use server";
|
||||
|
||||
import { executeGraphQL } from "app/_lib/zammad";
|
||||
import { executeGraphQL, executeREST } from "app/_lib/zammad";
|
||||
import { getTicketOverviewCountsQuery } from "app/_graphql/getTicketOverviewCountsQuery";
|
||||
import { getTicketsByOverviewQuery } from "app/_graphql/getTicketsByOverviewQuery";
|
||||
|
||||
|
|
@ -22,17 +22,12 @@ export const getOverviewTicketsAction = async (name: string) => {
|
|||
let error = null;
|
||||
|
||||
if (name === "Recent") {
|
||||
const response = await fetch(
|
||||
`${process.env.ZAMMAD_URL}/api/v1/recent_view`,
|
||||
);
|
||||
const recent = await response.json();
|
||||
console.log({ recent });
|
||||
const recent = await executeREST({ path: "/api/v1/recent_view" });
|
||||
|
||||
for (const rec of recent) {
|
||||
const res = await fetch(
|
||||
`${process.env.ZAMMAD_URL}/api/v1/tickets/${rec.o_id}`,
|
||||
);
|
||||
const tkt = await res.json();
|
||||
const tkt = await executeREST({
|
||||
path: `/api/v1/tickets/${rec.o_id}`,
|
||||
});
|
||||
tickets.push({
|
||||
...tkt,
|
||||
internalId: tkt.id,
|
||||
|
|
|
|||
|
|
@ -170,7 +170,13 @@ export const getTicketTagsAction = async () => {
|
|||
path: "/api/v1/tags",
|
||||
});
|
||||
|
||||
return states;
|
||||
const formattedStates =
|
||||
states?.map((state: any) => ({
|
||||
value: state.id,
|
||||
label: state.name,
|
||||
})) ?? [];
|
||||
|
||||
return formattedStates;
|
||||
};
|
||||
|
||||
export const getTicketPrioritiesAction = async () => {
|
||||
|
|
@ -178,5 +184,11 @@ export const getTicketPrioritiesAction = async () => {
|
|||
path: "/api/v1/ticket_priorities",
|
||||
});
|
||||
|
||||
return priorities;
|
||||
const formattedPriorities =
|
||||
priorities?.map((priority: any) => ({
|
||||
value: priority.id,
|
||||
label: priority.name,
|
||||
})) ?? [];
|
||||
|
||||
return formattedPriorities;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export const getAgentsAction = async () => {
|
|||
const agents = users?.filter((user: any) => user.role_ids.includes(2)) ?? [];
|
||||
const formattedAgents = agents
|
||||
.map((agent: any) => ({
|
||||
label: agent.login,
|
||||
label: `${agent.firstname} ${agent.lastname}`,
|
||||
value: `gid://zammad/User/${agent.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue