Skip to content

Commit

Permalink
Clone a grid
Browse files Browse the repository at this point in the history
#CTCTOWALTZ-2626
finos#6368
  • Loading branch information
jessica-woodland-scott-db committed Jan 25, 2023
1 parent e3d6f4c commit c78ecad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
description: null,
}
$: disabled = _.isNil(workingCopy.name) || _.isEmpty(workingCopy.name)
</script>


Expand All @@ -36,12 +38,13 @@
bind:value={workingCopy.description}/>
</div>

<button class="btn-success btn-sm"
disabled={_.isNil(workingCopy.name)}
<button class="btn btn-success btn-sm"
title={disabled ? "You must set a name for your grid before cloning" : null}
disabled={disabled}
on:click={() => doClone(grid.definition.id, workingCopy)}>
Clone
</button>
<button class="btn-primary btn btn-sm"
<button class="btn btn-primary btn btn-sm"
on:click={doCancel}>
Cancel
</button>
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ public ReportGridDefinition clone(long id, ReportGridUpdateCommand updateCommand

ReportGridDefinition gridToClone = reportGridDao.getGridDefinitionById(id);

if (gridToClone == null) {
throw new NotFoundException("REPORT_GRID_NOT_FOUND", format("Cannot find grid with id: %d to clone", id));
}

ImmutableReportGridCreateCommand newGridCreateCommand = ImmutableReportGridCreateCommand.builder()
.name(updateCommand.name())
.description(updateCommand.description())
Expand All @@ -301,7 +305,7 @@ public ReportGridDefinition clone(long id, ReportGridUpdateCommand updateCommand
.derivedColumnDefinitions(gridToClone.derivedColumnDefinitions())
.build();

reportGridDao.updateColumnDefinitions(newGrid.id().get(), updateColsCmd);
newGrid.id().ifPresent(newGridId -> reportGridDao.updateColumnDefinitions(newGridId, updateColsCmd));

return newGrid;
}
Expand Down

0 comments on commit c78ecad

Please sign in to comment.