Skip to content

Commit

Permalink
adding admin dashboard page
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Jan 16, 2019
1 parent f7f7428 commit eb1ae64
Show file tree
Hide file tree
Showing 17 changed files with 3,165 additions and 2,474 deletions.
Expand Up @@ -23,6 +23,8 @@ public class GuiStyleConstants {

public static final String CLASS_BOX = "box";
public static final String CLASS_BOX_DEFAULT = "box-default";

public static final String CLASS_DASHBOARD_ICON = "fa fa-dashboard";

public static final String CLASS_OBJECT_USER_ICON = "fa fa-user";
public static final String CLASS_OBJECT_USER_ICON_COLORED = CLASS_OBJECT_USER_ICON + " object-user-color";
Expand Down
4,592 changes: 2,319 additions & 2,273 deletions gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/page/PageBase.java

Large diffs are not rendered by default.

@@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2010-2017 Evolveum
~ Copyright (c) 2010-2019 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
@@ -0,0 +1,80 @@
/**
* Copyright (c) 2010-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.web.component.box;

import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.component.IRequestablePage;

import com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

/**
* @author katkav
* @author semancik
* @author skublik
*/
public class BasicInfoBoxPanel extends InfoBoxPanel{
private static final long serialVersionUID = 1L;

private static final String ID_PROGRESS = "progress";
private static final String ID_PROGRESS_BAR = "progressBar";
private static final String ID_DESCRIPTION = "description";

public BasicInfoBoxPanel(String id, IModel<InfoBoxType> model) {
super(id, model);
}

public BasicInfoBoxPanel(String id, IModel<InfoBoxType> model, Class<? extends IRequestablePage> linkPage) {
super(id, model, linkPage);
}

@Override
protected void customInitLayout(WebMarkupContainer parentInfoBox, IModel<InfoBoxType> model,
Class<? extends IRequestablePage> linkPage) {
WebMarkupContainer progress = new WebMarkupContainer(ID_PROGRESS);
parentInfoBox.add(progress);
progress.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return model.getObject().getProgress() != null;
}
});
ProgressbarPanel progressBar = new ProgressbarPanel(ID_PROGRESS_BAR, new PropertyModel<>(model, InfoBoxType.PROGRESS));
progress.add(progressBar);

Label description = new Label(ID_DESCRIPTION, new PropertyModel<String>(model, InfoBoxType.DESCRIPTION));
parentInfoBox.add(description);

if (linkPage != null) {
add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target) {
setResponsePage(linkPage);
}
});
}
}

}
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2016 Evolveum
* Copyright (c) 2010-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,46 +16,43 @@
package com.evolveum.midpoint.web.component.box;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.component.IRequestablePage;

import com.evolveum.midpoint.gui.api.component.progressbar.ProgressbarPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

/**
* @author katkav
* @author semancik
*/
public class InfoBoxPanel extends Panel{
public abstract class InfoBoxPanel extends Panel{
private static final long serialVersionUID = 1L;

private static final String ID_INFO_BOX = "infoBox";
private static final String ID_INFO_BOX_ICON = "infoBoxIcon";
private static final String ID_IMAGE_ID = "imageId";
private static final String ID_MESSAGE = "message";
private static final String ID_NUMBER = "number";
private static final String ID_PROGRESS = "progress";
private static final String ID_PROGRESS_BAR = "progressBar";
private static final String ID_DESCRIPTION = "description";

private Class<? extends IRequestablePage> linkPage;

public InfoBoxPanel(String id, IModel<InfoBoxType> model) {
super(id, model);

add(AttributeModifier.append("class", "dashboard-info-box"));

initLayout(model, null);
this(id, model, null);
}

public InfoBoxPanel(String id, IModel<InfoBoxType> model, Class<? extends IRequestablePage> linkPage) {
super(id, model);
add(AttributeModifier.append("class", "dashboard-info-box"));
initLayout(model, linkPage);
this.linkPage = linkPage;
}

@Override
protected void onInitialize() {
super.onInitialize();
initLayout((IModel<InfoBoxType>)getDefaultModel(), linkPage);

}

private void initLayout(final IModel<InfoBoxType> model, final Class<? extends IRequestablePage> linkPage) {
Expand All @@ -78,34 +75,10 @@ private void initLayout(final IModel<InfoBoxType> model, final Class<? extends I

Label number = new Label(ID_NUMBER, new PropertyModel<String>(model, InfoBoxType.NUMBER));
infoBox.add(number);

WebMarkupContainer progress = new WebMarkupContainer(ID_PROGRESS);
infoBox.add(progress);
progress.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return model.getObject().getProgress() != null;
}
});
ProgressbarPanel progressBar = new ProgressbarPanel(ID_PROGRESS_BAR, new PropertyModel<>(model, InfoBoxType.PROGRESS));
progress.add(progressBar);

Label description = new Label(ID_DESCRIPTION, new PropertyModel<String>(model, InfoBoxType.DESCRIPTION));
infoBox.add(description);

if (linkPage != null) {
add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target) {
setResponsePage(linkPage);
}
});
}

