Update deps, ticket edit updates

This commit is contained in:
Darren Clarke 2024-08-06 08:36:03 +02:00
parent aa453954ed
commit 2d892779bf
19 changed files with 1753 additions and 7776 deletions

View file

@ -13,17 +13,17 @@
"migrate:down:one": "tsx database/migrate.ts down:one"
},
"dependencies": {
"@auth/kysely-adapter": "^1.4.1",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@auth/kysely-adapter": "^1.4.2",
"@emotion/cache": "^11.13.1",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.172",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5",
"@mui/material-nextjs": "^5.16.4",
"@mui/x-data-grid-pro": "^7.10.0",
"@mui/x-date-pickers-pro": "^7.10.0",
"@mui/x-license": "^7.10.0",
"@mui/material-nextjs": "^5.16.6",
"@mui/x-data-grid-pro": "^7.12.0",
"@mui/x-date-pickers-pro": "^7.12.0",
"@mui/x-license": "^7.12.0",
"@link-stack/bridge-common": "*",
"@link-stack/bridge-ui": "*",
"@link-stack/signal-api": "*",
@ -37,18 +37,18 @@
"next-auth": "^4.24.7",
"pg": "^8.12.0",
"react": "18.3.1",
"react-cookie": "^7.1.4",
"react-cookie": "^7.2.0",
"react-digit-input": "^2.1.0",
"react-dom": "18.3.1",
"react-qr-code": "^2.0.15",
"react-timer-hook": "^3.0.7",
"sharp": "^0.33.4",
"tss-react": "^4.9.10",
"tsx": "^4.16.2",
"tss-react": "^4.9.12",
"tsx": "^4.16.5",
"@link-stack/ui": "*"
},
"devDependencies": {
"@types/node": "^20",
"@types/node": "^22",
"@types/pg": "^8.11.6",
"@types/react": "^18",
"@types/react-dom": "^18",

View file

@ -20,8 +20,8 @@
"@link-stack/typescript-config": "*",
"@types/node": "*",
"dotenv-cli": "^7.4.2",
"tsx": "^4.16.2",
"typescript": "^5.5.3"
"tsx": "^4.16.5",
"typescript": "^5.5.4"
},
"scripts": {
"build": "tsc -p tsconfig.json",

View file

@ -20,20 +20,20 @@
"jest": "^29.7.0",
"kysely": "^0.27.3",
"pg": "^8.12.0",
"remeda": "^2.6.0",
"remeda": "^2.7.1",
"twilio": "^5.2.2"
},
"devDependencies": {
"@babel/core": "7.24.9",
"@babel/preset-env": "7.24.8",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.3",
"@babel/preset-typescript": "7.24.7",
"@types/fluent-ffmpeg": "^2.1.24",
"@types/fluent-ffmpeg": "^2.1.25",
"dotenv-cli": "^7.4.2",
"@link-stack/eslint-config": "*",
"prettier": "^3.3.3",
"@link-stack/typescript-config": "*",
"ts-node": "^10.9.2",
"typedoc": "^0.26.4",
"typescript": "^5.5.3"
"typedoc": "^0.26.5",
"typescript": "^5.5.4"
}
}

View file

@ -13,16 +13,16 @@
"lint": "next lint"
},
"dependencies": {
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.4",
"@emotion/cache": "^11.13.1",
"@emotion/react": "^11.13.0",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.5",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.172",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5",
"@mui/x-data-grid-pro": "^7.10.0",
"@mui/x-date-pickers-pro": "^7.10.0",
"@opensearch-project/opensearch": "^2.10.0",
"@mui/x-data-grid-pro": "^7.12.0",
"@mui/x-date-pickers-pro": "^7.12.0",
"@opensearch-project/opensearch": "^2.11.0",
"cryptr": "^6.3.0",
"date-fns": "^3.6.0",
"http-proxy-middleware": "^3.0.0",
@ -34,7 +34,7 @@
"@link-stack/opensearch-common": "*",
"nodemailer": "^6.9.14",
"react": "18.3.1",
"react-cookie": "^7.1.4",
"react-cookie": "^7.2.0",
"react-cookie-consent": "^9.0.0",
"react-dom": "18.3.1",
"react-iframe": "^1.8.5",
@ -42,12 +42,12 @@
"react-polyglot": "^0.7.2",
"sharp": "^0.33.4",
"swr": "^2.2.5",
"tss-react": "^4.9.10",
"tss-react": "^4.9.12",
"uuid": "^10.0.0"
},
"devDependencies": {
"@babel/core": "^7.24.9",
"@types/node": "^20.14.11",
"@babel/core": "^7.25.2",
"@types/node": "^22.1.0",
"@types/react": "18.3.3",
"@types/uuid": "^10.0.0",
"babel-loader": "^9.1.3",
@ -56,8 +56,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.4",
"typescript": "5.5.3"
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"typescript": "5.5.4"
}
}

