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
13482b0f
Unverified
Commit
13482b0f
authored
Aug 25, 2023
by
zxhlyh
Committed by
GitHub
Aug 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: maintenance notice (#1016)
parent
38fa152c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
2 deletions
+45
-2
maintenance-notice.tsx
web/app/components/header/maintenance-notice.tsx
+38
-0
layout.tsx
web/app/layout.tsx
+1
-0
app-context.tsx
web/context/app-context.tsx
+6
-2
No files found.
web/app/components/header/maintenance-notice.tsx
0 → 100644
View file @
13482b0f
import
{
useState
}
from
'react'
import
{
useContext
}
from
'use-context-selector'
import
I18n
from
'@/context/i18n'
import
{
X
}
from
'@/app/components/base/icons/src/vender/line/general'
const
NOTICE_I18N
=
{
title
:
{
'en'
:
'Important Notice'
,
'zh-Hans'
:
'重要公告'
,
},
desc
:
{
'en'
:
'Our system will be unavailable from 19:00 to 24:00 UTC on August 28 for an upgrade. For questions, kindly contact our support team (support@dify.ai). We value your patience.'
,
'zh-Hans'
:
'为了有效提升数据检索能力及稳定性,Dify 将于 2022 年 8 月 29 日 03:00 至 08:00 期间进行服务升级,届时 Dify 云端版及应用将无法访问。感谢您的耐心与支持。'
,
},
}
const
MaintenanceNotice
=
()
=>
{
const
{
locale
}
=
useContext
(
I18n
)
const
[
showNotice
,
setShowNotice
]
=
useState
(
localStorage
.
getItem
(
'hide-maintenance-notice'
)
!==
'1'
)
const
handleCloseNotice
=
()
=>
{
localStorage
.
setItem
(
'hide-maintenance-notice'
,
'1'
)
setShowNotice
(
false
)
}
if
(
!
showNotice
)
return
null
return
(
<
div
className=
'shrink-0 flex items-center px-4 h-[38px] bg-[#FFFAEB] border-b border-[0.5px] border-b-[#FEF0C7] z-20'
>
<
div
className=
'shrink-0 flex items-center mr-2 px-2 h-[22px] bg-[#F79009] text-white text-[11px] font-medium rounded-xl'
>
{
NOTICE_I18N
.
title
[
locale
]
}
</
div
>
<
div
className=
'grow text-xs font-medium text-gray-700'
>
{
NOTICE_I18N
.
desc
[
locale
]
}
</
div
>
<
X
className=
'shrink-0 w-4 h-4 text-gray-500 cursor-pointer'
onClick=
{
handleCloseNotice
}
/>
</
div
>
)
}
export
default
MaintenanceNotice
web/app/layout.tsx
View file @
13482b0f
...
@@ -25,6 +25,7 @@ const LocaleLayout = ({
...
@@ -25,6 +25,7 @@ const LocaleLayout = ({
data
-
pubic
-
api
-
prefix=
{
process
.
env
.
NEXT_PUBLIC_PUBLIC_API_PREFIX
}
data
-
pubic
-
api
-
prefix=
{
process
.
env
.
NEXT_PUBLIC_PUBLIC_API_PREFIX
}
data
-
public
-
edition=
{
process
.
env
.
NEXT_PUBLIC_EDITION
}
data
-
public
-
edition=
{
process
.
env
.
NEXT_PUBLIC_EDITION
}
data
-
public
-
sentry
-
dsn=
{
process
.
env
.
NEXT_PUBLIC_SENTRY_DSN
}
data
-
public
-
sentry
-
dsn=
{
process
.
env
.
NEXT_PUBLIC_SENTRY_DSN
}
data
-
public
-
maintenance
-
notice=
{
process
.
env
.
NEXT_PUBLIC_MAINTENANCE_NOTICE
}
>
>
<
BrowerInitor
>
<
BrowerInitor
>
<
SentryInitor
>
<
SentryInitor
>
...
...
web/context/app-context.tsx
View file @
13482b0f
...
@@ -9,6 +9,7 @@ import Loading from '@/app/components/base/loading'
...
@@ -9,6 +9,7 @@ import Loading from '@/app/components/base/loading'
import
{
fetchCurrentWorkspace
,
fetchLanggeniusVersion
,
fetchUserProfile
}
from
'@/service/common'
import
{
fetchCurrentWorkspace
,
fetchLanggeniusVersion
,
fetchUserProfile
}
from
'@/service/common'
import
type
{
App
}
from
'@/types/app'
import
type
{
App
}
from
'@/types/app'
import
type
{
ICurrentWorkspace
,
LangGeniusVersionResponse
,
UserProfileResponse
}
from
'@/models/common'
import
type
{
ICurrentWorkspace
,
LangGeniusVersionResponse
,
UserProfileResponse
}
from
'@/models/common'
import
MaintenanceNotice
from
'@/app/components/header/maintenance-notice'
export
type
AppContextValue
=
{
export
type
AppContextValue
=
{
apps
:
App
[]
apps
:
App
[]
...
@@ -119,9 +120,12 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
...
@@ -119,9 +120,12 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
isCurrentWorkspaceManager
,
isCurrentWorkspaceManager
,
mutateCurrentWorkspace
,
mutateCurrentWorkspace
,
}
}
>
}
}
>
<
div
ref=
{
pageContainerRef
}
className=
'relative flex flex-col h-full overflow-auto bg-gray-100'
>
<
div
className=
'flex flex-col h-full'
>
{
globalThis
.
document
?.
body
?.
getAttribute
(
'data-public-maintenance-notice'
)
&&
<
MaintenanceNotice
/>
}
<
div
ref=
{
pageContainerRef
}
className=
'grow relative flex flex-col overflow-auto bg-gray-100'
>
{
children
}
{
children
}
</
div
>
</
div
>
</
div
>
</
AppContext
.
Provider
>
</
AppContext
.
Provider
>
)
)
}
}
...
...
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