Fix TypeScript errors in prev/next navigation
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@ export const FilamentEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
const [colorType, setColorType] = useState<"single" | "multi">("single");
|
const [colorType, setColorType] = useState<"single" | "multi">("single");
|
||||||
|
|
||||||
// Get all filament IDs for prev/next navigation
|
// Get all filament IDs for prev/next navigation
|
||||||
const { data: allFilaments } = useList<IFilament>({
|
const { result: allFilaments } = useList<IFilament>({
|
||||||
resource: "filament",
|
resource: "filament",
|
||||||
pagination: { mode: "off" },
|
pagination: { mode: "off" },
|
||||||
sorters: [{ field: "id", order: "asc" }],
|
sorters: [{ field: "id", order: "asc" }],
|
||||||
@@ -49,13 +49,13 @@ export const FilamentEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
// Calculate prev/next IDs for navigation
|
// Calculate prev/next IDs for navigation
|
||||||
const { prevId, nextId } = useMemo(() => {
|
const { prevId, nextId } = useMemo(() => {
|
||||||
if (!allFilaments?.data || !id) return { prevId: null, nextId: null };
|
if (!allFilaments?.data || !id) return { prevId: null, nextId: null };
|
||||||
const ids = allFilaments.data.map((f) => f.id);
|
const ids = allFilaments.data.map((f: IFilament) => f.id);
|
||||||
const currentIndex = ids.indexOf(Number(id));
|
const currentIndex = ids.indexOf(Number(id));
|
||||||
return {
|
return {
|
||||||
prevId: currentIndex > 0 ? ids[currentIndex - 1] : null,
|
prevId: currentIndex > 0 ? ids[currentIndex - 1] : null,
|
||||||
nextId: currentIndex < ids.length - 1 ? ids[currentIndex + 1] : null,
|
nextId: currentIndex < ids.length - 1 ? ids[currentIndex + 1] : null,
|
||||||
};
|
};
|
||||||
}, [allFilaments?.data, id]);
|
}, [allFilaments, id]);
|
||||||
|
|
||||||
// Get vendor selection options
|
// Get vendor selection options
|
||||||
const { selectProps } = useSelect<IVendor>({
|
const { selectProps } = useSelect<IVendor>({
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const SpoolEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
// Get all spool IDs for prev/next navigation
|
// Get all spool IDs for prev/next navigation
|
||||||
const { data: allSpools } = useList<ISpool>({
|
const { result: allSpools } = useList<ISpool>({
|
||||||
resource: "spool",
|
resource: "spool",
|
||||||
pagination: { mode: "off" },
|
pagination: { mode: "off" },
|
||||||
sorters: [{ field: "id", order: "asc" }],
|
sorters: [{ field: "id", order: "asc" }],
|
||||||
@@ -71,13 +71,13 @@ export const SpoolEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
// Calculate prev/next IDs for navigation
|
// Calculate prev/next IDs for navigation
|
||||||
const { prevId, nextId } = useMemo(() => {
|
const { prevId, nextId } = useMemo(() => {
|
||||||
if (!allSpools?.data || !id) return { prevId: null, nextId: null };
|
if (!allSpools?.data || !id) return { prevId: null, nextId: null };
|
||||||
const ids = allSpools.data.map((s) => s.id);
|
const ids = allSpools.data.map((s: ISpool) => s.id);
|
||||||
const currentIndex = ids.indexOf(Number(id));
|
const currentIndex = ids.indexOf(Number(id));
|
||||||
return {
|
return {
|
||||||
prevId: currentIndex > 0 ? ids[currentIndex - 1] : null,
|
prevId: currentIndex > 0 ? ids[currentIndex - 1] : null,
|
||||||
nextId: currentIndex < ids.length - 1 ? ids[currentIndex + 1] : null,
|
nextId: currentIndex < ids.length - 1 ? ids[currentIndex + 1] : null,
|
||||||
};
|
};
|
||||||
}, [allSpools?.data, id]);
|
}, [allSpools, id]);
|
||||||
|
|
||||||
// Add the filament_id field to the form
|
// Add the filament_id field to the form
|
||||||
if (formProps.initialValues) {
|
if (formProps.initialValues) {
|
||||||
|
|||||||
6
client/src/pages/vendors/edit.tsx
vendored
6
client/src/pages/vendors/edit.tsx
vendored
@@ -25,7 +25,7 @@ export const VendorEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
const extraFields = useGetFields(EntityType.vendor);
|
const extraFields = useGetFields(EntityType.vendor);
|
||||||
|
|
||||||
// Get all vendor IDs for prev/next navigation
|
// Get all vendor IDs for prev/next navigation
|
||||||
const { data: allVendors } = useList<IVendor>({
|
const { result: allVendors } = useList<IVendor>({
|
||||||
resource: "vendor",
|
resource: "vendor",
|
||||||
pagination: { mode: "off" },
|
pagination: { mode: "off" },
|
||||||
sorters: [{ field: "id", order: "asc" }],
|
sorters: [{ field: "id", order: "asc" }],
|
||||||
@@ -43,13 +43,13 @@ export const VendorEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
// Calculate prev/next IDs for navigation
|
// Calculate prev/next IDs for navigation
|
||||||
const { prevId, nextId } = useMemo(() => {
|
const { prevId, nextId } = useMemo(() => {
|
||||||
if (!allVendors?.data || !id) return { prevId: null, nextId: null };
|
if (!allVendors?.data || !id) return { prevId: null, nextId: null };
|
||||||
const ids = allVendors.data.map((v) => v.id);
|
const ids = allVendors.data.map((v: IVendor) => v.id);
|
||||||
const currentIndex = ids.indexOf(Number(id));
|
const currentIndex = ids.indexOf(Number(id));
|
||||||
return {
|
return {
|
||||||
prevId: currentIndex > 0 ? ids[currentIndex - 1] : null,
|
prevId: currentIndex > 0 ? ids[currentIndex - 1] : null,
|
||||||
nextId: currentIndex < ids.length - 1 ? ids[currentIndex + 1] : null,
|
nextId: currentIndex < ids.length - 1 ? ids[currentIndex + 1] : null,
|
||||||
};
|
};
|
||||||
}, [allVendors?.data, id]);
|
}, [allVendors, id]);
|
||||||
|
|
||||||
// Parse the extra fields from string values into real types
|
// Parse the extra fields from string values into real types
|
||||||
if (formProps.initialValues) {
|
if (formProps.initialValues) {
|
||||||
|
|||||||
Reference in New Issue
Block a user