Skip to content

Commit

Permalink
Modal content, message content changed
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunnbunt committed Jan 25, 2025
1 parent 3c72d4e commit 71c5b63
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
38 changes: 26 additions & 12 deletions platform/wab/src/wab/client/components/cms/CmsEntryDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,17 @@ function CmsEntryDetailsForm_(
</Form>
{showCopyModal && (
<Modal
title={
row.identifier && row.identifier !== ""
? `Copy ${row.identifier}`
: "Copy untitled entry"
}
title="Duplicate CMS entry"
footer={null}
open={true}
onCancel={() => setShowCopyModal(false)}
>
<Form.Item label="Title of new copy" name="copyIdentifier">
<Form.Item name="copyIdentifier">
<span>
{`Duplicate the CMS entry with identifier "${inputCopyIdentifier}"?`}
<br />
{`This will create an unpublished copy of the entry and all its data.`}
</span>
<Input
defaultValue={inputCopyIdentifier}
onChange={(e) => setInputCopyIdentifier(e.target.value)}
Expand All @@ -680,18 +681,31 @@ function CmsEntryDetailsForm_(
type="primary"
onClick={async (e) => {
e.currentTarget.disabled = true;
const copiedRow = await api.copyCmsRow(row.id, {
identifier: inputCopyIdentifier,
});
await message.loading({
key: "copy-message",
content: "Copying...",
content: `Duplicating CMS entry "${
row.identifier ? row.identifier : "Untitled"
}"...`,
});
const copiedRow = await api.copyCmsRow(row.id, {
identifier: inputCopyIdentifier,
});
if (copiedRow) {
await message.success({
key: "copy-message",
content: `Copied`,
duration: 0.5,
content: (
<>
{`A duplicate of CMS entry
"${
copiedRow.identifier
? copiedRow.identifier
: "Untitled"
}"
has been created.`}
<br />
{`You are now viewing the duplicated entry.`}
</>
),
});
history.push(
UU.cmsEntry.fill({
Expand Down
2 changes: 1 addition & 1 deletion platform/wab/src/wab/server/db/DbMgr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7354,8 +7354,8 @@ export class DbMgr implements MigrationDbMgr {
await this.checkCmsRowPerms(rowId, "content");
const row = await this.getCmsRowById(rowId);
opts = {
identifier: opts.identifier !== "" ? opts.identifier : undefined,
draftData: row.draftData || row.data,
...opts,
};
const copiedRow = await this.createCmsRow(tableId, opts);
return await this.entMgr.save(copiedRow);
Expand Down

0 comments on commit 71c5b63

Please sign in to comment.