User:Tessus/Mantis: Difference between revisions

From evermeet.cx Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:
|needs-updatephp = No
|needs-updatephp = No
|schema-registry =
|schema-registry =
|license        = GPLv2+
|license        = GPL-2.0+
|download        = {{ {{TNTN|GithubDownload}} |tessus|mwExtensionMantis}}
|download        = {{ {{TNTN|GithubDownload}} |tessus|mwExtensionMantis}}
|readme          =  
|readme          =  

Revision as of 01:28, 21 October 2017

{{ Template:TNTN |name = Mantis |status = stable |type1 = tag |type2 = |hook1 = ParserFirstCallInit |hook2 = |username = tessus |author = Helmut K. C. Tessarek |description = Displays a (customizable) list of MantisBT tickets |image = |imagesize = |version = 2.0 |update = 2017-09-11 |mediawiki = 1.25+ |php = 5.4+ |compatibility policy = master |needs-updatephp = No |schema-registry = |license = GPL-2.0+ |download = {{ Template:TNTN |tessus|mwExtensionMantis}} |readme = |changelog = |parameters = $wgMantisConf[] |tags = <mantis> |rights = |example = |compatibility = |bugzilla = }}

The Mantis extension allows users to display a list of MantisBT tickets on a page.

By default it shows a color-coded table of open tickets. The following options can be customized:

  • table header on/off
  • colors on/off
  • length of summary text
  • date format
  • specify tickets by
    • bugid
    • status
    • severity
    • category
    • project
    • username
    • version (range filtering supported)
    • target_version (range filtering supported)
    • fixed_in_version (range filtering supported)
    • resolution
  • sort by multiple columns with individual sort order
  • show only certain columns
  • limit the output
  • suppress error and informational messages
  • change header names for columns
  • change the alignment of columns
  • add comments to tickets


Installation

This extension is for Mantis databases running on MySQL.

  • Grab the code via git:
cd extensions
git clone https://github.com/tessus/mwExtensionMantis.git Mantis
  • Add the following code at the bottom of your LocalSettings.php:
require_once( "$IP/extensions/Mantis/Mantis.php" );
  • Template:Done – Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Configuration

By default the following options are set by this extension:

$wgMantisConf['DBserver']         = 'localhost'; // Mantis database server
$wgMantisConf['DBport']           = NULL;        // Mantis database port
$wgMantisConf['DBname']           = '';          // Mantis database name
$wgMantisConf['DBuser']           = '';
$wgMantisConf['DBpassword']       = '';
$wgMantisConf['DBprefix']         = '';          // Table prefix
$wgMantisConf['Url']              = '';          // Mantis Root Page
$wgMantisConf['MaxCacheTime']     = 60*60*0;     // How long to cache pages in seconds
$wgMantisConf['PriorityString']   = '10:none,20:low,30:normal,40:high,50:urgent,60:immediate';
$wgMantisConf['StatusString']     = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,80:resolved,90:closed';
$wgMantisConf['StatusColors']     = '10:fcbdbd,20:e3b7eb,30:ffcd85,40:fff494,50:c2dfff,80:d2f5b0,90:c9ccc4';
$wgMantisConf['SeverityString']   = '10:feature,20:trivial,30:text,40:tweak,50:minor,60:major,70:crash,80:block';
$wgMantisConf['ResolutionString'] = '10:open,20:fixed,30:reopened,40:unable to duplicate,50:not fixable,60:duplicate,70:not a bug,80:suspended,90:wont fix';

You may change each one of these parameters by including it with your specified value into your LocalSettings.php below the initialization of this extension.

Set $wgMantisConf['Url'] to the root of the Mantis web page, e.g. https://www.example.com/mantis. If you don't set it or leave it empty, the Id field will not have a link to the Mantis ticket.

If you have customized or added additional fields to your MantisBT environment, you should change the last 5 parameters accordingly. The correct strings ($g_priority_enum_string, $g_status_enum_string, $g_status_colors, $g_severity_enum_string, $g_resolution_enum_string) can be found in the file config_defaults_inc.php in your Mantis directory.

Performance Considerations

Some of the filters use columns for which no corresponding indexes exist in the Mantis database. The same is true for columns that can be used in orderby to sort the output.

If you experience performance issues, please talk to your Mantis database admin. In most cases performance should not be an issue, unless you have millions of bugs in your Mantis database, in which case you should consider to scrap your product anyway. 😏

