-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2f11e9
commit b1861b3
Showing
7 changed files
with
194 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
.../java/com/evolveum/midpoint/web/page/admin/certification/component/CampaignTilePanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- | ||
~ Copyright (c) 2024 Evolveum and contributors | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html xmlns:wicket="http://wicket.apache.org"> | ||
<wicket:panel> | ||
<div class="d-flex flex-wrap w-100"> | ||
<div class="d-flex flex-wrap flex-grow-1 justify-content-start" wicket:id="selectTileCheckbox"/> | ||
<div class="d-flex flex-wrap flex-grow-1 justify-content-end" wicket:id="status"/> | ||
<a wicket:id="menu" class="d-flex flex-wrap flex-grow-1 justify-content-end"> | ||
<i class="fa fa-ellipsis-v"/> | ||
</a> | ||
</div> | ||
<div class="font-weight-bold text-truncate w-100" wicket:id="title"/> | ||
<div class="tile-description mt-2 text-center text-secondary flex-grow-1 info-box-icon w-100" wicket:id="description"/> | ||
<div class="w-100"> | ||
<span wicket:message="CampaignTilePanel.progress" /> | ||
<div wicket:id="progressBar" /> | ||
</div> | ||
|
||
|
||
<!-- <div wicket:id="infoPanel"/>--> | ||
<!-- <div wicket:id="buttonsPanel"/>--> | ||
</wicket:panel> | ||
</html> |
129 changes: 129 additions & 0 deletions
129
.../java/com/evolveum/midpoint/web/page/admin/certification/component/CampaignTilePanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
* Copyright (c) 2024 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.page.admin.certification.component; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.gui.api.component.form.CheckBoxPanel; | ||
import com.evolveum.midpoint.gui.api.component.progressbar.ProgressBar; | ||
import com.evolveum.midpoint.gui.api.component.progressbar.ProgressBarPanel; | ||
import com.evolveum.midpoint.gui.api.util.LocalizationUtil; | ||
import com.evolveum.midpoint.gui.api.util.WebComponentUtil; | ||
import com.evolveum.midpoint.gui.impl.page.admin.resource.component.TemplateTile; | ||
import com.evolveum.midpoint.schema.util.CertCampaignTypeUtil; | ||
import com.evolveum.midpoint.web.component.AjaxButton; | ||
import com.evolveum.midpoint.web.component.util.SelectableBean; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType; | ||
|
||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.behavior.AttributeAppender; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.io.Serial; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class CampaignTilePanel extends BasePanel<TemplateTile<SelectableBean<AccessCertificationCampaignType>>> { | ||
|
||
@Serial private static final long serialVersionUID = 1L; | ||
|
||
private static final String ID_SELECT_TILE_CHECKBOX = "selectTileCheckbox"; | ||
private static final String ID_STATUS = "status"; | ||
private static final String ID_MENU = "menu"; | ||
private static final String ID_TITLE = "title"; | ||
private static final String ID_DESCRIPTION = "description"; | ||
private static final String ID_PROGRESS_BAR = "progressBar"; | ||
private static final String ID_INFO_PANEL = "infoPanel"; | ||
private static final String ID_BUTTONS_PANEL = "buttonsPanel"; | ||
|
||
public CampaignTilePanel(String id, IModel<TemplateTile<SelectableBean<AccessCertificationCampaignType>>> model) { | ||
super(id, model); | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
initLayout(); | ||
} | ||
|
||
protected void initLayout() { | ||
add(AttributeAppender.append("class", "catalog-tile-panel d-flex flex-column align-items-center bordered p-4")); | ||
|
||
setOutputMarkupId(true); | ||
|
||
CheckBoxPanel selectTileCheckbox = new CheckBoxPanel(ID_SELECT_TILE_CHECKBOX, getSelectedModel()); | ||
selectTileCheckbox.setOutputMarkupId(true); | ||
add(selectTileCheckbox); | ||
|
||
Label status = new Label(ID_STATUS, getStatusModel()); | ||
status.setOutputMarkupId(true); | ||
add(status); | ||
|
||
AjaxButton menu = new AjaxButton(ID_MENU) { | ||
@Serial private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public void onClick(AjaxRequestTarget target) { | ||
// TODO implement | ||
} | ||
}; | ||
menu.setOutputMarkupId(true); | ||
add(menu); | ||
|
||
Label title = new Label(ID_TITLE, getTitleModel()); | ||
title.setOutputMarkupId(true); | ||
add(title); | ||
|
||
Label description = new Label(ID_DESCRIPTION, Model.of(getModelObject().getDescription())); | ||
description.setOutputMarkupId(true); | ||
add(description); | ||
|
||
ProgressBarPanel progressBar = new ProgressBarPanel(ID_PROGRESS_BAR, createProgressBarModel()); | ||
progressBar.setOutputMarkupId(true); | ||
add(progressBar); | ||
|
||
} | ||
|
||
private IModel<Boolean> getSelectedModel() { | ||
return new IModel<>() { | ||
@Serial private static final long serialVersionUID = 1L; | ||
@Override | ||
public Boolean getObject() { | ||
return getModelObject().isSelected(); | ||
} | ||
|
||
@Override | ||
public void setObject(Boolean object) { | ||
getModelObject().setSelected(object); | ||
} | ||
}; | ||
} | ||
private IModel<String> getStatusModel() { | ||
return Model.of(LocalizationUtil.translateEnum(getCampaign().getState())); | ||
} | ||
|
||
private IModel<String> getTitleModel() { | ||
return Model.of(WebComponentUtil.getName(getCampaign())); | ||
} | ||
|
||
private AccessCertificationCampaignType getCampaign() { | ||
return getModelObject().getValue().getValue(); | ||
} | ||
|
||
protected @NotNull IModel<List<ProgressBar>> createProgressBarModel() { | ||
return () -> { | ||
AccessCertificationCampaignType campaign = getCampaign(); | ||
float completed = CertCampaignTypeUtil.getCasesCompletedPercentageAllStagesAllIterations(campaign); | ||
|
||
ProgressBar progressBar = new ProgressBar(completed, ProgressBar.State.INFO); | ||
return Collections.singletonList(progressBar); | ||
}; | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.