Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
12989375
Unverified
Commit
12989375
authored
May 10, 2023
by
zhu-mingye
Committed by
GitHub
May 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Refactor][web] refactor system center's system info (#1957)
* refactor system center's system info * refactor system center's system info
parent
e8db2094
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
670 additions
and
130 deletions
+670
-130
GitController.java
...min/src/main/java/org/dinky/controller/GitController.java
+3
-3
SystemController.java
.../src/main/java/org/dinky/controller/SystemController.java
+19
-12
TreeNodeDTO.java
dinky-admin/src/main/java/org/dinky/dto/TreeNodeDTO.java
+4
-8
GitProjectService.java
...in/src/main/java/org/dinky/service/GitProjectService.java
+3
-3
SystemService.java
...-admin/src/main/java/org/dinky/service/SystemService.java
+2
-9
GitProjectServiceImpl.java
...in/java/org/dinky/service/impl/GitProjectServiceImpl.java
+6
-74
SystemServiceImpl.java
...c/main/java/org/dinky/service/impl/SystemServiceImpl.java
+6
-8
TreeUtil.java
dinky-admin/src/main/java/org/dinky/utils/TreeUtil.java
+110
-0
routes.ts
dinky-web/config/routes.ts
+1
-1
package.json
dinky-web/package.json
+5
-6
index.tsx
dinky-web/src/components/CustomEditor/CodeShow/index.tsx
+1
-1
index.tsx
dinky-web/src/components/CustomEditor/EditFloatBtn/index.tsx
+95
-0
global.less
dinky-web/src/global.less
+26
-0
pages.ts
dinky-web/src/locales/en-US/pages.ts
+1
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+1
-0
index.tsx
...ages/RegCenter/GitProject/components/BuildSteps/index.tsx
+4
-1
index.tsx
...c/pages/RegCenter/GitProject/components/ShowLog/index.tsx
+1
-1
index.tsx
dinky-web/src/pages/SettingCenter/GlobalSetting/index.tsx
+17
-0
index.tsx
...ttingCenter/SystemInfo/TagInfo/LogList/LogsShow/index.tsx
+56
-0
index.tsx
...ttingCenter/SystemInfo/TagInfo/LogList/LogsTree/index.tsx
+47
-0
index.tsx
.../pages/SettingCenter/SystemInfo/TagInfo/LogList/index.tsx
+79
-0
index.tsx
...pages/SettingCenter/SystemInfo/TagInfo/RootLogs/index.tsx
+58
-0
index.tsx
...-web/src/pages/SettingCenter/SystemInfo/TagInfo/index.tsx
+39
-0
index.tsx
dinky-web/src/pages/SettingCenter/SystemInfo/index.tsx
+25
-0
BusinessCrud.ts
dinky-web/src/services/BusinessCrud.ts
+12
-2
constants.tsx
dinky-web/src/services/constants.tsx
+10
-1
function.tsx
dinky-web/src/utils/function.tsx
+39
-0
No files found.
dinky-admin/src/main/java/org/dinky/controller/GitController.java
View file @
12989375
...
...
@@ -22,7 +22,7 @@ package org.dinky.controller;
import
org.dinky.common.result.ProTableResult
;
import
org.dinky.common.result.Result
;
import
org.dinky.dto.GitProjectDTO
;
import
org.dinky.dto.
GitProject
TreeNodeDTO
;
import
org.dinky.dto.TreeNodeDTO
;
import
org.dinky.model.GitProject
;
import
org.dinky.service.GitProjectService
;
import
org.dinky.utils.GitProjectStepSseFactory
;
...
...
@@ -189,9 +189,9 @@ public class GitController {
* @return {@link Result} of {@link Void}
*/
@GetMapping
(
"/getProjectCode"
)
public
Result
<
List
<
GitProject
TreeNodeDTO
>>
getProjectCode
(
@RequestParam
(
"id"
)
Integer
id
)
{
public
Result
<
List
<
TreeNodeDTO
>>
getProjectCode
(
@RequestParam
(
"id"
)
Integer
id
)
{
List
<
GitProject
TreeNodeDTO
>
projectCode
=
gitProjectService
.
getProjectCode
(
id
);
List
<
TreeNodeDTO
>
projectCode
=
gitProjectService
.
getProjectCode
(
id
);
if
(
projectCode
==
null
)
{
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"response.get.failed"
));
}
...
...
dinky-admin/src/main/java/org/dinky/controller/SystemController.java
View file @
12989375
...
...
@@ -21,7 +21,7 @@ package org.dinky.controller;
import
org.dinky.common.result.Result
;
import
org.dinky.constant.DirConstant
;
import
org.dinky.
model.FileNode
;
import
org.dinky.
dto.TreeNodeDTO
;
import
org.dinky.service.SystemService
;
import
java.util.List
;
...
...
@@ -33,11 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
import
lombok.RequiredArgsConstructor
;
/**
* SystemController
*
* @since 2022/10/15 19:20
*/
/** SystemController */
@RestController
@RequestMapping
(
"/api/system"
)
@RequiredArgsConstructor
...
...
@@ -45,21 +41,32 @@ public class SystemController {
private
final
SystemService
systemService
;
/**
* All log files for this project
*
* @return {@link Result} <{@link List}<{@link TreeNodeDTO}>>
*/
@GetMapping
(
"/listLogDir"
)
public
Result
<
List
<
FileNode
>>
listLogDir
()
{
public
Result
<
List
<
TreeNodeDTO
>>
listLogDir
()
{
return
Result
.
data
(
systemService
.
listLogDir
());
}
/**
* get root log file content
*
* @return {@link Result} <{@link String}>
*/
@GetMapping
(
"/getRootLog"
)
public
Result
<
String
>
getRootLog
()
{
return
Result
.
data
(
systemService
.
readFile
(
DirConstant
.
ROOT_LOG_PATH
));
}
@GetMapping
(
"/listDirByPath"
)
public
Result
<
List
<
FileNode
>>
listDirByPath
(
@RequestParam
String
path
)
{
return
Result
.
data
(
systemService
.
listDirByPath
(
path
));
}
/**
* readFile by path
*
* @param path {@link String}
* @return {@link Result} <{@link String}>
*/
@GetMapping
(
"/readFile"
)
public
Result
<
String
>
readFile
(
@RequestParam
String
path
)
{
return
Result
.
data
(
systemService
.
readFile
(
path
));
...
...
dinky-admin/src/main/java/org/dinky/dto/
GitProject
TreeNodeDTO.java
→
dinky-admin/src/main/java/org/dinky/dto/TreeNodeDTO.java
View file @
12989375
...
...
@@ -35,20 +35,16 @@ import lombok.ToString;
@NoArgsConstructor
@AllArgsConstructor
@ToString
public
class
GitProject
TreeNodeDTO
{
public
class
TreeNodeDTO
{
private
String
name
;
private
String
path
;
private
String
content
;
private
Long
size
;
private
boolean
isLeaf
;
private
List
<
GitProject
TreeNodeDTO
>
children
;
private
List
<
TreeNodeDTO
>
children
;
public
GitProjectTreeNodeDTO
(
String
name
,
String
path
,
boolean
isLeaf
,
List
<
GitProjectTreeNodeDTO
>
children
,
Long
size
)
{
public
TreeNodeDTO
(
String
name
,
String
path
,
boolean
isLeaf
,
List
<
TreeNodeDTO
>
children
,
Long
size
)
{
this
.
name
=
name
;
this
.
path
=
path
;
this
.
isLeaf
=
isLeaf
;
...
...
dinky-admin/src/main/java/org/dinky/service/GitProjectService.java
View file @
12989375
...
...
@@ -21,7 +21,7 @@ package org.dinky.service;
import
org.dinky.db.service.ISuperService
;
import
org.dinky.dto.GitProjectDTO
;
import
org.dinky.dto.
GitProject
TreeNodeDTO
;
import
org.dinky.dto.TreeNodeDTO
;
import
org.dinky.model.GitProject
;
import
java.util.List
;
...
...
@@ -49,9 +49,9 @@ public interface GitProjectService extends ISuperService<GitProject> {
* get project code tree
*
* @param id {@link Integer}
* @return {@link List<
GitProject
TreeNodeDTO >}
* @return {@link List< TreeNodeDTO >}
*/
List
<
GitProject
TreeNodeDTO
>
getProjectCode
(
Integer
id
);
List
<
TreeNodeDTO
>
getProjectCode
(
Integer
id
);
/**
* remove project and code cascade by id
...
...
dinky-admin/src/main/java/org/dinky/service/SystemService.java
View file @
12989375
...
...
@@ -19,6 +19,7 @@
package
org
.
dinky
.
service
;
import
org.dinky.dto.TreeNodeDTO
;
import
org.dinky.model.FileNode
;
import
java.util.List
;
...
...
@@ -30,20 +31,12 @@ import java.util.List;
*/
public
interface
SystemService
{
/**
* list all dir and file by dir path
*
* @param path
* @return {@link List<FileNode>}
*/
List
<
FileNode
>
listDirByPath
(
String
path
);
/**
* List log root dir.
*
* @return {@link List<FileNode>}
*/
List
<
FileNode
>
listLogDir
();
List
<
TreeNodeDTO
>
listLogDir
();
/**
* readFile
...
...
dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java
View file @
12989375
...
...
@@ -21,18 +21,18 @@ package org.dinky.service.impl;
import
org.dinky.db.service.impl.SuperServiceImpl
;
import
org.dinky.dto.GitProjectDTO
;
import
org.dinky.dto.GitProjectTreeNodeDTO
;
import
org.dinky.dto.JarClassesDTO
;
import
org.dinky.dto.TreeNodeDTO
;
import
org.dinky.mapper.GitProjectMapper
;
import
org.dinky.model.GitProject
;
import
org.dinky.process.exception.DinkyException
;
import
org.dinky.service.GitProjectService
;
import
org.dinky.utils.GitProjectStepSseFactory
;
import
org.dinky.utils.GitRepository
;
import
org.dinky.utils.TreeUtil
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -85,10 +85,10 @@ public class GitProjectServiceImpl extends SuperServiceImpl<GitProjectMapper, Gi
* @return {@link List < GitProjectCodeTreeDTO >}
*/
@Override
public
List
<
GitProject
TreeNodeDTO
>
getProjectCode
(
Integer
id
)
{
public
List
<
TreeNodeDTO
>
getProjectCode
(
Integer
id
)
{
GitProject
gitProject
=
getById
(
id
);
File
projectDir
=
GitRepository
.
getProjectDir
(
gitProject
.
getName
());
return
treeNodeData
(
projectDir
);
return
TreeUtil
.
treeNodeData
(
projectDir
,
true
);
}
/**
...
...
@@ -159,79 +159,11 @@ public class GitProjectServiceImpl extends SuperServiceImpl<GitProjectMapper, Gi
buildStep5Logs
(
file
,
sb
);
sb
.
append
(
"\n\n\n\n"
);
}
else
{
sb
.
append
(
readFile
(
file
));
sb
.
append
(
FileUtil
.
readUtf8String
(
file
));
sb
.
append
(
"\n\n\n\n"
);
}
}
/**
* build tree node data
*
* @param projectDir {@link File}
* @return {@link List < GitProjectTreeNodeDTO >}
*/
private
static
List
<
GitProjectTreeNodeDTO
>
treeNodeData
(
File
projectDir
)
{
List
<
GitProjectTreeNodeDTO
>
nodes
=
new
ArrayList
<>();
if
(
projectDir
.
exists
()
&&
projectDir
.
isDirectory
())
{
GitProjectTreeNodeDTO
rootNode
=
new
GitProjectTreeNodeDTO
(
projectDir
.
getName
(),
projectDir
.
getAbsolutePath
(),
true
,
new
ArrayList
<>(),
0L
);
buildTree
(
projectDir
,
rootNode
);
nodes
.
add
(
rootNode
);
}
return
nodes
;
}
/**
* build tree
*
* @param file {@link File}
* @param parentNode {@link GitProjectTreeNodeDTO}
*/
private
static
void
buildTree
(
File
file
,
GitProjectTreeNodeDTO
parentNode
)
{
if
(
file
.
isDirectory
())
{
File
[]
children
=
file
.
listFiles
();
if
(
children
!=
null
)
{
for
(
File
child
:
children
)
{
GitProjectTreeNodeDTO
childNode
=
new
GitProjectTreeNodeDTO
(
child
.
getName
(),
child
.
getAbsolutePath
(),
child
.
isDirectory
(),
new
ArrayList
<>(),
child
.
length
());
parentNode
.
getChildren
().
add
(
childNode
);
buildTree
(
child
,
childNode
);
}
}
}
else
{
try
{
String
content
=
readFile
(
file
);
parentNode
.
setLeaf
(
file
.
isDirectory
());
parentNode
.
setContent
(
content
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
/**
* read file
*
* @param file {@link File}
* @return {@link String}
* @throws IOException
*/
private
static
String
readFile
(
File
file
)
throws
IOException
{
return
FileUtil
.
readUtf8String
(
file
);
}
/**
* match step by code type
*
...
...
@@ -295,7 +227,7 @@ public class GitProjectServiceImpl extends SuperServiceImpl<GitProjectMapper, Gi
* @throws IOException
*/
private
void
buildStep5Logs
(
File
file
,
StringBuilder
sb
)
throws
IOException
{
String
step5Log
=
readFile
(
file
);
String
step5Log
=
FileUtil
.
readUtf8String
(
file
);
sb
.
append
(
"Jar And UDF Class List:\n"
);
List
<
JarClassesDTO
>
jarClassesDTOList
=
JSONUtil
.
toList
(
step5Log
,
JarClassesDTO
.
class
);
jarClassesDTOList
.
stream
()
...
...
dinky-admin/src/main/java/org/dinky/service/impl/SystemServiceImpl.java
View file @
12989375
...
...
@@ -20,10 +20,12 @@
package
org
.
dinky
.
service
.
impl
;
import
org.dinky.constant.DirConstant
;
import
org.dinky.
model.FileNode
;
import
org.dinky.
dto.TreeNodeDTO
;
import
org.dinky.service.SystemService
;
import
org.dinky.utils.DirUtil
;
import
org.dinky.utils.TreeUtil
;
import
java.io.File
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
...
...
@@ -37,13 +39,9 @@ import org.springframework.stereotype.Service;
public
class
SystemServiceImpl
implements
SystemService
{
@Override
public
List
<
FileNode
>
listDirByPath
(
String
path
)
{
return
DirUtil
.
listDirByPath
(
path
);
}
@Override
public
List
<
FileNode
>
listLogDir
()
{
return
DirUtil
.
listDirByPath
(
DirConstant
.
LOG_DIR_PATH
);
public
List
<
TreeNodeDTO
>
listLogDir
()
{
File
systemLogFiles
=
TreeUtil
.
getFilesOfDir
(
DirConstant
.
LOG_DIR_PATH
);
return
TreeUtil
.
treeNodeData
(
systemLogFiles
,
false
);
}
@Override
...
...
dinky-admin/src/main/java/org/dinky/utils/TreeUtil.java
0 → 100644
View file @
12989375
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
utils
;
import
org.dinky.dto.TreeNodeDTO
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.hutool.core.io.FileUtil
;
/** the tree util , is use build tree , and show tree view */
public
class
TreeUtil
{
/**
* build tree node data
*
* @param dir {@link File}
* @return {@link List < GitProjectTreeNodeDTO >}
*/
public
static
List
<
TreeNodeDTO
>
treeNodeData
(
File
dir
,
Boolean
readContent
)
{
List
<
TreeNodeDTO
>
nodes
=
new
ArrayList
<>();
if
(
dir
.
exists
()
&&
dir
.
isDirectory
())
{
TreeNodeDTO
rootNode
=
new
TreeNodeDTO
(
dir
.
getName
(),
dir
.
getAbsolutePath
(),
true
,
new
ArrayList
<>(),
0L
);
buildTree
(
dir
,
rootNode
,
readContent
);
nodes
.
add
(
rootNode
);
}
return
nodes
;
}
/**
* build tree, if readContent is true , read file content to set {@link TreeNodeDTO#content}
*
* @param file {@link File}
* @param parentNode {@link TreeNodeDTO}
* @param readContent {@link Boolean}
*/
private
static
void
buildTree
(
File
file
,
TreeNodeDTO
parentNode
,
Boolean
readContent
)
{
if
(
file
.
isDirectory
())
{
File
[]
children
=
file
.
listFiles
();
if
(
children
!=
null
)
{
for
(
File
child
:
children
)
{
TreeNodeDTO
childNode
=
new
TreeNodeDTO
(
child
.
getName
(),
child
.
getAbsolutePath
(),
child
.
isDirectory
(),
new
ArrayList
<>(),
child
.
length
());
parentNode
.
getChildren
().
add
(
childNode
);
buildTree
(
child
,
childNode
,
readContent
);
}
}
}
else
{
try
{
if
(
readContent
)
{
String
content
=
readFiles
(
file
);
parentNode
.
setContent
(
content
);
}
parentNode
.
setLeaf
(
file
.
isDirectory
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
/**
* read file
*
* @param file {@link File}
* @return {@link String}
* @throws IOException
*/
public
static
String
readFiles
(
File
file
)
throws
IOException
{
return
FileUtil
.
readUtf8String
(
file
);
}
/**
* get files of dir
*
* @param path {@link String}
* @return {@File}
*/
public
static
File
getFilesOfDir
(
String
path
)
{
return
FileUtil
.
file
(
path
);
}
}
dinky-web/config/routes.ts
View file @
12989375
...
...
@@ -219,7 +219,7 @@ export default [
path
:
'/settings/system'
,
name
:
'system'
,
icon
:
'InfoCircleOutlined'
,
//
component: './SettingCenter/SystemInfo',
component
:
'./SettingCenter/SystemInfo'
,
},
{
path
:
'/settings/process'
,
...
...
dinky-web/package.json
View file @
12989375
...
...
@@ -46,14 +46,14 @@
],
"dependencies"
:
{
"@ant-design/icons"
:
"^5.0.1"
,
"@ant-design/pro-components"
:
"^2.
3.57
"
,
"@ant-design/pro-layout"
:
"^7.
8.2
"
,
"@ant-design/pro-table"
:
"^3.
3.1
"
,
"@ant-design/pro-components"
:
"^2.
4.14
"
,
"@ant-design/pro-layout"
:
"^7.
13.3
"
,
"@ant-design/pro-table"
:
"^3.
6.9
"
,
"@ant-design/use-emotion-css"
:
"^1.0.4"
,
"@umijs/route-utils"
:
"^4.0.1"
,
"antd"
:
"^5.4.
5
"
,
"antd"
:
"^5.4.
7
"
,
"classnames"
:
"^2.3.2"
,
"js-cookie"
:
"^3.0.
4
"
,
"js-cookie"
:
"^3.0.
5
"
,
"lodash"
:
"^4.17.21"
,
"moment"
:
"^2.29.4"
,
"omit.js"
:
"^2.0.2"
,
...
...
@@ -63,7 +63,6 @@
"react-dev-inspector"
:
"^1.8.1"
,
"react-monaco-editor"
:
"^0.52.0"
,
"react-dom"
:
"^18.0.0"
,
"react-draggable"
:
"^4.4.5"
,
"react-helmet-async"
:
"^1.3.0"
,
"screenfull"
:
"^6.0.2"
,
"use-sse"
:
"^2.0.1"
...
...
dinky-web/src/components/CustomEditor/CodeShow/index.tsx
View file @
12989375
...
...
@@ -184,7 +184,7 @@ const CodeShow = (props: CodeShowFormProps) => {
* render
*/
return
(<>
<
div
id=
{
"monaco"
}
className=
{
"monaco-float"
}
>
<
div
className=
{
"monaco-float"
}
>
<
MonacoEditor
width=
{
width
}
height=
{
height
}
...
...
dinky-web/src/components/CustomEditor/EditFloatBtn/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
React
from
"react"
;
import
{
FloatButton
,
Space
}
from
"antd"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
DownCircleFilled
,
StopFilled
,
SyncOutlined
,
UpCircleFilled
}
from
"@ant-design/icons"
;
import
{
PlayCircleFilled
}
from
"@ant-design/icons/lib/icons"
;
/**
* props
*/
type
EditFloatBtnProps
=
{
refreshLogCallback
?:
()
=>
void
;
// refresh log callback
autoRefresh
?:
boolean
;
// auto refresh flag
stopping
?:
boolean
;
// stop auto refresh flag
loading
?:
boolean
;
// loading flag
handleSyncLog
?:
()
=>
void
;
// sync log callback
handleStopAutoRefresh
?:
()
=>
void
;
// stop auto refresh callback
handleStartAutoRefresh
?:
()
=>
void
;
// start auto refresh callback
handleBackTop
?:
()
=>
void
;
// back to top callback
handleBackBottom
?:
()
=>
void
;
// back to bottom callback
handleUpScroll
?:
()
=>
void
;
// up scroll callback
handleDownScroll
?:
()
=>
void
;
// down scroll callback
}
const
EditFloatBtn
:
React
.
FC
<
EditFloatBtnProps
>
=
(
props
)
=>
{
/**
* init props
*/
const
{
refreshLogCallback
,
autoRefresh
,
stopping
,
loading
,
handleSyncLog
,
handleStopAutoRefresh
,
handleStartAutoRefresh
,
handleBackTop
,
handleBackBottom
,
handleUpScroll
,
handleDownScroll
}
=
props
;
/**
* render
*/
return
<>
<
FloatButton
.
Group
shape=
"circle"
className=
{
"float-button"
}
>
<
Space
direction=
{
"vertical"
}
>
{
/* if refreshLogCallback is not null, then show sync button , auto refresh button and stop auto refresh button */
}
{
refreshLogCallback
&&
<>
<
FloatButton
tooltip=
{
l
(
"button.refresh"
)
}
icon=
{
<
SyncOutlined
spin=
{
loading
}
/>
}
onClick=
{
handleSyncLog
}
/>
{
autoRefresh
?
<
FloatButton
icon=
{
<
StopFilled
spin=
{
stopping
}
/>
}
tooltip=
{
l
(
"button.stopRefresh"
)
}
onClick=
{
handleStopAutoRefresh
}
/>
:
<
FloatButton
icon=
{
<
PlayCircleFilled
/>
}
tooltip=
{
l
(
"button.startRefresh"
)
}
onClick=
{
handleStartAutoRefresh
}
/>
}
</>
}
{
/* back top */
}
<
FloatButton
.
BackTop
tooltip=
{
l
(
"button.backTop"
)
}
onClick=
{
handleBackTop
}
visibilityHeight=
{
0
}
/>
{
/* go bottom */
}
<
FloatButton
.
BackTop
className=
{
"back-bottom"
}
tooltip=
{
l
(
"button.backBottom"
)
}
onClick=
{
handleBackBottom
}
visibilityHeight=
{
0
}
/>
{
/* scroll up */
}
<
FloatButton
icon=
{
<
UpCircleFilled
/>
}
tooltip=
{
l
(
"button.upScroll"
)
}
onClick=
{
handleUpScroll
}
/>
{
/* scroll down */
}
<
FloatButton
icon=
{
<
DownCircleFilled
/>
}
tooltip=
{
l
(
"button.downScroll"
)
}
onClick=
{
handleDownScroll
}
/>
</
Space
>
</
FloatButton
.
Group
>
</>;
};
export
default
EditFloatBtn
;
dinky-web/src/global.less
View file @
12989375
...
...
@@ -26,6 +26,32 @@ body,
'Noto Color Emoji';
}
// scrollbar style --- start ----
::-webkit-scrollbar {
width: 0.5vw;
height: 1vh;
background-color: #f5f5f5;
}
::-webkit-scrollbar-thumb {
background-color: #ccc;
border-radius: 6px;
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb:hover {
background-color: #aaa;
}
::-webkit-scrollbar-thumb:active {
background-color: #999;
}
::-webkit-scrollbar-corner {
background-color: #f5f5f5;
}
// scrollbar style --- end ----
.colorWeak {
filter: invert(80%);
}
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
12989375
...
...
@@ -793,6 +793,7 @@ export default {
'sys.process.endtime'
:
'End Time'
,
'sys.process.duration'
:
'Duration'
,
'sys.process.operator'
:
'Operator'
,
'sys.info.logList.tips'
:
'Click left log file to viewing'
,
'devops.jobinfo.alert.title'
:
'Title'
,
'devops.jobinfo.alert.content'
:
'Body'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
12989375
...
...
@@ -787,6 +787,7 @@ export default {
'sys.process.endtime'
:
'结束时间'
,
'sys.process.duration'
:
'耗时'
,
'sys.process.operator'
:
'操作人'
,
'sys.info.logList.tips'
:
'点击左侧日志文件查看'
,
'devops.jobinfo.alert.title'
:
'标题'
,
'devops.jobinfo.alert.content'
:
'正文'
,
...
...
dinky-web/src/pages/RegCenter/GitProject/components/BuildSteps/index.tsx
View file @
12989375
...
...
@@ -92,7 +92,9 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
return
l
(
"rc.gp.build.step."
+
step
);
}
// const [data, error] = useSSE(() => {
// return fetch("https://myapi.example.com").then((res) => res.json());
// }, []);
useEffect
(()
=>
{
if
(
values
.
buildStep
===
0
)
{
...
...
@@ -100,6 +102,7 @@ export const BuildSteps: React.FC<BuildStepsProps> = (props) => {
setCurrentStep
(
0
);
}
const
eventSource
=
new
EventSource
(
API_CONSTANTS
.
GIT_PROJECT_BUILD_STEP_LOGS
+
"?id="
+
values
.
id
);
setEventSource
(
eventSource
);
buildStepList
();
...
...
dinky-web/src/pages/RegCenter/GitProject/components/ShowLog/index.tsx
View file @
12989375
...
...
@@ -65,7 +65,7 @@ export const ShowLog: React.FC<ShowLogProps> = (props) => {
*/
useEffect
(()
=>
{
queryAllStepLogs
();
},
[
modalVisible
]);
},
[]);
/**
...
...
dinky-web/src/pages/SettingCenter/GlobalSetting/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
dinky-web/src/pages/SettingCenter/SystemInfo/TagInfo/LogList/LogsShow/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
CodeShow
from
"@/components/CustomEditor/CodeShow"
;
import
React
from
"react"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
Empty
}
from
"antd"
;
const
CodeEditProps
=
{
height
:
"70vh"
,
width
:
"100%"
,
lineNumbers
:
"on"
,
language
:
"java"
,
};
type
LogsShowProps
=
{
code
:
string
;
refreshLogCallback
:
()
=>
void
;
}
// todo:
// If the log is too large and there are too many contents,
// MonacoEditor will have performance problems.
// It is planned to optimize it through `react-virtualized`
const
LogsShow
:
React
.
FC
<
LogsShowProps
>
=
(
props
)
=>
{
const
{
code
,
refreshLogCallback
}
=
props
;
const
restLogsShowProps
=
{
showFloatButton
:
true
,
code
,
refreshLogCallback
,
};
return
<>
{
code
?
<
CodeShow
{
...
restLogsShowProps
}
{
...
CodeEditProps
}
/>
:
<
Empty
className=
{
"code-content-empty"
}
description=
{
l
(
"sys.info.logList.tips"
)
}
/>
}
</>;
};
export
default
LogsShow
;
dinky-web/src/pages/SettingCenter/SystemInfo/TagInfo/LogList/LogsTree/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
React
from
"react"
;
import
{
Empty
,
Tree
}
from
"antd"
;
import
{
PageLoading
}
from
"@ant-design/pro-components"
;
import
{
buildTreeData
}
from
"@/utils/function"
;
type
LogsTreeProps
=
{
treeData
:
Partial
<
any
>
[];
onNodeClick
:
(
info
:
any
)
=>
void
}
const
{
DirectoryTree
}
=
Tree
;
const
LogsTree
:
React
.
FC
<
LogsTreeProps
>
=
(
props
)
=>
{
const
{
treeData
,
onNodeClick
}
=
props
;
return
<>
{
(
treeData
.
length
>
0
)
?
<
DirectoryTree
onSelect=
{
(
_
,
info
)
=>
onNodeClick
(
info
)
}
treeData=
{
buildTreeData
(
treeData
)
}
/>
:
<
Empty
className=
{
"code-content-empty"
}
/>
}
</>;
};
export
default
LogsTree
;
dinky-web/src/pages/SettingCenter/SystemInfo/TagInfo/LogList/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
Col
,
Row
}
from
"antd"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
LogsTree
from
"@/pages/SettingCenter/SystemInfo/TagInfo/LogList/LogsTree"
;
import
LogsShow
from
"@/pages/SettingCenter/SystemInfo/TagInfo/LogList/LogsShow"
;
import
{
queryDataByParams
}
from
"@/services/BusinessCrud"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
const
LogList
=
()
=>
{
const
[
treeData
,
setTreeData
]
=
useState
<
Partial
<
any
>
[]
>
([]);
const
[
log
,
setLog
]
=
useState
<
string
>
(
""
);
const
[
clickFileName
,
setClickFileName
]
=
useState
<
any
>
();
const
queryLogList
=
async
()
=>
{
await
queryDataByParams
(
API_CONSTANTS
.
SYSTEM_ROOT_LOG_LIST
).
then
(
res
=>
{
setTreeData
(
res
);
});
};
const
queryLogContent
=
async
(
fileName
:
string
)
=>
{
await
queryDataByParams
(
API_CONSTANTS
.
SYSTEM_ROOT_LOG_READ
,
{
path
:
fileName
}).
then
(
res
=>
{
setLog
(
res
);
});
};
useEffect
(()
=>
{
queryLogList
();
},
[]);
const
handleNodeClick
=
async
(
info
:
any
)
=>
{
const
{
node
:
{
path
,
isLeaf
}}
=
info
;
if
(
isLeaf
)
{
setClickFileName
(
path
);
await
queryLogContent
(
path
);
}
};
const
refreshLogByClickNode
=
async
()
=>
{
await
queryLogContent
(
clickFileName
);
};
return
<>
<
Row
>
<
Col
span=
{
4
}
className=
{
"siderTree"
}
>
{
/* tree */
}
<
LogsTree
treeData=
{
treeData
}
onNodeClick=
{
(
info
:
any
)
=>
handleNodeClick
(
info
)
}
/>
{
/*<SiderTree treeData={treeData} onNodeClick={(info: any) => handleNodeClick(info)} loading={loading}/>*/
}
</
Col
>
<
Col
span=
{
20
}
>
{
/* code */
}
<
LogsShow
code=
{
log
}
refreshLogCallback=
{
()
=>
refreshLogByClickNode
()
}
/>
{
/*<CodeContent code={codeValue} current={currentGitProjectTreeNode}/>*/
}
</
Col
>
</
Row
>
</>;
};
export
default
LogList
;
dinky-web/src/pages/SettingCenter/SystemInfo/TagInfo/RootLogs/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
CodeShow
from
"@/components/CustomEditor/CodeShow"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
queryDataByParams
}
from
"@/services/BusinessCrud"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
/**
* code edit props
*/
const
CodeEditProps
=
{
height
:
"75vh"
,
width
:
"100%"
,
lineNumbers
:
"on"
,
language
:
"java"
,
};
const
RootLogs
=
()
=>
{
const
[
code
,
setCode
]
=
useState
<
string
>
(
""
);
const
queryLogs
=
async
()
=>
{
const
result
=
await
queryDataByParams
(
API_CONSTANTS
.
SYSTEM_ROOT_LOG
);
setCode
(
result
);
};
useEffect
(()
=>
{
queryLogs
();
},
[]);
const
restRootLogProps
=
{
code
:
code
,
showFloatButton
:
true
,
refreshLogCallback
:
queryLogs
,
};
return
<>
<
CodeShow
{
...
restRootLogProps
}
{
...
CodeEditProps
}
/>
</>;
};
export
default
RootLogs
;
dinky-web/src/pages/SettingCenter/SystemInfo/TagInfo/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
Tabs
}
from
"antd"
;
import
RootLogs
from
"@/pages/SettingCenter/SystemInfo/TagInfo/RootLogs"
;
import
LogList
from
"@/pages/SettingCenter/SystemInfo/TagInfo/LogList"
;
const
{
TabPane
}
=
Tabs
;
const
TagInfo
=
()
=>
{
return
<>
<
Tabs
>
<
TabPane
tab=
{
" Root Logs "
}
key=
"logs"
>
<
RootLogs
/>
</
TabPane
>
<
TabPane
tab=
{
" Log List "
}
key=
"logList"
>
<
LogList
/>
</
TabPane
>
</
Tabs
>
</>;
};
export
default
TagInfo
;
dinky-web/src/pages/SettingCenter/SystemInfo/index.tsx
0 → 100644
View file @
12989375
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
PageContainer
}
from
"@ant-design/pro-components"
;
import
TagInfo
from
"@/pages/SettingCenter/SystemInfo/TagInfo"
;
export
default
()
=>
{
return
<
PageContainer
title=
{
false
}
>
<
TagInfo
/>
</
PageContainer
>
}
dinky-web/src/services/BusinessCrud.ts
View file @
12989375
...
...
@@ -18,7 +18,7 @@
import
{
addOrUpdateData
,
putData
,
getDataByRequestBody
,
getInfoById
,
postAll
,
removeById
,
updateDataByParams
,
removeById
,
updateDataByParams
,
getData
,
}
from
"@/services/api"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
API_CONSTANTS
,
METHOD_CONSTANTS
,
RESPONSE_CODE
}
from
"@/services/constants"
;
...
...
@@ -190,7 +190,7 @@ export const handlePutData = async (url: string, fields: any) => {
};
export
const
getDataByParams
=
async
(
url
:
string
,
params
:
any
)
=>
{
export
const
getDataByParams
=
async
(
url
:
string
,
params
?
:
any
)
=>
{
try
{
const
{
datas
}
=
await
getDataByRequestBody
(
url
,
params
);
return
datas
;
...
...
@@ -199,6 +199,16 @@ export const getDataByParams = async (url: string, params: any) => {
}
};
export
const
queryDataByParams
=
async
(
url
:
string
,
params
?:
any
)
=>
{
try
{
const
{
datas
}
=
await
getData
(
url
,
params
);
return
datas
;
}
catch
(
error
)
{
return
false
;
}
};
export
const
handlePutDataByParams
=
async
(
url
:
string
,
title
:
string
,
params
:
any
)
=>
{
await
LoadingMessageAsync
(
l
(
"app.request.running"
)
+
title
);
try
{
...
...
dinky-web/src/services/constants.tsx
View file @
12989375
...
...
@@ -124,7 +124,16 @@ export const API_CONSTANTS = {
// ---- get project build steps ----
GIT_PROJECT_BUILD_STEPS
:
"/api/git/build-steps"
,
// ---- get project all build logs ----
GIT_PROJECT_BUILD_ALL_LOGS
:
"/api/git/getAllBuildLog"
,
GIT_PROJECT_BUILD_ALL_LOGS
:
"/api/git/getAllBuildLog"
,
// system config center
//-- system root logs
SYSTEM_ROOT_LOG
:
"/api/system/getRootLog"
,
// -- get logs list
SYSTEM_ROOT_LOG_LIST
:
"/api/system/listLogDir"
,
// -- READ LOG file
SYSTEM_ROOT_LOG_READ
:
"/api/system/readFile"
,
};
...
...
dinky-web/src/utils/function.tsx
View file @
12989375
...
...
@@ -266,3 +266,42 @@ export const renderLanguage = (type: string, splitChar: string) => {
export
const
folderSeparator
=
()
=>
{
return
path
.
sep
;
}
/**
* build tree data
* @param data
* @returns {any}
*/
export
const
buildTreeData
=
(
data
:
any
):
any
=>
data
?.
map
((
item
:
any
)
=>
{
// build key
let
buildKey
=
item
.
path
+
folderSeparator
()
+
item
.
name
;
// if has children , recursive build
if
(
item
.
children
)
{
return
{
isLeaf
:
!
item
.
leaf
,
name
:
item
.
name
,
parentId
:
item
.
path
,
icon
:
renderIcon
(
item
.
name
,
"."
,
item
.
leaf
),
content
:
item
.
content
,
path
:
item
.
path
,
title
:
item
.
name
,
key
:
buildKey
,
children
:
buildTreeData
(
item
.
children
)
};
}
return
{
isLeaf
:
!
item
.
leaf
,
name
:
item
.
name
,
parentId
:
item
.
path
,
icon
:
renderIcon
(
item
.
name
,
"."
,
item
.
leaf
),
content
:
item
.
content
,
path
:
item
.
path
,
title
:
item
.
name
,
key
:
buildKey
,
};
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment