Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

docs: add icon to distinguish between tables and views

Brad Barbind4b7f0771e1c
diff --git a/apps/carbon/app/modules/api/ui/TableDocs.tsx b/apps/carbon/app/modules/api/ui/TableDocs.tsx
index 3646933b1d..5a6583dca5 100644
--- a/apps/carbon/app/modules/api/ui/TableDocs.tsx
+++ b/apps/carbon/app/modules/api/ui/TableDocs.tsx
@@ -25,6 +25,7 @@ const TableDocs = ({
}: TableDocsProps) => {
const { paths, definitions } = swaggerDocsSchema;
// @ts-ignore
+
const resourcePaths = paths[`/${resourceId}`];
// @ts-ignore
const resourceDefinition = definitions?.[resourceId];
diff --git a/apps/carbon/app/modules/items/ui/Consumables/useConsumableNavigation.tsx b/apps/carbon/app/modules/items/ui/Consumables/useConsumableNavigation.tsx
index 5de95075a9..a9eea7fa2b 100644
--- a/apps/carbon/app/modules/items/ui/Consumables/useConsumableNavigation.tsx
+++ b/apps/carbon/app/modules/items/ui/Consumables/useConsumableNavigation.tsx
@@ -1,12 +1,6 @@
import { useParams } from "@remix-run/react";
-import {
- LuBox,
- LuFileBarChart,
- LuFileText,
- LuShoppingCart,
- LuTags,
-} from "react-icons/lu";
+import { LuBox, LuFileText, LuShoppingCart, LuTags } from "react-icons/lu";
import { usePermissions } from "~/hooks";
import type { Role } from "~/types";
import { path } from "~/utils/path";
@@ -37,13 +31,13 @@ export function useConsumableNavigation() {
icon: LuTags,
shortcut: "Command+Shift+c",
},
- {
- name: "Planning",
- to: path.to.consumablePlanning(itemId),
- role: ["employee"],
- icon: LuFileBarChart,
- shortcut: "Command+Shift+p",
- },
+ // {
+ // name: "Planning",
+ // to: path.to.consumablePlanning(itemId),
+ // role: ["employee"],
+ // icon: LuFileBarChart,
+ // shortcut: "Command+Shift+p",
+ // },
{
name: "Inventory",
to: path.to.consumableInventory(itemId),
diff --git a/apps/carbon/app/modules/items/ui/Materials/useMaterialNavigation.tsx b/apps/carbon/app/modules/items/ui/Materials/useMaterialNavigation.tsx
index 1cc03f27c1..a32841ede6 100644
--- a/apps/carbon/app/modules/items/ui/Materials/useMaterialNavigation.tsx
+++ b/apps/carbon/app/modules/items/ui/Materials/useMaterialNavigation.tsx
@@ -1,12 +1,6 @@
import { useParams } from "@remix-run/react";
-import {
- LuBox,
- LuFileBarChart,
- LuFileText,
- LuShoppingCart,
- LuTags,
-} from "react-icons/lu";
+import { LuBox, LuFileText, LuShoppingCart, LuTags } from "react-icons/lu";
import { usePermissions } from "~/hooks";
import type { Role } from "~/types";
import { path } from "~/utils/path";
@@ -37,13 +31,13 @@ export function useMaterialNavigation() {
icon: LuTags,
shortcut: "Command+Shift+c",
},
- {
- name: "Planning",
- to: path.to.materialPlanning(itemId),
- role: ["employee"],
- icon: LuFileBarChart,
- shortcut: "Command+Shift+p",
- },
+ // {
+ // name: "Planning",
+ // to: path.to.materialPlanning(itemId),
+ // role: ["employee"],
+ // icon: LuFileBarChart,
+ // shortcut: "Command+Shift+p",
+ // },
{
name: "Inventory",
to: path.to.materialInventory(itemId),
diff --git a/apps/carbon/app/modules/items/ui/Parts/usePartNavigation.tsx b/apps/carbon/app/modules/items/ui/Parts/usePartNavigation.tsx
index 6e810ccaac..726d3fe58d 100644
--- a/apps/carbon/app/modules/items/ui/Parts/usePartNavigation.tsx
+++ b/apps/carbon/app/modules/items/ui/Parts/usePartNavigation.tsx
@@ -3,7 +3,6 @@ import { useParams } from "@remix-run/react";
import { BiListCheck } from "react-icons/bi";
import {
LuBox,
- LuFileBarChart,
LuFileText,
LuReceipt,
LuShoppingCart,
@@ -64,13 +63,13 @@ export function usePartNavigation() {
icon: LuTags,
shortcut: "Command+Shift+a",
},
- {
- name: "Planning",
- to: path.to.partPlanning(itemId),
- role: ["employee"],
- icon: LuFileBarChart,
- shortcut: "Command+Shift+p",
- },
+ // {
+ // name: "Planning",
+ // to: path.to.partPlanning(itemId),
+ // role: ["employee"],
+ // icon: LuFileBarChart,
+ // shortcut: "Command+Shift+p",
+ // },
{
name: "Sales",
to: path.to.partSales(itemId),
diff --git a/apps/carbon/app/modules/items/ui/Tools/useToolNavigation.tsx b/apps/carbon/app/modules/items/ui/Tools/useToolNavigation.tsx
index 5ceb35b783..d1202e8992 100644
--- a/apps/carbon/app/modules/items/ui/Tools/useToolNavigation.tsx
+++ b/apps/carbon/app/modules/items/ui/Tools/useToolNavigation.tsx
@@ -1,12 +1,6 @@
import { useParams } from "@remix-run/react";
-import {
- LuBox,
- LuFileBarChart,
- LuFileText,
- LuShoppingCart,
- LuTags,
-} from "react-icons/lu";
+import { LuBox, LuFileText, LuShoppingCart, LuTags } from "react-icons/lu";
import { usePermissions } from "~/hooks";
import type { Role } from "~/types";
import { path } from "~/utils/path";
@@ -37,13 +31,13 @@ export function useToolNavigation() {
icon: LuTags,
shortcut: "Command+Shift+c",
},
- {
- name: "Planning",
- to: path.to.toolPlanning(itemId),
- role: ["employee"],
- icon: LuFileBarChart,
- shortcut: "Command+Shift+p",
- },
+ // {
+ // name: "Planning",
+ // to: path.to.toolPlanning(itemId),
+ // role: ["employee"],
+ // icon: LuFileBarChart,
+ // shortcut: "Command+Shift+p",
+ // },
{
name: "Inventory",
to: path.to.toolInventory(itemId),
diff --git a/apps/carbon/app/routes/x+/api+/_layout.tsx b/apps/carbon/app/routes/x+/api+/_layout.tsx
index 5653b9343f..401f4598a1 100644
--- a/apps/carbon/app/routes/x+/api+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/api+/_layout.tsx
@@ -2,6 +2,7 @@ import { swaggerDocsSchema } from "@carbon/database";
import { Button } from "@carbon/react";
import { Outlet, useLocation, useNavigate } from "@remix-run/react";
import type { MetaFunction } from "@vercel/remix";
+import { LuEye, LuTable2 } from "react-icons/lu";
import { GroupedContentSidebar } from "~/components/Layout";
import type { ValidLang } from "~/modules/api";
import { useSelectedLang } from "~/modules/api";
@@ -103,6 +104,12 @@ function useApiDocsMenu(): RouteGroup[] {
];
const tables = Object.keys(swaggerDocsSchema.definitions).sort();
+ const isTable = (table: string): boolean => {
+ const tableKey = `/${table}` as keyof typeof swaggerDocsSchema.paths;
+ return !!Object.keys(swaggerDocsSchema.paths[tableKey] ?? {})?.some(
+ (x) => x.toUpperCase() === "POST"
+ );
+ };
result.push({
name: "Tables and Views",
@@ -111,6 +118,7 @@ function useApiDocsMenu(): RouteGroup[] {
.map((table) => ({
name: table,
to: path.to.apiTable(selectedLang, table),
+ icon: isTable(table) ? <LuTable2 /> : <LuEye />,
})),
});