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.

refactor: rename Jobs to Operations in MES

Rob Carrington6a09cb2a797e
diff --git a/apps/mes/app/components/AvatarMenu.tsx b/apps/mes/app/components/AvatarMenu.tsx
index e878fb790e..e684f35996 100644
--- a/apps/mes/app/components/AvatarMenu.tsx
+++ b/apps/mes/app/components/AvatarMenu.tsx
@@ -32,7 +32,7 @@ import { Avatar } from "~/components";
import { useUser } from "~/hooks";
import { useMode } from "~/hooks/useMode";
import type { action } from "~/routes/x+/location";
-import type { Location } from "~/services/jobs.service";
+import type { Location } from "~/services/operations.service";
import { path } from "~/utils/path";
const AvatarMenu = ({
diff --git a/apps/mes/app/components/EndShift.tsx b/apps/mes/app/components/EndShift.tsx
index d6aeefeed5..bab3a3a566 100644
--- a/apps/mes/app/components/EndShift.tsx
+++ b/apps/mes/app/components/EndShift.tsx
@@ -23,7 +23,7 @@ import type { action } from "~/routes/x+/end-shift.tsx";
import {
getActiveJobOperationsByEmployee,
type Operation,
-} from "~/services/jobs.service";
+} from "~/services/operations.service";
import { path } from "~/utils/path";
export const EndShift = ({ isCollapsed }: { isCollapsed: boolean }) => {
diff --git a/apps/mes/app/components/Icons.tsx b/apps/mes/app/components/Icons.tsx
index b1ff5b2c5f..e428074d4a 100644
--- a/apps/mes/app/components/Icons.tsx
+++ b/apps/mes/app/components/Icons.tsx
@@ -32,7 +32,7 @@ import { InProgressStatusIcon } from "~/assets/icons/InProgressStatusIcon";
import { LowPriorityIcon } from "~/assets/icons/LowPriorityIcon";
import { MediumPriorityIcon } from "~/assets/icons/MediumPriorityIcon";
import { TodoStatusIcon } from "~/assets/icons/TodoStatusIcon";
-import type { documentTypes, Operation } from "~/services/jobs.service";
+import type { documentTypes, Operation } from "~/services/operations.service";
type FileIconProps = {
type: (typeof documentTypes)[number];
diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsx
index 3e614c0c78..a6f46938d8 100644
--- a/apps/mes/app/components/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation.tsx
@@ -67,14 +67,14 @@ import type {
productionEventType,
ProductionQuantity,
StorageItem,
-} from "~/services/jobs.service";
+} from "~/services/operations.service";
import {
finishValidator,
getFileType,
nonScrapQuantityValidator,
productionEventValidator,
scrapQuantityValidator,
-} from "~/services/jobs.service";
+} from "~/services/operations.service";
import { path } from "~/utils/path";
import { capitalize } from "~/utils/string";
@@ -924,7 +924,7 @@ function useOperationState(operation: OperationWithDetails, job: Job) {
} else if (payload.eventType === "DELETE") {
if (payload.old.id === operation.id) {
alert("This operation has been deleted.");
- window.location.href = path.to.jobs;
+ window.location.href = path.to.operations;
}
}
}
diff --git a/apps/mes/app/components/OperationsList.tsx b/apps/mes/app/components/OperationsList.tsx
index dc90b5e367..40956bc552 100644
--- a/apps/mes/app/components/OperationsList.tsx
+++ b/apps/mes/app/components/OperationsList.tsx
@@ -16,7 +16,10 @@ import {
} from "@carbon/utils";
import { Link, useParams } from "@remix-run/react";
import { LuAlertTriangle, LuClipboardCheck, LuTimer } from "react-icons/lu";
-import type { Operation, OperationSettings } from "~/services/jobs.service";
+import type {
+ Operation,
+ OperationSettings,
+} from "~/services/operations.service";
import { DeadlineIcon, OperationStatusIcon } from "./Icons";
type OperationsListProps = {
@@ -36,7 +39,7 @@ const settings = {
export function OperationsList({
operations,
- emptyMessage = "No scheduled jobs",
+ emptyMessage = "No scheduled operations",
}: OperationsListProps) {
const { operationId } = useParams();
diff --git a/apps/mes/app/components/ScrapReason.tsx b/apps/mes/app/components/ScrapReason.tsx
index 35f4a2aaac..f867efa6b6 100644
--- a/apps/mes/app/components/ScrapReason.tsx
+++ b/apps/mes/app/components/ScrapReason.tsx
@@ -3,7 +3,7 @@ import { Combobox } from "@carbon/form";
import { useMount } from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import { useMemo } from "react";
-import type { getScrapReasonsList } from "~/services/jobs.service";
+import type { getScrapReasonsList } from "~/services/operations.service";
import { path } from "~/utils/path";
type ScrapReasonSelectProps = Omit<ComboboxProps, "options">;
diff --git a/apps/mes/app/routes/api+/scrap-reasons.ts b/apps/mes/app/routes/api+/scrap-reasons.ts
index 8f33275895..9bf44ce7a3 100644
--- a/apps/mes/app/routes/api+/scrap-reasons.ts
+++ b/apps/mes/app/routes/api+/scrap-reasons.ts
@@ -1,7 +1,7 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { json } from "@vercel/remix";
-import { getScrapReasonsList } from "~/services/jobs.service";
+import { getScrapReasonsList } from "~/services/operations.service";
export async function loader({ request }: LoaderFunctionArgs) {
const { client, companyId } = await requirePermissions(request, {
diff --git a/apps/mes/app/routes/x+/_layout.tsx b/apps/mes/app/routes/x+/_layout.tsx
index 777c4f9424..978bea0c81 100644
--- a/apps/mes/app/routes/x+/_layout.tsx
+++ b/apps/mes/app/routes/x+/_layout.tsx
@@ -25,14 +25,14 @@ import { AvatarMenu, Nav } from "~/components";
import { EndShift } from "~/components/EndShift";
import Feedback from "~/components/Feedback";
import { useMediaQuery } from "~/hooks";
-import {
- getActiveJobCount,
- getLocationsByCompany,
-} from "~/services/jobs.service";
import {
getLocationAndWorkCenter,
setLocationAndWorkCenter,
} from "~/services/location.server";
+import {
+ getActiveJobCount,
+ getLocationsByCompany,
+} from "~/services/operations.service";
import { defaultLayout } from "~/utils/layout";
import { path } from "~/utils/path";
@@ -204,9 +204,9 @@ export default function AuthenticatedRoute() {
isCollapsed={isCollapsed}
links={[
{
- title: "Jobs",
+ title: "Operations",
icon: LuInbox,
- to: path.to.jobs,
+ to: path.to.operations,
},
{
title: "Active",
diff --git a/apps/mes/app/routes/x+/active.tsx b/apps/mes/app/routes/x+/active.tsx
index 0377ae603a..ffc97b955c 100644
--- a/apps/mes/app/routes/x+/active.tsx
+++ b/apps/mes/app/routes/x+/active.tsx
@@ -8,7 +8,7 @@ import { LuSearch } from "react-icons/lu";
import type { ImperativePanelHandle } from "react-resizable-panels";
import { OperationsList } from "~/components";
import { useMediaQuery } from "~/hooks";
-import { getActiveJobOperationsByEmployee } from "~/services/jobs.service";
+import { getActiveJobOperationsByEmployee } from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
import { defaultLayout } from "~/utils/layout";
@@ -88,7 +88,7 @@ export default function ActiveRoute() {
<div className="p-4 pt-0">
<OperationsList
key="active"
- emptyMessage="No active jobs"
+ emptyMessage="No active operations"
operations={filteredOperations}
/>
</div>
diff --git a/apps/mes/app/routes/x+/complete.tsx b/apps/mes/app/routes/x+/complete.tsx
index 5b6dc6ff1f..7ae86c59fa 100644
--- a/apps/mes/app/routes/x+/complete.tsx
+++ b/apps/mes/app/routes/x+/complete.tsx
@@ -7,7 +7,7 @@ import { json } from "@vercel/remix";
import {
insertProductionQuantity,
nonScrapQuantityValidator,
-} from "~/services/jobs.service";
+} from "~/services/operations.service";
export async function action({ request }: ActionFunctionArgs) {
assertIsPost(request);
diff --git a/apps/mes/app/routes/x+/end-shift.tsx b/apps/mes/app/routes/x+/end-shift.tsx
index 6bf88240b6..48c301b4d9 100644
--- a/apps/mes/app/routes/x+/end-shift.tsx
+++ b/apps/mes/app/routes/x+/end-shift.tsx
@@ -2,7 +2,7 @@ import { requirePermissions } from "@carbon/auth/auth.server";
import { getLocalTimeZone, now } from "@internationalized/date";
import type { ActionFunctionArgs } from "@vercel/remix";
import { json } from "@vercel/remix";
-import { endProductionEvents } from "~/services/jobs.service";
+import { endProductionEvents } from "~/services/operations.service";
export async function action({ request }: ActionFunctionArgs) {
const { client, companyId, userId } = await requirePermissions(request, {});
diff --git a/apps/mes/app/routes/x+/event.tsx b/apps/mes/app/routes/x+/event.tsx
index 695b0b7964..ba62a1292d 100644
--- a/apps/mes/app/routes/x+/event.tsx
+++ b/apps/mes/app/routes/x+/event.tsx
@@ -9,7 +9,7 @@ import {
endProductionEvent,
productionEventValidator,
startProductionEvent,
-} from "~/services/jobs.service";
+} from "~/services/operations.service";
export async function action({ request }: ActionFunctionArgs) {
assertIsPost(request);
diff --git a/apps/mes/app/routes/x+/finish.tsx b/apps/mes/app/routes/x+/finish.tsx
index 0671174e82..eedc8a636d 100644
--- a/apps/mes/app/routes/x+/finish.tsx
+++ b/apps/mes/app/routes/x+/finish.tsx
@@ -9,7 +9,10 @@ import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
import type { ActionFunctionArgs } from "@vercel/remix";
import { json, redirect } from "@vercel/remix";
-import { finishJobOperation, finishValidator } from "~/services/jobs.service";
+import {
+ finishJobOperation,
+ finishValidator,
+} from "~/services/operations.service";
import { path } from "~/utils/path";
export async function action({ request }: ActionFunctionArgs) {
@@ -40,7 +43,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
throw redirect(
- path.to.jobs,
+ path.to.operations,
await flash(request, success("Operation finished successfully"))
);
}
diff --git a/apps/mes/app/routes/x+/location.tsx b/apps/mes/app/routes/x+/location.tsx
index 8ae3dad37f..abd291a211 100644
--- a/apps/mes/app/routes/x+/location.tsx
+++ b/apps/mes/app/routes/x+/location.tsx
@@ -2,8 +2,8 @@ import { assertIsPost } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import type { ActionFunctionArgs } from "@vercel/remix";
import { redirect } from "@vercel/remix";
-import { getWorkCentersByLocation } from "~/services/jobs.service";
import { setLocationAndWorkCenter } from "~/services/location.server";
+import { getWorkCentersByLocation } from "~/services/operations.service";
import { path } from "~/utils/path";
export async function action({ request }: ActionFunctionArgs) {
diff --git a/apps/mes/app/routes/x+/jobs.$workCenterId.$operationId.tsx b/apps/mes/app/routes/x+/operations.$workCenterId.$operationId.tsx
similarity index 100%
rename from apps/mes/app/routes/x+/jobs.$workCenterId.$operationId.tsx
rename to apps/mes/app/routes/x+/operations.$workCenterId.$operationId.tsx
diff --git a/apps/mes/app/routes/x+/jobs.$workCenterId.tsx b/apps/mes/app/routes/x+/operations.$workCenterId.tsx
similarity index 97%
rename from apps/mes/app/routes/x+/jobs.$workCenterId.tsx
rename to apps/mes/app/routes/x+/operations.$workCenterId.tsx
index 587c42b618..5b7171e832 100644
--- a/apps/mes/app/routes/x+/jobs.$workCenterId.tsx
+++ b/apps/mes/app/routes/x+/operations.$workCenterId.tsx
@@ -29,15 +29,15 @@ import { useEffect, useMemo, useRef, useState } from "react";
import type { ImperativePanelHandle } from "react-resizable-panels";
import { OperationsList } from "~/components";
import { useMediaQuery } from "~/hooks";
-import {
- getJobOperationsByWorkCenter,
- getWorkCenter,
- getWorkCentersByLocation,
-} from "~/services/jobs.service";
import {
getLocationAndWorkCenter,
setLocationAndWorkCenter,
} from "~/services/location.server";
+import {
+ getJobOperationsByWorkCenter,
+ getWorkCenter,
+ getWorkCentersByLocation,
+} from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
import { path } from "~/utils/path";
@@ -88,7 +88,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
return json(payload);
}
-export default function JobsRoute() {
+export default function OperationsRoute() {
const { operations, workCenters } = useLoaderData<typeof loader>();
const [searchTerm, setSearchTerm] = useState("");
@@ -131,7 +131,7 @@ export default function JobsRoute() {
>
<Tabs defaultValue="current">
<div className="flex items-center px-4 py-2 h-[52px] bg-background">
- <Heading size="h2">Jobs</Heading>
+ <Heading size="h2">Operations</Heading>
<TabsList className="ml-auto">
<TabsTrigger value="current">Current</TabsTrigger>
<TabsTrigger value="all">All</TabsTrigger>
diff --git a/apps/mes/app/routes/x+/jobs._index.tsx b/apps/mes/app/routes/x+/operations._index.tsx
similarity index 100%
rename from apps/mes/app/routes/x+/jobs._index.tsx
rename to apps/mes/app/routes/x+/operations._index.tsx
diff --git a/apps/mes/app/routes/x+/recent.tsx b/apps/mes/app/routes/x+/recent.tsx
index 3ebad4ff94..764aa7d58b 100644
--- a/apps/mes/app/routes/x+/recent.tsx
+++ b/apps/mes/app/routes/x+/recent.tsx
@@ -7,7 +7,7 @@ import { LuSearch } from "react-icons/lu";
import type { ImperativePanelHandle } from "react-resizable-panels";
import { OperationsList } from "~/components";
import { useMediaQuery } from "~/hooks";
-import { getRecentJobOperationsByEmployee } from "~/services/jobs.service";
+import { getRecentJobOperationsByEmployee } from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
import { defaultLayout } from "~/utils/layout";
@@ -87,7 +87,7 @@ export default function ActiveRoute() {
<div className="p-4 pt-0">
<OperationsList
key="active"
- emptyMessage="No active jobs"
+ emptyMessage="No active operations"
operations={filteredOperations}
/>
</div>
diff --git a/apps/mes/app/routes/x+/rework.tsx b/apps/mes/app/routes/x+/rework.tsx
index ace52536b7..d92ddd0e89 100644
--- a/apps/mes/app/routes/x+/rework.tsx
+++ b/apps/mes/app/routes/x+/rework.tsx
@@ -7,7 +7,7 @@ import { json } from "@vercel/remix";
import {
insertReworkQuantity,
nonScrapQuantityValidator,
-} from "~/services/jobs.service";
+} from "~/services/operations.service";
export async function action({ request }: ActionFunctionArgs) {
assertIsPost(request);
diff --git a/apps/mes/app/routes/x+/scrap.tsx b/apps/mes/app/routes/x+/scrap.tsx
index 4264427bc3..5d5c00ef46 100644
--- a/apps/mes/app/routes/x+/scrap.tsx
+++ b/apps/mes/app/routes/x+/scrap.tsx
@@ -7,7 +7,7 @@ import { json } from "@vercel/remix";
import {
insertScrapQuantity,
scrapQuantityValidator,
-} from "~/services/jobs.service";
+} from "~/services/operations.service";
export async function action({ request }: ActionFunctionArgs) {
assertIsPost(request);
diff --git a/apps/mes/app/services/operation.server.ts b/apps/mes/app/services/operation.server.ts
index 80e3f49654..9eb64d4060 100644
--- a/apps/mes/app/services/operation.server.ts
+++ b/apps/mes/app/services/operation.server.ts
@@ -5,7 +5,7 @@ import type { LoaderFunctionArgs } from "@vercel/remix";
import { defer, redirect } from "@vercel/remix";
import { makeDurations } from "~/utils/durations";
import { path } from "~/utils/path";
-import type { OperationWithDetails } from "./jobs.service";
+import type { OperationWithDetails } from "./operations.service";
import {
getJobByOperationId,
getJobFiles,
@@ -13,7 +13,7 @@ import {
getJobOperationById,
getProductionEventsForJobOperation,
getProductionQuantitiesForJobOperation,
-} from "./jobs.service";
+} from "./operations.service";
export async function loader({ request, params }: LoaderFunctionArgs) {
const { client, userId, companyId } = await requirePermissions(request, {});
@@ -33,14 +33,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
if (job.error) {
throw redirect(
- path.to.jobs,
+ path.to.operations,
await flash(request, error(job.error, "Failed to fetch job"))
);
}
if (operation.error) {
throw redirect(
- path.to.jobs,
+ path.to.operations,
await flash(request, error(operation.error, "Failed to fetch operation"))
);
}
diff --git a/apps/mes/app/services/jobs.service.ts b/apps/mes/app/services/operations.service.ts
similarity index 100%
rename from apps/mes/app/services/jobs.service.ts
rename to apps/mes/app/services/operations.service.ts
diff --git a/apps/mes/app/utils/path.ts b/apps/mes/app/utils/path.ts
index de6524f7e6..3cf15b802f 100644
--- a/apps/mes/app/utils/path.ts
+++ b/apps/mes/app/utils/path.ts
@@ -30,7 +30,7 @@ export const path = {
finish: `${x}/finish`,
forgotPassword: "/forgot-password",
healthcheck: "/healthcheck",
- jobs: `${x}/jobs`,
+ operations: `${x}/operations`,
location: `${x}/location`,
login: "/login",
logout: "/logout",
@@ -44,7 +44,8 @@ export const path = {
scrapReasons: `${api}/scrap-reasons`,
switchCompany: (companyId: string) =>
generatePath(`${x}/company/switch/${companyId}`),
- workCenter: (workCenter: string) => generatePath(`${x}/jobs/${workCenter}`),
+ workCenter: (workCenter: string) =>
+ generatePath(`${x}/operations/${workCenter}`),
},
} as const;