Skip to content

Commit

Permalink
Fix 3.6 beta5 (#734)
Browse files Browse the repository at this point in the history
* style

* Delete codeql-analysis.yml

* fix some

* enh: VN

* v3.6.0

---------

Co-authored-by: devezhao <[email protected]>
  • Loading branch information
getrebuild and devezhao authored Mar 18, 2024
1 parent 142c8fc commit fb71f6d
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 109 deletions.
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from c24b2e to b620fe
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>3.6.0-beta4</version>
<version>3.6.0</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<url>https://getrebuild.com/</url>
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.6.0-beta4";
public static final String VER = "3.6.0";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3060004;
public static final int BUILD = 3060005;

static {
// Driver for DB
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/rebuild/core/configuration/ConfigBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.alibaba.fastjson.JSONObject;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.JSONable;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.util.Assert;

import java.io.Serializable;
Expand Down Expand Up @@ -66,11 +67,11 @@ public Boolean getBoolean(String name) {
}

public Integer getInteger(String name) {
return (Integer) data.get(name);
return ObjectUtils.defaultIfNull((Integer) data.get(name), 0);
}

public Long getLong(String name) {
return (Long) data.get(name);
return ObjectUtils.defaultIfNull((Long) data.get(name), 0L);
}

public JSON getJSON(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ protected String wrapAxisValue(Dimension dimension, Object value, boolean useRef

if (useRefLink && axisType == DisplayType.REFERENCE
&& ID.valueOf(value.toString()).getEntityCode() > 100) {
label = String.format("<a href='/app/redirect?id=%s'>%s</a>", value, label);
label = String.format("<a href='/app/redirect?id=%s&type=newtab'>%s</a>", value, label);
}

} else {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/rebuild/core/support/CommonsLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class CommonsLog {

public static final String TYPE_TRIGGER = "TRIGGER";
public static final String TYPE_EXPORT = "EXPORT";
public static final String TYPE_ACCESS = "ACCESS";

/**
* @param type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ private String parseSort(String sort) {
String[] sorts = sort.split("[,;]");
for (String s : sorts) {
String[] split = s.split(":");
if (StringUtils.isBlank(split[0])) return null;

sb.append(split[0]);
if (split.length > 1) sb.append("desc".equalsIgnoreCase(split[1]) ? " desc" : " asc");
sb.append(", ");
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/com/rebuild/core/support/task/TaskExecutors.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public class TaskExecutors extends DistributedJobLock {
MAX_TASKS_NUMBER, MAX_TASKS_NUMBER, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(MAX_TASKS_NUMBER * 6));

private static final Map<String, HeavyTask<?>> TASKS = new ConcurrentHashMap<>();
// 异步任务
private static final Map<String, HeavyTask<?>> ASYNC_TASKS = new ConcurrentHashMap<>();

// 队列执行
private static final ExecutorService SINGLE_QUEUE = new ThreadPoolExecutor(
Expand All @@ -61,7 +62,7 @@ public static String submit(HeavyTask<?> task, ID execUser) {
String taskid = task.getClass().getSimpleName() + "-" + CodecUtils.randomCode(20);
task.setUser(execUser);
EXEC.execute(task);
TASKS.put(taskid, task);
ASYNC_TASKS.put(taskid, task);
return taskid;
}

Expand All @@ -71,7 +72,7 @@ public static String submit(HeavyTask<?> task, ID execUser) {
* @param taskid
*/
public static boolean cancel(String taskid) {
HeavyTask<?> task = TASKS.get(taskid);
HeavyTask<?> task = ASYNC_TASKS.get(taskid);
if (task == null) {
log.warn("No task found : {}", taskid);
return false;
Expand All @@ -98,7 +99,7 @@ public static boolean cancel(String taskid) {
* @return
*/
public static HeavyTask<?> get(String taskid) {
return TASKS.get(taskid);
return ASYNC_TASKS.get(taskid);
}

/**
Expand Down Expand Up @@ -140,22 +141,22 @@ public static void shutdown() {
public void executeJob() {
if (!tryLock()) return;

if (!TASKS.isEmpty()) {
if (!ASYNC_TASKS.isEmpty()) {
int completed = 0;
for (Map.Entry<String, HeavyTask<?>> e : TASKS.entrySet()) {
for (Map.Entry<String, HeavyTask<?>> e : ASYNC_TASKS.entrySet()) {
HeavyTask<?> task = e.getValue();
if (task.getCompletedTime() == null || !task.isCompleted()) {
continue;
}

long leftTime = (System.currentTimeMillis() - task.getCompletedTime().getTime()) / 1000;
if (leftTime > 60 * 120) {
TASKS.remove(e.getKey());
ASYNC_TASKS.remove(e.getKey());
log.info("HeavyTask clean-up : {}", e.getKey());
}
completed++;
}
log.info("{} task(s) in the queue. {} are completed (will clean-up later)", TASKS.size(), completed);
log.info("{} task(s) in the queue. {} are completed (will clean-up later)", ASYNC_TASKS.size(), completed);
}

Queue<Runnable> queue = ((ThreadPoolExecutor) SINGLE_QUEUE).getQueue();
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/rebuild/web/RebuildWebInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.rebuild.core.cache.CommonsCache;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.privileges.bizz.ZeroEntry;
import com.rebuild.core.support.CommonsLog;
import com.rebuild.core.support.ConfigurationItem;
import com.rebuild.core.support.License;
import com.rebuild.core.support.RebuildConfiguration;
Expand Down Expand Up @@ -129,6 +130,8 @@ else if (!(requestUri.contains("/setup/") || requestUri.contains("/commons/theme
// User
request.setAttribute(WebConstants.$USER, Application.getUserStore().getUser(requestUser));

boolean isSecurityEnhanced = RebuildConfiguration.getBool(ConfigurationItem.SecurityEnhanced);

if (isHtmlRequest(requestUri, request)) {
// Last active
Application.getSessionStore().storeLastActive(request);
Expand All @@ -146,10 +149,15 @@ else if (!(requestUri.contains("/setup/") || requestUri.contains("/commons/theme

request.setAttribute(ZeroEntry.AllowCustomNav.name(),
Application.getPrivilegesManager().allow(requestUser, ZeroEntry.AllowCustomNav));

// v3.6-b5
if (isSecurityEnhanced) {
CommonsLog.createLog(CommonsLog.TYPE_ACCESS, requestUser, null, requestUri);
}
}

// 非增强安全超管可访问
if (RebuildConfiguration.getBool(ConfigurationItem.SecurityEnhanced)) skipCheckSafeUse = false;
if (isSecurityEnhanced) skipCheckSafeUse = false;
else skipCheckSafeUse = UserHelper.isSuperAdmin(requestUser);

} else if (!isIgnoreAuth(requestUri)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ public ModelAndView pageSystems() {
// Available langs
mv.getModel().put("availableLangs", JSON.toJSON(Application.getLanguage().availableLocales()));

JSONObject auth = License.queryAuthority();
final JSONObject auth = License.queryAuthority();
mv.getModel().put("LicenseType",
auth.getString("authType") + " (" + auth.getString("authObject") + ")");
mv.getModel().put("Version", Application.VER);
mv.getModel().put("SN", "***" + License.SN().substring(12));
mv.getModel().put("SN", "***" + auth.getString("sn").substring(12));
mv.getModel().put("VN", auth.getString("vn"));

return mv;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/web/admin/system-cfg.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ <h5>[[${bundle.L('其他')}]]</h5>
<div class="card-header card-header-divider">[[${bundle.L('关于')}]] REBUILD</div>
<div class="card-body">
<p class="mb-1">[[${bundle.L('系统版本')}]] <a class="link" target="_blank" th:href="|https://getrebuild.com/download?v=${Version}|">[[${Version}]]</a></p>
<p class="mb-2">[[${bundle.L('授权类型')}]] <a class="link" target="_blank" th:href="|https://getrebuild.com/authority?sn=${SN}|">[[${LicenseType}]]</a></p>
<p class="mb-1">[[${bundle.L('授权类型')}]] <a class="link" target="_blank" th:href="|https://getrebuild.com/authority?sn=${SN}|">[[${LicenseType}]]</a></p>
<p th:if="${VN != null}" class="mb-1">[[${bundle.L('服务支持码')}]] <a>[[${VN}]]</a></p>
<ul style="line-height: 2">
<li><a class="link" target="_blank" th:href="@{/error/server-status}">[[${bundle.L('系统状态')}]]</a></li>
<li><a class="link" target="_blank" href="https://getrebuild.com/docs/">[[${bundle.L('帮助文档')}]]</a></li>
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/web/assets/css/charts.css
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,22 @@ See LICENSE and COMMERCIAL in the project root for license information.
max-width: 400px;
}

.chart-box.DataList .table td.open-newtab {
padding-bottom: 0;
text-align: center;
padding: 8px;
}

.chart-box.DataList .table td.open-newtab .icon {
font-size: 15px;
width: 100%;
color: #404040;
}

.chart-box.DataList .table td.open-newtab a:hover .icon {
color: #4285f4;
}

.DataList-showfields .select2-container--default .select2-selection--single .select2-selection__arrow b::after {
font-family: 'Material Design Icons', serif;
content: '\f0415';
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/web/assets/css/rb-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -5558,3 +5558,7 @@ span.icon-append .icon {
background-color: red;
animation: blink 1s infinite;
}

.dropdown-menu.nott .dropdown-item {
text-transform: none;
}
12 changes: 10 additions & 2 deletions src/main/resources/web/assets/css/view-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ body {
display: none;
}

.view-body.loading .view-header > .header-icon::before {
animation: flash 2s infinite;
@keyframes spinAnimation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.view-body.loading .view-header .zmdi-refresh {
animation: spinAnimation 1s infinite linear;
}

.tab-container {
Expand Down
28 changes: 14 additions & 14 deletions src/main/resources/web/assets/js/charts/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1272,24 +1272,25 @@ class DataList extends BaseChart {
</th>
)
})}
<th width="40" />
</tr>
</thead>
<tbody>
{listData.map((row) => {
const lastCell = row[lastIndex]
const rkey = `tr-${lastCell.id}`
return (
<tr
key={rkey}
data-id={lastCell.id}
onDoubleClick={(e) => {
$stopEvent(e, true)
window.open(`${rb.baseUrl}/app/redirect?id=${lastCell.id}&type=newtab`)
}}>
<tr key={rkey} data-id={lastCell.id}>
{row.map((c, idx) => {
if (idx === lastIndex) return null // Last is ID
return this.renderCell(c, listFields[idx])
})}

<td className="open-newtab">
<a href={`${rb.baseUrl}/app/redirect?id=${lastCell.id}&type=newtab`} target="_blank" title={$L('打开')}>
<i className="zmdi zmdi-open-in-new icon" />
</a>
</td>
</tr>
)
})}
Expand All @@ -1307,21 +1308,20 @@ class DataList extends BaseChart {
.perfectScrollbar()

let trActive
const $els = this._$tb.find('tbody tr').on('mousedown', function () {
const $trs = this._$tb.find('tbody tr').on('mousedown', function () {
if (trActive === this) {
$(this).toggleClass('highlight')
return
} else {
trActive = this
$trs.removeClass('highlight')
$(this).addClass('highlight')
}
trActive = this
$els.removeClass('highlight')
$(this).addClass('highlight')
})
})
}

renderCell(cellVal, field) {
const c = CellRenders.render(cellVal, field.type, 'auto', `cell-${field.field}`)
return c
return CellRenders.render(cellVal, field.type, 'auto', `cell-${field.field}`)
}

resize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const AdvFilters = {
const $menu = $('.adv-search .dropdown-menu')
$(res.data).each(function () {
const item = this
const $item = $(`<div class="dropdown-item J_custom" data-id="${item.id}"><a class="text-truncate">${item.name}</a></div>`).appendTo($menu)
$item.on('click', () => that._effectFilter($item, 'aside'))
const $item = $(`<div class="dropdown-item J_custom" data-id="${item.id}"><a class="text-truncate"></a></div>`).appendTo($menu)
$item.text(item.name).on('click', () => that._effectFilter($item, 'aside'))

if (lastFilter === item.id) $defaultFilter = $item

Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/web/assets/js/rb-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ var _showNotification = function (state) {
if (_Notification) {
if (_Notification.permission === 'granted') {
var n = new _Notification($L('你有 %d 条未读消息', state), {
icon: rb.baseUrl + '/assets/img/favicon.png',
body: window.rb.appName,
icon: rb.baseUrl + '/assets/img/icon-192x192.png',
tag: 'rbNotification',
renotify: true,
silent: false,
Expand Down
Loading

0 comments on commit fb71f6d

Please sign in to comment.