Usage

This extension can be used with XML-like syntax in the wiki edit view. The parameters control what data and how it will be displayed. See the following sections for information on each parameter. By default it will show a color-coded table of open tickets.

<mantis/>

File:Mantis example1.png

To display the last 3 'assigned' tickets without header and without colorized rows showing columns Id, Status, Updated, and Summary:

<mantis>
status = assigned
header = false
color  = false
count  = 3
show   = id, status, updated, summary
</mantis>

File:Mantis example2.png

Parameters

Parameters are set in the format parameter=value. Whitespaces are ignored.

bugid

bugid specifies a single ticket or a list of tickets (separated by comma). If only a single ticket is specified, header and color are turned off automatically. They can be turned on again, by setting them explicitly. If the ticket is (or the tickets are) not found, an informational message is displayed unless suppressinfo is set to true.

Parameter bugid
Format value [, value, ...]
Value(s) a Mantis ticket id
Default

header

header decides, if a table header will be displayed. The default value is true unless a single bugid is specified. The parameter can be set to true or false, whereas on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter header
Format value
Value(s) true|yes|on, false|no|off
Default true

color

color decides, if the table will be color-coded. The default value is true unless a single bugid is specified. The parameter can be set to true or false, whereas on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter color
Format value
Value(s) true|yes|on, false|no|off
Default true

dateformat

dateformat specifies the format of the date that will be shown in the columns Updated and Created. The default value is Y-m-d.

Parameter dateformat
Format value
Value(s) a valid date format string
Default Y-m-d

show

show specifies which columns are shown in the table. By default the following columns are shown: id, project, category, severity, status, updated, and summary. Valid values are id, category, severity, priority, status, username, created, updated, version, target_version, fixed_in_version, resolution, and summary. If the input value is not recognized, it will be ignored. Are all of the input values invalid, the default columns are shown.

Parameter show
Format value [, value, ...]
Value(s) id, project, category, severity, priority, status, username, created, updated, version, target_version, fixed_in_version, resolution, summary
Default id, category, severity, status, updated, summary

status

status determines which tickets will be shown in the table. The default value is open, which are all tickets that are not closed. In a standard Mantis environment, the following values are valid: new, feedback, acknowledged, confirmed, assigned, resolved, closed, and all. If the input value is not recognized, it will be ignored and the default value will be used.

If you have a customized $wgMantisConf['StatusString'], the status names listed in the parameter are valid values (see Configuration).

Parameter status
Format value [, value, ...]
Value(s) open, new, feedback, acknowledged, confirmed, assigned, resolved, closed, all
Default open

severity

severity allows to filter tickets by severity. In a standard Mantis environment, the following values are valid: feature, trivial, text, tweak, minor, major, crash, and block.

If you have a customized $wgMantisConf['SeverityString'], the severity names listed in the parameter are valid values (see Configuration).

Parameter severity
Format value [, value, ...]
Value(s) feature, trivial, text, tweak, minor, major, crash, block
Default

category

category allows to filter tickets by category. Only category names defined in the database are valid. If the input value is not recognized, it will be ignored.

Parameter category
Format value [, value, ...]
Value(s) category name
Default

project

project allows to filter tickets by project. Only project names defined in the database are valid. If the input value is not recognized, it will be ignored.

Parameter project
Format value [, value, ...]
Value(s) project name
Default

username

username allows to filter tickets by username. Only usernames defined in the database are valid. If the input value is not recognized, it will be ignored.

Parameter username
Format value [, value, ...]
Value(s) username
Default

version

version allows to filter tickets by version. Only versions defined in the database are valid. If the input value is not recognized, it will be ignored.

Range Filtering is supported. Please see section Range Filtering for more details.

Parameter version
Format value [, value, ...]
Value(s) version
Default

target_version

target_version allows to filter tickets by target_version. Only target_versions defined in the database are valid. If the input value is not recognized, it will be ignored.

Range Filtering is supported. Please see section Range Filtering for more details.

Parameter target_version
Format value [, value, ...]
Value(s) target version
Default

fixed_in_version

fixed_in_version allows to filter tickets by fixed_in_version. Only fixed_in_versions defined in the database are valid. If the input value is not recognized, it will be ignored.

Range Filtering is supported. Please see section Range Filtering for more details.

Parameter fixed_in_version
Format value [, value, ...]
Value(s) fixed in version
Default

resolution

