mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-03 05:18:59 +08:00
Page Stage: Preserve filter value
On page stage the filter value is preserved while navigating to diff or commit page and navigate back.
This commit is contained in:
parent
3c86342bef
commit
2b4ff9529b
|
@ -9,6 +9,7 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
||||||
CONSTANTS: BEGIN OF c_action,
|
CONSTANTS: BEGIN OF c_action,
|
||||||
stage_all TYPE string VALUE 'stage_all',
|
stage_all TYPE string VALUE 'stage_all',
|
||||||
stage_commit TYPE string VALUE 'stage_commit',
|
stage_commit TYPE string VALUE 'stage_commit',
|
||||||
|
stage_filter TYPE string VALUE 'stage_filter',
|
||||||
END OF c_action.
|
END OF c_action.
|
||||||
|
|
||||||
METHODS:
|
METHODS:
|
||||||
|
@ -37,6 +38,7 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
||||||
DATA mo_repo TYPE REF TO zcl_abapgit_repo_online .
|
DATA mo_repo TYPE REF TO zcl_abapgit_repo_online .
|
||||||
DATA ms_files TYPE zif_abapgit_definitions=>ty_stage_files .
|
DATA ms_files TYPE zif_abapgit_definitions=>ty_stage_files .
|
||||||
DATA mv_seed TYPE string . " Unique page id to bind JS sessionStorage
|
DATA mv_seed TYPE string . " Unique page id to bind JS sessionStorage
|
||||||
|
DATA mv_filter_value TYPE string.
|
||||||
|
|
||||||
METHODS find_changed_by
|
METHODS find_changed_by
|
||||||
IMPORTING
|
IMPORTING
|
||||||
|
@ -227,7 +229,8 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
" Filter bar
|
" Filter bar
|
||||||
ro_html->add( '<td class="right">' ).
|
ro_html->add( '<td class="right">' ).
|
||||||
ro_html->add( '<input class="stage-filter" id="objectSearch"' &&
|
ro_html->add( '<input class="stage-filter" id="objectSearch"' &&
|
||||||
' type="search" placeholder="Filter objects">' ).
|
' type="search" placeholder="Filter objects"' &&
|
||||||
|
| value={ mv_filter_value }>| ).
|
||||||
ro_html->add( '</td>' ).
|
ro_html->add( '</td>' ).
|
||||||
|
|
||||||
ro_html->add( '</tr>' ).
|
ro_html->add( '</tr>' ).
|
||||||
|
@ -399,7 +402,9 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD zif_abapgit_gui_page~on_event.
|
METHOD zif_abapgit_gui_page~on_event.
|
||||||
|
|
||||||
DATA lo_stage TYPE REF TO zcl_abapgit_stage.
|
DATA: lo_stage TYPE REF TO zcl_abapgit_stage,
|
||||||
|
lv_string TYPE string,
|
||||||
|
lt_fields TYPE tihttpnvp.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_file> LIKE LINE OF ms_files-local.
|
FIELD-SYMBOLS: <ls_file> LIKE LINE OF ms_files-local.
|
||||||
|
|
||||||
|
@ -435,6 +440,18 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
io_stage = lo_stage.
|
io_stage = lo_stage.
|
||||||
ev_state = zif_abapgit_definitions=>c_event_state-new_page.
|
ev_state = zif_abapgit_definitions=>c_event_state-new_page.
|
||||||
|
|
||||||
|
WHEN c_action-stage_filter.
|
||||||
|
|
||||||
|
CONCATENATE LINES OF it_postdata INTO lv_string.
|
||||||
|
|
||||||
|
lt_fields = zcl_abapgit_html_action_utils=>parse_fields( lv_string ).
|
||||||
|
|
||||||
|
zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = 'filterValue'
|
||||||
|
it_field = lt_fields
|
||||||
|
CHANGING cg_field = mv_filter_value ).
|
||||||
|
|
||||||
|
ev_state = zif_abapgit_definitions=>c_event_state-no_more_act.
|
||||||
|
|
||||||
WHEN zif_abapgit_definitions=>c_action-go_patch. " Go Patch page
|
WHEN zif_abapgit_definitions=>c_action-go_patch. " Go Patch page
|
||||||
|
|
||||||
ei_page = get_page_patch(
|
ei_page = get_page_patch(
|
||||||
|
|
|
@ -180,7 +180,7 @@ function StageHelper(params) {
|
||||||
this.pageSeed = params.seed;
|
this.pageSeed = params.seed;
|
||||||
this.formAction = params.formAction;
|
this.formAction = params.formAction;
|
||||||
this.choiseCount = 0;
|
this.choiseCount = 0;
|
||||||
this.lastSearchValue = "";
|
this.lastFilterValue = "";
|
||||||
|
|
||||||
// DOM nodes
|
// DOM nodes
|
||||||
this.dom = {
|
this.dom = {
|
||||||
|
@ -218,8 +218,8 @@ function StageHelper(params) {
|
||||||
StageHelper.prototype.setHooks = function() {
|
StageHelper.prototype.setHooks = function() {
|
||||||
this.dom.stageTab.onclick = this.onTableClick.bind(this);
|
this.dom.stageTab.onclick = this.onTableClick.bind(this);
|
||||||
this.dom.commitBtn.onclick = this.submit.bind(this);
|
this.dom.commitBtn.onclick = this.submit.bind(this);
|
||||||
this.dom.objectSearch.oninput = this.onSearch.bind(this);
|
this.dom.objectSearch.oninput = this.onFilter.bind(this);
|
||||||
this.dom.objectSearch.onkeypress = this.onSearch.bind(this);
|
this.dom.objectSearch.onkeypress = this.onFilter.bind(this);
|
||||||
window.onbeforeunload = this.onPageUnload.bind(this);
|
window.onbeforeunload = this.onPageUnload.bind(this);
|
||||||
window.onload = this.onPageLoad.bind(this);
|
window.onload = this.onPageLoad.bind(this);
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ StageHelper.prototype.onPageUnload = function() {
|
||||||
|
|
||||||
var data = this.collectData();
|
var data = this.collectData();
|
||||||
window.sessionStorage.setItem(this.pageSeed, JSON.stringify(data));
|
window.sessionStorage.setItem(this.pageSeed, JSON.stringify(data));
|
||||||
}
|
};
|
||||||
|
|
||||||
// Re-store table state on entering the page
|
// Re-store table state on entering the page
|
||||||
StageHelper.prototype.onPageLoad = function() {
|
StageHelper.prototype.onPageLoad = function() {
|
||||||
|
@ -254,8 +254,11 @@ StageHelper.prototype.onPageLoad = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.updateMenu();
|
this.updateMenu();
|
||||||
|
if (this.dom.objectSearch.value) {
|
||||||
|
this.applyFilterValue(this.dom.objectSearch.value);
|
||||||
|
}
|
||||||
debugOutput("StageHelper.onPageLoad: " + ((data) ? "from Storage" : "initial state"));
|
debugOutput("StageHelper.onPageLoad: " + ((data) ? "from Storage" : "initial state"));
|
||||||
}
|
};
|
||||||
|
|
||||||
// Table event handler, change status
|
// Table event handler, change status
|
||||||
StageHelper.prototype.onTableClick = function (event) {
|
StageHelper.prototype.onTableClick = function (event) {
|
||||||
|
@ -292,15 +295,22 @@ StageHelper.prototype.onTableClick = function (event) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Search object
|
// Search object
|
||||||
StageHelper.prototype.onSearch = function (e) {
|
StageHelper.prototype.onFilter = function (e) {
|
||||||
if ( // Enter hit or clear, IE SUCKS !
|
if ( // Enter hit or clear, IE SUCKS !
|
||||||
e.type === "input" && !e.target.value && this.lastSearchValue
|
e.type === "input" && !e.target.value && this.lastFilterValue
|
||||||
|| e.type === "keypress" && e.which === 13 ) {
|
|| e.type === "keypress" && e.which === 13 ) {
|
||||||
|
|
||||||
this.lastSearchValue = e.target.value;
|
this.applyFilterValue(e.target.value);
|
||||||
this.iterateStageTab(true, this.applyFilterToRow, e.target.value);
|
submitSapeventForm({ 'filterValue': e.target.value }, "stage_filter", "post");
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
StageHelper.prototype.applyFilterValue = function(sFilterValue) {
|
||||||
|
|
||||||
|
this.lastFilterValue = sFilterValue;
|
||||||
|
this.iterateStageTab(true, this.applyFilterToRow, sFilterValue);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// Apply filter to a single stage line - hide or show
|
// Apply filter to a single stage line - hide or show
|
||||||
StageHelper.prototype.applyFilterToRow = function (row, filter) {
|
StageHelper.prototype.applyFilterToRow = function (row, filter) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user