-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete action for Container Repository Images and Vault Secrets #7649
Delete action for Container Repository Images and Vault Secrets #7649
Conversation
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/actions/DeleteNodeAction.java
Outdated
Show resolved
Hide resolved
@@ -101,6 +103,11 @@ public TreeItemData createDecorations(Node n, boolean expanded) { | |||
d.addContextValues(CTXVALUE_CAP_REFERENCE_NAME); | |||
set = true; | |||
} | |||
|
|||
if (item instanceof SecretItem) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhorvath these interface-dependent extractions ("if X in Lookup, use put "prefix:${X.property}" into contextValue) seem rather common / useful ... if the usage will grow, we could invent a declarative support for that, would be then far easier to export state to LSP clients.
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/vault/SecretNode.java
Show resolved
Hide resolved
The DeleteNodeAction should not be implemented at all. There is already support for deletion. The context value cap:delete is added when Node.canDestroy() returns true in DefaultDecorationsImpl. Additionally, destroy() is called in LspTreeViewServiceImpl for the delete command, which should appear automatically based on the context value. |
9804941
to
3b916c4
Compare
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/NotificationUtils.java
Outdated
Show resolved
Hide resolved
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/OCINode.java
Show resolved
Hide resolved
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/vault/SecretNode.java
Outdated
Show resolved
Hide resolved
3b916c4
to
086ad44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
|
||
@Override | ||
public void destroy() throws IOException { | ||
ArtifactsClient client = OCIManager.getDefault().getActiveSession().newClient(ArtifactsClient.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lengthy operation cannot be executed inside destroy(). You have use RequestProcessor here
"DeleteNodeAction=Delete item", | ||
"MSG_ConfirmDeleteAction=Are you sure that you want to delete {0}", | ||
"MSG_DeleteActionFailed=Failed to delete {0}.", | ||
"MSG_DeleteActionSuccess=Successfully deleted {0}." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message is not accurate for scheduled deletions. You should display a different message specifically for scheduled deletions and consider making it more general, as other special cases might arise in the future.
|
||
@Override | ||
public void destroy() throws IOException { | ||
RequestProcessor.getDefault().post(() -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use default RP. Create a dedicated one for this class with throughput 1 like this:
RequestProcessor RP = new RequestProcessor(ContainerTagNode.class);
Action for deleting Container Repository Images and Vault Secrets.
Since there is no API to instantly delete Vault Secrets, the deletion is scheduled for tomorrow. Also Cloud Asset view now shows if Vault Secret is in state: PENDING_DELETION