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
ac84664a
Unverified
Commit
ac84664a
authored
Mar 31, 2023
by
zhu-mingye
Committed by
GitHub
Mar 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature][dinky-web] added global var list for dinky-web (#1815)
* added global var list for dinky-web * delete some shell
parent
f8c8d925
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1007 additions
and
105 deletions
+1007
-105
FragmentVariableController.java
...java/org/dinky/controller/FragmentVariableController.java
+54
-11
FragmentVariableService.java
.../main/java/org/dinky/service/FragmentVariableService.java
+19
-6
FragmentVariableServiceImpl.java
...a/org/dinky/service/impl/FragmentVariableServiceImpl.java
+10
-8
.gitignore
dinky-web/.gitignore
+2
-0
routes.ts
dinky-web/config/routes.ts
+1
-7
package.json
dinky-web/package.json
+5
-4
app.tsx
dinky-web/src/app.tsx
+3
-2
index.tsx
...-web/src/components/CustomMonacoEditor/CodeEdit/index.tsx
+85
-0
index.tsx
...-web/src/components/CustomMonacoEditor/CodeShow/index.tsx
+79
-0
index.tsx
dinky-web/src/components/RightContent/index.tsx
+2
-6
menu.ts
dinky-web/src/locales/en-US/menu.ts
+1
-1
pages.ts
dinky-web/src/locales/en-US/pages.ts
+10
-16
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+10
-16
index.tsx
dinky-web/src/pages/AuthCenter/Role/index.tsx
+1
-1
index.tsx
dinky-web/src/pages/AuthCenter/Tenant/index.tsx
+1
-1
index.tsx
dinky-web/src/pages/Other/Login/index.tsx
+1
-1
GlobalVarForm.tsx
...rc/pages/RegCenter/GlobalVar/components/GlobalVarForm.tsx
+141
-0
index.tsx
dinky-web/src/pages/RegCenter/GlobalVar/index.tsx
+261
-0
.ignore
dinky-web/src/pages/RegistrationCenter/.ignore
+0
-0
constants.ts
dinky-web/src/services/constants.ts
+10
-3
data.ts
dinky-web/src/types/Public/data.ts
+24
-22
data.d.ts
dinky-web/src/types/RegCenter/data.d.ts
+190
-0
function.ts
dinky-web/src/utils/function.ts
+97
-0
No files found.
dinky-admin/src/main/java/org/dinky/controller/FragmentVariableController.java
View file @
ac84664a
...
@@ -23,6 +23,7 @@ import org.dinky.common.result.ProTableResult;
...
@@ -23,6 +23,7 @@ import org.dinky.common.result.ProTableResult;
import
org.dinky.common.result.Result
;
import
org.dinky.common.result.Result
;
import
org.dinky.model.FragmentVariable
;
import
org.dinky.model.FragmentVariable
;
import
org.dinky.service.FragmentVariableService
;
import
org.dinky.service.FragmentVariableService
;
import
org.dinky.utils.MessageResolverUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
...
@@ -39,12 +41,7 @@ import com.fasterxml.jackson.databind.JsonNode;
...
@@ -39,12 +41,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
/**
/** FragmentVariableController */
* FragmentVariableController
*
* @author zhumingye
* @since 2022/8/18
*/
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/api/fragment"
)
@RequestMapping
(
"/api/fragment"
)
...
@@ -53,25 +50,71 @@ public class FragmentVariableController {
...
@@ -53,25 +50,71 @@ public class FragmentVariableController {
private
final
FragmentVariableService
fragmentVariableService
;
private
final
FragmentVariableService
fragmentVariableService
;
/** 新增或者更新 */
/**
* save or update
*
* @param fragmentVariable {@link FragmentVariable}
* @return {@link Result} of {@link Void}
*/
@PutMapping
@PutMapping
public
Result
<
Void
>
saveOrUpdate
(
@RequestBody
FragmentVariable
fragmentVariable
)
public
Result
<
Void
>
saveOrUpdate
(
@RequestBody
FragmentVariable
fragmentVariable
)
throws
Exception
{
throws
Exception
{
if
(
fragmentVariableService
.
saveOrUpdate
(
fragmentVariable
))
{
if
(
fragmentVariableService
.
saveOrUpdate
(
fragmentVariable
))
{
return
Result
.
succeed
(
"保存成功"
);
return
Result
.
succeed
(
MessageResolverUtils
.
getMessage
(
"save.success"
)
);
}
else
{
}
else
{
return
Result
.
failed
(
"保存失败"
);
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"save.failed"
)
);
}
}
}
}
/** 动态查询列表 */
/**
* query list
*
* @param para {@link JsonNode}
* @return {@link ProTableResult} of {@link FragmentVariable}
*/
@PostMapping
@PostMapping
public
ProTableResult
<
FragmentVariable
>
listFragmentVariable
(
@RequestBody
JsonNode
para
)
{
public
ProTableResult
<
FragmentVariable
>
listFragmentVariable
(
@RequestBody
JsonNode
para
)
{
return
fragmentVariableService
.
selectForProTable
(
para
);
return
fragmentVariableService
.
selectForProTable
(
para
);
}
}
/** 批量删除 */
/**
* delete by id
*
* @param id {@link Integer}
* @return {@link Result} of {@link Void}
*/
@DeleteMapping
(
"/delete"
)
public
Result
<
Void
>
deleteById
(
@RequestParam
Integer
id
)
{
if
(
fragmentVariableService
.
removeById
(
id
))
{
return
Result
.
succeed
(
MessageResolverUtils
.
getMessage
(
"delete.success"
));
}
else
{
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"delete.failed"
));
}
}
/**
* enable or disable
*
* @param id {@link Integer}
* @return {@link Result} of {@link Void}
*/
@PutMapping
(
"/enable"
)
public
Result
<
Void
>
enable
(
@RequestParam
Integer
id
)
{
if
(
fragmentVariableService
.
enable
(
id
))
{
return
Result
.
succeed
(
MessageResolverUtils
.
getMessage
(
"save.success"
));
}
else
{
return
Result
.
failed
(
MessageResolverUtils
.
getMessage
(
"save.failed"
));
}
}
/**
* batch delete , this method is deprecated, please use {@link #deleteById(Integer)}
*
* @param para {@link JsonNode}
* @return {@link Result} of {@link Void}
*/
@DeleteMapping
@DeleteMapping
@Deprecated
public
Result
<
Void
>
deleteMul
(
@RequestBody
JsonNode
para
)
{
public
Result
<
Void
>
deleteMul
(
@RequestBody
JsonNode
para
)
{
if
(
para
.
size
()
>
0
)
{
if
(
para
.
size
()
>
0
)
{
List
<
Integer
>
error
=
new
ArrayList
<>();
List
<
Integer
>
error
=
new
ArrayList
<>();
...
...
dinky-admin/src/main/java/org/dinky/service/FragmentVariableService.java
View file @
ac84664a
...
@@ -25,15 +25,28 @@ import org.dinky.model.FragmentVariable;
...
@@ -25,15 +25,28 @@ import org.dinky.model.FragmentVariable;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/** FragmentVariableService */
* FragmentVariableService
*
* @author zhumingye
* @since 2022/8/18
*/
public
interface
FragmentVariableService
extends
ISuperService
<
FragmentVariable
>
{
public
interface
FragmentVariableService
extends
ISuperService
<
FragmentVariable
>
{
/**
* list enabled all
*
* @return {@link List<FragmentVariable>}
*/
List
<
FragmentVariable
>
listEnabledAll
();
List
<
FragmentVariable
>
listEnabledAll
();
/**
* list enabled variables
*
* @return {@link Map<String, String>}
*/
Map
<
String
,
String
>
listEnabledVariables
();
Map
<
String
,
String
>
listEnabledVariables
();
/**
* enable or disable
*
* @param id
* @return {@link Boolean}
*/
Boolean
enable
(
Integer
id
);
}
}
dinky-admin/src/main/java/org/dinky/service/impl/FragmentVariableServiceImpl.java
View file @
ac84664a
...
@@ -30,14 +30,9 @@ import java.util.Map;
...
@@ -30,14 +30,9 @@ import java.util.Map;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.
Lambda
QueryWrapper
;
/**
/** FragmentVariableServiceImpl */
* FragmentVariableServiceImpl
*
* @author zhumingye
* @since 2022/8/18
*/
@Service
@Service
public
class
FragmentVariableServiceImpl
public
class
FragmentVariableServiceImpl
extends
SuperServiceImpl
<
FragmentVariableMapper
,
FragmentVariable
>
extends
SuperServiceImpl
<
FragmentVariableMapper
,
FragmentVariable
>
...
@@ -45,7 +40,7 @@ public class FragmentVariableServiceImpl
...
@@ -45,7 +40,7 @@ public class FragmentVariableServiceImpl
@Override
@Override
public
List
<
FragmentVariable
>
listEnabledAll
()
{
public
List
<
FragmentVariable
>
listEnabledAll
()
{
return
list
(
new
QueryWrapper
<
FragmentVariable
>().
eq
(
"enabled"
,
1
));
return
list
(
new
LambdaQueryWrapper
<
FragmentVariable
>().
eq
(
FragmentVariable:
:
getEnabled
,
1
));
}
}
@Override
@Override
...
@@ -56,4 +51,11 @@ public class FragmentVariableServiceImpl
...
@@ -56,4 +51,11 @@ public class FragmentVariableServiceImpl
}
}
return
variables
;
return
variables
;
}
}
@Override
public
Boolean
enable
(
Integer
id
)
{
FragmentVariable
fragmentVariable
=
getById
(
id
);
fragmentVariable
.
setEnabled
(!
fragmentVariable
.
getEnabled
());
return
updateById
(
fragmentVariable
);
}
}
}
dinky-web/.gitignore
View file @
ac84664a
...
@@ -41,3 +41,5 @@ screenshot
...
@@ -41,3 +41,5 @@ screenshot
build
build
pnpm-lock.yaml
pnpm-lock.yaml
.husky
dinky-web/config/routes.ts
View file @
ac84664a
...
@@ -114,12 +114,6 @@ export default [
...
@@ -114,12 +114,6 @@ export default [
},
},
],
],
},
},
{
path
:
'/registration/jar'
,
name
:
'jar'
,
icon
:
'FileZipOutlined'
,
// component: './RegistrationCenter/Jar',
},
{
{
path
:
'/registration/database'
,
path
:
'/registration/database'
,
name
:
'database'
,
name
:
'database'
,
...
@@ -153,7 +147,7 @@ export default [
...
@@ -153,7 +147,7 @@ export default [
path
:
'/registration/fragment'
,
path
:
'/registration/fragment'
,
name
:
'fragment'
,
name
:
'fragment'
,
icon
:
'RocketOutlined'
,
icon
:
'RocketOutlined'
,
// component: './RegistrationCenter/FragmentVariable
',
component
:
'./RegCenter/GlobalVar
'
,
},
},
],
],
},
},
...
...
dinky-web/package.json
View file @
ac84664a
...
@@ -62,6 +62,7 @@
...
@@ -62,6 +62,7 @@
"react"
:
"^18.2.0"
,
"react"
:
"^18.2.0"
,
"react-custom-scrollbars"
:
"^4.2.1"
,
"react-custom-scrollbars"
:
"^4.2.1"
,
"react-dev-inspector"
:
"^1.8.1"
,
"react-dev-inspector"
:
"^1.8.1"
,
"react-monaco-editor"
:
"^0.52.0"
,
"react-dom"
:
"^18.0.0"
,
"react-dom"
:
"^18.0.0"
,
"react-draggable"
:
"^4.4.5"
,
"react-draggable"
:
"^4.4.5"
,
"react-helmet-async"
:
"^1.3.0"
,
"react-helmet-async"
:
"^1.3.0"
,
...
@@ -85,15 +86,15 @@
...
@@ -85,15 +86,15 @@
"eslint"
:
"^8.35.0"
,
"eslint"
:
"^8.35.0"
,
"express"
:
"^4.18.2"
,
"express"
:
"^4.18.2"
,
"gh-pages"
:
"^5.0.0"
,
"gh-pages"
:
"^5.0.0"
,
"husky"
:
"^8
.0.3
"
,
"husky"
:
"^8"
,
"jest"
:
"^29.4.3"
,
"jest"
:
"^29.4.3"
,
"jest-environment-jsdom"
:
"^29.4.3"
,
"jest-environment-jsdom"
:
"^29.4.3"
,
"lint-staged"
:
"^13
.1.2
"
,
"lint-staged"
:
"^13"
,
"mockjs"
:
"^1.1.0"
,
"mockjs"
:
"^1.1.0"
,
"prettier"
:
"^2
.8.4
"
,
"prettier"
:
"^2"
,
"swagger-ui-dist"
:
"^4.16.1"
,
"swagger-ui-dist"
:
"^4.16.1"
,
"ts-node"
:
"^10.9.1"
,
"ts-node"
:
"^10.9.1"
,
"typescript"
:
"^4
.8.4
"
,
"typescript"
:
"^4"
,
"umi-presets-pro"
:
"^2.0.0"
"umi-presets-pro"
:
"^2.0.0"
},
},
"engines"
:
{
"engines"
:
{
...
...
dinky-web/src/app.tsx
View file @
ac84664a
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
*/
*/
import
Footer
from
"@/components/Footer"
;
import
Footer
from
"@/components/Footer"
;
import
RightContent
,
{
THEME
}
from
"@/components/RightContent"
;
import
RightContent
from
"@/components/RightContent"
;
import
{
Settings
as
LayoutSettings
}
from
"@ant-design/pro-components"
;
import
{
Settings
as
LayoutSettings
}
from
"@ant-design/pro-components"
;
// import {SettingDrawer} from "@ant-design/pro-components";
// import {SettingDrawer} from "@ant-design/pro-components";
import
type
{
RunTimeLayoutConfig
}
from
"@umijs/max"
;
import
type
{
RunTimeLayoutConfig
}
from
"@umijs/max"
;
...
@@ -25,6 +25,7 @@ import defaultSettings from "../config/defaultSettings";
...
@@ -25,6 +25,7 @@ import defaultSettings from "../config/defaultSettings";
import
{
errorConfig
}
from
"./requestErrorConfig"
;
import
{
errorConfig
}
from
"./requestErrorConfig"
;
import
{
currentUser
as
queryCurrentUser
}
from
"./services/BusinessCrud"
;
import
{
currentUser
as
queryCurrentUser
}
from
"./services/BusinessCrud"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
API_CONSTANTS
}
from
"@/services/constants"
;
import
{
THEME
}
from
"@/types/Public/data"
;
// const isDev = process.env.NODE_ENV === "development";
// const isDev = process.env.NODE_ENV === "development";
const
loginPath
=
API_CONSTANTS
.
LOGIN_PATH
;
const
loginPath
=
API_CONSTANTS
.
LOGIN_PATH
;
...
@@ -91,7 +92,7 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) =>
...
@@ -91,7 +92,7 @@ export const layout: RunTimeLayoutConfig = ({initialState, setInitialState}) =>
return
{
return
{
rightContentRender
:
()
=>
<
RightContent
/>,
rightContentRender
:
()
=>
<
RightContent
/>,
footerRender
:
()
=>
<
Footer
/>,
footerRender
:
()
=>
<
Footer
/>,
siderWidth
:
1
55
,
siderWidth
:
1
80
,
waterMarkProps
:
{
waterMarkProps
:
{
content
:
initialState
?.
currentUser
?.
user
.
username
+
" "
+
new
Date
().
toLocaleString
(),
content
:
initialState
?.
currentUser
?.
user
.
username
+
" "
+
new
Date
().
toLocaleString
(),
fontColor
:
theme
===
THEME
.
light
||
undefined
?
"rgba(0, 0, 0, 0.15)"
:
"rgba(255, 255, 255, 0.15)"
,
fontColor
:
theme
===
THEME
.
light
||
undefined
?
"rgba(0, 0, 0, 0.15)"
:
"rgba(255, 255, 255, 0.15)"
,
...
...
dinky-web/src/components/CustomMonacoEditor/CodeEdit/index.tsx
0 → 100644
View file @
ac84664a
/*
*
* 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
MonacoEditor
from
"react-monaco-editor"
;
import
{
ConvertCodeEditTheme
}
from
"@/utils/function"
;
import
{
MonacoEditorOptions
}
from
"@/types/Public/data"
;
export
type
CodeEditFormProps
=
{
height
?:
string
;
width
?:
string
;
language
?:
string
;
options
?:
any
;
onChange
:
(
val
:
string
)
=>
void
;
code
:
string
;
readOnly
?:
boolean
;
lineNumbers
?:
string
;
theme
?:
string
;
autoWrap
?:
string
;
};
const
CodeEdit
=
(
props
:
CodeEditFormProps
)
=>
{
/**
* 1. height: edit height
* 2. width: edit width
* 3. language: edit language
* 4. options: edit options
* 5. onChange: edit change callback
* 6. code: content
* 7. readOnly: is readOnly, value: true | false
* 8. lineNumbers: is show lineNumbers, value: on | off | relative | interval
* 9. theme: edit theme , value: vs-dark | vs | hc-black
* 10. autoWrap: is auto wrap, value: on | off | wordWrapColumn | bounded
*/
const
{
height
=
'100%'
,
// if null or undefined, set default value
width
=
'100%'
,
// if null or undefined, set default value
language
,
// edit language
options
=
{
...
MonacoEditorOptions
,
// set default options
},
onChange
,
// edit change callback
code
,
// content
readOnly
=
false
,
// is readOnly
lineNumbers
,
// show lineNumbers
theme
,
// edit theme
autoWrap
=
'on'
,
// auto wrap
}
=
props
;
return
(<>
<
MonacoEditor
width=
{
width
}
height=
{
height
}
value=
{
code
}
options=
{
{
...
options
,
readOnly
,
wordWrap
:
autoWrap
,
lineNumbers
,
language
}
}
onChange=
{
onChange
}
theme=
{
theme
?
theme
:
ConvertCodeEditTheme
()
}
/>
</>)
};
export
default
CodeEdit
;
dinky-web/src/components/CustomMonacoEditor/CodeShow/index.tsx
0 → 100644
View file @
ac84664a
/*
*
* 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
MonacoEditor
from
"react-monaco-editor"
;
import
{
ConvertCodeEditTheme
}
from
"@/utils/function"
;
import
{
MonacoEditorOptions
}
from
"@/types/Public/data"
;
export
type
CodeShowFormProps
=
{
height
?:
string
;
width
?:
string
;
language
?:
string
;
options
?:
any
;
code
:
string
;
lineNumbers
?:
string
;
theme
?:
string
;
autoWrap
?:
string
;
};
const
CodeShow
=
(
props
:
CodeShowFormProps
)
=>
{
/**
* 1. height: edit height
* 2. width: edit width
* 3. language: edit language
* 4. options: edit options
* 5. code: content
* 6. readOnly: is readOnly, value: true | false
* 7. lineNumbers: is show lineNumbers, value: on | off | relative | interval
* 8. theme: edit theme , value: vs-dark | vs | hc-black
* 9. autoWrap: is auto wrap, value: on | off | wordWrapColumn | bounded
*/
const
{
height
=
'30vh'
,
// if null or undefined, set default value
width
=
'100%'
,
// if null or undefined, set default value
language
,
options
=
{
...
MonacoEditorOptions
,
// set default options
},
code
,
// content
lineNumbers
,
// show lineNumbers
theme
,
// edit theme
autoWrap
=
'on'
,
// auto wrap
}
=
props
;
return
(<>
<
MonacoEditor
width=
{
width
}
height=
{
height
}
value=
{
code
}
options=
{
{
...
options
,
readOnly
:
true
,
wordWrap
:
autoWrap
,
lineNumbers
,
language
}
}
theme=
{
theme
?
theme
:
ConvertCodeEditTheme
()
}
/>
</>)
};
export
default
CodeShow
;
dinky-web/src/components/RightContent/index.tsx
View file @
ac84664a
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
*/
*/
import
{
VERSION
}
from
"@/services/constants"
;
import
{
VERSION
}
from
"@/services/constants"
;
import
{
parseJsonStr
,
setTenantStorageAndCookie
}
from
"@/
service
s/function"
;
import
{
parseJsonStr
,
setTenantStorageAndCookie
}
from
"@/
util
s/function"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
l
}
from
"@/utils/intl"
;
import
{
import
{
FullscreenExitOutlined
,
FullscreenExitOutlined
,
...
@@ -34,12 +34,8 @@ import Avatar from "./AvatarDropdown";
...
@@ -34,12 +34,8 @@ import Avatar from "./AvatarDropdown";
import
{
ThemeCloud
,
ThemeStar
}
from
"@/components/ThemeSvg/ThemeSvg"
;
import
{
ThemeCloud
,
ThemeStar
}
from
"@/components/ThemeSvg/ThemeSvg"
;
import
{
chooseTenantSubmit
}
from
"@/services/BusinessCrud"
;
import
{
chooseTenantSubmit
}
from
"@/services/BusinessCrud"
;
import
{
ErrorNotification
,
SuccessNotification
}
from
"@/utils/messages"
;
import
{
ErrorNotification
,
SuccessNotification
}
from
"@/utils/messages"
;
import
{
THEME
}
from
"@/types/Public/data"
;
export
const
THEME
=
{
NAV_THEME
:
"navTheme"
,
dark
:
"realDark"
,
light
:
"light"
,
}
const
GlobalHeaderRight
:
React
.
FC
=
()
=>
{
const
GlobalHeaderRight
:
React
.
FC
=
()
=>
{
/**
/**
...
...
dinky-web/src/locales/en-US/menu.ts
View file @
ac84664a
...
@@ -50,7 +50,7 @@ export default {
...
@@ -50,7 +50,7 @@ export default {
'menu.registration.alert.group'
:
'Alarm Group'
,
'menu.registration.alert.group'
:
'Alarm Group'
,
'menu.registration.document'
:
'Document'
,
'menu.registration.document'
:
'Document'
,
'menu.registration.fragment'
:
'Global Variable'
,
'menu.registration.fragment'
:
'Global Variable'
,
'menu.auth'
:
'Auth
entication
Center'
,
'menu.auth'
:
'Auth Center'
,
'menu.auth.user'
:
'User'
,
'menu.auth.user'
:
'User'
,
'menu.auth.role'
:
'Role'
,
'menu.auth.role'
:
'Role'
,
'menu.auth.namespace'
:
'NameSpace'
,
'menu.auth.namespace'
:
'NameSpace'
,
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
ac84664a
...
@@ -697,22 +697,16 @@ export default {
...
@@ -697,22 +697,16 @@ export default {
'rc.doc.subTypePlaceholder'
:
'Please select the function type this Document belongs to!'
,
'rc.doc.subTypePlaceholder'
:
'Please select the function type this Document belongs to!'
,
'rc.doc.categoryPlaceholder'
:
'Please select the type of this Document!'
,
'rc.doc.categoryPlaceholder'
:
'Please select the type of this Document!'
,
'rc.fv.Management'
:
'Global Variable Management'
,
'rc.gv.Management'
:
'Global Variable Management'
,
'rc.fv.id'
:
'Global Variable ID'
,
'rc.gv.id'
:
'Global Variable ID'
,
'rc.fv.name'
:
'Name'
,
'rc.gv.name'
:
'Name'
,
'rc.fv.fragmentValue'
:
'Global Variable value'
,
'rc.gv.value'
:
'Value'
,
'rc.fv.create'
:
'Create Global Variable'
,
'rc.gv.create'
:
'Create Global Variable'
,
'rc.fv.modify'
:
'Modify Global Variables'
,
'rc.gv.modify'
:
'Modify Global Variables'
,
'rc.fv.delete'
:
'Delete Global Variable'
,
'rc.gv.delete'
:
'Delete Global Variable'
,
'rc.fv.deleteConfirm'
:
'Are you sure you want to delete the selected Global Variable? '
,
'rc.gv.deleteConfirm'
:
'Are you sure you want to delete this Global Variable? '
,
'rc.fv.enable'
:
'Enable Global Variables'
,
'rc.gv.namePlaceholder'
:
'Please enter a name!'
,
'rc.fv.enableConfirm'
:
'Are you sure to enable the selected Global Variable? '
,
'rc.gv.valuePlaceholder'
:
'Please enter the Global Variable value'
,
'rc.fv.disable'
:
'Disable Global Variables'
,
'rc.fv.disableConfirm'
:
'Are you sure you want to disable the selected Global Variable? '
,
'rc.fv.disableTotalOf'
:
'Total Of {total} Global Variables Is Disabled'
,
'rc.fv.namePlaceholder'
:
'Please enter a name!'
,
'rc.fv.fragmentValuePlaceholder'
:
'Please enter the Global Variable value'
,
'rc.fv.enabledPlaceholder'
:
'Please choose whether to enable!'
,
'task.api.job.async'
:
'Asynchronous submit'
,
'task.api.job.async'
:
'Asynchronous submit'
,
'task.api.job.stop'
:
'Stop job'
,
'task.api.job.stop'
:
'Stop job'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
ac84664a
...
@@ -691,22 +691,16 @@ export default {
...
@@ -691,22 +691,16 @@ export default {
'rc.doc.categoryPlaceholder'
:
'请选择该文档所属类型!'
,
'rc.doc.categoryPlaceholder'
:
'请选择该文档所属类型!'
,
'rc.fv.Management'
:
'全局变量管理'
,
'rc.gv.Management'
:
'全局变量管理'
,
'rc.fv.id'
:
'全局变量 ID'
,
'rc.gv.id'
:
'全局变量 ID'
,
'rc.fv.name'
:
'名称'
,
'rc.gv.name'
:
'名称'
,
'rc.fv.fragmentValue'
:
'全局变量值'
,
'rc.gv.value'
:
'变量值'
,
'rc.fv.create'
:
'创建全局变量'
,
'rc.gv.create'
:
'创建全局变量'
,
'rc.fv.modify'
:
'修改全局变量'
,
'rc.gv.modify'
:
'修改全局变量'
,
'rc.fv.delete'
:
'删除全局变量'
,
'rc.gv.delete'
:
'删除全局变量'
,
'rc.fv.deleteConfirm'
:
'确定删除选中的全局变量吗?'
,
'rc.gv.deleteConfirm'
:
'确定删除该全局变量吗?'
,
'rc.fv.enable'
:
'启用全局变量'
,
'rc.gv.namePlaceholder'
:
'请输入名称!'
,
'rc.fv.enableConfirm'
:
'确定启用选中的全局变量吗?'
,
'rc.gv.valuePlaceholder'
:
'请输入全局变量值'
,
'rc.fv.disable'
:
'禁用全局变量'
,
'rc.fv.disableConfirm'
:
'确定禁用选中的全局变量吗?'
,
'rc.fv.disableTotalOf'
:
'被禁用的全局变量共 {total} 个'
,
'rc.fv.namePlaceholder'
:
'请输入名称!'
,
'rc.fv.fragmentValuePlaceholder'
:
'请输入全局变量值'
,
'rc.fv.enabledPlaceholder'
:
'请选择是否启用!'
,
'task.api.job.async'
:
'异步提交'
,
'task.api.job.async'
:
'异步提交'
,
'task.api.job.stop'
:
'停止作业'
,
'task.api.job.stop'
:
'停止作业'
,
...
...
dinky-web/src/pages/AuthCenter/Role/index.tsx
View file @
ac84664a
...
@@ -29,7 +29,7 @@ import {queryList} from "@/services/api";
...
@@ -29,7 +29,7 @@ import {queryList} from "@/services/api";
import
{
API_CONSTANTS
,
PROTABLE_OPTIONS_PUBLIC
}
from
"@/services/constants"
;
import
{
API_CONSTANTS
,
PROTABLE_OPTIONS_PUBLIC
}
from
"@/services/constants"
;
import
RoleForm
from
"./components/RoleForm"
;
import
RoleForm
from
"./components/RoleForm"
;
import
{
DangerDeleteIcon
}
from
"@/components/Icons/CustomIcons"
;
import
{
DangerDeleteIcon
}
from
"@/components/Icons/CustomIcons"
;
import
{
getTenantByLocalStorage
}
from
"@/
service
s/function"
;
import
{
getTenantByLocalStorage
}
from
"@/
util
s/function"
;
const
RoleList
:
React
.
FC
=
()
=>
{
const
RoleList
:
React
.
FC
=
()
=>
{
...
...
dinky-web/src/pages/AuthCenter/Tenant/index.tsx
View file @
ac84664a
...
@@ -100,7 +100,7 @@ const TenantFormList: React.FC = () => {
...
@@ -100,7 +100,7 @@ const TenantFormList: React.FC = () => {
title=
{
l
(
'tenant.AssignUser'
)
}
title=
{
l
(
'tenant.AssignUser'
)
}
open=
{
handleGrantTenant
}
open=
{
handleGrantTenant
}
destroyOnClose
destroyOnClose
width=
{
"
90
%"
}
width=
{
"
75
%"
}
onCancel=
{
()
=>
{
setHandleGrantTenant
(
false
)}
}
onCancel=
{
()
=>
{
setHandleGrantTenant
(
false
)}
}
onOk=
{
handleAssignUserSubmit
}
onOk=
{
handleAssignUserSubmit
}
>
>
...
...
dinky-web/src/pages/Other/Login/index.tsx
View file @
ac84664a
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
import
Footer
from
'@/components/Footer'
;
import
Footer
from
'@/components/Footer'
;
import
{
setTenantStorageAndCookie
}
from
'@/
service
s/function'
;
import
{
setTenantStorageAndCookie
}
from
'@/
util
s/function'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
LockOutlined
,
UserOutlined
}
from
'@ant-design/icons'
;
import
{
LockOutlined
,
UserOutlined
}
from
'@ant-design/icons'
;
import
{
CheckCard
,
LoginForm
,
ProFormCheckbox
,
ProFormText
}
from
'@ant-design/pro-components'
;
import
{
CheckCard
,
LoginForm
,
ProFormCheckbox
,
ProFormText
}
from
'@ant-design/pro-components'
;
...
...
dinky-web/src/pages/RegCenter/GlobalVar/components/GlobalVarForm.tsx
0 → 100644
View file @
ac84664a
/*
*
* 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
,
{
useState
}
from
'react'
;
import
{
Form
,
Modal
}
from
'antd'
;
import
{
l
}
from
"@/utils/intl"
;
import
{
GlobalVar
}
from
"@/types/RegCenter/data"
;
import
{
ProForm
,
ProFormItem
,
ProFormSwitch
,
ProFormText
,
ProFormTextArea
}
from
"@ant-design/pro-components"
;
import
{
FORM_LAYOUT_PUBLIC
,
NORMAL_MODAL_OPTIONS
,
PROTABLE_OPTIONS_PUBLIC
}
from
"@/services/constants"
;
import
CodeEdit
from
"@/components/CustomMonacoEditor/CodeEdit"
;
/**
* params
*/
export
type
GlobalVarFormProps
=
{
onCancel
:
(
flag
?:
boolean
)
=>
void
;
onSubmit
:
(
values
:
GlobalVar
)
=>
void
;
modalVisible
:
boolean
;
values
:
Partial
<
GlobalVar
>
;
};
/**
* global variable code edit props
*/
const
CodeEditProps
=
{
height
:
"25vh"
,
lineNumbers
:
"on"
,
}
const
GlobalVarForm
:
React
.
FC
<
GlobalVarFormProps
>
=
(
props
:
any
)
=>
{
const
[
globalVarValue
,
setGlobalVarValue
]
=
useState
<
string
>
(
props
.
values
.
fragmentValue
||
''
);
const
[
form
]
=
Form
.
useForm
();
const
[
formVals
,
setFormVals
]
=
useState
<
GlobalVar
>
({
id
:
props
.
values
.
id
,
name
:
props
.
values
.
name
,
fragmentValue
:
props
.
values
.
fragmentValue
,
note
:
props
.
values
.
note
,
enabled
:
props
.
values
.
enabled
,
createTime
:
props
.
values
.
createTime
,
updateTime
:
props
.
values
.
updateTime
,
});
const
{
onSubmit
:
handleSubmit
,
onCancel
:
handleModalVisible
,
modalVisible
,
}
=
props
;
const
submitForm
=
async
()
=>
{
const
fieldsValue
=
await
form
.
validateFields
();
fieldsValue
.
id
=
formVals
.
id
;
setFormVals
({...
formVals
,
...
fieldsValue
});
handleSubmit
({...
formVals
,
...
fieldsValue
});
};
const
handleGlobalVarChange
=
(
value
:
string
)
=>
{
setGlobalVarValue
(
value
);
}
const
GlobalVarRender
=
()
=>
{
return
(
<>
<
ProFormText
name=
"name"
label=
{
l
(
'rc.gv.name'
)
}
placeholder=
{
l
(
'rc.gv.namePlaceholder'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.gv.namePlaceholder'
)}]
}
/>
<
ProFormTextArea
name=
"note"
label=
{
l
(
'global.table.note'
)
}
placeholder=
{
l
(
'global.table.notePlaceholder'
)
}
allowClear
/>
<
ProFormSwitch
name=
"enabled"
label=
{
l
(
'global.table.isEnable'
)
}
checkedChildren=
{
l
(
'button.enable'
)
}
unCheckedChildren=
{
l
(
'button.disable'
)
}
/>
<
ProFormItem
name=
"fragmentValue"
label=
{
l
(
'rc.gv.value'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.gv.valuePlaceholder'
)}]
}
>
<
CodeEdit
onChange=
{
(
value
=>
{
handleGlobalVarChange
(
value
)})
}
code=
{
globalVarValue
}
language=
{
"sql"
}
{
...
CodeEditProps
}
/>
</
ProFormItem
>
</>
);
};
return
(
<
Modal
{
...
NORMAL_MODAL_OPTIONS
}
title=
{
formVals
.
id
?
l
(
'rc.gv.modify'
)
:
l
(
'rc.gv.create'
)
}
open=
{
modalVisible
}
onOk=
{
()
=>
submitForm
()
}
onCancel=
{
()
=>
handleModalVisible
()
}
>
<
ProForm
{
...
FORM_LAYOUT_PUBLIC
}
layout=
{
"horizontal"
}
submitter=
{
false
}
form=
{
form
}
initialValues=
{
formVals
}
>
{
GlobalVarRender
()
}
</
ProForm
>
</
Modal
>
);
};
export
default
GlobalVarForm
;
dinky-web/src/pages/RegCenter/GlobalVar/index.tsx
0 → 100644
View file @
ac84664a
/*
*
* 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
{
EditTwoTone
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
Button
,
Drawer
,
Form
,
Popconfirm
,
Space
,
Switch
}
from
'antd'
;
import
React
,
{
useRef
,
useState
}
from
'react'
;
import
{
PageContainer
}
from
'@ant-design/pro-layout'
;
import
type
{
ActionType
,
ProColumns
}
from
'@ant-design/pro-table'
;
import
ProTable
from
'@ant-design/pro-table'
;
import
ProDescriptions
from
'@ant-design/pro-descriptions'
;
import
{
l
}
from
"@/utils/intl"
;
import
{
GlobalVar
}
from
"@/types/RegCenter/data"
;
import
{
API_CONSTANTS
,
PROTABLE_OPTIONS_PUBLIC
,
STATUS_ENUM
,
STATUS_MAPPING
}
from
"@/services/constants"
;
import
{
DangerDeleteIcon
}
from
"@/components/Icons/CustomIcons"
;
import
{
handleAddOrUpdate
,
handleRemoveById
,
updateEnabled
}
from
"@/services/BusinessCrud"
;
import
GlobalVarForm
from
"@/pages/RegCenter/GlobalVar/components/GlobalVarForm"
;
import
{
queryList
}
from
"@/services/api"
;
import
CodeShow
from
"@/components/CustomMonacoEditor/CodeShow"
;
const
GlobalVarList
:
React
.
FC
=
(
props
:
any
)
=>
{
/**
* state
*/
const
[
modalVisible
,
handleModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
updateModalVisible
,
handleUpdateModalVisible
]
=
useState
<
boolean
>
(
false
);
const
[
formValues
,
setFormValues
]
=
useState
({});
const
actionRef
=
useRef
<
ActionType
>
();
const
[
row
,
setRow
]
=
useState
<
GlobalVar
>
();
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
/**
* var enable or disable
* @param value
*/
const
handleChangeEnable
=
async
(
value
:
GlobalVar
)
=>
{
setLoading
(
true
);
await
updateEnabled
(
API_CONSTANTS
.
GLOBAL_VARIABLE_ENABLE
,
{
id
:
value
.
id
});
setLoading
(
false
);
actionRef
.
current
?.
reload
?.();
};
/**
* delete role by id
* @param id role id
*/
const
handleDeleteSubmit
=
async
(
id
:
number
)
=>
{
await
handleRemoveById
(
API_CONSTANTS
.
GLOBAL_VARIABLE_DELETE
,
id
);
actionRef
.
current
?.
reloadAndRest
?.();
}
/**
* added global var
* @param value
*/
const
handleAddSubmit
=
async
(
value
:
GlobalVar
)
=>
{
const
success
=
await
handleAddOrUpdate
(
API_CONSTANTS
.
GLOBAL_VARIABLE
,
value
);
if
(
success
)
{
handleModalVisible
(
!
modalVisible
);
setFormValues
({});
if
(
actionRef
.
current
)
{
actionRef
.
current
.
reload
();
}
}
}
/**
* update global var
* @param value
*/
const
handleUpdateSubmit
=
async
(
value
:
GlobalVar
)
=>
{
const
success
=
await
handleAddOrUpdate
(
API_CONSTANTS
.
GLOBAL_VARIABLE
,
value
);
if
(
success
)
{
handleUpdateModalVisible
(
!
updateModalVisible
);
setFormValues
({});
if
(
actionRef
.
current
)
{
actionRef
.
current
.
reload
();
}
}
}
/**
* columns
*/
const
columns
:
ProColumns
<
GlobalVar
>
[]
=
[
{
title
:
l
(
'rc.gv.name'
),
dataIndex
:
'name'
,
sorter
:
true
,
render
:
(
dom
,
entity
)
=>
{
return
<
a
onClick=
{
()
=>
setRow
(
entity
)
}
>
{
dom
}
</
a
>;
},
},
{
title
:
l
(
'rc.gv.value'
),
dataIndex
:
'fragmentValue'
,
hideInTable
:
true
,
render
:
(
_
,
record
)
=>
{
return
<
CodeShow
code=
{
record
.
fragmentValue
}
/>
},
},
{
title
:
l
(
'global.table.note'
),
dataIndex
:
'note'
,
valueType
:
'textarea'
,
},
{
title
:
l
(
"global.table.isEnable"
),
dataIndex
:
"enabled"
,
hideInSearch
:
true
,
width
:
'15vh'
,
render
:
(
_
,
record
)
=>
{
return
<>
<
Space
>
<
Switch
key=
{
record
.
id
}
checkedChildren=
{
l
(
"status.enabled"
)
}
unCheckedChildren=
{
l
(
"status.disabled"
)
}
checked=
{
record
.
enabled
}
onChange=
{
()
=>
handleChangeEnable
(
record
)
}
/>
</
Space
>
</>;
},
filters
:
STATUS_MAPPING
(),
filterMultiple
:
false
,
valueEnum
:
STATUS_ENUM
(),
},
{
title
:
l
(
'global.table.createTime'
),
dataIndex
:
'createTime'
,
hideInSearch
:
true
,
width
:
'20vh'
,
sorter
:
true
,
valueType
:
'dateTime'
,
},
{
title
:
l
(
'global.table.lastUpdateTime'
),
dataIndex
:
'updateTime'
,
width
:
'20vh'
,
hideInSearch
:
true
,
sorter
:
true
,
valueType
:
'dateTime'
,
},
{
title
:
l
(
'global.table.operate'
),
width
:
'20vh'
,
valueType
:
'option'
,
render
:
(
_
,
record
)
=>
[
<
Button
className=
{
"options-button"
}
key=
{
"GlobalVarEdit"
}
icon=
{
<
EditTwoTone
/>
}
title=
{
l
(
"button.edit"
)
}
onClick=
{
()
=>
{
setFormValues
(
record
);
handleUpdateModalVisible
(
true
);
}
}
/>,
<
Popconfirm
placement=
"topRight"
title=
{
l
(
"button.delete"
)
}
description=
{
l
(
"rc.gv.deleteConfirm"
)
}
onConfirm=
{
()
=>
{
handleDeleteSubmit
(
record
.
id
);
}
}
okText=
{
l
(
"button.confirm"
)
}
cancelText=
{
l
(
"button.cancel"
)
}
>
<
Button
key=
{
'DeleteGlobalVarIcon'
}
icon=
{
<
DangerDeleteIcon
/>
}
/>
</
Popconfirm
>
],
},
];
/**
* render
*/
return
(
<
PageContainer
title=
{
false
}
>
{
/*table*/
}
<
ProTable
<
GlobalVar
>
headerTitle=
{
l
(
'rc.gv.Management'
)
}
actionRef=
{
actionRef
}
loading=
{
loading
}
{
...
PROTABLE_OPTIONS_PUBLIC
}
toolBarRender=
{
()
=>
[
<
Button
type=
"primary"
onClick=
{
()
=>
handleModalVisible
(
true
)
}
>
<
PlusOutlined
/>
{
l
(
'button.create'
)
}
</
Button
>,
]
}
request=
{
(
params
,
sorter
,
filter
:
any
)
=>
queryList
(
API_CONSTANTS
.
GLOBAL_VARIABLE
,
{...
params
,
sorter
,
filter
})
}
columns=
{
columns
}
/
>
{
/*add*/
}
<
GlobalVarForm
onSubmit=
{
(
value
:
GlobalVar
)
=>
{
handleAddSubmit
(
value
)}
}
onCancel=
{
()
=>
{
handleModalVisible
(
!
modalVisible
)
}
}
modalVisible=
{
modalVisible
}
values=
{
{}
}
/>
{
/*update*/
}
{
formValues
&&
Object
.
keys
(
formValues
).
length
?
(
<
GlobalVarForm
onSubmit=
{
(
value
:
GlobalVar
)
=>
{
handleUpdateSubmit
(
value
)}
}
onCancel=
{
()
=>
{
handleUpdateModalVisible
(
!
updateModalVisible
)
setFormValues
({});
}
}
modalVisible=
{
updateModalVisible
}
values=
{
formValues
}
/>
)
:
null
}
{
/*drawer render*/
}
<
Drawer
extra=
{
undefined
}
width=
{
600
}
visible=
{
!!
row
}
onClose=
{
()
=>
{
setRow
(
undefined
);
}
}
closable=
{
false
}
>
{
row
?.
name
&&
(
<
ProDescriptions
<
GlobalVar
>
column=
{
1
}
title=
{
row
.
name
}
request=
{
async
()
=>
({
data
:
row
,
})
}
params=
{
{
id
:
row
.
id
,
}
}
columns=
{
columns
as
any
}
/
>
)
}
</
Drawer
>
</
PageContainer
>
);
};
export default GlobalVarList;
dinky-web/src/pages/RegistrationCenter/.ignore
deleted
100644 → 0
View file @
f8c8d925
dinky-web/src/services/constants.ts
View file @
ac84664a
...
@@ -62,6 +62,13 @@ export const API_CONSTANTS = {
...
@@ -62,6 +62,13 @@ export const API_CONSTANTS = {
ROLE_ADDED_OR_UPDATE
:
"/api/role/addedOrUpdateRole"
,
ROLE_ADDED_OR_UPDATE
:
"/api/role/addedOrUpdateRole"
,
ROLE_DELETE
:
"/api/role/delete"
,
ROLE_DELETE
:
"/api/role/delete"
,
// --- global variable ---
// global variable list
GLOBAL_VARIABLE
:
"/api/fragment"
,
// delete global variable by id
GLOBAL_VARIABLE_DELETE
:
"/api/fragment/delete"
,
// global variable enable or disable
GLOBAL_VARIABLE_ENABLE
:
"/api/fragment/enable"
,
};
};
...
@@ -126,8 +133,8 @@ export const RESPONSE_CODE = {
...
@@ -126,8 +133,8 @@ export const RESPONSE_CODE = {
* the form layout of public
* the form layout of public
*/
*/
export
const
FORM_LAYOUT_PUBLIC
=
{
export
const
FORM_LAYOUT_PUBLIC
=
{
labelCol
:
{
span
:
7
},
labelCol
:
{
span
:
5
},
wrapperCol
:
{
span
:
1
3
},
wrapperCol
:
{
span
:
1
5
},
};
};
/**
/**
...
@@ -148,7 +155,7 @@ export const PROTABLE_OPTIONS_PUBLIC = {
...
@@ -148,7 +155,7 @@ export const PROTABLE_OPTIONS_PUBLIC = {
*/
*/
export
const
NORMAL_MODAL_OPTIONS
=
{
export
const
NORMAL_MODAL_OPTIONS
=
{
width
:
"40%"
,
width
:
"40%"
,
bodyStyle
:
{
padding
:
"
32px 40px 48
px"
},
bodyStyle
:
{
padding
:
"
20px 10px 10
px"
},
destroyOnClose
:
true
,
destroyOnClose
:
true
,
};
};
...
...
dinky-web/src/
services/function
.ts
→
dinky-web/src/
types/Public/data
.ts
View file @
ac84664a
...
@@ -15,33 +15,35 @@
...
@@ -15,33 +15,35 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
{
TENANT_ID
}
from
"@/services/constants"
;
import
cookies
from
"js-cookie"
;
/**
/**
* PUT tenantId TO localStorage & cookies
* theme of nav
* @param tenantId
*/
*/
export
function
setTenantStorageAndCookie
(
tenantId
:
number
)
{
export
const
THEME
=
{
// save as localStorage
NAV_THEME
:
"navTheme"
,
localStorage
.
setItem
(
TENANT_ID
,
tenantId
.
toString
());
dark
:
"realDark"
,
// save as cookies
light
:
"light"
,
cookies
.
set
(
TENANT_ID
,
tenantId
.
toString
(),
{
path
:
"/"
});
};
}
/**
* get tenant id
* @param tenantId
*/
export
function
getTenantByLocalStorage
()
{
return
localStorage
.
getItem
(
TENANT_ID
);
}
/**
/**
* parseJsonStr
* MonacoEditor of CodeEdit's theme
* @param jsonStr
*/
*/
export
function
parseJsonStr
(
jsonStr
:
string
)
{
export
const
CODE_EDIT_THEME
=
{
return
JSON
.
parse
(
JSON
.
stringify
(
jsonStr
));
VS
:
"vs"
,
}
DARK
:
"vs-dark"
,
HC_BLACK
:
"hc-black"
,
VS_CUSTOME
:
"vs-custom"
,
};
export
const
MonacoEditorOptions
=
{
// selectOnLineNumbers: true,
renderSideBySide
:
false
,
// side by side
autoIndent
:
'None'
,
// auto indent
fontSize
:
16
,
// font size
automaticLayout
:
true
,
// auto layout
scrollBeyondLastLine
:
false
,
//is scroll beyond the last line
autoDetectHighContrast
:
true
,
// auto detect high contrast
}
dinky-web/src/types/RegCenter/data.d.ts
0 → 100644
View file @
ac84664a
/*
* 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.
*/
/**
* about alert
*/
declare
namespace
Alert
{
/**
* alert group
*/
export
type
AlertGroup
=
{
id
:
number
,
name
:
string
,
alertInstanceIds
:
string
,
note
:
string
,
enabled
:
boolean
,
createTime
:
Date
,
updateTime
:
Date
,
};
/**
* alert instance
*/
export
type
AlertInstance
=
{
id
:
number
,
name
:
string
,
type
:
string
,
params
:
string
,
enabled
:
boolean
,
createTime
:
Date
,
updateTime
:
Date
,
};
}
/**
* about flink cluster
*/
declare
namespace
Cluster
{
/**
* flink cluster instance
* mainly used for `yarn session` `standalone`
*/
export
type
ClusterInstance
=
{
id
:
number
,
name
:
string
,
alias
:
string
,
type
:
string
,
hosts
:
string
,
jobManagerHost
:
string
,
autoRegisters
:
boolean
,
version
:
string
,
status
:
number
,
note
:
string
,
enabled
:
boolean
,
createTime
:
Date
,
updateTime
:
Date
,
};
/**
* flink cluster config
* mainly used for `projob` `application` `k8s` and start a new session cluster
*/
export
type
ClusterConfig
=
{
id
:
number
,
name
:
string
,
type
:
string
,
config
:
any
,
configJson
:
string
,
isAvailable
:
boolean
,
note
:
string
,
enabled
:
boolean
,
createTime
:
Date
,
updateTime
:
Date
,
};
}
/**
* about database and metadata
*/
declare
namespace
DataBases
{
/**
* database info
*/
export
type
DataBase
=
{
id
:
number
,
name
:
string
,
groupName
:
string
,
type
:
string
,
url
:
string
,
username
:
string
,
password
:
string
,
note
:
string
,
flinkConfig
:
string
,
flinkTemplate
:
string
,
dbVersion
:
string
,
status
:
boolean
,
healthTime
:
Date
,
heartbeatTime
:
Date
,
enabled
:
boolean
,
createTime
:
Date
,
updateTime
:
Date
,
};
/**
* table info
*/
export
type
Table
=
{
name
:
string
,
schema
:
string
,
catalog
:
string
,
comment
:
string
,
type
:
string
,
engine
:
string
,
options
:
string
,
rows
:
number
,
createTime
:
string
,
updateTime
:
string
,
};
/**
* table columns info
*/
export
type
Column
=
{
name
:
string
,
type
:
string
,
comment
:
string
,
keyFlag
:
boolean
,
autoIncrement
:
boolean
,
defaultValue
:
string
,
nullable
:
string
,
javaType
:
string
,
columnFamily
:
string
,
position
:
number
,
precision
:
number
,
scale
:
number
,
characterSet
:
string
,
collation
:
string
,
};
}
/**
* about document
*/
export
type
Document
=
{
id
:
number
,
name
:
string
,
category
:
string
,
type
:
string
,
subtype
:
string
,
description
:
string
,
fillValue
:
string
,
version
:
string
,
likeNum
:
number
,
enabled
:
boolean
,
createTime
:
Date
,
updateTime
:
Date
,
};
/**
* global variable
*/
export
type
GlobalVar
=
{
id
:
number
,
name
:
string
,
fragmentValue
:
string
,
note
:
string
,
enabled
:
boolean
,
createTime
:
Date
,
updateTime
:
Date
,
};
dinky-web/src/utils/function.ts
0 → 100644
View file @
ac84664a
/*
* 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
{
TENANT_ID
}
from
"@/services/constants"
;
import
cookies
from
"js-cookie"
;
import
{
THEME
,
CODE_EDIT_THEME
}
from
"@/types/Public/data"
;
import
{
editor
}
from
"monaco-editor"
;
/**
* PUT tenantId TO localStorage & cookies
* @param tenantId
*/
export
function
setTenantStorageAndCookie
(
tenantId
:
number
)
{
// save as localStorage
localStorage
.
setItem
(
TENANT_ID
,
tenantId
.
toString
());
// save as cookies
cookies
.
set
(
TENANT_ID
,
tenantId
.
toString
(),
{
path
:
"/"
});
}
/**
* get tenant id
* @param tenantId
*/
export
function
getTenantByLocalStorage
()
{
return
localStorage
.
getItem
(
TENANT_ID
);
}
/**
* parseJsonStr
* @param jsonStr
*/
export
function
parseJsonStr
(
jsonStr
:
string
)
{
return
JSON
.
parse
(
JSON
.
stringify
(
jsonStr
));
}
/**
* get theme by localStorage's theme
*/
export
function
getLocalTheme
()
{
return
localStorage
.
getItem
(
THEME
.
NAV_THEME
);
}
/**
* get code edit theme by localStorage's theme
* @constructor
*/
export
function
ConvertCodeEditTheme
()
{
/**
* user can define a new theme by calling the defineTheme method on the editor.
*/
editor
.
defineTheme
(
CODE_EDIT_THEME
.
VS_CUSTOME
,
{
base
:
'vs'
,
// 指定基础主题 , 可选值: 'vs', 'vs-dark', 'hc-black' , base theme
inherit
:
true
,
// 是否继承基础主题配置 , 默认为 true, is to inherit the base theme
// rules is an array of rules. The array must not be sparse (i.e. do not use holes).
rules
:
[
{
token
:
'comment'
,
foreground
:
'#008800'
,
fontStyle
:
'italic'
},
{
token
:
'keyword'
,
foreground
:
'#f30282'
,
fontStyle
:
'bold'
},
{
token
:
'string'
,
foreground
:
'#0b14cc'
},
{
token
:
'delimiter'
,
foreground
:
'#ffffff'
}
],
// colors is an object of color identifiers and their color values.
colors
:
{
'editor.background'
:
'#141414'
,
// editor background color
'editor.lineHighlightBackground'
:
'#0000ff20'
,
// editor line highlight background color
'editorLineNumber.foreground'
:
'#ffffff'
,
// editor line number color
'editorCursor.foreground'
:
'#ffffff'
,
// editor cursor color
'editorIndentGuide.background'
:
'#ffffff'
,
// editor indent guide color
'editor.foreground'
:
'#ffffff'
,
// editor selection highlight border color
}
});
const
theme
=
getLocalTheme
();
switch
(
theme
)
{
case
THEME
.
dark
:
return
CODE_EDIT_THEME
.
VS_CUSTOME
;
case
THEME
.
light
:
return
CODE_EDIT_THEME
.
DARK
;
default
:
return
CODE_EDIT_THEME
.
HC_BLACK
;
}
}
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