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

IVYPORTAL-17304 Implement the hide Fullscreen mode / Widget Info icons in all widgets #1022

Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -537,4 +537,27 @@ public SelenideElement getConfigurationFilterContainer() {
return $("div#new-widget-configuration-dialog").shouldBe(appear, DEFAULT_TIMEOUT).$("div[id$='filter-container']")
.shouldBe(appear, DEFAULT_TIMEOUT);
}

private SelenideElement getExpandModeCheckbox() {
return getConfigurationFilterContainer().$("span[id$='fullscreen-mode-group']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT).$("div[class*='ui-inputgroup']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT).$("div[id$='fullscreen-option']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT);
}

public void clickOnExpandModeCheckbox() {
getExpandModeCheckbox().shouldBe(getClickableCondition(), DEFAULT_TIMEOUT).click();
}

public SelenideElement getWidgetInfoIconCheckbox() {
return getConfigurationFilterContainer().$("span[id$='widget-info-icon-group']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT).$("div[class*='ui-inputgroup']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT).$("div[id$='widget-info']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT).$("div[class*='ui-chkbox-box']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT).$("span");
}

public void clickOnWidgetInfoIconCheckbox() {
getWidgetInfoIconCheckbox().shouldBe(getClickableCondition(), DEFAULT_TIMEOUT).click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;

import org.openqa.selenium.Keys;import com.codeborne.selenide.CollectionCondition;
import com.codeborne.selenide.Condition;
import org.openqa.selenium.Keys;

import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;

Expand Down Expand Up @@ -101,4 +101,12 @@ public void shiftAndArrowKeyOnQuickSearchInput() {
searchInput.sendKeys(Keys.ENTER);
waitForPageLoad();
}

public boolean isExpandButtonAppear() {
return getProcessWidgetHeader().$(".expand-link").isDisplayed();
}

public boolean isWidgetInfoIconAppear() {
return getProcessWidgetHeader().$(".widget__info-sidebar-link").isDisplayed();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.codeborne.selenide.CollectionCondition.size;
import static com.codeborne.selenide.Selenide.$$;
import static org.junit.jupiter.api.Assertions.assertFalse;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import


import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -17,6 +18,7 @@
import com.axonivy.portal.selenium.page.NewDashboardPage;
import com.axonivy.portal.selenium.page.ProcessEditWidgetNewDashBoardPage;
import com.axonivy.portal.selenium.page.ProcessInformationPage;
import com.axonivy.portal.selenium.page.ProcessWidgetNewDashBoardPage;
import com.axonivy.portal.selenium.page.TaskDetailsPage;
import com.axonivy.portal.selenium.page.TaskIFrameTemplatePage;
import com.axonivy.portal.selenium.page.TaskTemplateIFramePage;
Expand All @@ -25,6 +27,7 @@

@IvyWebTest
public class DashboardProcessWidgetTest extends BaseTest {
private static final String YOUR_PROCESSES = "Your Processes";
private static final String EXPRESS_PROCESS = "EXPRESS_PROCESS";
private static final String CASE_LEAVE_REQUEST_TEST_FOR_IVYPORTAL_3369 =
"Case: Leave Request Test For IVYPORTAL-3369";
Expand Down Expand Up @@ -700,6 +703,28 @@ public void testSavedDataWhenChangeProcessDisplayMode() {
.shouldNotHave(Condition.value(CATEGORIED_LEAVE_REQUEST));
}

@Test
public void testHideExpandMode() {
ProcessEditWidgetNewDashBoardPage editProcessWidgetConfiguration =
newDashboardPage.editProcessWidgetConfiguration();
editProcessWidgetConfiguration.clickOnExpandModeCheckbox();;
editProcessWidgetConfiguration.save();
backToNewDashboardPage();
ProcessWidgetNewDashBoardPage processWidget = newDashboardPage.selectProcessWidget(YOUR_PROCESSES);
assertFalse(processWidget.isExpandButtonAppear());
}

@Test
public void testHideWidgetInfoIcon() {
ProcessEditWidgetNewDashBoardPage editProcessWidgetConfiguration =
newDashboardPage.editProcessWidgetConfiguration();
editProcessWidgetConfiguration.clickOnWidgetInfoIconCheckbox();
editProcessWidgetConfiguration.save();
backToNewDashboardPage();
ProcessWidgetNewDashBoardPage processWidget = newDashboardPage.selectProcessWidget(YOUR_PROCESSES);
assertFalse(processWidget.isWidgetInfoIconAppear());
}

private void backToNewDashboardPage() {
NewDashboardDetailsEditPage newDashboardDetailsEditPage = new NewDashboardDetailsEditPage();
var configurationPage = newDashboardDetailsEditPage.backToConfigurationPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public boolean canShowWidgetInfoIcon(DashboardWidget widget) {
}

public boolean canShowExpandMode(DashboardWidget widget) {
return widget.getType().canShowFullscreenMode();
return widget.getType().canShowFullscreenModeOption();
}

public void setSelectedDashboardName(String dashboardName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1028,9 +1028,9 @@ public boolean displayWidgetInfoOption() {
.map(DashboardWidgetType::canShowWidgetInfoOption).orElse(false);
}

public boolean displayFullscreenMode() {
public boolean displayFullscreenModeOption() {
return Optional.ofNullable(this.widget).map(DashboardWidget::getType)
.map(DashboardWidgetType::canShowFullscreenMode).orElse(false);
.map(DashboardWidgetType::canShowFullscreenModeOption).orElse(false);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ public class ClientStatisticDashboardWidget extends DashboardWidget {

private static final long serialVersionUID = 1L;
private String chartId;
private boolean showFullscreenMode;

public ClientStatisticDashboardWidget() {}
public ClientStatisticDashboardWidget() {
setShowFullscreenMode(true);
}

@JsonIgnore
@Override
Expand All @@ -35,4 +38,12 @@ public void setChartId(String chartId) {
public void cancelUserFilter() {
}

public boolean isShowFullscreenMode() {
return showFullscreenMode;
}

public void setShowFullscreenMode(boolean showFullscreenMode) {
this.showFullscreenMode = showFullscreenMode;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class CustomDashboardWidget extends DashboardWidget {
private String errorMessage;
@JsonIgnore
private String errorIcon;
private boolean showFullscreenMode;

@Override
public DashboardWidgetType getType() {
Expand Down Expand Up @@ -61,6 +62,7 @@ public static CustomDashboardWidget buildDefaultWidget(String id, String name) {
result.getLayout().setAxisX(0);
result.getLayout().setAxisY(0);
result.setData(new DashboardCustomWidgetData());
result.setShowFullscreenMode(true);
return result;
}

Expand Down Expand Up @@ -169,4 +171,12 @@ public void setErrorIcon(String errorIcon) {

@Override
public void cancelUserFilter() {}

public void setShowFullscreenMode(boolean showFullscreenMode) {
this.showFullscreenMode = showFullscreenMode;
}

public boolean isShowFullscreenMode() {
return showFullscreenMode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,22 @@ public class ProcessDashboardWidget extends DashboardWidget {
private boolean isPreview;
@JsonIgnore
protected DashboardProcessSearchCriteria criteria;
private boolean showFullscreenMode;
private boolean showWidgetInfo;

public ProcessDashboardWidget() {
criteria = new DashboardProcessSearchCriteria();
setShowFullscreenMode(true);
setShowWidgetInfo(true);
}

public ProcessDashboardWidget(ProcessDashboardWidget widget) {
super(widget);
criteria = widget.getCriteria();
displayMode = widget.getDisplayMode();
isPreview = widget.isPreview();
showFullscreenMode = widget.showFullscreenMode;
showWidgetInfo = widget.showWidgetInfo;
}

@Override
Expand Down Expand Up @@ -126,4 +132,20 @@ public void cancelUserFilter() {}
public void setQuickSearchKeyword() {
this.criteria.setQuickSearchKeyword(this.getQuickSearchKeyword());
}

public void setShowFullscreenMode(boolean showFullscreenMode) {
this.showFullscreenMode = showFullscreenMode;
}

public boolean isShowFullscreenMode() {
return showFullscreenMode;
}

public void setShowWidgetInfo(boolean showWidgetInfo) {
this.showWidgetInfo = showWidgetInfo;
}

public boolean isShowWidgetInfo() {
return showWidgetInfo;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ProcessViewerDashboardWidget extends DashboardWidget {
private String processPath;
@JsonIgnore
private DashboardProcess process;
private boolean showFullscreenMode;

@Override
public DashboardWidgetType getType() {
Expand All @@ -39,6 +40,7 @@ public static ProcessViewerDashboardWidget buildDefaultWidget(String id, String
result.getLayout().setHeight(6);
result.getLayout().setAxisX(0);
result.getLayout().setAxisY(0);
result.setShowFullscreenMode(true);
return result;
}

Expand Down Expand Up @@ -69,4 +71,13 @@ public String getProcessLink() {

@Override
public void cancelUserFilter() {}

public void setShowFullscreenMode(boolean showFullscreenMode) {
this.showFullscreenMode = showFullscreenMode;
}

public boolean isShowFullscreenMode() {
return showFullscreenMode;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ public class StatisticDashboardWidget extends DashboardWidget {
private StatisticChart chart;
@JsonIgnore
private boolean isChartEmpty;
private boolean showFullscreenMode;

public StatisticDashboardWidget() {}
public StatisticDashboardWidget() {
setShowFullscreenMode(true);
}

public StatisticDashboardWidget(StatisticDashboardWidget widget) {
super(widget);
chart = widget.getChart();
showFullscreenMode = widget.showFullscreenMode;
}

@JsonIgnore
Expand Down Expand Up @@ -113,4 +117,12 @@ public String getEmptyChartIcon() {

@Override
public void cancelUserFilter() {}

public void setShowFullscreenMode(boolean showFullscreenMode) {
this.showFullscreenMode = showFullscreenMode;
}

public boolean isShowFullscreenMode() {
return showFullscreenMode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ public boolean canEnableQuickSearch() {
}

public boolean canShowWidgetInfoOption() {
return this == TASK || this == CASE;
return this == TASK || this == CASE || this == PROCESS;
}

public boolean canShowFullscreenMode() {
return this == TASK || this == CASE;

public boolean canShowFullscreenModeOption() {
return this == TASK || this == CASE || this == PROCESS || this == NEWS || this == CUSTOM || this == PROCESS_VIEWER
|| this == CLIENT_STATISTIC || this == NOTIFICATION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class NewsDashboardWidget extends DashboardWidget implements Serializable
private static final long serialVersionUID = -5650954020648136966L;
@JsonIgnore
private List<News> newsList;
private boolean showFullscreenMode;

public void buildDataFirstTime() {
newsList = NewsService.getInstance().findAll();
Expand All @@ -42,6 +43,7 @@ public static NewsDashboardWidget buildDefaultWidget(String widgetId, String wid
widget.getLayout().setHeight(6);
widget.getLayout().setAxisX(0);
widget.getLayout().setAxisY(0);
widget.setShowFullscreenMode(true);
return widget;
}

Expand All @@ -55,4 +57,12 @@ public void setNewsList(List<News> newsList) {

@Override
public void cancelUserFilter() {}

public void setShowFullscreenMode(boolean showFullscreenMode) {
this.showFullscreenMode = showFullscreenMode;
}

public boolean isShowFullscreenMode() {
return showFullscreenMode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ public class NotificationDashboardWidget extends DashboardWidget {
@JsonIgnore
private long countUnread;
private boolean onlyUnread;
private boolean showFullscreenMode;

public NotificationDashboardWidget() {
this.webNotifications = WebNotifications.current();
this.countAll = webNotifications.countAll();
this.countUnread = webNotifications.countUnread();
setShowFullscreenMode(true);
}

@JsonIgnore
Expand Down Expand Up @@ -93,4 +95,12 @@ public void goToTaskDetail(NotificationDto dto) {
PortalNavigator.redirect(dto.getInfoAction().getLink().getRelative());
}

public boolean isShowFullscreenMode() {
return showFullscreenMode;
}

public void setShowFullscreenMode(boolean showFullscreenMode) {
this.showFullscreenMode = showFullscreenMode;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

<c:if test="#{widgetType eq 'STATISTIC'}">
<ic:ch.ivy.addon.portal.generic.dashboard.component.StatisticChartWidgetConfiguration id="new-widget-configuration-component"
widget="#{widget}" componentToUpdate="widget-configuration-form" isPublicDashboard="#{isPublicDashboard}"/>
widget="#{widget}" componentToUpdate="widget-configuration-form" isPublicDashboard="#{isPublicDashboard}" managedBean="#{dashboardDetailModificationBean}" />
</c:if>

<c:if test="#{widgetType eq 'CUSTOM'}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<ui:param name="isReadOnlyMode" value="#{cc.attrs.isReadOnlyMode}" />
<ui:param name="isRenderFilter" value="false" />
<ui:param name="isRenderInfo" value="#{empty widget.info ? 'false' : 'true'}" />
<ui:param name="isRenderExpandCollapse" value="true" />
<ui:param name="isRenderExpandCollapse" value="#{widget.isShowFullscreenMode()}" />
<ui:param name="isHeaderHidden" value="#{empty widget.name and cc.attrs.isReadOnlyMode}" />
<ui:param name="panelStyleClass" value="#{isHeaderHidden ? 'custom-widget-panel no-header' : 'custom-widget-panel'}" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,22 @@
</div>
</h:panelGroup>

<h:panelGroup id="fullscreen-mode-group" rendered="#{managedBean.displayFullscreenModeOption()}"
styleClass="ui-g-12 u-padding-0 ui-fluid">
<div class="ui-g-4">
<p:outputLabel for="fullscreen-option"
value="#{ivy.cms.co('/ch.ivy.addon.portalkit.ui.jsf/dashboard/fullscreenMode')}"
styleClass="u-mar-right-5" />
</div>
<div class="ui-g-6 ui-inputgroup">
<p:selectBooleanCheckbox id="fullscreen-option"
value="#{widget.showFullscreenMode}">
<p:ajax process="fullscreen-mode-group"
update="fullscreen-mode-group" partialSubmit="true"/>
</p:selectBooleanCheckbox>
</div>
</h:panelGroup>

<c:set var="isIvyProcess" value="#{widget.data.type == 'PROCESS'}" />
<h:panelGroup id="external-url-panel"
styleClass="ui-g-12 u-padding-0" rendered="#{!isIvyProcess}">
Expand Down
Loading
Loading