-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4565 from enonic/issue-4535
Implement undo of Pending Delete flag
- Loading branch information
Showing
15 changed files
with
426 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
...ain/java/com/enonic/xp/admin/impl/rest/resource/content/json/DeleteContentResultJson.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...ava/com/enonic/xp/admin/impl/rest/resource/content/json/UndoPendingDeleteContentJson.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.enonic.xp.admin.impl.rest.resource.content.json; | ||
|
||
|
||
import java.util.List; | ||
|
||
public class UndoPendingDeleteContentJson | ||
{ | ||
private List<String> contentIds; | ||
|
||
public List<String> getContentIds() | ||
{ | ||
return contentIds; | ||
} | ||
|
||
@SuppressWarnings("unused") | ||
public void setContentIds( final List<String> contentIds ) | ||
{ | ||
this.contentIds = contentIds; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...m/enonic/xp/admin/impl/rest/resource/content/json/UndoPendingDeleteContentResultJson.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.enonic.xp.admin.impl.rest.resource.content.json; | ||
|
||
public class UndoPendingDeleteContentResultJson | ||
{ | ||
private Integer success = 0; | ||
|
||
@SuppressWarnings("unused") | ||
public Integer getSuccess() | ||
{ | ||
return success; | ||
} | ||
|
||
public UndoPendingDeleteContentResultJson setSuccess( final Integer success ) | ||
{ | ||
if ( success != null ) | ||
{ | ||
this.success = success; | ||
} | ||
|
||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...rces/web/admin/apps/content-studio/js/app/browse/action/UndoPendingDeleteContentAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import '../../../api.ts'; | ||
import {ContentTreeGrid} from '../ContentTreeGrid'; | ||
|
||
import Action = api.ui.Action; | ||
import UndoPendingDeleteContentRequest = api.content.resource.UndoPendingDeleteContentRequest; | ||
|
||
export class UndoPendingDeleteContentAction extends Action { | ||
|
||
constructor(grid: ContentTreeGrid) { | ||
super('Undo delete'); | ||
|
||
this.setEnabled(false); | ||
|
||
this.onExecuted(() => { | ||
let contents: api.content.ContentSummaryAndCompareStatus[] | ||
= grid.getSelectedDataList(); | ||
new UndoPendingDeleteContentRequest(contents.map((content) => content.getContentId())) | ||
.sendAndParse().then((result: number) => { | ||
if (result > 0) { | ||
api.notify.showFeedback(`The item has been successfully undeleted`); | ||
} else { | ||
api.notify.showWarning(`No item found to undelete`); | ||
} | ||
}); | ||
}); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...src/main/resources/web/admin/common/js/content/json/UndoPendingDeleteContentResultJson.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module api.content.json { | ||
|
||
export interface UndoPendingDeleteContentResultJson { | ||
|
||
success: number; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...rc/main/resources/web/admin/common/js/content/resource/UndoPendingDeleteContentRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module api.content.resource { | ||
|
||
import UndoPendingDeleteContentResultJson = api.content.json.UndoPendingDeleteContentResultJson; | ||
|
||
export class UndoPendingDeleteContentRequest extends ContentResourceRequest<UndoPendingDeleteContentResultJson, number> { | ||
|
||
private ids: ContentId[]; | ||
|
||
constructor(ids: ContentId[]) { | ||
super(); | ||
super.setMethod('POST'); | ||
this.ids = ids; | ||
} | ||
|
||
getParams(): Object { | ||
return { | ||
contentIds: this.ids.map((contentId: ContentId) => contentId.toString()) | ||
}; | ||
} | ||
|
||
getRequestPath(): api.rest.Path { | ||
return api.rest.Path.fromParent(super.getResourcePath(), 'undoPendingDelete'); | ||
} | ||
|
||
sendAndParse(): wemQ.Promise<number> { | ||
return this.send().then((response: api.rest.JsonResponse<UndoPendingDeleteContentResultJson>) => { | ||
return response.getResult().success; | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...les/core/core-api/src/main/java/com/enonic/xp/content/UndoPendingDeleteContentParams.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.enonic.xp.content; | ||
|
||
import com.google.common.annotations.Beta; | ||
|
||
import com.enonic.xp.branch.Branch; | ||
|
||
@Beta | ||
public final class UndoPendingDeleteContentParams | ||
{ | ||
private final ContentIds contentIds; | ||
|
||
private final Branch target; | ||
|
||
public UndoPendingDeleteContentParams( final ContentIds contentIds, final Branch target ) | ||
{ | ||
this.contentIds = contentIds; | ||
this.target = target; | ||
} | ||
|
||
public ContentIds getContentIds() | ||
{ | ||
return contentIds; | ||
} | ||
|
||
public Branch getBranch() | ||
{ | ||
return target; | ||
} | ||
} |
Oops, something went wrong.