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
1dc4bef7
Unverified
Commit
1dc4bef7
authored
May 15, 2024
by
Zzm0809
Committed by
GitHub
May 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Optimization][web]Optimize resource path replication method (#3491)
Signed-off-by:
Zzm0809
<
934230207@qq.com
>
Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
2077a7e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
11 deletions
+25
-11
index.tsx
.../RegCenter/Resource/components/ResourceOverView/index.tsx
+5
-11
function.tsx
dinky-web/src/utils/function.tsx
+20
-0
No files found.
dinky-web/src/pages/RegCenter/Resource/components/ResourceOverView/index.tsx
View file @
1dc4bef7
...
@@ -40,9 +40,8 @@ import { API_CONSTANTS } from '@/services/endpoints';
...
@@ -40,9 +40,8 @@ import { API_CONSTANTS } from '@/services/endpoints';
import
{
ResourceInfo
}
from
'@/types/RegCenter/data'
;
import
{
ResourceInfo
}
from
'@/types/RegCenter/data'
;
import
{
InitResourceState
}
from
'@/types/RegCenter/init.d'
;
import
{
InitResourceState
}
from
'@/types/RegCenter/init.d'
;
import
{
ResourceState
}
from
'@/types/RegCenter/state.d'
;
import
{
ResourceState
}
from
'@/types/RegCenter/state.d'
;
import
{
unSupportView
}
from
'@/utils/function'
;
import
{
handleCopyToClipboard
,
unSupportView
}
from
'@/utils/function'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
SuccessMessage
}
from
'@/utils/messages'
;
import
{
SplitPane
}
from
'@andrewray/react-multi-split-pane'
;
import
{
SplitPane
}
from
'@andrewray/react-multi-split-pane'
;
import
{
Pane
}
from
'@andrewray/react-multi-split-pane/dist/lib/Pane'
;
import
{
Pane
}
from
'@andrewray/react-multi-split-pane/dist/lib/Pane'
;
import
{
WarningOutlined
}
from
'@ant-design/icons'
;
import
{
WarningOutlined
}
from
'@ant-design/icons'
;
...
@@ -166,11 +165,6 @@ const ResourceOverView: React.FC<connect> = (props) => {
...
@@ -166,11 +165,6 @@ const ResourceOverView: React.FC<connect> = (props) => {
}
}
};
};
async
function
handleCopyTo
(
fillValue
:
string
)
{
await
navigator
.
clipboard
.
writeText
(
fillValue
);
await
SuccessMessage
(
l
(
'rc.resource.copy_success'
,
''
,
{
fillValue
}));
}
const
handleMenuClick
=
async
(
node
:
MenuInfo
)
=>
{
const
handleMenuClick
=
async
(
node
:
MenuInfo
)
=>
{
const
{
fullInfo
}
=
resourceState
.
rightClickedNode
;
const
{
fullInfo
}
=
resourceState
.
rightClickedNode
;
switch
(
node
.
key
)
{
switch
(
node
.
key
)
{
...
@@ -189,25 +183,25 @@ const ResourceOverView: React.FC<connect> = (props) => {
...
@@ -189,25 +183,25 @@ const ResourceOverView: React.FC<connect> = (props) => {
case
ResourceRightMenuKey
.
COPY_TO_ADD_CUSTOM_JAR
:
case
ResourceRightMenuKey
.
COPY_TO_ADD_CUSTOM_JAR
:
if
(
fullInfo
)
{
if
(
fullInfo
)
{
const
fillValue
=
`ADD CUSTOMJAR 'rs:
${
fullInfo
.
fullName
}
';`
;
const
fillValue
=
`ADD CUSTOMJAR 'rs:
${
fullInfo
.
fullName
}
';`
;
await
handleCopyTo
(
fillValue
);
await
handleCopyTo
Clipboard
(
fillValue
);
}
}
break
;
break
;
case
ResourceRightMenuKey
.
COPY_TO_ADD_JAR
:
case
ResourceRightMenuKey
.
COPY_TO_ADD_JAR
:
if
(
fullInfo
)
{
if
(
fullInfo
)
{
const
fillValue
=
`ADD JAR 'rs:
${
fullInfo
.
fullName
}
';`
;
const
fillValue
=
`ADD JAR 'rs:
${
fullInfo
.
fullName
}
';`
;
await
handleCopyTo
(
fillValue
);
await
handleCopyTo
Clipboard
(
fillValue
);
}
}
break
;
break
;
case
ResourceRightMenuKey
.
COPY_TO_ADD_FILE
:
case
ResourceRightMenuKey
.
COPY_TO_ADD_FILE
:
if
(
fullInfo
)
{
if
(
fullInfo
)
{
const
fillValue
=
`ADD FILE 'rs:
${
fullInfo
.
fullName
}
';`
;
const
fillValue
=
`ADD FILE 'rs:
${
fullInfo
.
fullName
}
';`
;
await
handleCopyTo
(
fillValue
);
await
handleCopyTo
Clipboard
(
fillValue
);
}
}
break
;
break
;
case
ResourceRightMenuKey
.
COPY_TO_ADD_RS_PATH
:
case
ResourceRightMenuKey
.
COPY_TO_ADD_RS_PATH
:
if
(
fullInfo
)
{
if
(
fullInfo
)
{
const
fillValue
=
`rs:
${
fullInfo
.
fullName
}
`
;
const
fillValue
=
`rs:
${
fullInfo
.
fullName
}
`
;
await
handleCopyTo
(
fillValue
);
await
handleCopyTo
Clipboard
(
fillValue
);
}
}
break
;
break
;
default
:
default
:
...
...
dinky-web/src/utils/function.tsx
View file @
1dc4bef7
...
@@ -42,6 +42,7 @@ import {
...
@@ -42,6 +42,7 @@ import {
}
from
'@/services/constants'
;
}
from
'@/services/constants'
;
import
{
CODE_EDIT_THEME
,
THEME
}
from
'@/types/Public/data'
;
import
{
CODE_EDIT_THEME
,
THEME
}
from
'@/types/Public/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
SuccessMessage
}
from
'@/utils/messages'
;
import
{
Monaco
}
from
'@monaco-editor/react'
;
import
{
Monaco
}
from
'@monaco-editor/react'
;
import
dayjs
from
'dayjs'
;
import
dayjs
from
'dayjs'
;
import
cookies
from
'js-cookie'
;
import
cookies
from
'js-cookie'
;
...
@@ -629,3 +630,22 @@ export const formatTimestampToYYYYMMDDHHMMSS = (timestamp: number) => {
...
@@ -629,3 +630,22 @@ export const formatTimestampToYYYYMMDDHHMMSS = (timestamp: number) => {
export const parseDateStringToDate = (dateString: Date) =
>
{
export const parseDateStringToDate = (dateString: Date) =
>
{
return
dayjs
(
dateString
).
toDate
();
return
dayjs
(
dateString
).
toDate
();
}
;
}
;
/**
* copy text to clipboard function
* @param copyText
*/
export async function handleCopyToClipboard(copyText: string)
{
// Adapting to browsers without the navigator.clipboard.writeText method can be done using the following code
if
(
!
navigator
)
{
const
textarea
=
document
.
createElement
(
'textarea'
);
textarea
.
value
=
copyText
;
document
.
body
.
appendChild
(
textarea
);
textarea
.
select
();
document
.
execCommand
(
'copy'
);
document
.
body
.
removeChild
(
textarea
);
}
else
{
await
navigator
.
clipboard
.
writeText
(
copyText
);
}
await
SuccessMessage
(
l
(
'rc.resource.copy_success'
,
''
,
{
fillValue
:
copyText
}));
}
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