Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/axonivy-market/portal int…
Browse files Browse the repository at this point in the history
…o feature/IVYPORTAL-17170-Stage-1-Start-process-by-name-or-description

# Conflicts:
#	AxonIvyPortal/portal/webContent/resources/css/module.css
  • Loading branch information
mnhnam-axonivy committed Nov 19, 2024
2 parents e22c179 + f300310 commit b77ab49
Show file tree
Hide file tree
Showing 97 changed files with 1,649 additions and 1,310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
"type" : "RequestStart",
"name" : "testPortalCustomErrorHandler.ivp",
"config" : {
"signature" : "testPortalCustomErrorHandler"
"signature" : "testPortalCustomErrorHandler",
"task" : {
"customFields" : [
{ "name" : "embedInFrame", "type" : "STRING", "value" : "\"false\"" }
]
}
},
"visual" : {
"at" : { "x" : 96, "y" : 64 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
<body>
<ui:composition>
<!-- Exception Handler for ViewExpiredExceptions -->
<!-- This is a customized ViewExpiredException dialog -->
<p:ajaxExceptionHandler
type="javax.faces.application.ViewExpiredException"
update="viewExpiredExceptionDialog"
onexception="PF('viewExpiredExceptionDialog').show();" />
onexception="parent.PF &amp;&amp; parent.PF('portal-view-expired-exception-dialog') ? parent.PF('portal-view-expired-exception-dialog').show() : PF('viewExpiredExceptionDialog').show()" />

<!-- Error Dialog shown if a view or session has expired -->
<p:dialog id="viewExpiredExceptionDialog"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@
"config" : {
"output" : {
"code" : [
"import com.axonivy.portal.components.jsf.ManagedBeans;",
"import com.axonivy.portal.components.bean.DocumentUploadBean;",
"import com.axonivy.portal.components.masterdata.MasterData;",
"import com.axonivy.portal.components.enums.UploadDocumentCheckStatus;",
"import org.apache.commons.io.FileUtils;",
Expand All @@ -248,10 +250,17 @@
" in.message = ivy.cms.co(\"/Dialogs/com/axonivy/portal/components/DocumentTable/EmptyFileMessage\");",
" in.status = UploadDocumentCheckStatus.FAIL;",
"} else {",
" DocumentUploadBean documentUploadBean = ManagedBeans.get(\"documentUploadBean\") as DocumentUploadBean;",
" Long maxFileUploadSize = MasterData.getFileUploadSizeLimit();",
"",
" if(documentUploadBean != null) {",
" maxFileUploadSize = documentUploadBean.getFileUploadSizeLimit();",
" }",
" ",
" if (in.uploadedFile.getSize() > maxFileUploadSize) {",
" in.message = ivy.cms.co(\"/Dialogs/com/axonivy/portal/components/DocumentTable/ErrorFileUploadSize\", Arrays.asList(FileUtils.byteCountToDisplaySize(maxFileUploadSize)));",
" }",
" ",
" in.status = UploadDocumentCheckStatus.FAIL;",
"}"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ public class DocumentUploadBean implements Serializable {

private static final long serialVersionUID = 1L;

private Long customFileSizeLimit;

public Long getFileUploadSizeLimit() {
return MasterData.getFileUploadSizeLimit();
return (customFileSizeLimit != null && customFileSizeLimit > 0) ? customFileSizeLimit : MasterData.getFileUploadSizeLimit();
}

public String getFileUploadInvalidSizeMessage() {
public String getFileUploadInvalidSizeMessage(Long fileUploadSizeLimit) {
return Ivy.cms().co("/Dialogs/com/axonivy/portal/components/DocumentTable/ErrorFileUploadSize",
Arrays.asList(FileUtils.byteCountToDisplaySize(getFileUploadSizeLimit())));
Arrays.asList(FileUtils.byteCountToDisplaySize(fileUploadSizeLimit)));
}

public DocumentType[] getDocumentTypes() {
Expand All @@ -46,4 +48,12 @@ public boolean getPortalVirusScannerSettingOrDefault(boolean defaultIfEmpty) {
public String getPortalAllowedUploadFileTypesSettingOrDefault(String defaultIfEmpty) {
return GlobalSettingService.getInstance().findGlobalSettingValueAsString(GlobalVariable.UPLOAD_DOCUMENT_WHITELIST_EXTENSION, defaultIfEmpty);
}

public Long getCustomFileSizeLimit() {
return customFileSizeLimit;
}

public void setCustomFileSizeLimit(Long customFileSizeLimit) {
this.customFileSizeLimit = customFileSizeLimit;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<cc:attribute name="renderChooseUploadIcon" default="true" />

<cc:attribute name="fileLimit" type="Integer" shortDescription="Number of files are in the given ICase" default="-1" />
<cc:attribute name="sizeLimit" type="Long" shortDescription="Individual file size limit in bytes" />
<cc:attribute name="uploadText" default="#{ivy.cms.co('/Dialogs/com/axonivy/portal/components/DocumentTable/Upload')}" />
<cc:attribute name="updatedComponentAfterUploaded" />

Expand Down Expand Up @@ -43,7 +44,7 @@
<ui:param name="messageComponentId" value="#{cc.clientId.concat(':document-messages')}" />
<ui:param name="typeSelectionItems" value="#{not empty cc.attrs.typeSelectionItems ? cc.attrs.typeSelectionItems : documentUploadBean.documentTypes}" />
<ui:param name="selectedType" value="#{not empty cc.attrs.selectedType ? cc.attrs.selectedType : typeSelectionItems[0]}" />
<f:event type="preRenderComponent" listener="#{logic.renderComponent(messageComponentId, cc.attrs.typeColumnRendered, selectedType, cc.attrs.enableScriptCheckingForUploadedDocument, cc.attrs.enableVirusScannerForUploadedDocument, cc.attrs.allowedUploadFileTypes)}" />
<f:event type="preRenderComponent" listener="#{logic.renderComponent(messageComponentId, cc.attrs.typeColumnRendered, selectedType, cc.attrs.enableScriptCheckingForUploadedDocument, cc.attrs.enableVirusScannerForUploadedDocument, cc.attrs.allowedUploadFileTypes, cc.attrs.sizeLimit)}" />

<div id="#{cc.clientId}" class="document-table-component">

Expand Down Expand Up @@ -96,7 +97,7 @@
listener="#{logic.upload}"
rendered="#{cc.attrs.uploadRendered}"
update="document-table document-messages #{cc.attrs.updatedComponentAfterUploaded}"
invalidSizeMessage="#{documentUploadBean.getFileUploadInvalidSizeMessage()}"
invalidSizeMessage="#{documentUploadBean.getFileUploadInvalidSizeMessage(documentUploadBean.fileUploadSizeLimit)}"
label="#{not empty cc.attrs.uploadText ? cc.attrs.uploadText : ivy.cms.co('/Dialogs/com/axonivy/portal/components/DocumentTable/Upload')}"
cancelLabel="#{ivy.cms.co('/Dialogs/com/axonivy/portal/components/Common/Cancel')}"
onstart="#{logic.setFileLimit(cc.attrs.fileLimit)}" sizeLimit="#{documentUploadBean.fileUploadSizeLimit}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,9 @@
"name" : "uploadedFile",
"type" : "org.primefaces.model.file.UploadedFile",
"modifiers" : [ "PERSISTENT" ]
}, {
"name" : "sizeLimit",
"type" : "Long",
"modifiers" : [ "PERSISTENT" ]
} ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
}, {
"id" : "f42",
"type" : "HtmlDialogMethodStart",
"name" : "renderComponent(String,Boolean,DocumentType,Boolean,Boolean,String)",
"name" : "renderComponent(String,Boolean,DocumentType,Boolean,Boolean,String,Long)",
"config" : {
"signature" : "renderComponent",
"input" : {
Expand All @@ -456,13 +456,15 @@
{ "name" : "selectedType", "type" : "com.axonivy.portal.components.enums.DocumentType", "desc" : "" },
{ "name" : "enableScriptCheckingForUploadedDocument", "type" : "Boolean", "desc" : "" },
{ "name" : "enableVirusScannerForUploadedDocument", "type" : "Boolean", "desc" : "" },
{ "name" : "allowedUploadFileTypes", "type" : "String", "desc" : "" }
{ "name" : "allowedUploadFileTypes", "type" : "String", "desc" : "" },
{ "name" : "sizeLimit", "type" : "Long", "desc" : "" }
],
"map" : {
"out.allowedUploadFileTypes" : "param.allowedUploadFileTypes",
"out.enableScriptCheckingForUploadedDocument" : "param.enableScriptCheckingForUploadedDocument",
"out.enableVirusScannerForUploadedDocument" : "param.enableVirusScannerForUploadedDocument",
"out.messageComponentId" : "param.messageComponentId",
"out.sizeLimit" : "param.sizeLimit",
"out.typeColumnRendered" : "param.typeColumnRendered",
"out.typeSelection" : "param.selectedType"
}
Expand All @@ -471,10 +473,10 @@
},
"visual" : {
"at" : { "x" : 96, "y" : 192 },
"labelOffset" : { "x" : 121, "y" : 37 }
"labelOffset" : { "x" : 123, "y" : 43 }
},
"connect" : [
{ "id" : "f44", "to" : "f43" }
{ "id" : "f44", "to" : "f15" }
]
}, {
"id" : "f43",
Expand All @@ -500,5 +502,29 @@
"connect" : [
{ "id" : "f14", "to" : "f51" }
]
}, {
"id" : "f15",
"type" : "Script",
"name" : "Set size limit into bean",
"config" : {
"output" : {
"code" : [
"import com.axonivy.portal.components.jsf.ManagedBeans;",
"import com.axonivy.portal.components.bean.DocumentUploadBean;",
"",
"DocumentUploadBean documentUploadBean = ManagedBeans.get(\"documentUploadBean\") as DocumentUploadBean;",
"",
"if(documentUploadBean != null) {",
" documentUploadBean.setCustomFileSizeLimit(in.sizeLimit);",
"}"
]
}
},
"visual" : {
"at" : { "x" : 224, "y" : 192 }
},
"connect" : [
{ "id" : "f17", "to" : "f43", "color" : "default" }
]
} ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,19 @@

<h:panelGroup id="#{cc.attrs.componentId}-label-panel" layout="block"
rendered="#{not empty cc.attrs.label and !cc.attrs.floatingLabel}"
styleClass="#{cc.attrs.labelPanelStyleClass}">
styleClass="#{cc.attrs.labelPanelStyleClass} ui-g-6 pl-0">
<p:outputLabel id="#{cc.attrs.componentId}-label" value="#{cc.attrs.label}" for="#{cc.attrs.componentId}"
styleClass="#{cc.attrs.labelStyleClass}" />
</h:panelGroup>

<c:set var="completeMethod" value="#{not empty cc.attrs.completeMethod ? cc.attrs.completeMethod : userSelectionBean.completeUserMethod}" />
<h:panelGroup layout="block"
styleClass="#{cc.attrs.messageStyleClass} #{cc.attrs.floatingLabel ? 'message-for-floating-label' : ''}">
<p:message id="#{cc.attrs.componentId}-message"
for="#{cc.attrs.componentId}" rendered="#{cc.attrs.isRenderedMessage}"/>
</h:panelGroup>
<h:panelGroup id="#{cc.attrs.componentId}-autocomplete-panel" layout="block"
styleClass="user-selection-panel #{cc.attrs.autoCompletePanelStyleClass} #{cc.attrs.floatingLabel and ivyPrimefacesThemeResolver.sessionTheme.contains('serenity') ? 'md-inputfield' : ''} #{cc.attrs.floatingLabel and ivyPrimefacesThemeResolver.sessionTheme.contains('freya') ? 'ui-float-label' : ''}">
styleClass="pl-0 user-selection-panel #{cc.attrs.autoCompletePanelStyleClass} #{cc.attrs.floatingLabel and ivyPrimefacesThemeResolver.sessionTheme.contains('serenity') ? 'md-inputfield' : ''} #{cc.attrs.floatingLabel and ivyPrimefacesThemeResolver.sessionTheme.contains('freya') ? 'ui-float-label' : ''}">
<p:autoComplete id="#{cc.attrs.componentId}"
value="#{cc.attrs.selectedUser}"
scrollHeight="#{cc.attrs.scrollHeight}"
Expand Down Expand Up @@ -104,11 +109,6 @@
styleClass="#{cc.attrs.labelStyleClass}"
rendered="#{cc.attrs.floatingLabel}" />
</h:panelGroup>
<h:panelGroup layout="block"
styleClass="#{cc.attrs.messageStyleClass} #{cc.attrs.floatingLabel ? 'message-for-floating-label' : ''}">
<p:message id="#{cc.attrs.componentId}-message"
for="#{cc.attrs.componentId}" rendered="#{cc.attrs.isRenderedMessage}"/>
</h:panelGroup>
<h:outputScript name="theme-checker.js" library="js" />
<script type="text/javascript">
ThemeChecker.updateLayoutByTheme('#{ivyPrimefacesThemeResolver.sessionTheme}');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.name-after-avatar {
flex: 1;
display: flex;
display: block;
padding-left: .3rem;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
width: 100%;
}

.ui-fluid.user-selection-panel {
display: inline-block;
width: 85%;
}

.message-for-floating-label {
padding-left: 2px;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_DATA_CLASS=ch.ivyteam.ivy.project.portal.test.Data
ch.ivyteam.ivy.designer.preferences.DataClassPreferencePage\:DEFAULT_NAMESPACE=ch.ivyteam.ivy.project.portal.test
ch.ivyteam.ivy.project.preferences\:PORTAL_VERSION=10
ch.ivyteam.ivy.project.preferences\:PRIMEFACES_VERSION=13
ch.ivyteam.ivy.project.preferences\:PROJECT_VERSION=114006
ch.ivyteam.ivy.project.preferences\:PROJECT_VERSION=120001
eclipse.preferences.version=1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema" : "https://json-schema.axonivy.com/data-class/11.4.0/data-class.json",
"$schema" : "https://json-schema.axonivy.com/data-class/12.0.0/data-class.json",
"simpleName" : "Data",
"namespace" : "ch.ivyteam.ivy.project.portal.test",
"isBusinessCaseData" : false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema" : "https://json-schema.axonivy.com/data-class/11.4.0/data-class.json",
"$schema" : "https://json-schema.axonivy.com/data-class/12.0.0/data-class.json",
"simpleName" : "Responsible",
"namespace" : "ch.ivyteam.ivy.project.portal.test",
"isBusinessCaseData" : false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class AbsencePage extends TemplatePage {

private static final String DELETE_ABSENCE__LINK_ID_PATTERN =
"absences-management-form:absence-table:%d:delete-absence";
private static final String ABSENCE_ACTION_BUTTON_PATTERN =
"absences-management-form:absence-table:%d:absence-action-button";
private static final String EDIT_ABSENCE__LINK_ID_PATTERN = "absences-management-form:absence-table:%d:edit-absence";

@Override
Expand All @@ -44,10 +46,10 @@ public void countAbsences(int expectedSize) {
}

public void showAbsencesInThePast(boolean shown) {
SelenideElement checkBox = $("input[id*='show-absence-in-the-past']");
SelenideElement checkBox = $(".show-absence-in-the-past-panel");
boolean checkBoxSelected = checkBox.isSelected();
if (checkBoxSelected != shown) {
waitForElementClickableThenClick("div[id*='show-absence-in-the-past'] div.ui-chkbox-box");
waitForElementClickableThenClick(checkBox);
}
}

Expand Down Expand Up @@ -157,7 +159,7 @@ public void saveSubstitute() {
}

public WebElement getAbsenceForm() {
return $("[id$='absences-management-form']");
return $("[id$='absences-management-container']");
}

public SelenideElement getAddAbsenceDialog() {
Expand All @@ -171,12 +173,20 @@ public void waitForAbsencesGrowlMessageDisplay() {
$(growlMessage.findElement(By.className("ui-growl-item-container"))).shouldBe(appear, DEFAULT_TIMEOUT);
}

public void clickOnAbsenceAction(int index) {
$(By.id(String.format(ABSENCE_ACTION_BUTTON_PATTERN, index))).click();
}
public void canDeleteAbsence(int index) {
clickOnAbsenceAction(index);
waitForElementDisplayed($(By.id(String.format(DELETE_ABSENCE__LINK_ID_PATTERN, index))), true);
//Click to close
clickOnAbsenceAction(index);
}

public void canEditAbsence(int index) {
clickOnAbsenceAction(index);
waitForElementDisplayed($(By.id(String.format(EDIT_ABSENCE__LINK_ID_PATTERN, index))), true);
clickOnAbsenceAction(index);
}

public void isDeputySettingSectionDisplayed(boolean isDisplay) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ private void editGlobalVariable(String variableName, String variableValue, boole
$("button[id$='admin-setting-component:adminTabView:restore-all-to-default-button']")
.shouldBe(Condition.appear, DEFAULT_TIMEOUT).shouldBe(getClickableCondition());
waitForElementDisplayed(By.id("admin-setting-component:adminTabView:settingTable"), true);

var variableRow = $("[id='admin-setting-component:adminTabView:settingTable']").$$(".setting-key")
.filter(Condition.text(variableName)).get(0);

if (variableRow != null) {
SelenideElement editButton = variableRow.ancestor("tr").$(By.cssSelector("a[id$=edit]"));
editButton.shouldBe(clickable(), DEFAULT_TIMEOUT).click();
variableRow.ancestor("tr").scrollTo();
SelenideElement actionButton = variableRow.ancestor("tr").$(By.cssSelector("button[id$=settings-action-button]"));
actionButton.shouldBe(getClickableCondition()).click();
String currentElementId = actionButton.attr("id");
String editButtonId = currentElementId.replace("settings-action-button", "edit-application");
$("a[id='" + editButtonId + "']").shouldBe(getClickableCondition(), DEFAULT_TIMEOUT).click();
}
waitForElementDisplayed(By.cssSelector("[id$=':settingDialogForm']"), true);
saveGlobalVariable(variableValue, isBooleanType);
Expand Down Expand Up @@ -72,12 +75,12 @@ private void saveGlobalVariable(String value, boolean isBooleanType) {
waitForElementClickableThenClick("[id='admin-setting-component:save-setting']");
}

public void clickOnbackToNewDashboardPageOnAdminSetting() {
WaitHelper.waitForNavigation(() -> waitForElementClickableThenClick(findElementById("back-to-home-button")));
public void closeConfirmationDialog() {
clickOnHomeLogo();
}

public void closeConfirmationDialog() {
clickOnbackToNewDashboardPageOnAdminSetting();
public void clickOnHomeLogo() {
$("span[class*='si si-house-chimney-2']").shouldBe(Condition.appear, DEFAULT_TIMEOUT).shouldBe(getClickableCondition()).click();
}

public void setGlobalFooterInfo() {
Expand Down Expand Up @@ -141,7 +144,8 @@ public WebElement getAddApplicationDialog() {
}

public WebElement getEditSettingDialogOfFirstRow() {
waitForElementClickableThenClick($(By.id("admin-setting-component:adminTabView:settingTable:0:edit")));
waitForElementClickableThenClick($(By.id("admin-setting-component:adminTabView:settingTable:0:settings-action-button")));
$("a[id='admin-setting-component:adminTabView:settingTable:0:edit-application']").shouldBe(getClickableCondition(), DEFAULT_TIMEOUT).click();
waitForElementDisplayed(By.id("admin-setting-component:settingDialog"), true);
Sleeper.sleep(300);// Wait a bit focus effects, just only use this for capture screenshot
return findElementById("admin-setting-component:settingDialog");
Expand Down
Loading

0 comments on commit b77ab49

Please sign in to comment.