\TransvisionHealth

Health class

Helper functions for the Health view

Summary

Methods
Properties
Constants
getColumnsKeys()
getColumnsNames()
getStatus()
getStats()
addLink()
addTab()
addRow()
getStatsTab()
getStatsPane()
No public properties found
No constants found
No protected methods found
$columns
N/A
No private methods found
No private properties found
N/A

Properties

$columns

$columns : 

This array stores all the different columns we display in the table for products health with the associated display name

Type

Methods

getColumnsKeys()

getColumnsKeys() : array

Get the list of id for columns used in products health table

Returns

array —

list of column ids

getColumnsNames()

getColumnsNames() : array

Get the list of name for columns used in products health table

Returns

array —

list of column names

getStatus()

getStatus(string  $name, array  $ref_strings, array  $loc_strings) : array

Get an array with the completion status by analyzing the localized strings array vs. the reference strings array.

Parameters

string $name

Real name of the repository that will be displayed in the UI.

array $ref_strings

Array containing all the reference strings of the repo ('entity_name' => 'Content.')

array $loc_strings

Array containing all the strings of the repo for a given locale ('entity_name' => 'Localized content.')

Returns

array —

Status for a repository of a locale

getStats()

getStats(  $projects) : array

Get an array with the total of available strings and total of translated strings for all the projects of the current locale

Parameters

$projects

Returns

array —

Total number of translated strings and reference strings

addLink()

addLink(string  $title, string  $anchor, boolean  $active) : string

Create a tab-link element that can be added to a list of tabs.

Parameters

string $title

Text displayed in the tab

string $anchor

HTML anchor used to activate the associated tab-content. Should be the same as the $id argument in Health::addTab.

boolean $active

Should this tab be the active one?

Returns

string —

HTML element to add between

addTab()

addTab(string  $id, boolean  $active) : string

Create a tab-content element that can be added to a list of tab-content.

Parameters

string $id

ID that will be used in combination with an HTML anchor in a tab-link to show this tab-content. Should match the $anchor argument in Health::addLink.

boolean $active

Should this tab be the active one?

Returns

string —

HTML element to add between

and
.

addRow()

addRow(array  $col, array  $status) : string

Create a row to be added to a table, extracting values for all the columns.

Parameters

array $col

Array containing the id of each column

array $status

Array containing the value for each column

Returns

string —

HTML element to add to a table

getStatsTab()

getStatsTab(array  $data, string  $id, boolean  $active) : string

Create a tab containing the repo info

Parameters

array $data

Array containing structured commit data

string $id

ID that will be used in combination with an HTML anchor in a tab-link to show this tab-content. Should match the id in $data argument used in Health::getStatsPane.

boolean $active

Should this tab be the active one?

Returns

string —

HTML element to add between

and
, or false if data are missing.

getStatsPane()

getStatsPane(array  $data) : string

Create a panel containing tabs with info for all the repos of this group For instance, a panel with tabs for mozilla_org and firefox_ios repos.

Parameters

array $data

Array containing all the data for each repo

Returns

string —

HTML element to add in the repo tab