Select overviews by name instead of index

This commit is contained in:
Darren Clarke 2023-10-23 13:27:42 +02:00
parent f13530f043
commit 7df947f35a
28 changed files with 1581 additions and 2809 deletions

View file

@ -17,47 +17,47 @@
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@fontsource/playfair-display": "^5.0.15",
"@fontsource/playfair-display": "^5.0.17",
"@fontsource/poppins": "^5.0.8",
"@fontsource/roboto": "^5.0.8",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.148",
"@mui/lab": "^5.0.0-alpha.149",
"@mui/material": "^5",
"@mui/x-data-grid-pro": "^6.16.2",
"@mui/x-date-pickers-pro": "^6.16.2",
"@mui/x-data-grid-pro": "^6.16.3",
"@mui/x-date-pickers-pro": "^6.16.3",
"@opensearch-project/opensearch": "^2.4.0",
"cryptr": "^6.3.0",
"date-fns": "^2.30.0",
"http-proxy-middleware": "^2.0.6",
"leafcutter-common": "*",
"material-ui-popup-state": "^5.0.9",
"next": "13.5.4",
"next-auth": "^4.23.2",
"next": "13.5.6",
"next-auth": "^4.24.3",
"next-http-proxy-middleware": "^1.2.6",
"nodemailer": "^6.9.6",
"nodemailer": "^6.9.7",
"react": "18.2.0",
"react-cookie": "^6.1.1",
"react-cookie-consent": "^8.0.1",
"react-cookie-consent": "^9.0.0",
"react-dom": "18.2.0",
"react-iframe": "^1.8.5",
"react-markdown": "^9.0.0",
"react-polyglot": "^0.7.2",
"sharp": "^0.32.6",
"swr": "^2.2.4",
"tss-react": "^4.9.2",
"tss-react": "^4.9.3",
"uuid": "^9.0.1"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@types/node": "^20.8.6",
"@types/react": "18.2.28",
"@types/uuid": "^9.0.5",
"@types/node": "^20.8.7",
"@types/react": "18.2.31",
"@types/uuid": "^9.0.6",
"babel-loader": "^9.1.3",
"eslint": "^8.51.0",
"eslint": "^8.52.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^13.5.4",
"eslint-config-next": "^13.5.6",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",

View file

