mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: Add isEditable prop to CustomFieldsDetail and set it in UserView
This commit is contained in:
@@ -25,6 +25,7 @@ export interface ComponentProps {
|
||||
customFieldType: DatabaseBaseModelType;
|
||||
projectId: ObjectID;
|
||||
name: string;
|
||||
isEditable?: boolean;
|
||||
}
|
||||
|
||||
const CustomFieldsDetail: FunctionComponent<ComponentProps> = (
|
||||
@@ -102,20 +103,26 @@ const CustomFieldsDetail: FunctionComponent<ComponentProps> = (
|
||||
await onLoad();
|
||||
}, []);
|
||||
|
||||
const isEditable: boolean = props.isEditable !== false;
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={props.title}
|
||||
description={props.description}
|
||||
buttons={[
|
||||
{
|
||||
title: "Edit Fields",
|
||||
buttonStyle: ButtonStyleType.NORMAL,
|
||||
onClick: () => {
|
||||
setShowModelForm(true);
|
||||
},
|
||||
icon: IconProp.Edit,
|
||||
},
|
||||
]}
|
||||
buttons={
|
||||
isEditable
|
||||
? [
|
||||
{
|
||||
title: "Edit Fields",
|
||||
buttonStyle: ButtonStyleType.NORMAL,
|
||||
onClick: () => {
|
||||
setShowModelForm(true);
|
||||
},
|
||||
icon: IconProp.Edit,
|
||||
},
|
||||
]
|
||||
: []
|
||||
}
|
||||
>
|
||||
<div className="border-t border-gray-200 px-4 py-5 sm:px-6 -m-6 -mt-2">
|
||||
{isLoading && !error && <ComponentLoader />}
|
||||
|
||||
@@ -324,6 +324,7 @@ const UserView: FunctionComponent<PageComponentProps> = (
|
||||
name="User Custom Fields"
|
||||
projectId={ProjectUtil.getCurrentProjectId()!}
|
||||
modelId={projectUserProfileId}
|
||||
isEditable={false}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user