From c4b06d78534d309fcd2299e9528b8866b48543c4 Mon Sep 17 00:00:00 2001 From: sbcgua Date: Sat, 10 Dec 2016 10:15:37 +0200 Subject: [PATCH] topmenu & tutorial finetuning #487 --- src/zabapgit_css_common.w3mi.data.css | 18 ++++ src/zabapgit_css_common.w3mi.xml | 2 +- src/zabapgit_definitions.prog.abap | 1 + src/zabapgit_gui_router.prog.abap | 3 + src/zabapgit_page_main.prog.abap | 14 ++- src/zabapgit_popups.prog.abap | 26 ++++- src/zabapgit_services_abapgit.prog.abap | 138 ++++++++++++++++-------- src/zabapgit_view_tutorial.prog.abap | 50 ++++++++- 8 files changed, 195 insertions(+), 57 deletions(-) diff --git a/src/zabapgit_css_common.w3mi.data.css b/src/zabapgit_css_common.w3mi.data.css index 448204e41..d326d2f69 100644 --- a/src/zabapgit_css_common.w3mi.data.css +++ b/src/zabapgit_css_common.w3mi.data.css @@ -587,3 +587,21 @@ table.tag { } table.tag td { padding: 0.2em 0.5em; } table.tag td.label { background-color: #b3c1cc; } + +/* TUTORIAL */ + +div.tutorial { + margin-top: 3px; + background-color: #f2f2f2; + padding: 0.5em 1em 0.5em 1em; +} + +div.tutorial hr { border-color: #CCC; } +div.tutorial h1 { + font-size: 18pt; + color: #404040; +} +div.tutorial h2 { + font-size: 14pt; + color: #404040; +} diff --git a/src/zabapgit_css_common.w3mi.xml b/src/zabapgit_css_common.w3mi.xml index 3fa9bc1c3..ddab44689 100644 --- a/src/zabapgit_css_common.w3mi.xml +++ b/src/zabapgit_css_common.w3mi.xml @@ -21,7 +21,7 @@ MI ZABAPGIT_CSS_COMMON filesize - 12322 + 12615 MI diff --git a/src/zabapgit_definitions.prog.abap b/src/zabapgit_definitions.prog.abap index a9cee3b0b..139849bfe 100644 --- a/src/zabapgit_definitions.prog.abap +++ b/src/zabapgit_definitions.prog.abap @@ -173,6 +173,7 @@ CONSTANTS: BEGIN OF gc_action, abapgit_home TYPE string VALUE 'abapgit_home', abapgit_wiki TYPE string VALUE 'abapgit_wiki', abapgit_install TYPE string VALUE 'abapgit_install', + abapgit_install_pi TYPE string VALUE 'abapgit_install_pi', zip_import TYPE string VALUE 'zip_import', zip_export TYPE string VALUE 'zip_export', diff --git a/src/zabapgit_gui_router.prog.abap b/src/zabapgit_gui_router.prog.abap index 8f8f05fdb..3c259c095 100644 --- a/src/zabapgit_gui_router.prog.abap +++ b/src/zabapgit_gui_router.prog.abap @@ -138,6 +138,9 @@ CLASS lcl_gui_router IMPLEMENTATION. WHEN gc_action-abapgit_install. " Install abapGit lcl_services_abapgit=>install_abapgit( ). ev_state = gc_event_state-re_render. + WHEN gc_action-abapgit_install_pi. " Install abapGit plugins + lcl_services_abapgit=>install_abapgit_pi( ). + ev_state = gc_event_state-re_render. " Repository services actions WHEN gc_action-repo_newoffline. " New offline repo diff --git a/src/zabapgit_page_main.prog.abap b/src/zabapgit_page_main.prog.abap index 934a69cb1..7ab201350 100644 --- a/src/zabapgit_page_main.prog.abap +++ b/src/zabapgit_page_main.prog.abap @@ -205,14 +205,12 @@ CLASS lcl_gui_page_main IMPLEMENTATION. lo_helpsub->add( iv_txt = 'Tutorial' iv_act = gc_action-go_tutorial ) ##NO_TEXT. lo_helpsub->add( iv_txt = 'abapGit wiki' iv_act = gc_action-abapgit_wiki ) ##NO_TEXT. - ro_menu->add( iv_txt = 'Clone' iv_act = gc_action-repo_clone ) ##NO_TEXT. - ro_menu->add( iv_txt = 'Explore' iv_act = gc_action-go_explore ) ##NO_TEXT. - ro_menu->add( iv_txt = 'New offline repo' iv_act = gc_action-repo_newoffline ) ##NO_TEXT. - IF lcl_services_abapgit=>needs_installation( ) = abap_true. - ro_menu->add( iv_txt = 'Get abapGit' iv_act = gc_action-abapgit_install ) ##NO_TEXT. - ENDIF. - ro_menu->add( iv_txt = 'Advanced' io_sub = lo_advsub ) ##NO_TEXT. - ro_menu->add( iv_txt = 'Help' io_sub = lo_helpsub ) ##NO_TEXT. + ro_menu->add( iv_txt = '+ Clone' iv_act = gc_action-repo_clone ) ##NO_TEXT. + ro_menu->add( iv_txt = '+ Offline' iv_act = gc_action-repo_newoffline ) ##NO_TEXT. + ro_menu->add( iv_txt = 'Explore' iv_act = gc_action-go_explore ) ##NO_TEXT. + + ro_menu->add( iv_txt = 'Advanced' io_sub = lo_advsub ) ##NO_TEXT. + ro_menu->add( iv_txt = 'Help' io_sub = lo_helpsub ) ##NO_TEXT. ENDMETHOD. "build main_menu diff --git a/src/zabapgit_popups.prog.abap b/src/zabapgit_popups.prog.abap index 89d8ba4b8..1d442cf06 100644 --- a/src/zabapgit_popups.prog.abap +++ b/src/zabapgit_popups.prog.abap @@ -59,7 +59,13 @@ CLASS lcl_popups DEFINITION FINAL. default_button TYPE char1 DEFAULT '1' display_cancel_button TYPE char1 DEFAULT abap_true RETURNING VALUE(rv_answer) TYPE char1 - RAISING lcx_exception. + RAISING lcx_exception, + popup_to_inform + IMPORTING + titlebar TYPE clike + text_message TYPE clike + RAISING lcx_exception. + ENDCLASS. @@ -438,4 +444,22 @@ CLASS lcl_popups IMPLEMENTATION. ENDMETHOD. "popup_to_confirm + METHOD popup_to_inform. + + DATA: lv_line1 TYPE char70, + lv_line2 TYPE char70. + + lv_line1 = text_message. + IF strlen( text_message ) > 70. + lv_line2 = text_message+70. + ENDIF. + + CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT' + EXPORTING + titel = titlebar + textline1 = lv_line1 + textline2 = lv_line2. + + ENDMETHOD. " popup_to_inform. + ENDCLASS. \ No newline at end of file diff --git a/src/zabapgit_services_abapgit.prog.abap b/src/zabapgit_services_abapgit.prog.abap index 0b6ce6edf..1b7fb6efa 100644 --- a/src/zabapgit_services_abapgit.prog.abap +++ b/src/zabapgit_services_abapgit.prog.abap @@ -21,8 +21,23 @@ CLASS lcl_services_abapgit DEFINITION FINAL. CLASS-METHODS install_abapgit RAISING lcx_exception lcx_cancel. - CLASS-METHODS needs_installation - RETURNING VALUE(rv_not_completely_installed) TYPE abap_bool. + CLASS-METHODS install_abapgit_pi + RAISING lcx_exception lcx_cancel. + + CLASS-METHODS is_installed + RETURNING VALUE(rv_installed) TYPE abap_bool. + + CLASS-METHODS is_installed_pi + RETURNING VALUE(rv_installed) TYPE abap_bool. + + PRIVATE SECTION. + + CLASS-METHODS do_install + IMPORTING iv_title TYPE c + iv_text TYPE c + iv_url TYPE string + iv_package TYPE devclass + RAISING lcx_exception. ENDCLASS. "lcl_services_abapgit @@ -52,69 +67,108 @@ CLASS lcl_services_abapgit IMPLEMENTATION. METHOD install_abapgit. - DATA lv_text TYPE c LENGTH 100. - DATA lv_answer TYPE c LENGTH 1. - DATA lo_repo TYPE REF TO lcl_repo_online. - DATA lv_url TYPE string. - DATA lv_target_package TYPE devclass. + CONSTANTS lc_title TYPE c LENGTH 40 VALUE 'Install abapGit'. + DATA lv_text TYPE c LENGTH 100. - lv_text = |Installing current version ABAPGit to package { c_package_abapgit } | - && |and plugins to { c_package_plugins }|. + IF is_installed( ) = abap_true. + lv_text = 'Seems like abapGit package is already installed. No changes to be done'. + lcl_popups=>popup_to_inform( + titlebar = lc_title + text_message = lv_text ). + RETURN. + ENDIF. + + lv_text = |Confirm to install current version of ABAPGit to package { c_package_abapgit }|. + + do_install( iv_title = lc_title + iv_text = lv_text + iv_url = c_abapgit_url + iv_package = c_package_abapgit ). + + ENDMETHOD. "install_abapgit + + METHOD install_abapgit_pi. + + CONSTANTS lc_title TYPE c LENGTH 40 VALUE 'Install abapGit plugins'. + DATA lv_text TYPE c LENGTH 100. + + IF is_installed_pi( ) = abap_true. + lv_text = 'Seems like abapGit plugins package is already installed. No changes to be done'. + lcl_popups=>popup_to_inform( + titlebar = lc_title + text_message = lv_text ). + RETURN. + ENDIF. + + lv_text = |Confirm to install current version ABAPGit plugins to package { + c_package_plugins }|. + + do_install( iv_title = lc_title + iv_text = lv_text + iv_url = c_plugins_url + iv_package = c_package_plugins ). + + ENDMETHOD. "install_abapgit_pi + + METHOD do_install. + + DATA lo_repo TYPE REF TO lcl_repo_online. + DATA lv_answer TYPE c LENGTH 1. lv_answer = lcl_popups=>popup_to_confirm( - titlebar = 'Install abapGit' - text_question = lv_text + titlebar = iv_title + text_question = iv_text text_button_1 = 'Continue' text_button_2 = 'Cancel' default_button = '2' display_cancel_button = abap_false ). "#EC NOTEXT IF lv_answer <> '1'. - RETURN. ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + RETURN. ENDIF. - DO 2 TIMES. - CASE sy-index. - WHEN 1. - lv_url = c_abapgit_url. - lv_target_package = c_package_abapgit. - WHEN 2. - lv_url = c_plugins_url. - lv_target_package = c_package_plugins. - ENDCASE. + IF abap_false = lcl_app=>repo_srv( )->is_repo_installed( + iv_url = iv_url + iv_target_package = iv_package ). - IF abap_false = lcl_app=>repo_srv( )->is_repo_installed( - iv_url = lv_url - iv_target_package = lv_target_package ). + lcl_sap_package=>create_local( iv_package ). - lcl_sap_package=>create_local( lv_target_package ). + lo_repo = lcl_app=>repo_srv( )->new_online( + iv_url = iv_url + iv_branch_name = 'refs/heads/master' + iv_package = iv_package ) ##NO_TEXT. - lo_repo = lcl_app=>repo_srv( )->new_online( - iv_url = lv_url - iv_branch_name = 'refs/heads/master' "TODO replace with HEAD ? - iv_package = lv_target_package ) ##NO_TEXT. - - lo_repo->status( ). " check for errors - lo_repo->deserialize( ). - ENDIF. - ENDDO. + lo_repo->status( ). " check for errors + lo_repo->deserialize( ). + ENDIF. COMMIT WORK. - ENDMETHOD. "install_abapgit + ENDMETHOD. " do_install. - METHOD needs_installation. + + METHOD is_installed. TRY. - IF lcl_app=>repo_srv( )->is_repo_installed( c_abapgit_url ) = abap_false - OR lcl_app=>repo_srv( )->is_repo_installed( c_plugins_url ) = abap_false. - rv_not_completely_installed = abap_true. - ENDIF. + rv_installed = lcl_app=>repo_srv( )->is_repo_installed( c_abapgit_url ). + " TODO, alternative checks for presence in the system CATCH lcx_exception. " cannot be installed anyway in this case, e.g. no connection - rv_not_completely_installed = abap_false. + rv_installed = abap_false. ENDTRY. - ENDMETHOD. "needs_installation + ENDMETHOD. "is_installed + + METHOD is_installed_pi. + + TRY. + rv_installed = lcl_app=>repo_srv( )->is_repo_installed( c_plugins_url ). + " TODO, alternative checks for presence in the system + CATCH lcx_exception. + " cannot be installed anyway in this case, e.g. no connection + rv_installed = abap_false. + ENDTRY. + + ENDMETHOD. "is_installed_pi ENDCLASS. "lcl_services_abapgit \ No newline at end of file diff --git a/src/zabapgit_view_tutorial.prog.abap b/src/zabapgit_view_tutorial.prog.abap index 2dbeabd07..e264ac50c 100644 --- a/src/zabapgit_view_tutorial.prog.abap +++ b/src/zabapgit_view_tutorial.prog.abap @@ -7,6 +7,8 @@ CLASS lcl_gui_view_tutorial DEFINITION FINAL INHERITING FROM lcl_gui_page_super. METHODS lif_gui_page~render REDEFINITION. PRIVATE SECTION. + METHODS render_content + RETURNING VALUE(ro_html) TYPE REF TO lcl_html_helper. ENDCLASS. "lcl_gui_view_tutorial @@ -16,13 +18,51 @@ CLASS lcl_gui_view_tutorial IMPLEMENTATION. CREATE OBJECT ro_html. - ro_html->add( '
' ). - ro_html->add( 'Tutorial
' ). - ro_html->add( 'To add a repo as favorite' - && ' click icon at repo toolbar.
' ). - ro_html->add( 'To choose a repo press at the favorite bar.
' ). + ro_html->add( '
' ). + ro_html->add( render_content( ) ). ro_html->add( '
' ). ENDMETHOD. "lif_gui_page~render + METHOD render_content. + + CREATE OBJECT ro_html. + + _add '

