refactor(settings): refactored the admincheck so we can reuse it
This commit is contained in:
50
frontend/package-lock.json
generated
50
frontend/package-lock.json
generated
@@ -16,6 +16,7 @@
|
|||||||
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
||||||
"@radix-ui/react-label": "^2.1.2",
|
"@radix-ui/react-label": "^2.1.2",
|
||||||
"@radix-ui/react-popover": "^1.1.6",
|
"@radix-ui/react-popover": "^1.1.6",
|
||||||
|
"@radix-ui/react-select": "^2.1.6",
|
||||||
"@radix-ui/react-separator": "^1.1.2",
|
"@radix-ui/react-separator": "^1.1.2",
|
||||||
"@radix-ui/react-slot": "^1.1.2",
|
"@radix-ui/react-slot": "^1.1.2",
|
||||||
"@radix-ui/react-tabs": "^1.1.3",
|
"@radix-ui/react-tabs": "^1.1.3",
|
||||||
@@ -1152,6 +1153,12 @@
|
|||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@radix-ui/number": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-V3gRzhVNU1ldS5XhAPTom1fOIo4ccrjjJgmE+LI2h/WaFpHmx0MQApT+KZHnx8abG6Avtfcz4WoEciMnpFT3HQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@radix-ui/primitive": {
|
"node_modules/@radix-ui/primitive": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.1.tgz",
|
||||||
@@ -1722,6 +1729,49 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@radix-ui/react-select": {
|
||||||
|
"version": "2.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.1.6.tgz",
|
||||||
|
"integrity": "sha512-T6ajELxRvTuAMWH0YmRJ1qez+x4/7Nq7QIx7zJ0VK3qaEWdnWpNbEDnmWldG1zBDwqrLy5aLMUWcoGirVj5kMg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@radix-ui/number": "1.1.0",
|
||||||
|
"@radix-ui/primitive": "1.1.1",
|
||||||
|
"@radix-ui/react-collection": "1.1.2",
|
||||||
|
"@radix-ui/react-compose-refs": "1.1.1",
|
||||||
|
"@radix-ui/react-context": "1.1.1",
|
||||||
|
"@radix-ui/react-direction": "1.1.0",
|
||||||
|
"@radix-ui/react-dismissable-layer": "1.1.5",
|
||||||
|
"@radix-ui/react-focus-guards": "1.1.1",
|
||||||
|
"@radix-ui/react-focus-scope": "1.1.2",
|
||||||
|
"@radix-ui/react-id": "1.1.0",
|
||||||
|
"@radix-ui/react-popper": "1.2.2",
|
||||||
|
"@radix-ui/react-portal": "1.1.4",
|
||||||
|
"@radix-ui/react-primitive": "2.0.2",
|
||||||
|
"@radix-ui/react-slot": "1.1.2",
|
||||||
|
"@radix-ui/react-use-callback-ref": "1.1.0",
|
||||||
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
||||||
|
"@radix-ui/react-use-layout-effect": "1.1.0",
|
||||||
|
"@radix-ui/react-use-previous": "1.1.0",
|
||||||
|
"@radix-ui/react-visually-hidden": "1.1.2",
|
||||||
|
"aria-hidden": "^1.2.4",
|
||||||
|
"react-remove-scroll": "^2.6.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/react": "*",
|
||||||
|
"@types/react-dom": "*",
|
||||||
|
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
||||||
|
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@types/react-dom": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@radix-ui/react-separator": {
|
"node_modules/@radix-ui/react-separator": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.2.tgz",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
||||||
"@radix-ui/react-label": "^2.1.2",
|
"@radix-ui/react-label": "^2.1.2",
|
||||||
"@radix-ui/react-popover": "^1.1.6",
|
"@radix-ui/react-popover": "^1.1.6",
|
||||||
|
"@radix-ui/react-select": "^2.1.6",
|
||||||
"@radix-ui/react-separator": "^1.1.2",
|
"@radix-ui/react-separator": "^1.1.2",
|
||||||
"@radix-ui/react-slot": "^1.1.2",
|
"@radix-ui/react-slot": "^1.1.2",
|
||||||
"@radix-ui/react-tabs": "^1.1.3",
|
"@radix-ui/react-tabs": "^1.1.3",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {useQuery} from "@tanstack/react-query";
|
|||||||
import {useRouter} from "@tanstack/react-router";
|
import {useRouter} from "@tanstack/react-router";
|
||||||
import {format} from "date-fns";
|
import {format} from "date-fns";
|
||||||
import UpdateServer from "./UpdateServer";
|
import UpdateServer from "./UpdateServer";
|
||||||
|
import {adminUrlCheck} from "@/utils/adminUrlCheck";
|
||||||
|
|
||||||
export type Servers = {
|
export type Servers = {
|
||||||
server_id?: string;
|
server_id?: string;
|
||||||
@@ -85,9 +86,7 @@ export default function ServerPage() {
|
|||||||
{format(server.lastUpdated, "MM/dd/yyyy hh:mm")}
|
{format(server.lastUpdated, "MM/dd/yyyy hh:mm")}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="font-medium">
|
<TableCell className="font-medium">
|
||||||
{window.location.host.split(":")[0] === "localhost" && (
|
{adminUrlCheck() && <UpdateServer server={server} token={token as string} />}
|
||||||
<UpdateServer server={server} token={token as string} />
|
|
||||||
)}
|
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export default function SettingsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LstCard className="m-2 flex place-content-center w-dvh">
|
<LstCard className="m-2 flex place-content-center w-fit">
|
||||||
<Table>
|
<Table>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { Route as AuthImport } from './routes/_auth'
|
|||||||
import { Route as AdminImport } from './routes/_admin'
|
import { Route as AdminImport } from './routes/_admin'
|
||||||
import { Route as IndexImport } from './routes/index'
|
import { Route as IndexImport } from './routes/index'
|
||||||
import { Route as OcpIndexImport } from './routes/ocp/index'
|
import { Route as OcpIndexImport } from './routes/ocp/index'
|
||||||
import { Route as OcpLotsImport } from './routes/ocp/lots'
|
|
||||||
import { Route as EomEomImport } from './routes/_eom/eom'
|
import { Route as EomEomImport } from './routes/_eom/eom'
|
||||||
import { Route as AuthProfileImport } from './routes/_auth/profile'
|
import { Route as AuthProfileImport } from './routes/_auth/profile'
|
||||||
import { Route as AdminSettingsImport } from './routes/_admin/settings'
|
import { Route as AdminSettingsImport } from './routes/_admin/settings'
|
||||||
@@ -70,12 +69,6 @@ const OcpIndexRoute = OcpIndexImport.update({
|
|||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
const OcpLotsRoute = OcpLotsImport.update({
|
|
||||||
id: '/ocp/lots',
|
|
||||||
path: '/ocp/lots',
|
|
||||||
getParentRoute: () => rootRoute,
|
|
||||||
} as any)
|
|
||||||
|
|
||||||
const EomEomRoute = EomEomImport.update({
|
const EomEomRoute = EomEomImport.update({
|
||||||
id: '/eom',
|
id: '/eom',
|
||||||
path: '/eom',
|
path: '/eom',
|
||||||
@@ -214,13 +207,6 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof EomEomImport
|
preLoaderRoute: typeof EomEomImport
|
||||||
parentRoute: typeof EomImport
|
parentRoute: typeof EomImport
|
||||||
}
|
}
|
||||||
'/ocp/lots': {
|
|
||||||
id: '/ocp/lots'
|
|
||||||
path: '/ocp/lots'
|
|
||||||
fullPath: '/ocp/lots'
|
|
||||||
preLoaderRoute: typeof OcpLotsImport
|
|
||||||
parentRoute: typeof rootRoute
|
|
||||||
}
|
|
||||||
'/ocp/': {
|
'/ocp/': {
|
||||||
id: '/ocp/'
|
id: '/ocp/'
|
||||||
path: '/ocp'
|
path: '/ocp'
|
||||||
@@ -307,7 +293,6 @@ export interface FileRoutesByFullPath {
|
|||||||
'/settings': typeof AdminSettingsRoute
|
'/settings': typeof AdminSettingsRoute
|
||||||
'/profile': typeof AuthProfileRoute
|
'/profile': typeof AuthProfileRoute
|
||||||
'/eom': typeof EomEomRoute
|
'/eom': typeof EomEomRoute
|
||||||
'/ocp/lots': typeof OcpLotsRoute
|
|
||||||
'/ocp': typeof OcpIndexRoute
|
'/ocp': typeof OcpIndexRoute
|
||||||
'/article/$av': typeof EomArticleAvRoute
|
'/article/$av': typeof EomArticleAvRoute
|
||||||
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
||||||
@@ -325,7 +310,6 @@ export interface FileRoutesByTo {
|
|||||||
'/settings': typeof AdminSettingsRoute
|
'/settings': typeof AdminSettingsRoute
|
||||||
'/profile': typeof AuthProfileRoute
|
'/profile': typeof AuthProfileRoute
|
||||||
'/eom': typeof EomEomRoute
|
'/eom': typeof EomEomRoute
|
||||||
'/ocp/lots': typeof OcpLotsRoute
|
|
||||||
'/ocp': typeof OcpIndexRoute
|
'/ocp': typeof OcpIndexRoute
|
||||||
'/article/$av': typeof EomArticleAvRoute
|
'/article/$av': typeof EomArticleAvRoute
|
||||||
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
'/materialHelper': typeof logisticsMaterialHelperIndexRoute
|
||||||
@@ -346,7 +330,6 @@ export interface FileRoutesById {
|
|||||||
'/_admin/settings': typeof AdminSettingsRoute
|
'/_admin/settings': typeof AdminSettingsRoute
|
||||||
'/_auth/profile': typeof AuthProfileRoute
|
'/_auth/profile': typeof AuthProfileRoute
|
||||||
'/_eom/eom': typeof EomEomRoute
|
'/_eom/eom': typeof EomEomRoute
|
||||||
'/ocp/lots': typeof OcpLotsRoute
|
|
||||||
'/ocp/': typeof OcpIndexRoute
|
'/ocp/': typeof OcpIndexRoute
|
||||||
'/_eom/article/$av': typeof EomArticleAvRoute
|
'/_eom/article/$av': typeof EomArticleAvRoute
|
||||||
'/(logistics)/materialHelper/': typeof logisticsMaterialHelperIndexRoute
|
'/(logistics)/materialHelper/': typeof logisticsMaterialHelperIndexRoute
|
||||||
@@ -366,7 +349,6 @@ export interface FileRouteTypes {
|
|||||||
| '/settings'
|
| '/settings'
|
||||||
| '/profile'
|
| '/profile'
|
||||||
| '/eom'
|
| '/eom'
|
||||||
| '/ocp/lots'
|
|
||||||
| '/ocp'
|
| '/ocp'
|
||||||
| '/article/$av'
|
| '/article/$av'
|
||||||
| '/materialHelper'
|
| '/materialHelper'
|
||||||
@@ -383,7 +365,6 @@ export interface FileRouteTypes {
|
|||||||
| '/settings'
|
| '/settings'
|
||||||
| '/profile'
|
| '/profile'
|
||||||
| '/eom'
|
| '/eom'
|
||||||
| '/ocp/lots'
|
|
||||||
| '/ocp'
|
| '/ocp'
|
||||||
| '/article/$av'
|
| '/article/$av'
|
||||||
| '/materialHelper'
|
| '/materialHelper'
|
||||||
@@ -402,7 +383,6 @@ export interface FileRouteTypes {
|
|||||||
| '/_admin/settings'
|
| '/_admin/settings'
|
||||||
| '/_auth/profile'
|
| '/_auth/profile'
|
||||||
| '/_eom/eom'
|
| '/_eom/eom'
|
||||||
| '/ocp/lots'
|
|
||||||
| '/ocp/'
|
| '/ocp/'
|
||||||
| '/_eom/article/$av'
|
| '/_eom/article/$av'
|
||||||
| '/(logistics)/materialHelper/'
|
| '/(logistics)/materialHelper/'
|
||||||
@@ -418,7 +398,6 @@ export interface RootRouteChildren {
|
|||||||
EomRoute: typeof EomRouteWithChildren
|
EomRoute: typeof EomRouteWithChildren
|
||||||
AboutRoute: typeof AboutRoute
|
AboutRoute: typeof AboutRoute
|
||||||
LoginRoute: typeof LoginRoute
|
LoginRoute: typeof LoginRoute
|
||||||
OcpLotsRoute: typeof OcpLotsRoute
|
|
||||||
OcpIndexRoute: typeof OcpIndexRoute
|
OcpIndexRoute: typeof OcpIndexRoute
|
||||||
logisticsMaterialHelperIndexRoute: typeof logisticsMaterialHelperIndexRoute
|
logisticsMaterialHelperIndexRoute: typeof logisticsMaterialHelperIndexRoute
|
||||||
logisticsMaterialHelperConsumptionIndexRoute: typeof logisticsMaterialHelperConsumptionIndexRoute
|
logisticsMaterialHelperConsumptionIndexRoute: typeof logisticsMaterialHelperConsumptionIndexRoute
|
||||||
@@ -432,7 +411,6 @@ const rootRouteChildren: RootRouteChildren = {
|
|||||||
EomRoute: EomRouteWithChildren,
|
EomRoute: EomRouteWithChildren,
|
||||||
AboutRoute: AboutRoute,
|
AboutRoute: AboutRoute,
|
||||||
LoginRoute: LoginRoute,
|
LoginRoute: LoginRoute,
|
||||||
OcpLotsRoute: OcpLotsRoute,
|
|
||||||
OcpIndexRoute: OcpIndexRoute,
|
OcpIndexRoute: OcpIndexRoute,
|
||||||
logisticsMaterialHelperIndexRoute: logisticsMaterialHelperIndexRoute,
|
logisticsMaterialHelperIndexRoute: logisticsMaterialHelperIndexRoute,
|
||||||
logisticsMaterialHelperConsumptionIndexRoute:
|
logisticsMaterialHelperConsumptionIndexRoute:
|
||||||
@@ -457,7 +435,6 @@ export const routeTree = rootRoute
|
|||||||
"/_eom",
|
"/_eom",
|
||||||
"/about",
|
"/about",
|
||||||
"/login",
|
"/login",
|
||||||
"/ocp/lots",
|
|
||||||
"/ocp/",
|
"/ocp/",
|
||||||
"/(logistics)/materialHelper/",
|
"/(logistics)/materialHelper/",
|
||||||
"/(logistics)/materialHelper/consumption/",
|
"/(logistics)/materialHelper/consumption/",
|
||||||
@@ -514,9 +491,6 @@ export const routeTree = rootRoute
|
|||||||
"filePath": "_eom/eom.tsx",
|
"filePath": "_eom/eom.tsx",
|
||||||
"parent": "/_eom"
|
"parent": "/_eom"
|
||||||
},
|
},
|
||||||
"/ocp/lots": {
|
|
||||||
"filePath": "ocp/lots.tsx"
|
|
||||||
},
|
|
||||||
"/ocp/": {
|
"/ocp/": {
|
||||||
"filePath": "ocp/index.tsx"
|
"filePath": "ocp/index.tsx"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user