Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8.3 #1025

Merged
merged 34 commits into from
Jan 23, 2025
Merged

0.8.3 #1025

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3b4ae7a
refactor: dockerfile
SergBily Jan 21, 2025
70fd771
fix: go back to main menu by backButton
AndreichukVladlena Jan 21, 2025
1022c0a
Merge pull request #1000 from 5sControl/991-30min-пересмотреть-путь-с…
SergBily Jan 21, 2025
07253c9
fix: remove order name max length on edit
kirilbaskakov Jan 21, 2025
72ea239
Merge pull request #1006 from 5sControl/fix/913-edit-order-name
SergBily Jan 21, 2025
05c0c47
fix: zones names sort
kirilbaskakov Jan 22, 2025
4a27aad
fix: locale compare
kirilbaskakov Jan 22, 2025
6520672
Merge pull request #1010 from 5sControl/fix/902-zones-sort
SergBily Jan 22, 2025
43ecf7a
fix: prohibit timespans from future
AndreichukVladlena Jan 22, 2025
d91eaa6
fix: blank operations navigation
kirilbaskakov Jan 22, 2025
bfbbd23
Merge pull request #1012 from 5sControl/1008-4h-проверить-ограничения…
SergBily Jan 22, 2025
cfa4087
Merge pull request #1013 from 5sControl/fix/1011-blank-operations-nav…
SergBily Jan 22, 2025
9ae5395
fix: edit timespan employee name
kirilbaskakov Jan 23, 2025
f3abfc9
Merge pull request #1017 from 5sControl/fix/1015-edit-timespan-employ…
SergBily Jan 23, 2025
075ac8d
fix: get timespan data
kirilbaskakov Jan 23, 2025
d79b87f
fix: add opportunity to come back to the main menu after finish timespan
AndreichukVladlena Jan 23, 2025
265abcb
fix: get timespan data
kirilbaskakov Jan 23, 2025
3c50803
Merge branch 'development' into fix/1014-timespan-data-disappear
kirilbaskakov Jan 23, 2025
fb6e7db
refactor: change get order item name for qr code
SergBily Jan 23, 2025
53e043b
Merge pull request #1020 from 5sControl/1009-30min-добавить-возможнос…
SergBily Jan 23, 2025
9d970b4
Merge branch 'development' into fix/1014-timespan-data-disappear
SergBily Jan 23, 2025
9ad1cfe
Merge pull request #1021 from 5sControl/fix/1014-timespan-data-disappear
SergBily Jan 23, 2025
3999cd2
feat: add worker tasks
kirilbaskakov Jan 23, 2025
a0f878b
Merge pull request #1022 from 5sControl/feat/1016-add-worker-tasks
SergBily Jan 23, 2025
55357bb
fix: add order item name to header
kirilbaskakov Jan 23, 2025
607e51d
fix: new timespan types
kirilbaskakov Jan 23, 2025
13b55ab
fix: change back button visibility
AndreichukVladlena Jan 23, 2025
691e6cb
Merge pull request #1024 from 5sControl/1009-30min-добавить-возможнос…
SergBily Jan 23, 2025
f165ba6
fix: type in timespan
SergBily Jan 23, 2025
70ea895
fix: types
SergBily Jan 23, 2025
6d1f5e4
Merge pull request #1023 from 5sControl/fix/1011-operation-header
SergBily Jan 23, 2025
5868f03
feat: implemnt dynamic args for ci/cd
SergBily Jan 23, 2025
c2592bd
feat: delete args for dev mobile workflows
SergBily Jan 23, 2025
1e218bd
feat: delete args for stage mobile workflows
SergBily Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/dev-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ jobs:
with:
context: ./mobile
push: true
build-args: |
VITE_API_BASE_URL=${{secrets.API_BASE_URL}}
BASE_URL=${{secrets.BASE_URL}}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=5scontrol/5scontrol_front_mobile:cache
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/stage-mobile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ jobs:
with:
context: ./mobile
push: true
build-args: |
VITE_API_BASE_URL=${{secrets.API_BASE_URL_STAGE}}
BASE_URL=${{secrets.BASE_URL}}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=5scontrol/5scontrol_front_mobile:stage-cache
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# production
/build
/mobile/dist
/mobile/docker-compose.yml

