feat(xo-web): disclaimer banner cooldown (#5008)

This commit is contained in:
Pierre Donias
2020-05-26 10:59:10 +02:00
committed by GitHub
parent 67a60a7557
commit 1368c18844
2 changed files with 16 additions and 1 deletions

View File

@@ -1936,6 +1936,7 @@ const messages = {
"If you are a company, it's better to use it with our appliance + pro support included:",
disclaimerText3:
'This version is not bundled with any support nor updates. Use it with caution.',
disclaimerText4: 'Why do I see this message?',
notRegisteredDisclaimerInfo:
'You are not registered. Your XOA may not be up to date.',
notRegisteredDisclaimerCreateAccount: 'Click here to create an account.',

View File

@@ -123,6 +123,10 @@ export default class XoApp extends Component {
}
getChildContext = () => ({ shortcuts: shortcutManager })
state = {
dismissedSourceBanner: Boolean(cookies.get('dismissedSourceBanner')),
}
displayOpenSourceDisclaimer() {
const previousDisclaimer = cookies.get('previousDisclaimer')
const now = Math.floor(Date.now() / 1e3)
@@ -145,7 +149,10 @@ export default class XoApp extends Component {
}
}
dismissSourceBanner = () => this.setState({ dismissedSourceBanner: true })
dismissSourceBanner = () => {
cookies.set('dismissedSourceBanner', true, { expires: 24 * 60 * 60 }) // 1 day
this.setState({ dismissedSourceBanner: true })
}
componentDidMount() {
this.refs.bodyWrapper.style.minHeight =
@@ -252,6 +259,13 @@ export default class XoApp extends Component {
target='_blank'
>
{_('disclaimerText3')}
</a>{' '}
<a
href='https://xen-orchestra.com/docs/installation.html#banner-and-warnings'
rel='noopener noreferrer'
target='_blank'
>
{_('disclaimerText4')}
</a>
<button className='close' onClick={this.dismissSourceBanner}>
&times;