Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 55cbc01cab |
@ -2,25 +2,29 @@ name: Deploy
|
||||
run-name: ${{ gitea.actor }} build image and push to container registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
registry_package:
|
||||
types: [published]
|
||||
#package_name: "gitea.pena/squiz/frontanswerer/main:latest"
|
||||
|
||||
jobs:
|
||||
CreateImage:
|
||||
runs-on: [skeris]
|
||||
uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p
|
||||
with:
|
||||
runner: skeris
|
||||
secrets:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
# CreateImage:
|
||||
# runs-on: [skeris]
|
||||
# uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p
|
||||
# with:
|
||||
# runner: skeris
|
||||
# secrets:
|
||||
# REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
# REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
DeployService:
|
||||
if: contains(github.event.package.name, 'main')
|
||||
runs-on: [frontprod]
|
||||
#needs: CreateImage
|
||||
uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7
|
||||
with:
|
||||
runner: frontprod
|
||||
actionid: ${{ gitea.run_id }}
|
||||
|
||||
|
||||
container:
|
||||
image: gitea.pena/penadevops/container-images/node-compose:main
|
||||
env:
|
||||
GITHUB_RUN_NUMBER: "${{ inputs.actionid }}"
|
||||
volumes:
|
||||
- /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: http://gitea.pena/PenaDevops/actions.git/checkout@v1
|
||||
- run: compose -f deployments/main/docker-compose.yaml up -d
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
services:
|
||||
admin_front:
|
||||
restart: unless-stopped
|
||||
image: gitea.pena/penaside/adminfront/main:$GITHUB_RUN_NUMBER
|
||||
image: gitea.pena/penaside/adminfront/main:latest
|
||||
hostname: admin
|
||||
ports:
|
||||
- 10.8.0.131:80:80
|
||||
- 10.8.0.131:443:443
|
||||
tty: true
|
||||
pull_policy: always
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"@date-io/dayjs": "^2.15.0",
|
||||
"@emotion/react": "^11.10.4",
|
||||
"@emotion/styled": "^11.10.4",
|
||||
"@frontend/kitui": "1.0.110",
|
||||
"@frontend/kitui": "^1.0.108",
|
||||
"@material-ui/pickers": "^3.3.10",
|
||||
"@mui/icons-material": "^5.10.3",
|
||||
"@mui/material": "^5.10.5",
|
||||
|
||||
@ -2,7 +2,7 @@ import makeRequest from "@root/api/makeRequest";
|
||||
|
||||
import { parseAxiosError } from "@root/utils/parse-error";
|
||||
|
||||
import type { SendTicketMessageRequest } from "@frontend/kitui";
|
||||
import type { SendTicketMessageRequest } from "@root/model/ticket";
|
||||
|
||||
const API_URL = `${process.env.REACT_APP_DOMAIN}/heruvym/v1.0.0`;
|
||||
|
||||
|
||||
43
src/model/ticket.ts
Normal file
43
src/model/ticket.ts
Normal file
@ -0,0 +1,43 @@
|
||||
export interface CreateTicketRequest {
|
||||
Title: string;
|
||||
Message: string;
|
||||
}
|
||||
|
||||
export interface CreateTicketResponse {
|
||||
Ticket: string;
|
||||
}
|
||||
|
||||
export interface SendTicketMessageRequest {
|
||||
message: string;
|
||||
ticket: string;
|
||||
lang: string;
|
||||
files: string[];
|
||||
}
|
||||
|
||||
export type TicketStatus = "open";
|
||||
|
||||
export interface Ticket {
|
||||
id: string;
|
||||
user: string;
|
||||
sess: string;
|
||||
ans: string;
|
||||
state: string;
|
||||
top_message: TicketMessage;
|
||||
title: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
system?: boolean;
|
||||
rate: number;
|
||||
}
|
||||
|
||||
export interface TicketMessage {
|
||||
id: string;
|
||||
ticket_id: string;
|
||||
user_id: string;
|
||||
session_id: string;
|
||||
message: string;
|
||||
files: string[];
|
||||
shown: { [key: string]: number };
|
||||
request_screenshot: string;
|
||||
created_at: string;
|
||||
}
|
||||
@ -12,7 +12,7 @@ import SendIcon from "@mui/icons-material/Send";
|
||||
import AttachFileIcon from "@mui/icons-material/AttachFile";
|
||||
import { KeyboardEvent, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { TicketMessage } from "@frontend/kitui";
|
||||
import { TicketMessage } from "@root/model/ticket";
|
||||
import { sendTicketMessage } from "@root/api/tickets";
|
||||
import { enqueueSnackbar } from "notistack";
|
||||
import { useTicketStore } from "@root/stores/tickets";
|
||||
@ -76,7 +76,6 @@ export default function Chat() {
|
||||
const [disableFileButton, setDisableFileButton] = useState(false);
|
||||
|
||||
const ticket = tickets.find((ticket) => ticket.id === ticketId);
|
||||
const isSystem = ticket?.top_message?.system === true;
|
||||
|
||||
useTicketMessages({
|
||||
url: process.env.REACT_APP_DOMAIN + "/heruvym/v1.0.0/getMessages",
|
||||
@ -302,11 +301,10 @@ export default function Chat() {
|
||||
onChange={(e) => setMessageField(e.target.value)}
|
||||
onKeyPress={handleTextfieldKeyPress}
|
||||
id="message-input"
|
||||
placeholder={isSystem ? "Системный тикет. Отправка сообщений запрещена" : "Написать сообщение"}
|
||||
placeholder="Написать сообщение"
|
||||
fullWidth
|
||||
multiline
|
||||
maxRows={8}
|
||||
disabled={isSystem}
|
||||
InputProps={{
|
||||
style: {
|
||||
backgroundColor: theme.palette.content.main,
|
||||
@ -316,7 +314,6 @@ export default function Chat() {
|
||||
<InputAdornment position="end">
|
||||
<IconButton
|
||||
onClick={handleSendMessage}
|
||||
disabled={isSystem}
|
||||
sx={{
|
||||
height: "45px",
|
||||
width: "45px",
|
||||
@ -329,7 +326,6 @@ export default function Chat() {
|
||||
onClick={() => {
|
||||
if (!disableFileButton) fileInputRef.current?.click();
|
||||
}}
|
||||
disabled={isSystem}
|
||||
sx={{
|
||||
height: "45px",
|
||||
width: "45px",
|
||||
@ -344,7 +340,6 @@ export default function Chat() {
|
||||
}}
|
||||
style={{ display: "none" }}
|
||||
type="file"
|
||||
disabled={isSystem}
|
||||
/>
|
||||
<AttachFileIcon sx={{ color: theme.palette.golden.main }} />
|
||||
</IconButton>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Box, Typography, useTheme } from "@mui/material";
|
||||
import { TicketMessage } from "@frontend/kitui";
|
||||
import { TicketMessage } from "@root/model/ticket";
|
||||
|
||||
interface Props {
|
||||
message: TicketMessage;
|
||||
|
||||
@ -3,7 +3,7 @@ import { Box, useMediaQuery, useTheme } from "@mui/material";
|
||||
import Chat from "./Chat/Chat";
|
||||
import Collapse from "./Collapse";
|
||||
import TicketList from "./TicketList/TicketList";
|
||||
import { Ticket } from "@frontend/kitui";
|
||||
import { Ticket } from "@root/model/ticket";
|
||||
import { clearTickets, setTicketsFetchState, updateTickets, useTicketStore } from "@root/stores/tickets";
|
||||
import { enqueueSnackbar } from "notistack";
|
||||
import { clearMessageState } from "@root/stores/messages";
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import CircleIcon from "@mui/icons-material/Circle";
|
||||
import { Box, Card, CardActionArea, CardContent, CardHeader, Divider, Typography, useTheme } from "@mui/material";
|
||||
import { green } from "@mui/material/colors";
|
||||
import { Ticket } from "@frontend/kitui";
|
||||
import { Ticket } from "@root/model/ticket";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
|
||||
const flexCenterSx = {
|
||||
@ -25,11 +25,10 @@ export default function TicketItem({ ticket, setActiveUserId }: Props) {
|
||||
console.log(ticket)
|
||||
const isUnread = ticket.user === ticket?.top_message?.user_id;
|
||||
const isSelected = ticket.id === ticketId;
|
||||
const isSystem = ticket.top_message?.system === true;
|
||||
|
||||
const unreadSx = {
|
||||
border: "1px solid",
|
||||
borderColor: ticket.top_message?.system ? "red" : theme.palette.golden.main,
|
||||
borderColor: ticket.system ? "red" : theme.palette.golden.main,
|
||||
backgroundColor: theme.palette.goldenMedium.main,
|
||||
};
|
||||
|
||||
@ -45,7 +44,7 @@ export default function TicketItem({ ticket, setActiveUserId }: Props) {
|
||||
<Card
|
||||
sx={{
|
||||
minHeight: "70px",
|
||||
backgroundColor: isSystem ? "#111" : "transparent",
|
||||
backgroundColor: "transparent",
|
||||
color: "white",
|
||||
...(isUnread && unreadSx),
|
||||
...(isSelected && selectedSx),
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import HighlightOffOutlinedIcon from "@mui/icons-material/HighlightOffOutlined";
|
||||
import SearchOutlinedIcon from "@mui/icons-material/SearchOutlined";
|
||||
import { Box, Button, useMediaQuery, useTheme } from "@mui/material";
|
||||
import { Ticket } from "@frontend/kitui";
|
||||
import { Ticket } from "@root/model/ticket";
|
||||
import { incrementTicketsApiPage, useTicketStore } from "@root/stores/tickets";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import TicketItem from "./TicketItem";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { FetchState } from "@frontend/kitui";
|
||||
import { TicketMessage } from "@frontend/kitui";
|
||||
import { TicketMessage } from "@root/model/ticket";
|
||||
import { create } from "zustand";
|
||||
import { devtools } from "zustand/middleware";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Ticket } from "@frontend/kitui";
|
||||
import { Ticket } from "@root/model/ticket";
|
||||
|
||||
export const testTickets: Ticket[] = [
|
||||
{
|
||||
@ -17,13 +17,11 @@ export const testTickets: Ticket[] = [
|
||||
shown: {},
|
||||
request_screenshot: "",
|
||||
created_at: "2023-03-10T13:16:52.73Z",
|
||||
system: false,
|
||||
},
|
||||
title: "textual ticket",
|
||||
created_at: "2023-03-10T13:16:52.73Z",
|
||||
updated_at: "2023-03-10T13:16:52.73Z",
|
||||
rate: -1,
|
||||
origin: "user",
|
||||
},
|
||||
{
|
||||
id: "cg55nssvc9g7gddpnsug",
|
||||
@ -41,12 +39,10 @@ export const testTickets: Ticket[] = [
|
||||
shown: {},
|
||||
request_screenshot: "",
|
||||
created_at: "2023-03-09T22:21:39.822Z",
|
||||
system: false,
|
||||
},
|
||||
title: "textual ticket",
|
||||
created_at: "2023-03-09T22:21:39.822Z",
|
||||
updated_at: "2023-03-09T22:21:39.822Z",
|
||||
rate: -1,
|
||||
origin: "user",
|
||||
},
|
||||
];
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { FetchState } from "@frontend/kitui";
|
||||
import { Ticket } from "@frontend/kitui";
|
||||
import { Ticket } from "@root/model/ticket";
|
||||
import { create } from "zustand";
|
||||
import { devtools } from "zustand/middleware";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user