@ -175,16 +175,23 @@ export const Sidebar: FC<SidebarProps> = ({ open, setOpen }) => {
},
{ refreshInterval: 10000 },
);
console.log({ overviewData });
const findOverviewCountByID = (id: number) =>
overviewData?.ticketOverviews?.edges?.find((overview: any) =>
overview.node.id.endsWith(`/${id}`),
const findOverviewByName = (name: string) =>
overviewData?.ticketOverviews?.edges?.find(
(overview: any) => overview.node.name === name,
)?.node?.id;
const findOverviewCountByID = (id: string) =>
overviewData?.ticketOverviews?.edges?.find(
(overview: any) => overview.node.id === id,
)?.node?.ticketCount ?? 0;
const recentCount = 0;
const assignedCount = findOverviewCountByID(1);
const openCount = findOverviewCountByID(5);
const urgentCount = findOverviewCountByID(7);
const unassignedCount = findOverviewCountByID(2);
const assignedID = findOverviewByName("My Assigned Tickets");
const assignedCount = findOverviewCountByID(assignedID);
const openID = findOverviewByName("Open Tickets");
const openCount = findOverviewCountByID(openID);
const urgentID = findOverviewByName("Escalated Tickets");
const urgentCount = findOverviewCountByID(urgentID);
const unassignedID = findOverviewByName("Unassigned & Open Tickets");
const unassignedCount = findOverviewCountByID(unassignedID);
const logout = () => {
signOut({ callbackUrl: "/login" });

View file

@ -1,5 +1,5 @@
import { Metadata } from "next";
import { ZammadWrapper } from "../../../(main)/_components/ZammadWrapper";
import { ZammadWrapper } from "app/(main)/_components/ZammadWrapper";
export const metadata: Metadata = {
title: "Zammad",

View file

@ -3,9 +3,9 @@
import { FC, useState } from "react";
import { Grid, Box } from "@mui/material";
import { GridColDef } from "@mui/x-data-grid-pro";
import { StyledDataGrid } from "../../../_components/StyledDataGrid";
import { Button } from "../../../../_components/Button";
import { typography } from "../../../../_styles/theme";
import { StyledDataGrid } from "app/(main)/_components/StyledDataGrid";
import { Button } from "app/_components/Button";
import { typography } from "app/_styles/theme";
import { useRouter } from "next/navigation";
import { TicketCreateDialog } from "./TicketCreateDialog";

View file

@ -3,7 +3,7 @@
import { FC, useEffect, useState } from "react";
import useSWR from "swr";
import { TicketList } from "./TicketList";
import { getTicketsByOverviewQuery } from "../../../../_graphql/getTicketsByOverviewQuery";
import { getTicketsByOverviewQuery } from "app/_graphql/getTicketsByOverviewQuery";
type ZammadOverviewProps = {
name: string;

View file

@ -1,6 +1,6 @@
"use client";
import { DisplayError } from "../../../_components/DisplayError";
import { DisplayError } from "app/_components/DisplayError";
type PageProps = {
error: Error;

View file

@ -3,7 +3,7 @@
import { FC, useLayoutEffect } from "react";
import { useRouter } from "next/navigation";
import { CircularProgress, Box, Grid } from "@mui/material";
import { ZammadWrapper } from "../../../(main)/_components/ZammadWrapper";
import { ZammadWrapper } from "app/(main)/_components/ZammadWrapper";
export const Setup: FC = () => {
const router = useRouter();

View file

@ -10,7 +10,7 @@ import {
TextField,
} from "@mui/material";
import { useSWRConfig } from "swr";
import { updateTicketMutation } from "../../../../../_graphql/updateTicketMutation";
import { updateTicketMutation } from "app/_graphql/updateTicketMutation";
interface ArticleCreateDialogProps {
ticketID: string;

View file

@ -2,8 +2,8 @@
import { FC, useState } from "react";
import useSWR from "swr";
import { getTicketQuery } from "../../../../../_graphql/getTicketQuery";
import { getTicketArticlesQuery } from "../../../../../_graphql/getTicketArticlesQuery";
import { getTicketQuery } from "app/_graphql/getTicketQuery";
import { getTicketArticlesQuery } from "app/_graphql/getTicketArticlesQuery";
import {
Grid,
Box,
@ -51,12 +51,14 @@ export const TicketDetail: FC<TicketDetailProps> = ({ id }) => {
const mostRecentExternalArticle = externalArticles?.length
? externalArticles[externalArticles.length - 1].node
: null;
console.log({ mostRecentExternalArticle });
const mostRecentExternalArticleKind =
mostRecentExternalArticle?.type?.name ?? "phone";
const mostRecentEmailRecipient = mostRecentExternalArticle?.to?.name ?? "";
console.log({ mostRecentExternalArticleKind, mostRecentEmailRecipient });
const [dialogOpen, setDialogOpen] = useState(false);
const [articleKind, setArticleKind] = useState("phone");
const [recipient, setRecipient] = useState("");
const [recipient, setRecipient] = useState(mostRecentEmailRecipient);
const closeDialog = () => setDialogOpen(false);
const shouldRender =
@ -189,6 +191,7 @@ export const TicketDetail: FC<TicketDetailProps> = ({ id }) => {
open={dialogOpen}
closeDialog={closeDialog}
kind={articleKind}
recipient={recipient}
/>
</Box>
)

View file

@ -1,6 +1,6 @@
"use client";
import { DisplayError } from "../../../_components/DisplayError";
import { DisplayError } from "app/_components/DisplayError";
type PageProps = {
error: Error;

View file

@ -15,29 +15,29 @@
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@fontsource/playfair-display": "^5.0.15",
"@fontsource/playfair-display": "^5.0.17",
"@fontsource/poppins": "^5.0.8",
"@fontsource/roboto": "^5.0.8",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.148",
"@mui/lab": "^5.0.0-alpha.149",
"@mui/material": "^5",
"@mui/x-data-grid-pro": "^6.16.2",
"@mui/x-date-pickers-pro": "^6.16.2",
"@mui/x-data-grid-pro": "^6.16.3",
"@mui/x-date-pickers-pro": "^6.16.3",
"cryptr": "^6.3.0",
"date-fns": "^2.30.0",
"graphql-request": "^6.1.0",
"leafcutter-common": "*",
"material-ui-popup-state": "^5.0.9",
"mui-chips-input": "^2.1.3",
"next": "13.5.4",
"next-auth": "^4.23.2",
"next": "13.5.6",
"next-auth": "^4.24.3",
"ra-data-graphql": "^4.14.3",
"ra-i18n-polyglot": "^4.15.0",
"ra-input-rich-text": "^4.15.0",
"ra-language-english": "^4.15.0",
"ra-i18n-polyglot": "^4.15.1",
"ra-input-rich-text": "^4.15.1",
"ra-language-english": "^4.15.1",
"ra-postgraphile": "^6.1.2",
"react": "18.2.0",
"react-admin": "^4.15.0",
"react-admin": "^4.15.1",
"react-cookie": "^6.1.1",
"react-digit-input": "^2.1.0",
"react-dom": "18.2.0",
@ -47,20 +47,20 @@
"react-timer-hook": "^3.0.7",
"sharp": "^0.32.6",
"swr": "^2.2.4",
"tss-react": "^4.9.2",
"twilio-client": "^1.15.0"
"tss-react": "^4.9.3",
"twilio-client": "^1.15.1"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@types/node": "^20.8.6",
"@types/react": "18.2.28",
"@types/uuid": "^9.0.5",
"@types/node": "^20.8.7",
"@types/react": "18.2.31",
"@types/uuid": "^9.0.6",
"babel-loader": "^9.1.3",
"eslint": "^8.51.0",
"eslint": "^8.52.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^13.5.4",
"eslint-config-next": "^13.5.6",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",

View file

@ -22,7 +22,7 @@
"@hapipal/schmervice": "^3.0.0",
"@hapipal/toys": "^4.0.0",
"blipp": "^4.0.2",
"camelcase-keys": "^9.1.0",
"camelcase-keys": "^9.1.2",
"expiry-map": "^2.0.0",
"fluent-ffmpeg": "^2.1.2",
"graphile-migrate": "^1.4.1",
@ -41,7 +41,7 @@
"postgraphile": "4.12.3",
"postgraphile-plugin-connection-filter": "^2.3.0",
"remeda": "^1.27.1",
"twilio": "^4.18.1",
"twilio": "^4.19.0",
"typeorm": "^0.3.17",
"@whiskeysockets/baileys": "^6.5.0"
},
@ -49,7 +49,7 @@
"@types/long": "^4.0.2",
"@types/node": "*",
"babel-preset-link": "*",
"camelcase-keys": "^9.1.0",
"camelcase-keys": "^9.1.2",
"eslint-config-link": "*",
"jest-config-link": "*",
"nodemon": "^3.0.1",

View file

@ -91,7 +91,7 @@ export const TwilioRoutes = Helpers.noAuth([
},
async handler(request: Hapi.Request, _h: Hapi.ResponseToolkit) {
const { voiceLineId } = request.params;
const { To } = request.payload as { To: string };
const { To } = request.payload as { To: string; };
const voiceLine = await request.db().voiceLines.findBy({ number: To });
if (!voiceLine) return Boom.notFound();
if (voiceLine.id !== voiceLineId) return Boom.badRequest();
@ -193,7 +193,7 @@ export const TwilioRoutes = Helpers.noAuth([
},
},
async handler(request: Hapi.Request, h: Hapi.ResponseToolkit) {
const { providerId } = request.params as { providerId: string };
const { providerId } = request.params as { providerId: string; };
const provider: SavedVoiceProvider = await request
.db()
.voiceProviders.findById({ id: providerId });

View file

@ -23,7 +23,7 @@
"graphql": "15.8.0"
},
"devDependencies": {
"@types/jest": "^29.5.5",
"@types/jest": "^29.5.6",
"pino-pretty": "^10.2.3",
"nodemon": "^3.0.1",
"tsconfig-link": "*",

View file

@ -15,15 +15,15 @@
"node-fetch": "^3",
"pg-promise": "^11.5.4",
"remeda": "^1.27.1",
"twilio": "^4.18.1"
"twilio": "^4.19.0"
},
"devDependencies": {
"@babel/core": "7.23.2",
"@babel/preset-env": "7.23.2",
"@babel/preset-typescript": "7.23.2",
"@types/fluent-ffmpeg": "^2.1.22",
"@types/jest": "^29.5.5",
"eslint": "^8.51.0",
"@types/fluent-ffmpeg": "^2.1.23",
"@types/jest": "^29.5.6",
"eslint": "^8.52.0",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"jest-junit": "^16.0.0",

4161
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,6 @@
},
"peerDependencies": {},
"devDependencies": {
"eslint": "^8.51.0"
"eslint": "^8.52.0"
}
}

View file

@ -10,14 +10,14 @@
},
"dependencies": {
"@rushstack/eslint-patch": "^1.5.1",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-xo-space": "^0.34.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jest": "^27.4.3",
"eslint-plugin-no-use-extend-native": "^0.5.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "48.0.1",
@ -28,7 +28,7 @@
"typescript": "^4.9.5"
},
"devDependencies": {
"eslint": "^8.51.0",
"eslint": "^8.52.0",
"jest": "^29.7.0",
"typescript": "^5.2.2"
}

View file

@ -9,7 +9,7 @@
"private": false,
"devDependencies": {
"@hapi/basic": "^7.0.2",
"@types/jest": "^29.5.5",
"@types/jest": "^29.5.6",
"babel-preset-link": "*",
"eslint-config-link": "*",
"jest-config-link": "*",
@ -20,7 +20,7 @@
"@hapi/hapi": "^21.3.2",
"@hapi/hoek": "^11.0.2",
"joi": "^17.11.0",
"next-auth": "4.23.2"
"next-auth": "4.24.3"
},
"scripts": {
"build": "tsc -p tsconfig.json",

View file

@ -8,7 +8,7 @@
"license": "AGPL-3.0-or-later",
"private": false,
"devDependencies": {
"@types/jest": "^29.5.5",
"@types/jest": "^29.5.6",
"tsc-watch": "^6.0.4"
},
"dependencies": {

View file

@ -9,7 +9,7 @@
"node": ">=14"
},
"dependencies": {
"@types/jest": "^29.5.5",
"@types/jest": "^29.5.6",
"jest": "^29.7.0",
"jest-junit": "^16.0.0"
},

View file

@ -9,45 +9,45 @@
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@fontsource/playfair-display": "^5.0.15",
"@fontsource/playfair-display": "^5.0.17",
"@fontsource/poppins": "^5.0.8",
"@fontsource/roboto": "^5.0.8",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.148",
"@mui/lab": "^5.0.0-alpha.149",
"@mui/material": "^5",
"@mui/x-data-grid-pro": "^6.16.2",
"@mui/x-date-pickers-pro": "^6.16.2",
"@mui/x-data-grid-pro": "^6.16.3",
"@mui/x-date-pickers-pro": "^6.16.3",
"@opensearch-project/opensearch": "^2.4.0",
"date-fns": "^2.30.0",
"http-proxy-middleware": "^2.0.6",
"material-ui-popup-state": "^5.0.9",
"next": "13.5.4",
"next-auth": "^4.23.2",
"next": "13.5.6",
"next-auth": "^4.24.3",
"next-http-proxy-middleware": "^1.2.6",
"nodemailer": "^6.9.6",
"nodemailer": "^6.9.7",
"react": "18.2.0",
"react-cookie": "^6.1.1",
"react-cookie-consent": "^8.0.1",
"react-cookie-consent": "^9.0.0",
"react-dom": "18.2.0",
"react-iframe": "^1.8.5",
"react-markdown": "^9.0.0",
"react-polyglot": "^0.7.2",
"sharp": "^0.32.6",
"swr": "^2.2.4",
"tss-react": "^4.9.2",
"tss-react": "^4.9.3",
"uuid": "^9.0.1"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@types/node": "^20.8.6",
"@types/react": "18.2.28",
"@types/uuid": "^9.0.5",
"@types/node": "^20.8.7",
"@types/react": "18.2.31",
"@types/uuid": "^9.0.6",
"babel-loader": "^9.1.3",
"eslint": "^8.51.0",
"eslint": "^8.52.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^13.5.4",
"eslint-config-next": "^13.5.6",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",

File diff suppressed because one or more lines are too long

View file

@ -17,11 +17,11 @@
"dev": "tsc-watch --build --noClear "
},
"devDependencies": {
"@types/figlet": "^1.5.6",
"@types/lodash": "^4.14.199",
"@types/figlet": "^1.5.7",
"@types/lodash": "^4.14.200",
"@types/node": "*",
"@types/uuid": "^9.0.5",
"camelcase-keys": "^9.1.0",
"@types/uuid": "^9.0.6",
"camelcase-keys": "^9.1.2",
"pg-monitor": "^2.0.0",
"tsc-watch": "^6.0.4",
"typedoc": "^0.25.2",
@ -39,22 +39,22 @@
"@promster/hapi": "^12.0.0",
"@promster/server": "^12.0.0",
"@promster/types": "^12.0.0",
"@types/convict": "^6.1.4",
"@types/hapi__glue": "^6.1.7",
"@types/convict": "^6.1.5",
"@types/hapi__glue": "^6.1.8",
"@types/hapi__hapi": "^20.0.13",
"@types/hapi__inert": "^5.2.8",
"@types/hapi__vision": "^5.5.5",
"@types/hapipal__schmervice": "^2.0.5",
"@types/hapi__inert": "^5.2.9",
"@types/hapi__vision": "^5.5.6",
"@types/hapipal__schmervice": "^2.0.6",
"chalk": "^5.3.0",
"commander": "^11.1.0",
"convict": "^6.2.4",
"decamelcase-keys": "^1.1.1",
"figlet": "^1.6.0",
"figlet": "^1.7.0",
"hapi-pino": "^12.1.0",
"http-terminator": "^3.2.0",
"joi": "^17.11.0",
"lodash": "^4.17.21",
"next-auth": "^4.23.2",
"next-auth": "^4.24.3",
"pg-promise": "^11.5.4",
"pino": "^8.16.0",
"pino-pretty": "^10.2.3",

View file

@ -13,7 +13,7 @@
"@babel/core": "7.23.2",
"@babel/preset-env": "7.23.2",
"@babel/preset-typescript": "7.23.2",
"eslint": "^8.51.0",
"eslint": "^8.52.0",
"pino-pretty": "^10.2.3",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",

View file

@ -10,17 +10,18 @@
"@digiresilience/metamigo-common": "*",
"@digiresilience/metamigo-config": "^0.2.0",
"@graphile-contrib/pg-many-to-many": "^1.0.2",
"camelcase-keys": "^9.1.2",
"graphile-migrate": "^1.4.1",
"graphql": "15.8.0",
"postgraphile": "4.13.0",
"pg-promise": "^11.5.4"
"pg-promise": "^11.5.4",
"postgraphile": "4.13.0"
},
"devDependencies": {
"@babel/core": "7.23.2",
"@babel/preset-env": "7.23.2",
"@babel/preset-typescript": "7.23.2",
"@types/jest": "^29.5.5",
"eslint": "^8.51.0",
"@types/jest": "^29.5.6",
"eslint": "^8.52.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"pino-pretty": "^10.2.3",

View file

@ -23,7 +23,7 @@
"node": ">=14"
},
"devDependencies": {
"@types/jest": "^29.5.5",
"@types/jest": "^29.5.6",
"babel-preset-link": "*",
"eslint-config-link": "*",
"jest-config-link": "*",

View file

@ -26,7 +26,7 @@
"test": "echo n/a"
},
"devDependencies": {
"@types/backoff": "^2.5.3",
"@types/backoff": "^2.5.4",
"babel-preset-link": "*",
"camelcase": "^8.0.0",
"eslint-config-link": "*",
@ -37,9 +37,9 @@
},
"dependencies": {
"backoff": "^2.5.0",
"camelcase-keys": "^9.1.0",
"camelcase-keys": "^9.1.2",
"eventemitter3": "^5.0.1",
"snakecase-keys": "^5.4.7",
"snakecase-keys": "^5.5.0",
"ts-custom-error": "^3.3.1",
"uuid": "^9.0.1"
}