Tutorial

'. + _add '
'. + + _add '

Repository list and favorites

'. + _add '

    '. + _add '
  • To choose a repo press at the favorite bar.
  • '. + _add '
  • To add a repo as favorite'. + _add ' click icon at repo toolbar.
  • '. + _add '

'. + + + _add '

Adding and cloning repos

'. + _add '

    '. + _add `
  • To clone a remote repo (e.g. from github) click `. + ro_html->add_anchor( iv_txt = '+ Clone' iv_act = gc_action-repo_clone ). + _add ' from the top menu. This will copy a remote repo to your system.
  • '. + _add `
  • To add a local package as a repo click `. + ro_html->add_anchor( iv_txt = '+ Offline' iv_act = gc_action-repo_newoffline ). + _add ' from the top menu. This will track a repo which already exist in'. + _add ' the system with abapGit. You''ll be able to attach it to remote origin'. + _add ' or just serialize as a zip file
  • '. + _add '

'. + + _add '

abapGit related repositories

'. + + _add '

    '. + _add '
  • '. + ro_html->add_anchor( iv_txt = 'install abapGit repo' iv_act = gc_action-abapgit_install ). + _add ' - To keep abapGit up-to-date (or also to contribute) you need to'. + _add 'install it as a repository.
  • '. + _add '
  • '. + ro_html->add_anchor( iv_txt = 'install abapGit plugins' iv_act = gc_action-abapgit_install_pi ). + _add ' - you can also install plugins to extend supported object types
  • '. + _add '

'. + + ENDMETHOD. " render_content. + ENDCLASS. "lcl_gui_view_tutorial \ No newline at end of file