Browse Source

fix: remove unused billing plan logic from CreateFromDSLModal component

tags/2.0.0-beta.1
twwu 4 months ago
parent
commit
55906c8375

+ 5
- 13
web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/index.tsx View File

DSLImportMode, DSLImportMode,
DSLImportStatus, DSLImportStatus,
} from '@/models/app' } from '@/models/app'
import { useProviderContextSelector } from '@/context/provider-context'
import AppsFull from '@/app/components/billing/apps-full-in-dialog'
import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks' import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks'
import { noop } from 'lodash-es' import { noop } from 'lodash-es'
import Uploader from './uploader' import Uploader from './uploader'
setFileContent('') setFileContent('')
} }


const plan = useProviderContextSelector(state => state.plan)
const enableBilling = useProviderContextSelector(state => state.enableBilling)
const isAppsFull = (enableBilling && plan.usage.buildApps >= plan.total.buildApps)
// todo: TBD billing plan
// const plan = useProviderContextSelector(state => state.plan)
// const enableBilling = useProviderContextSelector(state => state.enableBilling)
// const isAppsFull = (enableBilling && plan.usage.buildApps >= plan.total.buildApps)


const isCreatingRef = useRef(false) const isCreatingRef = useRef(false)


} }


const buttonDisabled = useMemo(() => { const buttonDisabled = useMemo(() => {
if (isAppsFull)
return true
if (currentTab === CreateFromDSLModalTab.FROM_FILE) if (currentTab === CreateFromDSLModalTab.FROM_FILE)
return !currentFile return !currentFile
if (currentTab === CreateFromDSLModalTab.FROM_URL) if (currentTab === CreateFromDSLModalTab.FROM_URL)
return !dslUrlValue return !dslUrlValue
return false return false
}, [isAppsFull, currentTab, currentFile, dslUrlValue])
}, [currentTab, currentFile, dslUrlValue])


return ( return (
<> <>
) )
} }
</div> </div>
{isAppsFull && (
<div className='px-6'>
<AppsFull className='mt-0' loc='app-create-dsl' />
</div>
)}
<div className='flex justify-end gap-x-2 p-6 pt-5'> <div className='flex justify-end gap-x-2 p-6 pt-5'>
<Button onClick={onClose}> <Button onClick={onClose}>
{t('app.newApp.Cancel')} {t('app.newApp.Cancel')}

Loading…
Cancel
Save