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

Build hide incomplete #8433

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 10 additions & 5 deletions src/frontend/src/pages/build/BuildDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export default function BuildDetail() {

const user = useUserState();

const buildStatus = useStatusCodes({ modelType: ModelType.build });

const {
instance: build,
refreshInstance,
Expand Down Expand Up @@ -269,8 +271,10 @@ export default function BuildDetail() {
<BuildOutputTable build={build} refreshBuild={refreshInstance} />
) : (
<Skeleton />
)
// TODO: Hide if build is complete
),
hidden:
build.status == buildStatus.COMPLETE ||
build.status == buildStatus.CANCELLED
},
{
name: 'complete-outputs',
Expand All @@ -291,6 +295,9 @@ export default function BuildDetail() {
name: 'allocated-stock',
label: t`Allocated Stock`,
icon: <IconList />,
hidden:
build.status == buildStatus.COMPLETE ||
build.status == buildStatus.CANCELLED,
content: build.pk ? (
<BuildAllocatedStockTable buildId={build.pk} showPartInfo allowEdit />
) : (
Expand Down Expand Up @@ -355,7 +362,7 @@ export default function BuildDetail() {
model_id: build.pk
})
];
}, [build, id, user]);
}, [build, id, user, buildStatus]);

const buildOrderFields = useBuildOrderFields({ create: false });

Expand All @@ -379,8 +386,6 @@ export default function BuildDetail() {
modelType: ModelType.build
});

const buildStatus = useStatusCodes({ modelType: ModelType.build });

const cancelOrder = useCreateApiFormModal({
url: apiUrl(ApiEndpoints.build_order_cancel, build.pk),
title: t`Cancel Build Order`,
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/tables/settings/CustomUnitsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ export default function CustomUnitsTable() {
let actions = [];

actions.push(
// TODO: Adjust actions based on user permissions
<AddItemButton
tooltip={t`Add custom unit`}
onClick={() => newUnit.open()}
hidden={!user.isStaff() || !user.hasChangeRole(UserRoles.admin)}
/>
);

return actions;
}, []);
}, [user]);

return (
<>
Expand Down
Loading