Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
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
ai-tech
dify
Commits
cfb853ef
Commit
cfb853ef
authored
Mar 01, 2024
by
JzoNg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log detail panel
parent
2691164f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
156 additions
and
18 deletions
+156
-18
detail.tsx
web/app/components/app/workflow-log/detail.tsx
+27
-0
index.tsx
web/app/components/app/workflow-log/index.tsx
+20
-1
list.tsx
web/app/components/app/workflow-log/list.tsx
+3
-15
index.tsx
web/app/components/workflow/run/index.tsx
+46
-0
result.tsx
web/app/components/workflow/run/result.tsx
+24
-0
tracing.tsx
web/app/components/workflow/run/tracing.tsx
+24
-0
app-log.ts
web/i18n/en-US/app-log.ts
+6
-0
app-log.ts
web/i18n/zh-Hans/app-log.ts
+6
-2
No files found.
web/app/components/app/workflow-log/detail.tsx
0 → 100644
View file @
cfb853ef
'use client'
import
type
{
FC
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
type
{
App
}
from
'@/types/app'
import
Run
from
'@/app/components/workflow/run'
import
{
XClose
}
from
'@/app/components/base/icons/src/vender/line/general'
type
ILogDetail
=
{
appDetail
?:
App
onClose
:
()
=>
void
}
const
DetailPanel
:
FC
<
ILogDetail
>
=
({
appDetail
,
onClose
})
=>
{
const
{
t
}
=
useTranslation
()
return
(
<
div
className=
'grow relative flex flex-col py-3'
>
<
span
className=
'absolute right-3 top-4 p-1 cursor-pointer z-20'
onClick=
{
onClose
}
>
<
XClose
className=
'w-4 h-4 text-gray-500'
/>
</
span
>
<
h1
className=
'shrink-0 px-4 py-1 text-md font-semibold text-gray-900'
>
{
t
(
'appLog.runDetail.workflowTitle'
)
}
</
h1
>
<
Run
activeTab=
'RESULT'
appId=
{
appDetail
?.
id
||
''
}
></
Run
>
</
div
>
)
}
export
default
DetailPanel
web/app/components/app/workflow-log/index.tsx
View file @
cfb853ef
...
@@ -9,12 +9,14 @@ import { Trans, useTranslation } from 'react-i18next'
...
@@ -9,12 +9,14 @@ import { Trans, useTranslation } from 'react-i18next'
import
Link
from
'next/link'
import
Link
from
'next/link'
import
List
from
'./list'
import
List
from
'./list'
import
Filter
from
'./filter'
import
Filter
from
'./filter'
import
DetailPanel
from
'./detail'
import
s
from
'./style.module.css'
import
s
from
'./style.module.css'
import
Loading
from
'@/app/components/base/loading'
import
Loading
from
'@/app/components/base/loading'
import
{
fetchWorkflowLogs
}
from
'@/service/log'
import
{
fetchWorkflowLogs
}
from
'@/service/log'
import
{
fetchAppDetail
}
from
'@/service/apps'
import
{
fetchAppDetail
}
from
'@/service/apps'
import
{
APP_PAGE_LIMIT
}
from
'@/config'
import
{
APP_PAGE_LIMIT
}
from
'@/config'
import
type
{
AppMode
}
from
'@/types/app'
import
type
{
AppMode
}
from
'@/types/app'
import
Drawer
from
'@/app/components/base/drawer'
export
type
ILogsProps
=
{
export
type
ILogsProps
=
{
appId
:
string
appId
:
string
...
@@ -50,6 +52,11 @@ const EmptyElement: FC<{ appUrl: string }> = ({ appUrl }) => {
...
@@ -50,6 +52,11 @@ const EmptyElement: FC<{ appUrl: string }> = ({ appUrl }) => {
}
}
const
Logs
:
FC
<
ILogsProps
>
=
({
appId
})
=>
{
const
Logs
:
FC
<
ILogsProps
>
=
({
appId
})
=>
{
const
[
showDrawer
,
setShowDrawer
]
=
useState
<
boolean
>
(
true
)
const
onCloseDrawer
=
()
=>
{
setShowDrawer
(
false
)
}
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
[
queryParams
,
setQueryParams
]
=
useState
<
QueryParam
>
({
status
:
'all'
})
const
[
queryParams
,
setQueryParams
]
=
useState
<
QueryParam
>
({
status
:
'all'
})
const
[
currPage
,
setCurrPage
]
=
React
.
useState
<
number
>
(
0
)
const
[
currPage
,
setCurrPage
]
=
React
.
useState
<
number
>
(
0
)
...
@@ -79,7 +86,10 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
...
@@ -79,7 +86,10 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
return
(
return
(
<
div
className=
'flex flex-col h-full'
>
<
div
className=
'flex flex-col h-full'
>
<
h1
className=
'text-md font-semibold text-gray-900'
>
{
t
(
'appLog.workflowTitle'
)
}
</
h1
>
<
h1
className=
'text-md font-semibold text-gray-900'
onClick=
{
()
=>
{
console
.
log
(
1
)
setShowDrawer
(
true
)
}
}
>
{
t
(
'appLog.workflowTitle'
)
}
</
h1
>
<
p
className=
'flex text-sm font-normal text-gray-500'
>
{
t
(
'appLog.workflowSubtitle'
)
}
</
p
>
<
p
className=
'flex text-sm font-normal text-gray-500'
>
{
t
(
'appLog.workflowSubtitle'
)
}
</
p
>
<
div
className=
'flex flex-col py-4 flex-1'
>
<
div
className=
'flex flex-col py-4 flex-1'
>
<
Filter
queryParams=
{
queryParams
}
setQueryParams=
{
setQueryParams
}
/>
<
Filter
queryParams=
{
queryParams
}
setQueryParams=
{
setQueryParams
}
/>
...
@@ -124,6 +134,15 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
...
@@ -124,6 +134,15 @@ const Logs: FC<ILogsProps> = ({ appId }) => {
</
Pagination
>
</
Pagination
>
:
null
}
:
null
}
</
div
>
</
div
>
<
Drawer
isOpen=
{
showDrawer
}
onClose=
{
onCloseDrawer
}
mask=
{
false
}
footer=
{
null
}
panelClassname=
'mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl border border-gray-200'
>
<
DetailPanel
onClose=
{
onCloseDrawer
}
appDetail=
{
appDetail
}
/>
</
Drawer
>
</
div
>
</
div
>
)
)
}
}
...
...
web/app/components/app/workflow-log/list.tsx
View file @
cfb853ef
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
dayjs
from
'dayjs'
import
dayjs
from
'dayjs'
import
{
createContext
}
from
'use-context-selector'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
cn
from
'classnames'
import
cn
from
'classnames'
import
s
from
'./style.module.css'
import
s
from
'./style.module.css'
import
DetailPanel
from
'./detail'
import
type
{
WorkflowAppLogDetail
,
WorkflowLogsResponse
}
from
'@/models/log'
import
type
{
WorkflowAppLogDetail
,
WorkflowLogsResponse
}
from
'@/models/log'
import
type
{
App
}
from
'@/types/app'
import
type
{
App
}
from
'@/types/app'
import
Loading
from
'@/app/components/base/loading'
import
Loading
from
'@/app/components/base/loading'
...
@@ -21,13 +21,6 @@ type ILogs = {
...
@@ -21,13 +21,6 @@ type ILogs = {
const
defaultValue
=
'N/A'
const
defaultValue
=
'N/A'
type
IDrawerContext
=
{
onClose
:
()
=>
void
appDetail
?:
App
}
const
DrawerContext
=
createContext
<
IDrawerContext
>
({}
as
IDrawerContext
)
const
WorkflowAppLogList
:
FC
<
ILogs
>
=
({
logs
,
appDetail
,
onRefresh
})
=>
{
const
WorkflowAppLogList
:
FC
<
ILogs
>
=
({
logs
,
appDetail
,
onRefresh
})
=>
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
...
@@ -130,14 +123,9 @@ const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
...
@@ -130,14 +123,9 @@ const WorkflowAppLogList: FC<ILogs> = ({ logs, appDetail, onRefresh }) => {
onClose=
{
onCloseDrawer
}
onClose=
{
onCloseDrawer
}
mask=
{
isMobile
}
mask=
{
isMobile
}
footer=
{
null
}
footer=
{
null
}
panelClassname=
'mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl'
panelClassname=
'mt-16 mx-2 sm:mr-2 mb-3 !p-0 !max-w-[640px] rounded-xl
border border-gray-200
'
>
>
<
DrawerContext
.
Provider
value=
{
{
<
DetailPanel
onClose=
{
onCloseDrawer
}
appDetail=
{
appDetail
}
/>
onClose
:
onCloseDrawer
,
appDetail
,
}
}
>
{
<
div
>
TODO
</
div
>
}
</
DrawerContext
.
Provider
>
</
Drawer
>
</
Drawer
>
</
div
>
</
div
>
)
)
...
...
web/app/components/workflow/run/index.tsx
0 → 100644
View file @
cfb853ef
'use client'
import
type
{
FC
}
from
'react'
import
React
,
{
useState
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
cn
from
'classnames'
import
Result
from
'./result'
import
Tracing
from
'./tracing'
type
RunProps
=
{
activeTab
:
'RESULT'
|
'TRACING'
appId
:
string
}
const
RunPanel
:
FC
<
RunProps
>
=
({
activeTab
,
appId
})
=>
{
const
{
t
}
=
useTranslation
()
const
[
currentTab
,
setCurrentTab
]
=
useState
<
string
>
(
activeTab
)
return
(
<
div
className=
'grow relative flex flex-col'
>
{
/* tab */
}
<
div
className=
'shrink-0 flex items-center px-4 border-b-[0.5px] border-[rgba(0,0,0,0.05)]'
>
<
div
className=
{
cn
(
'mr-6 py-3 border-b-2 border-transparent text-[13px] font-semibold leading-[18px] text-gray-400 cursor-pointer'
,
currentTab
===
'RESULT'
&&
'!border-[rgb(21,94,239)] text-gray-700'
,
)
}
onClick=
{
()
=>
setCurrentTab
(
'RESULT'
)
}
>
{
t
(
'appLog.runDetail.result'
)
}
</
div
>
<
div
className=
{
cn
(
'mr-6 py-3 border-b-2 border-transparent text-[13px] font-semibold leading-[18px] text-gray-400 cursor-pointer'
,
currentTab
===
'TRACING'
&&
'!border-[rgb(21,94,239)] text-gray-700'
,
)
}
onClick=
{
()
=>
setCurrentTab
(
'TRACING'
)
}
>
{
t
(
'appLog.runDetail.tracing'
)
}
</
div
>
</
div
>
{
/* panel detal */
}
<
div
className=
{
cn
(
'grow bg-white overflow-y-auto'
,
currentTab
===
'TRACING'
&&
'!bg-gray-50'
)
}
>
{
currentTab
===
'RESULT'
&&
<
Result
appId=
{
appId
}
/>
}
{
currentTab
===
'TRACING'
&&
<
Tracing
appId=
{
appId
}
/>
}
</
div
>
</
div
>
)
}
export
default
RunPanel
web/app/components/workflow/run/result.tsx
0 → 100644
View file @
cfb853ef
'use client'
import
type
{
FC
}
from
'react'
// import React, { useState } from 'react'
import
{
useTranslation
}
from
'react-i18next'
// import cn from 'classnames'
// import Loading from '@/app/components/base/loading'
// import Indicator from '@/app/components/header/indicator'
type
ResultProps
=
{
appId
:
string
}
const
Result
:
FC
<
ResultProps
>
=
({
appId
})
=>
{
const
{
t
}
=
useTranslation
()
// const [currentTab, setCurrentTab] = useState<string>(activeTab)
return
(
<
div
className=
'bg-white'
>
Result panel = TODO
</
div
>
)
}
export
default
Result
web/app/components/workflow/run/tracing.tsx
0 → 100644
View file @
cfb853ef
'use client'
import
type
{
FC
}
from
'react'
// import React, { useState } from 'react'
import
{
useTranslation
}
from
'react-i18next'
// import cn from 'classnames'
// import Loading from '@/app/components/base/loading'
// import Indicator from '@/app/components/header/indicator'
type
TracingProps
=
{
appId
:
string
}
const
Tracing
:
FC
<
TracingProps
>
=
({
appId
})
=>
{
const
{
t
}
=
useTranslation
()
// const [currentTab, setCurrentTab] = useState<string>(activeTab)
return
(
<
div
className=
'bg-gray-50'
>
Tracing panel = TODO
</
div
>
)
}
export
default
Tracing
web/i18n/en-US/app-log.ts
View file @
cfb853ef
...
@@ -72,6 +72,12 @@ const translation = {
...
@@ -72,6 +72,12 @@ const translation = {
},
},
workflowTitle
:
'Workflow Logs'
,
workflowTitle
:
'Workflow Logs'
,
workflowSubtitle
:
'The log recorded the operation of Automate.'
,
workflowSubtitle
:
'The log recorded the operation of Automate.'
,
runDetail
:
{
title
:
'Conversation Log'
,
workflowTitle
:
'Log Detail'
,
result
:
'RESULT'
,
tracing
:
'TRACING'
,
},
}
}
export
default
translation
export
default
translation
web/i18n/zh-Hans/app-log.ts
View file @
cfb853ef
...
@@ -70,8 +70,12 @@ const translation = {
...
@@ -70,8 +70,12 @@ const translation = {
not_annotated
:
'未标注'
,
not_annotated
:
'未标注'
,
},
},
},
},
workflowTitle
:
'Workflow Logs'
,
workflowTitle
:
'日志'
,
workflowSubtitle
:
'The log recorded the operation of Automate.'
,
workflowSubtitle
:
'日志记录了应用的执行情况'
,
runDetail
:
{
title
:
'对话日志'
,
workflowTitle
:
'日志详情'
,
},
}
}
export
default
translation
export
default
translation
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