Skip to content

Commit

Permalink
fix(app-headless-cms): do not allow to change plugin models (#2769)
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-vinck committed Jan 10, 2023
1 parent ebc5d53 commit c202971
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Expand Up @@ -56,6 +56,7 @@ export const MODEL_FIELDS = `
fields {
${FIELDS_FIELDS}
}
plugin
`;
/**
* ############################
Expand Down
Expand Up @@ -16,6 +16,7 @@ import { ButtonIcon, ButtonSecondary } from "@webiny/ui/Button";
import { Cell, Grid } from "@webiny/ui/Grid";
import { Scrollbar } from "@webiny/ui/Scrollbar";
import { Select } from "@webiny/ui/Select";
import { Tooltip } from "@webiny/ui/Tooltip";
import { ReactComponent as AddIcon } from "@webiny/app-admin/assets/icons/add-18px.svg";
import { ReactComponent as FilterIcon } from "@webiny/app-admin/assets/icons/filter-24px.svg";
import SearchUI from "@webiny/app-admin/components/SearchUI";
Expand Down Expand Up @@ -57,6 +58,11 @@ const listItemMinHeight = css({
minHeight: "66px !important"
});

const disabled = css({
color: "rgba(0, 0, 0, 0.54)",
cursor: "default"
});

const ContentEntriesList: React.FC = () => {
const {
contentModel,
Expand Down Expand Up @@ -152,9 +158,22 @@ const ContentEntriesList: React.FC = () => {
<Typography use={"subtitle1"}>
<ModelId>
Model ID:{" "}
<Link to={`/cms/content-models/${contentModel.modelId}`}>
{contentModel.modelId}
</Link>
{contentModel.plugin ? (
<Tooltip
content={t`Content model is registered via a plugin.`}
placement={"top"}
>
<Link to="#" className={disabled}>
{contentModel.modelId}
</Link>
</Tooltip>
) : (
<Tooltip content={t`Edit content model`} placement={"top"}>
<Link to={`/cms/content-models/${contentModel.modelId}`}>
{contentModel.modelId}
</Link>
</Tooltip>
)}
</ModelId>
</Typography>
</span>
Expand Down

0 comments on commit c202971

Please sign in to comment.