Page MenuHomeMiraheze

Add search feature in ManageWiki
Closed, DeclinedPublic

Description

This would allow people to quickly locate the configuration option they want without having to look through every single option. Works even better when combined with T5792.

Event Timeline

Reception123 lowered the priority of this task from Normal to Low.Jun 22 2020, 06:18
Reception123 moved this task from Backlog to Features on the ManageWiki board.

as with all other feature request for MW

This is definitely a useful feature request, but it seems extremely difficult to implement and I'm not sure how feasible it is, but I'll try to look into it.

I think I know of a way to do this with a bit of JavaScript. I will attempt this. But if my way doesn't work I really don't know how else this will be possible, so it should probably be declined.

There are two options for this.

  • 1) Make this "search" filter the current tab values or
  • 2) Make the search return if the variable is available in ManageWiki, and in what section its in.

That's all I can think of to do this and I'm not sure which why is better for me to attempt.

I drafted some JavaScript for this to achieve this in one way. Not sure if this is the way we want to go though.

This will generate a dialog with a search field, which will filter the variable and section names in a generated table, in order to easily know where stuff is.

There are other options to achieve this, and I am really unsure how this will be to the UI, but this is just an option.

var names = [];
var sections = [];

$( '#managewiki-form :input[name]:not( #managewiki-submit-reason :input[name] )' ).each( function () {
	if ( $.inArray( this.name, names ) === -1 ) {
		names.push( this.name );

		sections[ this.name ] = $( $( this ).parents( 'fieldset' ).contents()[ 0 ] ).text();
	}

} );

function value( name ) {
	return name.toUpperCase().includes( $( '#managewiki-search :input' ).val().toUpperCase() );
}

function ProcessDialog( config ) {
	ProcessDialog.super.call( this, config );
}

OO.inheritClass( ProcessDialog, OO.ui.ProcessDialog );

ProcessDialog.static.name = 'managewiki-search';

ProcessDialog.static.title = 'Search';

ProcessDialog.static.actions = [ {
	label: 'Exit',
	flags: 'safe'
} ];

ProcessDialog.prototype.initialize = function () {
	ProcessDialog.super.prototype.initialize.apply( this, arguments );

	this.panel = new OO.ui.PanelLayout( {
		padded: true,
		expanded: false
	} );

	this.content = new OO.ui.FieldsetLayout();

	this.searchInput = new OO.ui.SearchInputWidget();

	this.field = new OO.ui.FieldLayout( this.searchInput, {
		label: 'Search',
		id: 'managewiki-search',
		align: 'top'
	} );

	this.content.addItems( [ this.field ] );

	this.panel.$element.append( this.content.$element );

	this.$body.append( this.panel.$element );

	var dialog = this;

	$( "#managewiki-search :input" ).keyup( function () {
		$( '.managewiki-table' ).remove();

		if ( $( '#managewiki-search :input' ).val() != '' ) {
			dialog.$body.append( '<center><table class="wikitable managewiki-table">' +
				'<tr class="header">' +
				'<th style="width:60%;">Name</th>' +
				'<th style="width:40%;">Section</th>' +
				'</tr>' +
				'</table></center>' );

			names.filter( value ).forEach( function ( name ) {
				if ( sections[ name ] ) {
					$( '.managewiki-table' ).append( '<tr><td>' + name + '</td><td>' + sections[ name ] + '</td></tr>' );
				}
			} );
		}
	} );
};

ProcessDialog.prototype.getActionProcess = function ( action ) {
	var dialog = this;
	if ( action ) {
		return new OO.ui.Process( function () {
			dialog.close( {
				action: action
			} );
		} );
	}

	return ProcessDialog.super.prototype.getActionProcess.call( this, action );
};

ProcessDialog.prototype.getBodyHeight = function () {
	return 300;
};

var windowManager = new OO.ui.WindowManager();
$( document.body ).append( windowManager.$element );

var processDialog = new ProcessDialog( {
	size: 'large'
} );

windowManager.addWindows( [ processDialog ] );

windowManager.openWindow( processDialog );

Regrettably declining this task.

  1. my implementation mentioned above seems to provide little benefit.
  2. implementing an actual search which filters fields is impossible with the way ManageWiki is setup with tabs.
  3. my current implementation plans, in addition to providing little benefit, don't provide for great UI.