Add warning banner if wrong browser control is used (#6260)

This commit is contained in:
Christian Günter 2023-05-05 13:20:08 +02:00 committed by GitHub
parent 1a3dff7ce6
commit 81cf14d4d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 1 deletions

View File

@ -74,6 +74,11 @@ CLASS zcl_abapgit_gui_page DEFINITION PUBLIC ABSTRACT
!ii_html TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS render_browser_control_warning
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS render_command_palettes
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
@ -289,6 +294,27 @@ CLASS zcl_abapgit_gui_page IMPLEMENTATION.
ENDMETHOD.
METHOD render_browser_control_warning.
DATA li_documentation_link TYPE REF TO zif_abapgit_html.
CREATE OBJECT li_documentation_link TYPE zcl_abapgit_html.
li_documentation_link->add_a(
iv_txt = 'Documentation'
iv_typ = zif_abapgit_html=>c_action_type-url
iv_act = 'https://docs.abapgit.org/guide-sapgui.html#sap-gui-for-windows' ).
ii_html->add( '<div id="browser-control-warning" class="browser-control-warning">' ).
ii_html->add( zcl_abapgit_gui_chunk_lib=>render_warning_banner(
|Attention: You use Edge browser control. |
&& |There are several known malfunctions. See |
&& li_documentation_link->render( ) ) ).
ii_html->add( '</div>' ).
ENDMETHOD.
METHOD scripts.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
@ -299,6 +325,7 @@ CLASS zcl_abapgit_gui_page IMPLEMENTATION.
render_link_hints( ri_html ).
render_command_palettes( ri_html ).
ri_html->add( |toggleBrowserControlWarning();| ).
ENDMETHOD.
@ -339,6 +366,8 @@ CLASS zcl_abapgit_gui_page IMPLEMENTATION.
ri_html->add( '</div>' ).
ENDIF.
render_browser_control_warning( ri_html ).
ri_html->add( '</div>' ).
ENDMETHOD.

View File

@ -1498,3 +1498,8 @@ table.unit_tests {
padding-left: 0;
border-left: none;
}
/* Warning if wrong browser control is used */
.browser-control-warning {
width: 100%;
}

View File

@ -28,6 +28,7 @@
/* exported enumerateUiActions */
/* exported onDiffCollapse */
/* exported restoreScrollPosition */
/* exported toggleBrowserControlWarning */
/**********************************************************
* Polyfills
@ -2482,4 +2483,10 @@ function toggleSticky() {
} else {
header.classList.remove(stickyClass);
}
}
}
function toggleBrowserControlWarning(){
if (!navigator.userAgent.includes("Edg")){
document.getElementById("browser-control-warning").style.display = "none";
}
}