use of org.kie.workbench.common.screens.library.api.settings.SpaceScreenModel in project kie-wb-common by kiegroup.
the class SettingsScreenPresenter method setupUsingCurrentSection.
public Promise<Void> setupUsingCurrentSection() {
this.view.init(this);
showBusyIndicator(ts.getTranslation(LibraryConstants.Loading));
view.enableActions(canUpdate());
return setupSections(new SpaceScreenModel()).then(o -> {
hideBusyIndicator();
if (sectionManager.manages(sectionManager.getCurrentSection())) {
return sectionManager.goToCurrentSection();
} else {
return sectionManager.goToFirstAvailable();
}
}).catch_(o -> promises.catchOrExecute(o, e -> {
hideBusyIndicator();
return promises.reject(e);
}, i -> {
notificationEvent.fire(new NotificationEvent(ts.getTranslation(LibraryConstants.SettingsLoadError), ERROR));
hideBusyIndicator();
return promises.resolve();
}));
}
use of org.kie.workbench.common.screens.library.api.settings.SpaceScreenModel in project kie-wb-common by kiegroup.
the class SettingsScreenPresenterTest method createSectionMock.
private Section<SpaceScreenModel> createSectionMock() {
final Section<SpaceScreenModel> section = mock(Section.class);
doReturn(mock(MenuItem.class)).when(section).getMenuItem();
doReturn(promises.resolve()).when(section).setup(any());
doReturn(promises.resolve()).when(section).save(any(), any());
final SectionView view = mock(SectionView.class);
doReturn("title").when(view).getTitle();
doReturn(view).when(section).getView();
return section;
}
use of org.kie.workbench.common.screens.library.api.settings.SpaceScreenModel in project kie-wb-common by kiegroup.
the class SettingsScreenPresenter method setupSection.
Promise<Object> setupSection(final SpaceScreenModel model, final Section<SpaceScreenModel> section) {
return section.setup(model).then(i -> {
sectionManager.resetDirtyIndicator(section);
return promises.resolve();
}).catch_(e -> {
sectionManager.remove(section);
notificationEvent.fire(new NotificationEvent(getSectionSetupErrorMessage(section), WARNING));
return promises.resolve();
});
}
Aggregations