Add a banner and log to information about the migration to Notebook 7 plan (#6742)

* Add a banner to inform about the migration plan to notebook 7

* remove trailing spaces
This commit is contained in:
Eric Charles 2023-02-20 18:12:03 +01:00 committed by GitHub
parent 87738641b3
commit d0ecb74a1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -185,6 +185,20 @@ class NotebookWebApplication(web.Application):
if settings['autoreload']: if settings['autoreload']:
log.info('Autoreload enabled: the webapp will restart when any Python src file changes.') log.info('Autoreload enabled: the webapp will restart when any Python src file changes.')
print("""
_ _ _ _
| | | |_ __ __| |__ _| |_ ___
| |_| | '_ \/ _` / _` | _/ -_)
\___/| .__/\__,_\__,_|\__\___|
|_|
Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.
https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html
Please note that updating to Notebook 7 might break some of your extensions.
""")
super().__init__(handlers, **settings) super().__init__(handlers, **settings)
def init_settings(self, jupyter_app, kernel_manager, contents_manager, def init_settings(self, jupyter_app, kernel_manager, contents_manager,

View File

@ -135,6 +135,25 @@ dir="ltr">
</noscript> </noscript>
<div id="header" role="navigation" aria-label="{% trans %}Top Menu{% endtrans %}"> <div id="header" role="navigation" aria-label="{% trans %}Top Menu{% endtrans %}">
<div id="newsId" style="display: none">
<div class="alert alert-info" role="alert">
<div style="display: flex">
<div>
<span class="label label-warning">UPDATE</span>
Read <a href="https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html" style="text-decoration: underline;" target="_blank">the migration plan</a> to Notebook 7 to learn about the new features and the actions to take if you are using extensions
-
Please note that updating to Notebook 7 might break some of your extensions.
</div>
<div style="margin-left: auto;">
<a href="" onclick="alert('This message will not be shown anymore.'); return false;">
<button type="button" class="btn btn-default btn-xs" id="dontShowId">
Don't show anymore
</button>
</a>
</div>
</div>
</div>
</div>
<div id="header-container" class="container"> <div id="header-container" class="container">
<div id="ipython_notebook" class="nav navbar-brand"><a href="{{default_url}} <div id="ipython_notebook" class="nav navbar-brand"><a href="{{default_url}}
{%- if logged_in and token -%}?token={{token}}{%- endif -%}" title='{% trans %}dashboard{% endtrans %}'> {%- if logged_in and token -%}?token={{token}}{%- endif -%}" title='{% trans %}dashboard{% endtrans %}'>
@ -203,6 +222,16 @@ dir="ltr">
} }
_remove_token_from_url(); _remove_token_from_url();
sys_info = {{sys_info|safe}}; sys_info = {{sys_info|safe}};
document.addEventListener('DOMContentLoaded', function () {
const newsId = document.querySelector('#newsId');
const dontShowId = document.querySelector('#dontShowId');
const showNotebookNews = localStorage.getItem('showNotebookNews');
dontShowId.addEventListener('click', () => {
localStorage.setItem('showNotebookNews', false);
newsId.style.display = 'none';
});
if (!showNotebookNews) newsId.style.display = 'inline';
});
</script> </script>
</body> </body>