# misc
.DS_Store
Expand Down
15 changes: 6 additions & 9 deletions mobile/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .

ARG BASE_URL
ENV BASE_URL=${BASE_URL}

ARG VITE_API_BASE_URL
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}

RUN npm run build

FROM nginx:latest AS production
FROM nginx:latest
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
COPY --from=build /app/dist /usr/share/nginx/html

ENTRYPOINT ["/entrypoint.sh"]
12 changes: 12 additions & 0 deletions mobile/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

if [ -z "$VITE_API_BASE_URL" ]; then
echo "Error: VITE_API_BASE_URL is not set."
exit 1
fi

echo "Replacing VITE_API_BASE_URL with: $VITE_API_BASE_URL"

find /usr/share/nginx/html -type f -exec sed -i "s|__VITE_API_BASE_URL__|$VITE_API_BASE_URL|g" {} \;

nginx -g "daemon off;"
13 changes: 7 additions & 6 deletions mobile/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
try_files $uri /index.html;
}
server {
listen 80;

location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
3 changes: 2 additions & 1 deletion mobile/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import { CollectionUpdateDynamic } from "./pages/directories-dynamic/CollectionU
import OrderReport from "./pages/reports/orderReport/OrderReport";
import TimespanCameras from "./pages/timespan/camera/TimespanCameras";
import OrderProducts from "./pages/order/orderProducts/OrderProducts";
import { API_BASE_PATH } from "./config";

setupIonicReact();

Expand Down Expand Up @@ -126,7 +127,7 @@ function App() {

return (
<IonApp>
<IonReactRouter basename={import.meta.env.BASE_URL ?? "/"}>
<IonReactRouter basename={API_BASE_PATH ?? "/"}>
<PermissionProvider role={role}>
{cookies.token ? (
<IonRouterOutlet>
Expand Down
19 changes: 10 additions & 9 deletions mobile/src/api/algorithmRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from "axios";
import { API_BASE_URL } from "../config";

const API_ALGORITHM = "api/camera-algorithms/algorithms-detail/";
const API_POSTALGORITHM = "api/camera-algorithms/create-process/";
Expand All @@ -7,7 +8,7 @@ const API_POSTOPERATIONID = "api/order/index_stanowisko/";
const API_UPLOAD = "api/camera-algorithms/upload-algorithm/";

export const getAveilableAlgorithms = (hostname, cookies) => {
return axios.get(`${import.meta.env.VITE_API_BASE_URL}${API_ALGORITHM}`, {
return axios.get(`${API_BASE_URL}${API_ALGORITHM}`, {
headers: {
Authorization: cookies,
"ngrok-skip-browser-warning": "true",
Expand All @@ -17,7 +18,7 @@ export const getAveilableAlgorithms = (hostname, cookies) => {

export const uploadAlgorithm = async (hostname, cookies, id) => {
return axios.post(
`${import.meta.env.VITE_API_BASE_URL}${API_UPLOAD}${id}/`,
`${API_BASE_URL}${API_UPLOAD}${id}/`,
{},
{
headers: {
Expand All @@ -31,7 +32,7 @@ export const uploadAlgorithm = async (hostname, cookies, id) => {

export const postAlgorithnDependences = async (hostname, cookies, response) => {
return axios.post(
`${import.meta.env.VITE_API_BASE_URL}${API_POSTALGORITHM}`,
`${API_BASE_URL}${API_POSTALGORITHM}`,
response,
{
headers: {
Expand All @@ -44,7 +45,7 @@ export const postAlgorithnDependences = async (hostname, cookies, response) => {
};

export const getProcess = (hostname, cookies) => {
return axios.get(`${import.meta.env.VITE_API_BASE_URL}${API_GETPROCESS}`, {
return axios.get(`${API_BASE_URL}${API_GETPROCESS}`, {
headers: {
Authorization: cookies,
"ngrok-skip-browser-warning": "true",
Expand All @@ -53,7 +54,7 @@ export const getProcess = (hostname, cookies) => {
};

export const getProcessByCamera = (hostname, cameraIp, cookies) => {
return axios.get(`${import.meta.env.VITE_API_BASE_URL}${API_GETPROCESS}${cameraIp}/`, {
return axios.get(`${API_BASE_URL}${API_GETPROCESS}${cameraIp}/`, {
headers: {
Authorization: cookies,
"ngrok-skip-browser-warning": "true",
Expand All @@ -62,7 +63,7 @@ export const getProcessByCamera = (hostname, cameraIp, cookies) => {
};

export const getOperationID = (hostname, cookies) => {
return axios.get(`${import.meta.env.VITE_API_BASE_URL}${API_POSTOPERATIONID}`, {
return axios.get(`${API_BASE_URL}${API_POSTOPERATIONID}`, {
headers: {
Authorization: cookies,
"ngrok-skip-browser-warning": "true",
Expand All @@ -71,7 +72,7 @@ export const getOperationID = (hostname, cookies) => {
};

export const postUploadAlgorithm = async (hostname, cookies, body) => {
return axios.post(`${import.meta.env.VITE_API_BASE_URL}${API_ALGORITHM}`, body, {
return axios.post(`${API_BASE_URL}${API_ALGORITHM}`, body, {
headers: {
"Content-Type": "application/json",
Authorization: cookies,
Expand All @@ -81,7 +82,7 @@ export const postUploadAlgorithm = async (hostname, cookies, body) => {
};

export const deleteAlgorithmAPI = (hostname, cookies, id) => {
return axios.delete(`${import.meta.env.VITE_API_BASE_URL}${API_ALGORITHM}${id}/`, {
return axios.delete(`${API_BASE_URL}${API_ALGORITHM}${id}/`, {
headers: {
Authorization: cookies,
"ngrok-skip-browser-warning": "true",
Expand All @@ -91,7 +92,7 @@ export const deleteAlgorithmAPI = (hostname, cookies, id) => {

export const putAlgorithmAPI = (cookies, id, body) => {
return axios.put(
`${import.meta.env.VITE_API_BASE_URL}${API_ALGORITHM}${id}/`,
`${API_BASE_URL}${API_ALGORITHM}${id}/`,
body,
{
headers: {
Expand Down
5 changes: 3 additions & 2 deletions mobile/src/api/authorization.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import axios from "axios";
import { API_BASE_URL } from "../config";

const API_AUTH = "api/auth/jwt/create/";
const API_VERIFYTOKEN = "api/auth/jwt/verify/";

export const authorizationRequest = (email: string, password: string) => {
return axios.post(`${import.meta.env.VITE_API_BASE_URL}${API_AUTH}`, {
return axios.post(`${API_BASE_URL}${API_AUTH}`, {
username: email,
password: password,
});
};

export const isVerifyToken = (cookies: string) => {
cookies = cookies?.split(" ")[1];
return axios.post(`${import.meta.env.VITE_API_BASE_URL}${API_VERIFYTOKEN}`, {
return axios.post(`${API_BASE_URL}${API_VERIFYTOKEN}`, {
token: cookies,
"ngrok-skip-browser-warning": "true",
});
Expand Down
25 changes: 13 additions & 12 deletions mobile/src/api/cameraRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from "axios";
import { API_BASE_URL } from "../config";

const API_CAMERASELECT = "api/camera-algorithms/camera/";
const API_CAMERACREATE = "api/cameras/create-camera/";
Expand All @@ -11,7 +12,7 @@ const API_ALGORITHMZONES = "api/camera-algorithms/zones-algorithms/";
const API_VIDEO = "api/onvif/is_video_available/";

export const getSelectedCameras = (hostname, cookies) => {
return axios.get(`${import.meta.env.VITE_API_BASE_URL}${API_CAMERASELECT}`, {
return axios.get(`${API_BASE_URL}${API_CAMERASELECT}`, {
headers: {
"Content-Type": "application/json",
Authorization: cookies,
Expand All @@ -22,7 +23,7 @@ export const getSelectedCameras = (hostname, cookies) => {

export const postCamera = (hostname, IPCamera, username, password, cookies) => {
return axios.post(
`${import.meta.env.VITE_API_BASE_URL}${API_CAMERACREATE}`,
`${API_BASE_URL}${API_CAMERACREATE}`,
{
ip: IPCamera,
username: username,
Expand All @@ -40,7 +41,7 @@ export const postCamera = (hostname, IPCamera, username, password, cookies) => {

export const deleteCameraAPI = (hostname, cookies, IPCamera) => {
return axios.delete(
`${import.meta.env.VITE_API_BASE_URL}${API_CAMERADELETE}${IPCamera}/`,
`${API_BASE_URL}${API_CAMERADELETE}${IPCamera}/`,
{
headers: {
Authorization: cookies,
Expand All @@ -51,15 +52,15 @@ export const deleteCameraAPI = (hostname, cookies, IPCamera) => {
};

export const findCamera = (hostname) => {
return axios.get(import.meta.env.VITE_API_BASE_URL + API_CAMERAFIND, {
return axios.get(API_BASE_URL + API_CAMERAFIND, {
headers: {
"ngrok-skip-browser-warning": "true",
},
});
};

export const checkCamera = (hostname, cameraIP, username, password) => {
return fetch(`${import.meta.env.VITE_API_BASE_URL}${API_CAMERACHECK}`, {
return fetch(`${API_BASE_URL}${API_CAMERACHECK}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -75,7 +76,7 @@ export const checkCamera = (hostname, cameraIP, username, password) => {

export const getCameraZones = (hostname, cookies, camera) => {
return axios.get(
`${import.meta.env.VITE_API_BASE_URL}${API_CAMERAZONES}?camera=${camera}`,
`${API_BASE_URL}${API_CAMERAZONES}?camera=${camera}`,
{
headers: {
"Content-Type": "application/json",
Expand All @@ -87,7 +88,7 @@ export const getCameraZones = (hostname, cookies, camera) => {
};

export const postCameraZones = (hostname, cookies, body) => {
return axios.post(`${import.meta.env.VITE_API_BASE_URL}${API_ZONES}`, body, {
return axios.post(`${API_BASE_URL}${API_ZONES}`, body, {
headers: {
Authorization: cookies,
"ngrok-skip-browser-warning": "true",
Expand All @@ -97,7 +98,7 @@ export const postCameraZones = (hostname, cookies, body) => {

export const patchCameraZones = (hostname, cookies, response, id) => {
return axios.put(
`${import.meta.env.VITE_API_BASE_URL}${API_ZONES}${id}/`,
`${API_BASE_URL}${API_ZONES}${id}/`,
response,
{
headers: {
Expand All @@ -109,7 +110,7 @@ export const patchCameraZones = (hostname, cookies, response, id) => {
};

export const deleteCameraZones = (hostname, cookies, id) => {
return axios.delete(`${import.meta.env.VITE_API_BASE_URL}${API_ZONES}${id}/`, {
return axios.delete(`${API_BASE_URL}${API_ZONES}${id}/`, {
headers: {
Authorization: cookies,
"ngrok-skip-browser-warning": "true",
Expand All @@ -119,7 +120,7 @@ export const deleteCameraZones = (hostname, cookies, id) => {

export const getAlgorithmZones = (hostname, cookies, camera) => {
return axios.get(
`${import.meta.env.VITE_API_BASE_URL}${API_ALGORITHMZONES}?camera=${camera}`,
`${API_BASE_URL}${API_ALGORITHMZONES}?camera=${camera}`,
{
headers: {
"Content-Type": "application/json",
Expand All @@ -131,15 +132,15 @@ export const getAlgorithmZones = (hostname, cookies, camera) => {
};

export const getVideo = (hostname, body) => {
return axios.post(`${import.meta.env.VITE_API_BASE_URL}${API_VIDEO}`, body, {
return axios.post(`${API_BASE_URL}${API_VIDEO}`, body, {
headers: {
"ngrok-skip-browser-warning": "true",
},
});
};

export const getSelectedZone = (hostname, cookies, id) => {
return axios.get(`${import.meta.env.VITE_API_BASE_URL}${API_ZONES}${id}/`, {
return axios.get(`${API_BASE_URL}${API_ZONES}${id}/`, {
headers: {
"Content-Type": "application/json",
Authorization: cookies,
Expand Down
5 changes: 3 additions & 2 deletions mobile/src/api/connections.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";
import { API_BASE_URL } from "../config";

const API_BASE_URL: string = import.meta.env.VITE_API_BASE_URL;
const BASE_URL: string = API_BASE_URL;
const API_STATUSDATA = "api/connector/status/";
const API_CONNECTIONS = "api/connector/connections/";
const GET_CONNECTIONS = "api/order/get-connections/";
Expand All @@ -12,7 +13,7 @@ const axiosConfig = (cookies: string) => ({
},
});

const constructUrl = (endpoint: string) => `${API_BASE_URL}${endpoint}`;
const constructUrl = (endpoint: string) => `${BASE_URL}${endpoint}`;

export const getStatusData = (hostname: string, cookies: string) => {
return axios.get(constructUrl(API_STATUSDATA), axiosConfig(cookies));
Expand Down
5 changes: 3 additions & 2 deletions mobile/src/api/directory/directory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";
import { API_BASE_URL } from "../../config";

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
const BASE_URL = API_BASE_URL;
const API_DIRECTORY = "api/erp-reference/references/";
const API_STATIC_DIRECTORY = "api/erp-reference/references/static/";

Expand All @@ -11,7 +12,7 @@ const axiosConfig = (cookies: string) => ({
},
});

const constructUrl = (endpoint: string) => `${API_BASE_URL}${endpoint}`;
const constructUrl = (endpoint: string) => `${BASE_URL}${endpoint}`;

export const getAllDirectories = (cookies: string) => {
return axios.get(constructUrl(API_DIRECTORY), axiosConfig(cookies));
Expand Down
5 changes: 3 additions & 2 deletions mobile/src/api/directory/directoryCategories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";
import { API_BASE_URL } from "../../config";

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
const BASE_URL = API_BASE_URL;
const API_DIRECTORY = "api/erp-reference/reference-items/";
const REFERENCE = 'reference/';

Expand All @@ -11,7 +12,7 @@ const axiosConfig = (cookies: string) => ({
},
});

const constructUrl = (endpoint: string) => `${API_BASE_URL}${endpoint}`;
const constructUrl = (endpoint: string) => `${BASE_URL}${endpoint}`;

export const createDirectoryCategory = (name: string, referenceId: number, cookies: string) => {
return axios.post(
Expand Down
5 changes: 3 additions & 2 deletions mobile/src/api/employees.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from "axios";
import { API_BASE_URL } from "../config";

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
const BASE_URL = API_BASE_URL;
const API_EMPLOYEE = "api/erp-reference/employees/";

const axiosConfig = (cookies: string) => ({
Expand All @@ -10,7 +11,7 @@ const axiosConfig = (cookies: string) => ({
},
});

const constructUrl = (endpoint: string) => `${API_BASE_URL}${endpoint}`;
const constructUrl = (endpoint: string) => `${BASE_URL}${endpoint}`;

export const getAllEmployees = (cookies: string) => {
return axios.get(constructUrl(API_EMPLOYEE), axiosConfig(cookies));
Expand Down
Loading