This commit is contained in:
bwcx_jzy 2024-01-10 12:04:37 +08:00
parent 1af396d5a8
commit 42a121dbdb
No known key found for this signature in database
GPG Key ID: 5E48E9372088B9E5
5 changed files with 43 additions and 59 deletions

View File

@ -7,6 +7,8 @@
### 🐞 解决BUG、优化功能
1. 【server】优化 系统Git拉取代码时强制云端最新代码覆盖本地代码
2. 【server】修复 升级页面更新日志样式错乱
3. 【server】修复 切换账户后用户信息未自动刷新
------
@ -23,6 +25,7 @@
3. 【server】修复 部分 icon 未更新、部分弹窗列表数据不能正常显示
4. 【server】修复 docker-compose 容器状态无非正确显示
5. 【agent】修复 低版本项目数据未存储节点ID
6. 【server】优化 项目操作鉴权(需要服务端缓存中有对应的数据)
------

View File

@ -279,20 +279,22 @@ public class UserBindWorkspaceService extends BaseDbService<UserBindWorkspaceMod
return UserBindWorkspaceModel.PermissionResult.builder().state(UserBindWorkspaceModel.PermissionResultEnum.SUCCESS).build();
}
// 拼接限制规则
String ruleStr = allowExecuteListRule.stream().map(jsonObject -> {
JSONArray week = jsonObject.getJSONArray("week");
String weekStr = week.stream()
.map(o -> Convert.toInt(o, 0))
.map(weekInt -> {
DayOfWeek dayOfWeek = DayOfWeek.of(weekInt);
return Week.of(dayOfWeek);
})
.map(week1 -> week1.toChinese(StrUtil.EMPTY))
.collect(Collectors.joining(StrUtil.COMMA));
String startTime = jsonObject.getString("startTime");
String endTime = jsonObject.getString("endTime");
return StrUtil.format("周{} 的 {} 至 {}", weekStr, startTime, endTime);
}).collect(Collectors.joining(StrUtil.SPACE));
String ruleStr = allowExecuteListRule.stream()
.map(jsonObject -> {
JSONArray week = jsonObject.getJSONArray("week");
String weekStr = week.stream()
.map(o -> Convert.toInt(o, 0))
.map(weekInt -> {
DayOfWeek dayOfWeek = DayOfWeek.of(weekInt);
return Week.of(dayOfWeek);
})
.map(week1 -> week1.toChinese(StrUtil.EMPTY))
.collect(Collectors.joining(StrUtil.COMMA));
String startTime = jsonObject.getString("startTime");
String endTime = jsonObject.getString("endTime");
return StrUtil.format("周{} 的 {} 至 {}", weekStr, startTime, endTime);
})
.collect(Collectors.joining(StrUtil.SPACE));
return UserBindWorkspaceModel.PermissionResult.builder()
.state(UserBindWorkspaceModel.PermissionResultEnum.MISS_PERIOD)
.msg("【禁止操作】当前时间不在可执行的时间段内,限制时间段:" + ruleStr)

View File

@ -156,39 +156,37 @@ export default {
checkCount: 0,
fileList: [],
percentage: 0,
changelog: ''
changelog: '',
markdownit: null
}
},
mounted() {
this.loadData()
// console.log(markdownit)
// markdownit.block.ruler.before('paragraph', 'my_rule', function replace(state) {
// //...
// })
// var defaultRender =
// markdownit.renderer.rules.link_open ||
// function (tokens, idx, options, env, self) {
// return self.renderToken(tokens, idx, options)
// }
const md = markdownit()
const proxy = (tokens, idx, options, env, self) => self.renderToken(tokens, idx, options)
const defaultBulletListOpenRenderer = md.renderer.rules.link_open || proxy
// markdownit.renderer.rules.link_open = function (tokens, idx, options, env, self) {
// // If you are sure other plugins can't add `target` - drop check below
// var aIndex = tokens[idx].attrIndex('target')
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
var aIndex = tokens[idx].attrIndex('target')
// if (aIndex < 0) {
// tokens[idx].attrPush(['target', '_blank']) // add new attribute
// } else {
// tokens[idx].attrs[aIndex][1] = '_blank' // replace value of existing attr
// }
// // pass token to default renderer.
// return defaultRender(tokens, idx, options, env, self)
// }
if (aIndex < 0) {
tokens[idx].attrPush(['target', '_blank']) // add new attribute
} else {
tokens[idx].attrs[aIndex][1] = '_blank' // replace value of existing attr
}
// Make your changes here ...
// ... then render it using the existing logic
return defaultBulletListOpenRenderer(tokens, idx, options, env, self)
}
this.markdownit = md
},
beforeUnmount() {},
methods: {
uploadPieces,
formatDuration,
renderMarkdown(markdown) {
return (this.markdownit && this.markdownit.render(markdown)) || '未初始化'
},
//
loadData() {
systemInfo({
@ -208,24 +206,7 @@ export default {
nodeId: this.nodeId,
machineId: this.machineId
}).then((resLog) => {
const md = markdownit()
const proxy = (tokens, idx, options, env, self) => self.renderToken(tokens, idx, options)
const defaultBulletListOpenRenderer = md.renderer.rules.link_open || proxy
md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
var aIndex = tokens[idx].attrIndex('target')
if (aIndex < 0) {
tokens[idx].attrPush(['target', '_blank']) // add new attribute
} else {
tokens[idx].attrs[aIndex][1] = '_blank' // replace value of existing attr
}
// Make your changes here ...
// ... then render it using the existing logic
return defaultBulletListOpenRenderer(tokens, idx, options, env, self)
}
this.changelog = md.render(resLog.data)
this.changelog = this.renderMarkdown(resLog.data)
//
// res.data.
this.showVersion(false, res.data?.remoteVersion).then((upgrade) => {
@ -478,7 +459,7 @@ export default {
}
if (this.temp.upgrade && data.changelog) {
this.changelog = data.changelog
this.changelog = this.renderMarkdown(data.changelog)
}
if (tip) {
$notification.success({

View File

@ -26,10 +26,6 @@ router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, n
// 判断 token 是否存在
if (!userStore().getToken) {
if (from.path !== '/') {
// notification.error({
// message: "未登录,无法访问!",
// description: `from: ${from.path} ==> to: ${to.path}`,
// });
console.warn(`from: ${from.path} ==> to: ${to.path}`)
}
next({

View File

@ -54,6 +54,8 @@ export const useUserStore = defineStore('user', {
// 调用其他 action
menuStore.clearTabs('normal', { key: 'all' })
menuStore.clearTabs('management', { key: 'all' })
// 重置,避免信息没有刷新
this.reloadUserInfo = false
//
return loginOut({})
}