system features initor
parent
cb09dbef66
commit
aac90e54ec
@ -0,0 +1,25 @@
|
|||||||
|
'use client'
|
||||||
|
import {
|
||||||
|
useEffect,
|
||||||
|
useState,
|
||||||
|
} from 'react'
|
||||||
|
import { useSystemFeaturesStore } from './store'
|
||||||
|
import { getSystemFeatures } from '@/service/common'
|
||||||
|
|
||||||
|
const SystemFeaturesInitor = ({
|
||||||
|
children,
|
||||||
|
}: { children: React.ReactElement }) => {
|
||||||
|
const [init, setInit] = useState(false)
|
||||||
|
const { setSystemFeatures } = useSystemFeaturesStore()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getSystemFeatures().then((res) => {
|
||||||
|
setSystemFeatures(res)
|
||||||
|
}).finally(() => {
|
||||||
|
setInit(true)
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
return init ? children : null
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SystemFeaturesInitor
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
'use client'
|
||||||
|
import cn from 'classnames'
|
||||||
|
import { useSystemFeaturesStore } from '../store'
|
||||||
|
import s from './styles.module.css'
|
||||||
|
|
||||||
|
const LicenseInfo = () => {
|
||||||
|
const { systemFeatures } = useSystemFeaturesStore()
|
||||||
|
|
||||||
|
if (!systemFeatures.expired_at) {
|
||||||
|
return (
|
||||||
|
<div className='fixed inset-0 flex flex-col pt-14 z-[99999]'>
|
||||||
|
<div className={cn(s.bg, 'grow flex flex-col items-center justify-center bg-white')}>
|
||||||
|
<div className='mb-3 text-xl font-semibold'>
|
||||||
|
Your organization's Dify Enterprise license has expired.
|
||||||
|
</div>
|
||||||
|
<div className='text-gray-300'>
|
||||||
|
Please contact your administrator to continue using Dify.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LicenseInfo
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
.bg {
|
||||||
|
background-image: url(../../../signin/assets/background.png);
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
import { create } from 'zustand'
|
||||||
|
import type { SystemFeatures } from '@/types/feature'
|
||||||
|
|
||||||
|
type StateAndAction = {
|
||||||
|
systemFeatures: SystemFeatures
|
||||||
|
setSystemFeatures: (features: SystemFeatures) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useSystemFeaturesStore = create<StateAndAction>(set => ({
|
||||||
|
systemFeatures: {
|
||||||
|
sso_enforced_for_signin: false,
|
||||||
|
sso_enforced_for_signin_protocol: '',
|
||||||
|
sso_enforced_for_web: false,
|
||||||
|
sso_enforced_for_web_protocol: '',
|
||||||
|
expired_at: 11,
|
||||||
|
},
|
||||||
|
setSystemFeatures: features => set({ systemFeatures: features }),
|
||||||
|
}))
|
||||||
Loading…
Reference in New Issue