Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View bin data 105 #687

Merged
merged 12 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,7 @@ module.exports = {
$escapeHtml: true,
$isLight: true,
RbGritter: true,
$formattedCode: true,
CodeViewport: true,
},
}
2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from b7e5e1 to cb938a
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.17</version>
<version>2.7.18</version>
<relativePath/>
</parent>
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>3.5.0-beta3</version>
<version>3.6.0-dev</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<!-- UNCOMMENT USE TOMCAT -->
Expand Down Expand Up @@ -335,7 +335,7 @@
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.4.3</version>
<version>4.4.6</version>
</dependency>
<dependency>
<groupId>com.qiniu</groupId>
Expand Down Expand Up @@ -497,6 +497,11 @@
<artifactId>mammoth</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.getui.push</groupId>
<artifactId>restful-sdk</artifactId>
<version>1.0.0.15</version>
</dependency>

<!-- fix: CVEs -->
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rebuild/core/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
/**
* Rebuild Version
*/
public static final String VER = "3.5.0-beta3";
public static final String VER = "3.6.0-dev";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3050003;
public static final int BUILD = 3060000;

static {
// Driver for DB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import cn.devezhao.persist4j.engine.ID;
import com.rebuild.core.privileges.UserService;
import com.rebuild.core.support.i18n.Language;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
Expand Down Expand Up @@ -57,4 +58,17 @@ public Message(ID fromUser, ID toUser, String message, int type, ID relatedRecor
this.type = type;
this.relatedRecord = relatedRecord;
}

/**
* 获取通知标题
* @return
*/
public String getTitle4Type() {
if (this.type == TYPE_ASSIGN) return Language.L("记录分配通知");
else if (this.type == TYPE_SAHRE) return Language.L("记录共享通知");
else if (this.type == TYPE_APPROVAL) return Language.L("记录审核通知");
else if (this.type == TYPE_FEEDS) return Language.L("动态通知");
else if (this.type == TYPE_PROJECT) return Language.L("项目任务通知");
else return Language.L("新通知");
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/rebuild/utils/MarkdownUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static String render(String md, boolean targetBlank) {
* @param md
* @return
*/
public static String cleanMd(String md) {
public static String cleanMarks(String md) {
String html = render(md);
return Jsoup.parse(html).body().text();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
package com.rebuild.web.admin.audit;

import cn.devezhao.persist4j.engine.ID;
import com.rebuild.api.RespBody;
import com.rebuild.core.Application;
import com.rebuild.core.service.general.recyclebin.RecycleRestore;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.IdParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
Expand All @@ -27,7 +30,7 @@
* @since 2019-08-20
*/
@Slf4j
@Controller
@RestController
@RequestMapping("/admin/audit/")
public class RecycleBinController extends BaseController {

Expand All @@ -37,7 +40,7 @@ public ModelAndView page() {
}

@RequestMapping("recycle-bin/restore")
public void dataList(HttpServletRequest request, HttpServletResponse response) {
public RespBody dataList(HttpServletRequest request) {
boolean cascade = getBoolParameter(request, "cascade");
String ids = getParameterNotNull(request, "ids");

Expand All @@ -60,9 +63,14 @@ public void dataList(HttpServletRequest request, HttpServletResponse response) {
}

if (lastError != null && restored == 0) {
writeFailure(response, lastError);
} else {
writeSuccess(response, JSONUtils.toJSONObject("restored", restored));
return RespBody.error(lastError);
}
return RespBody.ok(JSONUtils.toJSONObject("restored", restored));
}

@GetMapping("recycle-bin/details")
public RespBody details(@IdParam ID id) {
Object[] o = Application.getQueryFactory().uniqueNoFilter(id, "recordContent");
return RespBody.ok(o[0]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.metadata.easymeta.EasyField;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.support.i18n.I18nUtils;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.EntityController;
import com.rebuild.web.IdParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

/**
* @author devezhao
Expand All @@ -39,42 +44,70 @@ public ModelAndView page() {
return createModelAndView("/admin/audit/revision-history");
}

@RequestMapping("revision-history/details")
@GetMapping("revision-history/details")
public JSON details(@IdParam ID revisionId) {
Object[] rev = Application.createQueryNoFilter(
"select revisionContent,belongEntity from RevisionHistory where revisionId = ?")
.setParameter(1, revisionId)
.unique();
JSONArray contents = JSON.parseArray((String) rev[0]);

// 补充字段名称
JSONArray contents = JSON.parseArray((String) rev[0]);
if (MetadataHelper.containsEntity((String) rev[1])) {
Entity entity = MetadataHelper.getEntity((String) rev[1]);
paddingFieldsName(contents, MetadataHelper.getEntity((String) rev[1]));
}

for (Iterator<Object> iter = contents.iterator(); iter.hasNext(); ) {
JSONObject item = (JSONObject) iter.next();
String fieldName = item.getString("field");
return contents;
}

if (entity.containsField(fieldName)) {
EasyField easyField = EasyMetaFactory.valueOf(entity.getField(fieldName));
// 排除不可查询字段
if (!easyField.isQueryable()) {
iter.remove();
continue;
}
@GetMapping("revision-history/details-list")
public JSON detailsList(@IdParam ID revisionId) {
Object[] o = Application.getQueryFactory().uniqueNoFilter(revisionId, "recordId,belongEntity");
if (o == null) return JSONUtils.EMPTY_ARRAY;

fieldName = easyField.getLabel();
Object[][] array = Application.createQueryNoFilter(
"select revisionContent,revisionType,revisionOn,revisionBy.fullName from RevisionHistory where recordId = ? order by autoId desc")
.setParameter(1, o[0])
.array();

List<Object> list = new ArrayList<>();
if (MetadataHelper.containsEntity((String) o[1])) {
Entity entity = MetadataHelper.getEntity((String) o[1]);

for (Object[] item : array) {
JSONArray contents = JSON.parseArray((String) item[0]);
paddingFieldsName(contents, entity);

item[0] = contents;
item[2] = I18nUtils.formatDate((Date) item[2]);
list.add(item);
}
}
return (JSON) JSON.toJSON(list);
}

// 补充字段名称
private void paddingFieldsName(JSONArray contents, Entity entity) {
for (Iterator<Object> iter = contents.iterator(); iter.hasNext(); ) {
JSONObject item = (JSONObject) iter.next();
String fieldName = item.getString("field");

if (entity.containsField(fieldName)) {
EasyField easyField = EasyMetaFactory.valueOf(entity.getField(fieldName));
// 排除不可查询字段
if (!easyField.isQueryable()) {
iter.remove();
continue;
}

fieldName = easyField.getLabel();
} else {
if ("SHARETO".equalsIgnoreCase(fieldName)) {
fieldName = Language.L("共享用户");
} else {
if ("SHARETO".equalsIgnoreCase(fieldName)) {
fieldName = Language.L("共享用户");
} else {
fieldName = "[" + fieldName.toUpperCase() + "]";
}
fieldName = "[" + fieldName.toUpperCase() + "]";
}
item.put("field", fieldName);
}
item.put("field", fieldName);
}

return contents;
}
}
14 changes: 7 additions & 7 deletions src/main/resources/web/_include/forms.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script th:src="@{/assets/js/rb-forms.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-forms.append.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-forms.protable.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-approval.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-advfilter.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-assignshare.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-forms.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-forms.append.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-forms.protable.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-approval.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-advfilter.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-assignshare.js}" type="text/babel"></script>
<!--
<link rel="stylesheet" type="text/css" th:href="@{/assets/css/customized.css}" />
<script th:src="@{/assets/js/customized-forms.js}" type="text/babel"></script>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/web/admin/audit/login-logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
</div>
</div>
<th:block th:replace="~{/_include/footer}" />
<script th:src="@{/assets/js/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/admin/login-logs.js}" type="text/babel"></script>
</body>
</html>
8 changes: 6 additions & 2 deletions src/main/resources/web/admin/audit/recycle-bin.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
</div>
<div class="col-12 col-md-6">
<div class="dataTables_oper">
<button class="btn btn-space btn-secondary J_details" type="button"><i class="icon mdi mdi-text-box-search-outline"></i> [[${bundle.L('详情')}]]</button>
<button class="btn btn-space btn-outline btn-danger J_restore" type="button"><i class="icon zmdi zmdi-time-restore"></i> [[${bundle.L('恢复')}]]</button>
</div>
</div>
Expand All @@ -48,8 +49,11 @@
</div>
</div>
<th:block th:replace="~{/_include/footer}" />
<script th:src="@{/assets/js/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/admin/recycle-bin.js}" type="text/babel"></script>
<script th:src="@{/assets/lib/prettier/standalone.js}"></script>
<script th:src="@{/assets/lib/prettier/parser-babel.js}"></script>
<script th:src="@{/assets/lib/clipboard.min.js}"></script>
</body>
</html>
21 changes: 19 additions & 2 deletions src/main/resources/web/admin/audit/revision-history.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@
overflow: hidden;
text-overflow: ellipsis;
}
.table tr.group > td {
padding: 0;
}
.table tr.group > td > h5 {
padding: 8px 10px;
margin: 0;
background-color: #dee2e6;
border-radius: 0;
}
.table tr.group > td > h5,
.table tr.group > td > h5 * {
color: #444;
font-weight: normal;
}
.table.group > thead > tr > th {
border-bottom-width: 0;
}
</style>
</head>
<body>
Expand Down Expand Up @@ -59,8 +76,8 @@
</div>
</div>
<th:block th:replace="~{/_include/footer}" />
<script th:src="@{/assets/js/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.common.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/admin/revision-history.js}" type="text/babel"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/main/resources/web/admin/bizuser/dept-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}
</script>
<th:block th:replace="~{/_include/forms}" />
<script th:src="@{/assets/js/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/aside-tree.js}" type="text/babel"></script>
<script th:src="@{/assets/js/bizuser/dept-tree.js}" type="text/babel"></script>
<script type="text/babel">
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/admin/bizuser/dept-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h3 class="title">[[${bundle.L('部门详情')}]]</h3>
}
</script>
<th:block th:replace="~{/_include/forms}" />
<script th:src="@{/assets/js/rb-view.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-view.js}" type="text/babel"></script>
<script th:src="@{/assets/js/bizuser/dept-view.js}" type="text/babel"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/main/resources/web/admin/bizuser/role-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h3 class="title">[[${bundle.L('角色详情')}]]</h3>
}
</script>
<th:block th:replace="~{/_include/forms}" />
<script th:src="@{/assets/js/rb-view.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-view.js}" type="text/babel"></script>
<script th:src="@{/assets/js/bizuser/role-view.js}" type="text/babel"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/main/resources/web/admin/bizuser/team-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
}
</script>
<th:block th:replace="~{/_include/forms}" />
<script th:src="@{/assets/js/rb-datalist.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-datalist.js}" type="text/babel"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion src/main/resources/web/admin/bizuser/team-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ <h3 class="title">[[${bundle.L('团队详情')}]]</h3>
}
</script>
<th:block th:replace="~{/_include/forms}" />
<script th:src="@{/assets/js/rb-view.js}" type="text/babel"></script>
<script th:src="@{/assets/js/general/rb-view.js}" type="text/babel"></script>
<script th:src="@{/assets/js/bizuser/team-view.js}" type="text/babel"></script>
</body>
</html>
Loading
Loading