Render more actions on change view
There are more actions that don't require additional input and can be rendered already now: * Delete draft change * Delete draft revision * Publish draft revision Also align the primary button to the right side of the container to even more visually emphasize, that this button does something different in this specific change context, except blue color. Status of the current revision is currently not correctly computed, because the current code only respects the change.status field in the change/revision status calculation. When cange.status is NEW, then the revision draft field must be read to correctly render draft revision status. This will be fixed in follow-up change. Test Plan: - Add draft change. Confirm that Publish and Delete buttons are visible and work as exptected - Add draft revision. Confirm that Publish and Delete buttons are visible and work as exptected Bug: Issue 3906 Change-Id: I9db90142088e165cf65b89abbe11a3d1dc6db634
This commit is contained in:
@@ -72,6 +72,7 @@ public class DeleteDraftChange implements
|
||||
public UiAction.Description getDescription(ChangeResource rsrc) {
|
||||
try {
|
||||
return new UiAction.Description()
|
||||
.setLabel("Delete")
|
||||
.setTitle("Delete draft change " + rsrc.getId())
|
||||
.setVisible(allowDrafts
|
||||
&& rsrc.getChange().getStatus() == Status.DRAFT
|
||||
|
||||
@@ -184,6 +184,7 @@ public class DeleteDraftPatchSet implements RestModifyView<RevisionResource, Inp
|
||||
try {
|
||||
int psCount = psUtil.byChange(db.get(), rsrc.getNotes()).size();
|
||||
return new UiAction.Description()
|
||||
.setLabel("Delete")
|
||||
.setTitle(String.format("Delete draft revision %d",
|
||||
rsrc.getPatchSet().getPatchSetId()))
|
||||
.setVisible(allowDrafts
|
||||
|
||||
@@ -126,6 +126,7 @@ public class PublishDraftPatchSet implements RestModifyView<RevisionResource, In
|
||||
public UiAction.Description getDescription(RevisionResource rsrc) {
|
||||
try {
|
||||
return new UiAction.Description()
|
||||
.setLabel("Publish")
|
||||
.setTitle(String.format("Publish revision %d",
|
||||
rsrc.getPatchSet().getPatchSetId()))
|
||||
.setVisible(rsrc.getPatchSet().isDraft()
|
||||
|
||||
Reference in New Issue
Block a user