提交 1da75044 编写于 作者: S serge-rider

#4209 Dashboard render fix. Config dialog

上级 04506b17
......@@ -26,7 +26,7 @@ public class DashboardConstants {
public static final String RS_COL_TIMESTAMP = "STAT_TIMESTAMP";
public static final int DEF_DASHBOARD_MAXIMUM_ITEM_COUNT = 300;
public static final long DEF_DASHBOARD_MAXIMUM_AGE = 24 * 60 * 60 * 1000;
public static final long DEF_DASHBOARD_MAXIMUM_AGE = 30 * 60 * 1000; // Half of hour
public static final int DEF_DASHBOARD_UPDATE_PERIOD = 5000;
public static final double DEF_DASHBOARD_WIDTH_RATIO = 1.5;
......
......@@ -17,28 +17,24 @@
package org.jkiss.dbeaver.ui.dashboard.model;
import org.jkiss.dbeaver.ui.dashboard.registry.DashboardDescriptor;
import org.jkiss.utils.CommonUtils;
import org.jkiss.utils.xml.XMLBuilder;
import java.io.IOException;
public class DashboardItemViewConfiguration {
private DashboardDescriptor dashboardDescriptor;
private String description;
private float widthRatio;
private long updatePeriod;
private int maxItems;
private long maxAge;
private String description;
public DashboardDescriptor getDashboardDescriptor() {
return dashboardDescriptor;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public float getWidthRatio() {
return widthRatio;
}
......@@ -71,26 +67,44 @@ public class DashboardItemViewConfiguration {
this.maxAge = maxAge;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
DashboardItemViewConfiguration(DashboardDescriptor dashboardDescriptor) {
this.dashboardDescriptor = dashboardDescriptor;
this.description = dashboardDescriptor.getDescription();
this.widthRatio = dashboardDescriptor.getWidthRatio();
this.updatePeriod = dashboardDescriptor.getUpdatePeriod();
this.maxItems = dashboardDescriptor.getMaxItems();
this.maxAge = dashboardDescriptor.getMaxAge();
this.description = dashboardDescriptor.getDescription();
}
public DashboardItemViewConfiguration(DashboardItemViewConfiguration source) {
copyFrom(source);
}
public void copyFrom(DashboardItemViewConfiguration source) {
void copyFrom(DashboardItemViewConfiguration source) {
this.dashboardDescriptor = source.dashboardDescriptor;
this.description = source.description;
this.widthRatio = source.widthRatio;
this.updatePeriod = source.updatePeriod;
this.maxItems = source.maxItems;
this.maxAge = source.maxAge;
this.description = source.description;
}
void serialize(XMLBuilder xml) throws IOException {
xml.addAttribute("dashboard", dashboardDescriptor.getId());
xml.addAttribute("widthRatio", widthRatio);
xml.addAttribute("updatePeriod", updatePeriod);
xml.addAttribute("maxItems", maxItems);
xml.addAttribute("maxAge", maxAge);
if (!CommonUtils.isEmpty(description)) {
xml.addAttribute("description", description);
}
}
}
......@@ -65,14 +65,15 @@ public class DashboardViewConfiguration {
try (OutputStream out = new FileOutputStream(configFile)){
XMLBuilder xml = new XMLBuilder(out, GeneralUtils.UTF8_ENCODING);
xml.setButify(true);
xml.startElement("dashboards");
for (DashboardItemViewConfiguration itemConfig : items) {
xml.startElement("dashboard");
//itemConfig.serialize(xml);
itemConfig.serialize(xml);
xml.endElement();
}
xml.endElement();
out.flush();
xml.flush();
} catch (Exception e) {
log.error("Error saving dashboard view configuration", e);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册