customInitLayout(infoBox, model, linkPage);
}

protected abstract void customInitLayout(WebMarkupContainer parentInfoBox, final IModel<InfoBoxType> model, final Class<? extends IRequestablePage> linkPage);

}
@@ -0,0 +1,36 @@
<!--
~ Copyright (c) 2010-2019 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="col-lg-3 col-xs-6">
<div class="small-box" wicket:id="infoBox">
<div class="inner">
<h3 wicket:id="number"/>
<p wicket:id="message"/>
</div>
<div class="icon" wicket:id="infoBoxIcon">
<i wicket:id="imageId"></i>
</div>
<div class="small-box-footer" wicket:id="moreInfoBox">
<div wicket:id="moreInfoBoxLabel"/>
<i class="fa fa-arrow-circle-right" wicket:id="moreInfoBoxIcon"/>
</div>
</div>
</div>
</wicket:panel>
</html>
@@ -0,0 +1,97 @@
/**
* Copyright (c) 2010-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.web.component.box;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.component.IRequestablePage;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

/**
* @author skublik
*/
public class SmallInfoBoxPanel extends InfoBoxPanel{
private static final long serialVersionUID = 1L;

private static final String ID_MORE_INFO_BOX = "moreInfoBox";
private static final String ID_MORE_INFO_BOX_ICON = "moreInfoBoxIcon";
private static final String ID_MORE_INFO_BOX_LABEL = "moreInfoBoxLabel";

private PageBase pageBase;

public SmallInfoBoxPanel(String id, IModel<InfoBoxType> model, PageBase pageBase) {
super(id, model);
this.pageBase = pageBase;
}

public SmallInfoBoxPanel(String id, IModel<InfoBoxType> model, Class<? extends IRequestablePage> linkPage, PageBase pageBase) {
super(id, model, linkPage);
this.pageBase = pageBase;
}

protected void setParametersBeforeClickOnMoreInfo() {

}

@Override
protected void customInitLayout(WebMarkupContainer parentInfoBox, IModel<InfoBoxType> model,
Class<? extends IRequestablePage> linkPage) {

WebMarkupContainer moreInfoBox = new WebMarkupContainer(ID_MORE_INFO_BOX);
parentInfoBox.add(moreInfoBox);
WebMarkupContainer moreInfoBoxIcon = new WebMarkupContainer(ID_MORE_INFO_BOX_ICON);
moreInfoBox.add(moreInfoBoxIcon);
Label moreInfoBoxLabel = new Label(ID_MORE_INFO_BOX_LABEL, this.pageBase.createStringResource("PageDashboard.infobox.moreInfo"));
moreInfoBox.add(moreInfoBoxLabel);

if (linkPage != null) {
moreInfoBox.add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target) {
setParametersBeforeClickOnMoreInfo();
setResponsePage(linkPage);
}
});
moreInfoBox.add(AttributeModifier.append("class", "cursor-pointer"));
} else {
setInvisible(moreInfoBoxIcon);
setInvisible(moreInfoBoxLabel);
moreInfoBox.add(AttributeModifier.append("style", "height: 26px;"));
}
}

private void setInvisible(Component component) {
component.add(new VisibleEnableBehaviour(){
private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return false;
}
});
}
}

0 comments on commit eb1ae64

Please sign in to comment.