View file

@ -42,31 +42,31 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
useEffect(() => {
const fetchAgents = async () => {
const result = await getAgentsAction();
console.log({ result });
console.log({ agents: result });
setAgents(result);
};
const fetchGroups = async () => {
const result = await getGroupsAction();
console.log({ result });
console.log({ groups: result });
setGroups(result);
};
const fetchTicketStates = async () => {
const result = await getTicketStatesAction();
console.log({ result });
console.log({ ticketStates: result });
setTicketStates(result);
};
const fetchTicketPriorities = async () => {
const result = await getTicketPrioritiesAction();
console.log({ result });
console.log({ ticketPriorities: result });
setTicketPriorities(result);
};
const fetchTicketTags = async () => {
const result = await getTicketTagsAction();
console.log({ result });
console.log({ tags: result });
setTags(result);
};
@ -127,10 +127,10 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
errors: [],
values: {
customer: "",
group: ticket.group.id?.split("/").pop(),
owner: ticket.owner.id?.split("/").pop(),
priority: ticket.priority.id?.split("/").pop(),
state: ticket.state.id?.split("/").pop(),
group: ticket?.group?.id?.split("/").pop(),
owner: ticket?.owner?.id?.split("/").pop(),
priority: ticket?.priority?.id?.split("/").pop(),
state: ticket?.state?.id?.split("/").pop(),
tags: [],
title: "",
article: {
@ -157,21 +157,7 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
name="group"
label="Group"
formState={formState}
getOptions={() =>
groups?.map((group: any) => ({
value: group.id,
label: group.name,
})) ?? []
}
/*
onChange={(e: any) => {
const newGroup = e.target.value;
setSelectedGroup(newGroup);
updateTicket({
groupId: `gid://zammad/Group/${newGroup}`,
});
}}
*/
getOptions={() => groups}
/>
</Grid>
<Grid item>
@ -180,19 +166,7 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
name="owner"
label="Owner"
formState={formState}
getOptions={() =>
agents?.map((user: any) => ({
value: user.id,
label: `${user.firstname} ${user.lastname}`,
})) ?? []
}
/*
onChange={(e: any) => {
const newOwner = e.target.value;
setSelectedOwner(newOwner);
updateTicket({ ownerId: `gid://zammad/User/${newOwner}` });
}}
*/
getOptions={() => agents}
/>
</Grid>
<Grid item xs={12}>
@ -249,12 +223,7 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
name="priority"
label="Priority"
formState={formState}
getOptions={() =>
ticketPriorities?.map((priority: any) => ({
value: priority.id,
label: priority.name,
})) ?? []
}
getOptions={() => ticketPriorities}
/*
onChange={(e: any) => {

View file

@ -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,

View file

@ -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;
};

View file

@ -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));

View file

@ -61,7 +61,6 @@ export default withAuth(checkRewrites, {
},
callbacks: {
authorized: ({ token, req }) => {
console.log({ p: req.nextUrl.pathname });
if (req.nextUrl.pathname.startsWith("/api/v1/")) {
return true;
}

View file

@ -12,15 +12,15 @@
"dependencies": {
"@chatscope/chat-ui-kit-react": "^2.0.3",
"@chatscope/chat-ui-kit-styles": "^1.4.0",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.4",
"@emotion/cache": "^11.13.1",
"@emotion/react": "^11.13.0",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.5",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.172",
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5",
"@mui/x-data-grid-pro": "^7.10.0",
"@mui/x-date-pickers-pro": "^7.10.0",
"@mui/x-data-grid-pro": "^7.12.0",
"@mui/x-date-pickers-pro": "^7.12.0",
"@link-stack/bridge-common": "*",
"@link-stack/bridge-ui": "*",
"date-fns": "^3.6.0",
@ -33,19 +33,19 @@
"next-auth": "^4.24.7",
"@link-stack/opensearch-common": "*",
"react": "18.3.1",
"react-cookie": "^7.1.4",
"react-cookie": "^7.2.0",
"react-dom": "18.3.1",
"react-iframe": "^1.8.5",
"react-polyglot": "^0.7.2",
"sharp": "^0.33.4",
"swr": "^2.2.5",
"tss-react": "^4.9.10",
"tss-react": "^4.9.12",
"twilio-client": "^1.15.1",
"@link-stack/ui": "*"
},
"devDependencies": {
"@babel/core": "^7.24.9",
"@types/node": "^20.14.11",
"@babel/core": "^7.25.2",
"@types/node": "^22.1.0",
"@types/react": "18.3.3",
"@types/uuid": "^10.0.0",
"babel-loader": "^9.1.3",
@ -54,8 +54,8 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.4",
"typescript": "5.5.3"
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"typescript": "5.5.4"
}
}