mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-05 20:16:02 +08:00
chore: disabled logic
This commit is contained in:
parent
17a908fac1
commit
079d0f786d
@ -9,6 +9,7 @@ type Item = {
|
|||||||
isRight?: boolean
|
isRight?: boolean
|
||||||
icon?: React.ReactNode
|
icon?: React.ReactNode
|
||||||
extra?: React.ReactNode
|
extra?: React.ReactNode
|
||||||
|
disabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ITabHeaderProps = {
|
export type ITabHeaderProps = {
|
||||||
@ -24,14 +25,15 @@ const TabHeader: FC<ITabHeaderProps> = ({
|
|||||||
itemClassName,
|
itemClassName,
|
||||||
onChange,
|
onChange,
|
||||||
}) => {
|
}) => {
|
||||||
const renderItem = ({ id, name, icon, extra }: Item) => (
|
const renderItem = ({ id, name, icon, extra, disabled }: Item) => (
|
||||||
<div
|
<div
|
||||||
key={id}
|
key={id}
|
||||||
className={cn(
|
className={cn(
|
||||||
'system-md-semibold relative flex cursor-pointer items-center border-b-2 border-transparent pb-2 pt-2.5',
|
'system-md-semibold relative flex cursor-pointer items-center border-b-2 border-transparent pb-2 pt-2.5',
|
||||||
id === value ? 'border-components-tab-active text-text-primary' : 'text-text-tertiary',
|
id === value ? 'border-components-tab-active text-text-primary' : 'text-text-tertiary',
|
||||||
|
disabled && 'cursor-not-allowed opacity-30',
|
||||||
)}
|
)}
|
||||||
onClick={() => onChange(id)}
|
onClick={() => !disabled && onChange(id)}
|
||||||
>
|
>
|
||||||
{icon || ''}
|
{icon || ''}
|
||||||
<div className={cn('ml-2', itemClassName)}>{name}</div>
|
<div className={cn('ml-2', itemClassName)}>{name}</div>
|
||||||
|
@ -48,6 +48,7 @@ import type { Node } from '@/app/components/workflow/types'
|
|||||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||||
import { useStore } from '@/app/components/workflow/store'
|
import { useStore } from '@/app/components/workflow/store'
|
||||||
import Tab, { TabType } from './tab'
|
import Tab, { TabType } from './tab'
|
||||||
|
import LastRun from './last-run'
|
||||||
|
|
||||||
type BasePanelProps = {
|
type BasePanelProps = {
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
@ -105,6 +106,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
}, [handleNodeDataUpdateWithSyncDraft, id, saveStateToHistory])
|
}, [handleNodeDataUpdateWithSyncDraft, id, saveStateToHistory])
|
||||||
|
|
||||||
const [tabType, setTabType] = useState<TabType>(TabType.settings)
|
const [tabType, setTabType] = useState<TabType>(TabType.settings)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
'relative mr-2 h-full',
|
'relative mr-2 h-full',
|
||||||
@ -218,7 +220,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{tabType === TabType.lastRun && (
|
{tabType === TabType.lastRun && (
|
||||||
<div>last run content</div>
|
<LastRun appId={id} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
'use client'
|
||||||
|
import type { FC } from 'react'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
appId: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const LastRun: FC<Props> = ({
|
||||||
|
appId,
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
last run: {appId}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default React.memo(LastRun)
|
@ -23,7 +23,7 @@ const Tab: FC<Props> = ({
|
|||||||
<TabHeader
|
<TabHeader
|
||||||
items={[
|
items={[
|
||||||
{ id: TabType.settings, name: t('workflow.debug.settingsTab').toLocaleUpperCase() },
|
{ id: TabType.settings, name: t('workflow.debug.settingsTab').toLocaleUpperCase() },
|
||||||
{ id: TabType.lastRun, name: t('workflow.debug.lastRunTab').toLocaleUpperCase() },
|
{ id: TabType.lastRun, name: t('workflow.debug.lastRunTab').toLocaleUpperCase(), disabled: true }, // TODO: add disabled logic
|
||||||
]}
|
]}
|
||||||
itemClassName='ml-0'
|
itemClassName='ml-0'
|
||||||
value={value}
|
value={value}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user