Skip to content
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

HAL-1878: Disable reset for interface resource #923

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- [HAL-1878](https://issues.redhat.com/browse/HAL-1878): Disable reset for interface resource

## [3.6.11] - 2023-07-18

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import javax.inject.Inject;

import org.jboss.hal.ballroom.form.Form;
import org.jboss.hal.ballroom.form.Form.FinishReset;
import org.jboss.hal.core.CrudOperations;
import org.jboss.hal.core.finder.Finder;
import org.jboss.hal.core.finder.FinderPath;
Expand All @@ -30,8 +29,6 @@
import org.jboss.hal.dmr.ModelNode;
import org.jboss.hal.dmr.ResourceAddress;
import org.jboss.hal.meta.AddressTemplate;
import org.jboss.hal.meta.Metadata;
import org.jboss.hal.meta.MetadataRegistry;
import org.jboss.hal.meta.StatementContext;
import org.jboss.hal.meta.token.NameTokens;
import org.jboss.hal.resources.Ids;
Expand All @@ -55,7 +52,6 @@ public class InterfacePresenter
static final AddressTemplate ROOT_TEMPLATE = AddressTemplate.of(ROOT_ADDRESS);

private final CrudOperations crud;
private final MetadataRegistry metadataRegistry;
private final StatementContext statementContext;
private String interfce;

Expand All @@ -65,11 +61,9 @@ public InterfacePresenter(EventBus eventBus,
MyProxy proxy,
Finder finder,
CrudOperations crud,
MetadataRegistry metadataRegistry,
StatementContext statementContext) {
super(eventBus, view, proxy, finder);
this.crud = crud;
this.metadataRegistry = metadataRegistry;
this.statementContext = statementContext;
}

Expand Down Expand Up @@ -107,16 +101,6 @@ void saveInterface(final Form<ModelNode> form, final Map<String, Object> changed
crud.save(Names.INTERFACE, interfce, ROOT_TEMPLATE, changedValues, this::reload);
}

void resetInterface(final Form<ModelNode> form) {
Metadata metadata = metadataRegistry.lookup(ROOT_TEMPLATE);
crud.reset(Names.INTERFACE, interfce, ROOT_TEMPLATE, form, metadata, new FinishReset<ModelNode>(form) {
@Override
public void afterReset(final Form<ModelNode> form) {
reload();
}
});
}

// @formatter:off
@ProxyCodeSplit
@Requires(ROOT_ADDRESS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<metadata address="/interface=*">
<h1>Interface</h1>
<p>${metadata.getDescription().getDescription()}</p>
<form id="interface-form" title="Interface" on-save="${presenter.saveInterface(form, changedValues)}"
prepare-reset="${presenter.resetInterface(form)}"/>
<form id="interface-form" title="Interface" on-save="${presenter.saveInterface(form, changedValues)}" />
</metadata>
</view>