resolution allows to filter tickets by resolution. In a standard Mantis environment, the following values are valid: open, fixed, reopened, unable to duplicate, not fixable, duplicate, not a bug, suspended, and wont fix.

If you have a customized $wgMantisConf['ResolutionString'], the resolution names listed in the parameter are valid values (see Configuration).

Parameter category
Format value [, value, ...]
Value(s) open, fixed, reopened, unable to duplicate, not fixable, duplicate, not a bug, suspended, wont fix
Default

orderby

orderby determines by which columns the table is sorted. The default value is updated desc, which is the date the ticket was last updated with a reverse sort order (most recent tickets first). Valid values are id, project, category, severity, priority, status, username, created, updated, version, target_version, fixed_in_version, resolution, and summary. The additional values asc and desc can be appended to specify the sort order for that column. If the input value is not recognized, it will be ignored and the default value will be used. Instead of orderby, the aliases sortkey or ordermethod may be used.

Note: status, property, severity, and resolution are sorted by their numerical value (see Configuration), not their name.

Parameter orderby, ordermethod, sortkey
Format value [asc|desc| [, value [asc|desc], ...]
Value(s) id, project, category, severity, priority, status, username, created, updated, version, target_version, fixed_in_version, resolution, summary
Default updated desc

order

Note: This option is deprecated, but still available for backwards compatibilty. It will be ignored unless orderby specifies a single column without a sort order!

order decides the sort direction. The value can be descending (default, most recent to oldest, z to a) or ascending (oldest to most recent, a to z). desc is an alias for descending, and asc is an alias for ascending. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter order
Format value
Value(s) asc|ascending, desc|descending
Default desc

count

count restricts the number of results that are shown. There is no default value. If the input value is not recognized, it will be ignored.

Parameter count
Format value
Value(s) number of results to show
Default

summarylength

summarylength specifies the length of the summary text to display. If set, the summary text is cut off at the specified length. There is no default value. If the input value is not recognized, it will be ignored.

Parameter summarylength
Format value
Value(s) max length of summary text
Default

suppresserrors

suppresserrors hides database errors, like connection errors. The value can be true (hide errors) or false (default, show errors). on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter suppresserrors
Format value
Value(s) true|yes|on, false|no|off
Default false

suppressinfo

suppressinfo hides informational messages, e.g. that no ticket with a specified bugid was found or that there are no tickets with a certain status. The value can be true (hide informational messages) or false (default, show informational messages). on and yes are aliases for true, and off and no are aliases for false. If the input value is not recognized, it will be ignored and the default value will be used.

Parameter suppressinfo
Format value
Value(s) true|yes|on, false|no|off
Default false

headername

headername makes it possible to change the header names of table columns. They are specified by using the following format: headername<delimiter><colname> = text, where <delimiter> can be any character. Valid values for <colname> are all valid values for the option show.

Parameter headername<delimiter><colname>
Format value
Value(s) header name for column
Default

Example:

headername.fixed_in_version = Fixed In

align

align makes it possible to change the alignment of table columns. They are specified by using the following format: align<delimiter><colname> = value, where <delimiter> can be any character. Valid values for <colname> are all valid values for the option show.

Parameter align<delimiter><colname>
Format value
Value(s) l|left, c|center, r|right
Default

Example:

align.fixed_in_version = left

comment

comment makes it possible to add comments to tickets. They are specified by using the following format: comment<delimiter><bugid> = text, where <delimiter> can be any character. The following 3 expressions, which will add the comment to ticket number 42, are equivalent:

comment.42 = Answer to the Ultimate Question of Life, The Universe, and Everything
comment#42 = Answer to the Ultimate Question of Life, The Universe, and Everything
comment/42 = Answer to the Ultimate Question of Life, The Universe, and Everything
Parameter comment<delimiter><bugid>
Format value
Value(s) comment to be added to <bugid>
Default

Range Filtering

Range Filtering is available for the following options: version, target_version, and fixed_in_version

Following operators are available: gt, ge, lt, le.

Operator Meaning
gt greater than
ge greater than or equal to
lt less than
le less than or equal to

Maximal two operators are allowed.

Format op value [, op value]
op gt, ge, lt, le
value version

Examples:

<mantis>
status = resolved, closed
fixed_in_version = gt 2.71

It is also possible to restrict the range on both ends:

status = resolved, closed
fixed_in_version = gt 2.71, le 3.0