This is an automated email from the ASF dual-hosted git repository.
zhaoqingran pushed a commit to branch script
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/script by this push:
new 65ec2191f refactor: adjust table column widths and plugin form layout
for better UI consistency
65ec2191f is described below
commit 65ec2191f138140903416313b662450fa515e1a7
Author: Logic <[email protected]>
AuthorDate: Tue Sep 3 22:32:21 2024 +0800
refactor: adjust table column widths and plugin form layout for better UI
consistency
Adjust the table column widths in the alert setting component to ensure a
more balanced and
consistent UI layout. Update the plugin component form to reallocate space
for form labels
and controls, providing a more harmonious and user-friendly appearance.
Additionally, modify
the PluginParam entity in the manager module to use @Lob annotation for
paramValue field,
optimizing database performance for handling larger text data. Update
relevant i18n files
to include the new "alert.setting.id" translation for improved
internationalization support.
---
.../apache/hertzbeat/manager/pojo/dto/PluginParam.java | 4 ++--
.../manager/service/impl/PluginServiceImpl.java | 3 ++-
.../alert/alert-setting/alert-setting.component.html | 16 ++++++++++------
.../src/app/routes/setting/plugins/plugin.component.html | 4 ++--
web-app/src/assets/i18n/en-US.json | 1 +
web-app/src/assets/i18n/zh-CN.json | 1 +
web-app/src/assets/i18n/zh-TW.json | 1 +
7 files changed, 19 insertions(+), 11 deletions(-)
diff --git
a/manager/src/main/java/org/apache/hertzbeat/manager/pojo/dto/PluginParam.java
b/manager/src/main/java/org/apache/hertzbeat/manager/pojo/dto/PluginParam.java
index b92948f2b..2c64f98dd 100644
---
a/manager/src/main/java/org/apache/hertzbeat/manager/pojo/dto/PluginParam.java
+++
b/manager/src/main/java/org/apache/hertzbeat/manager/pojo/dto/PluginParam.java
@@ -27,6 +27,7 @@ import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
+import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.Min;
@@ -81,8 +82,7 @@ public class PluginParam {
* Param Value
*/
@Schema(title = "parameter values", example = "8080", accessMode =
READ_WRITE)
- @Size(max = 8126)
- @Column(length = 8126)
+ @Lob
private String paramValue;
/**
diff --git
a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/PluginServiceImpl.java
b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/PluginServiceImpl.java
index 0399eaed5..65b37a82f 100644
---
a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/PluginServiceImpl.java
+++
b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/PluginServiceImpl.java
@@ -58,6 +58,7 @@ import
org.apache.hertzbeat.common.entity.manager.PluginMetadata;
import org.apache.hertzbeat.common.entity.plugin.PluginConfig;
import org.apache.hertzbeat.common.entity.plugin.PluginContext;
import org.apache.hertzbeat.common.support.exception.CommonException;
+import org.apache.hertzbeat.common.util.SnowFlakeIdGenerator;
import org.apache.hertzbeat.manager.dao.PluginItemDao;
import org.apache.hertzbeat.manager.dao.PluginMetadataDao;
import org.apache.hertzbeat.manager.dao.PluginParamDao;
@@ -283,7 +284,7 @@ public class PluginServiceImpl implements PluginService {
if (fileName == null) {
throw new CommonException("Failed to upload plugin");
}
- fileName = UUID.randomUUID().toString().replace("-", "") + "_" +
fileName;
+ fileName = SnowFlakeIdGenerator.generateId() + "_" + fileName;
File destFile = new File(extLibDir, fileName);
FileUtils.createParentDirectories(destFile);
pluginUpload.getJarFile().transferTo(destFile);
diff --git
a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html
b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html
index a4cde2a22..495311dfb 100644
--- a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html
+++ b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html
@@ -90,19 +90,23 @@
<thead>
<tr>
<th nzAlign="center" nzLeft nzWidth="3%" [(nzChecked)]="checkedAll"
(nzCheckedChange)="onAllChecked($event)"></th>
- <th nzAlign="center" nzWidth="16%">{{ 'alert.setting.target' | i18n
}}</th>
- <th nzAlign="center" nzWidth="14%">{{ 'alert.setting.expr' | i18n }}</th>
- <th nzAlign="center" nzWidth="8%">{{ 'alert.priority' | i18n }}</th>
- <th nzAlign="center" nzWidth="8%">{{ 'alert.setting.times' | i18n }}</th>
+ <th nzAlign="center" nzWidth="6%">{{ 'alert.setting.id' | i18n }}</th>
+ <th nzAlign="center" nzWidth="15%">{{ 'alert.setting.target' | i18n
}}</th>
+ <th nzAlign="center" nzWidth="13%">{{ 'alert.setting.expr' | i18n }}</th>
+ <th nzAlign="center" nzWidth="7%">{{ 'alert.priority' | i18n }}</th>
+ <th nzAlign="center" nzWidth="7%">{{ 'alert.setting.times' | i18n }}</th>
<th nzAlign="center" nzWidth="20%">{{ 'alert.setting.template' | i18n
}}</th>
- <th nzAlign="center" nzWidth="8%">{{ 'alert.setting.default' | i18n
}}</th>
- <th nzAlign="center" nzWidth="8%">{{ 'alert.setting.enable' | i18n
}}</th>
+ <th nzAlign="center" nzWidth="7%">{{ 'alert.setting.default' | i18n
}}</th>
+ <th nzAlign="center" nzWidth="7%">{{ 'alert.setting.enable' | i18n
}}</th>
<th nzAlign="center" nzWidth="15%">{{ 'common.edit' | i18n }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of fixedTable.data">
<td nzAlign="center" nzLeft [nzChecked]="checkedDefineIds.has(data.id)"
(nzCheckedChange)="onItemChecked(data.id, $event)"></td>
+ <td nzAlign="center">
+ <span>{{ data.id }}</span>
+ </td>
<td nzAlign="center">
<span *ngIf="data.field">
{{ 'monitor.app.' + data.app | i18n }} / {{ 'monitor.app.' +
data.app + '.metrics.' + data.metric | i18nElse : data.metric }} /
diff --git a/web-app/src/app/routes/setting/plugins/plugin.component.html
b/web-app/src/app/routes/setting/plugins/plugin.component.html
index 9508f35e1..0a8d3238d 100644
--- a/web-app/src/app/routes/setting/plugins/plugin.component.html
+++ b/web-app/src/app/routes/setting/plugins/plugin.component.html
@@ -181,8 +181,8 @@
<form nz-form #form="ngForm">
<ng-container *ngFor="let paramDefine of paramDefines; let i = index">
<nz-form-item>
- <nz-form-label nzSpan="7" [nzRequired]="paramDefine.required"
[nzFor]="paramDefine.field">{{ paramDefine.name }}</nz-form-label>
- <nz-form-control nzSpan="8" [nzErrorTip]="'validation.required' |
i18n">
+ <nz-form-label nzSpan="5" [nzRequired]="paramDefine.required"
[nzFor]="paramDefine.field">{{ paramDefine.name }}</nz-form-label>
+ <nz-form-control nzSpan="24" [nzErrorTip]="'validation.required' |
i18n">
<app-form-field [item]="paramDefine" [name]="paramDefine.field"
[(ngModel)]="params[paramDefine.field].paramValue" />
</nz-form-control>
</nz-form-item>
diff --git a/web-app/src/assets/i18n/en-US.json
b/web-app/src/assets/i18n/en-US.json
index f7fc8ae19..99d3b579d 100644
--- a/web-app/src/assets/i18n/en-US.json
+++ b/web-app/src/assets/i18n/en-US.json
@@ -165,6 +165,7 @@
"alert.setting.delete": "Delete Threshold Rule",
"alert.setting.export": "Export Rule",
"alert.setting.import": "Import Rule",
+ "alert.setting.id": "Rule ID",
"alert.setting.target": "Metric Target",
"alert.setting.target.place-holder": "Please search or select metrics
target",
"alert.setting.expr": "Threshold Trigger Expr",
diff --git a/web-app/src/assets/i18n/zh-CN.json
b/web-app/src/assets/i18n/zh-CN.json
index 45e7174ab..70cd20d44 100644
--- a/web-app/src/assets/i18n/zh-CN.json
+++ b/web-app/src/assets/i18n/zh-CN.json
@@ -151,6 +151,7 @@
"alert.setting.delete": "删除阈值规则",
"alert.setting.export": "导出规则",
"alert.setting.import": "导入规则",
+ "alert.setting.id": "阈值规则ID",
"alert.setting.target": "指标对象",
"alert.setting.target.place-holder": "请搜索或选择指标对象",
"alert.setting.expr": "阈值触发表达式",
diff --git a/web-app/src/assets/i18n/zh-TW.json
b/web-app/src/assets/i18n/zh-TW.json
index f52a0a9d3..393742901 100644
--- a/web-app/src/assets/i18n/zh-TW.json
+++ b/web-app/src/assets/i18n/zh-TW.json
@@ -164,6 +164,7 @@
"alert.setting.delete": "刪除阈值規則",
"alert.setting.export": "導出規則",
"alert.setting.import": "導入規則",
+ "alert.setting.id": "阈值規則ID",
"alert.setting.target": "指標對象",
"alert.setting.target.place-holder": "請搜索或選擇指標對象",
"alert.setting.expr": "阈值觸發表達式",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]