mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2024-10-31 18:52:39 +00:00
Added draft status
Sort language strings Signed-off-by: Roland Dalmulder <contact@rolandd.com>
This commit is contained in:
parent
98e48eb411
commit
635327e36a
@ -57,6 +57,7 @@ class PullsModel extends ListModel
|
|||||||
'applied',
|
'applied',
|
||||||
'rtc',
|
'rtc',
|
||||||
'npm',
|
'npm',
|
||||||
|
'draft',
|
||||||
'label',
|
'label',
|
||||||
'branch',
|
'branch',
|
||||||
];
|
];
|
||||||
@ -267,6 +268,16 @@ class PullsModel extends ListModel
|
|||||||
$query->where($db->quoteName('pulls.is_npm') . ' = ' . $value);
|
$query->where($db->quoteName('pulls.is_npm') . ' = ' . $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$draft = $this->getState()->get('filter.draft');
|
||||||
|
|
||||||
|
if (!empty($draft))
|
||||||
|
{
|
||||||
|
// Not applied patches have a NULL value, so build our value part of the query based on this
|
||||||
|
$value = $draft === 'no' ? '0' : '1';
|
||||||
|
|
||||||
|
$query->where($db->quoteName('pulls.is_draft') . ' = ' . $value);
|
||||||
|
}
|
||||||
|
|
||||||
$labels = $this->getState()->get('filter.label');
|
$labels = $this->getState()->get('filter.label');
|
||||||
|
|
||||||
if (!empty($labels) && $labels[0] !== '')
|
if (!empty($labels) && $labels[0] !== '')
|
||||||
@ -351,7 +362,7 @@ class PullsModel extends ListModel
|
|||||||
// TODO - Option to configure the batch size
|
// TODO - Option to configure the batch size
|
||||||
$batchSize = 100;
|
$batchSize = 100;
|
||||||
|
|
||||||
$pullsResponse = Helper::initializeGithub()->getOpenIssues(
|
$pullsResponse = Helper::initializeGithub()->getOpenPulls(
|
||||||
$this->getState()->get('github_user'),
|
$this->getState()->get('github_user'),
|
||||||
$this->getState()->get('github_repo'),
|
$this->getState()->get('github_repo'),
|
||||||
$page,
|
$page,
|
||||||
@ -416,59 +427,54 @@ class PullsModel extends ListModel
|
|||||||
|
|
||||||
foreach ($pulls as $pull)
|
foreach ($pulls as $pull)
|
||||||
{
|
{
|
||||||
if (isset($pull->pull_request))
|
// Check if this PR is RTC and has a `PR-` branch label
|
||||||
|
$isRTC = false;
|
||||||
|
$isNPM = false;
|
||||||
|
$branch = $pull->base->ref;
|
||||||
|
|
||||||
|
foreach ($pull->labels as $label)
|
||||||
{
|
{
|
||||||
// Check if this PR is RTC and has a `PR-` branch label
|
if (strtolower($label->name) === 'rtc')
|
||||||
$isRTC = false;
|
|
||||||
$isNPM = false;
|
|
||||||
$branch = '';
|
|
||||||
|
|
||||||
foreach ($pull->labels as $label)
|
|
||||||
{
|
{
|
||||||
if (strtolower($label->name) === 'rtc')
|
$isRTC = true;
|
||||||
{
|
}
|
||||||
$isRTC = true;
|
elseif (in_array(
|
||||||
}
|
strtolower($label->name),
|
||||||
elseif (strpos($label->name, 'PR-') === 0)
|
['npm resource changed', 'composer dependency changed'],
|
||||||
{
|
true
|
||||||
$branch = substr($label->name, 3);
|
))
|
||||||
}
|
{
|
||||||
elseif (in_array(
|
$isNPM = true;
|
||||||
strtolower($label->name),
|
|
||||||
['npm resource changed', 'composer dependency changed'],
|
|
||||||
true
|
|
||||||
))
|
|
||||||
{
|
|
||||||
$isNPM = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$labels[] = implode(
|
|
||||||
',',
|
|
||||||
[
|
|
||||||
(int) $pull->number,
|
|
||||||
$this->getDbo()->quote($label->name),
|
|
||||||
$this->getDbo()->quote($label->color),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the data object to store in the database
|
$labels[] = implode(
|
||||||
$pullData = [
|
',',
|
||||||
(int) $pull->number,
|
[
|
||||||
$this->getDbo()->quote(
|
(int) $pull->number,
|
||||||
HTMLHelper::_('string.truncate', $pull->title, 150)
|
$this->getDbo()->quote($label->name),
|
||||||
),
|
$this->getDbo()->quote($label->color),
|
||||||
$this->getDbo()->quote(
|
]
|
||||||
HTMLHelper::_('string.truncate', $pull->body, 100)
|
);
|
||||||
),
|
|
||||||
$this->getDbo()->quote($pull->pull_request->html_url),
|
|
||||||
(int) $isRTC,
|
|
||||||
(int) $isNPM,
|
|
||||||
$this->getDbo()->quote($branch),
|
|
||||||
];
|
|
||||||
|
|
||||||
$data[] = implode(',', $pullData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build the data object to store in the database
|
||||||
|
$pullData = [
|
||||||
|
(int) $pull->number,
|
||||||
|
$this->getDbo()->quote(
|
||||||
|
HTMLHelper::_('string.truncate', $pull->title, 150)
|
||||||
|
),
|
||||||
|
$this->getDbo()->quote(
|
||||||
|
HTMLHelper::_('string.truncate', $pull->body, 100)
|
||||||
|
),
|
||||||
|
$this->getDbo()->quote($pull->html_url),
|
||||||
|
(int) $isRTC,
|
||||||
|
(int) $isNPM,
|
||||||
|
$this->getDbo()->quote($branch),
|
||||||
|
($pull->draft ? 1 : 0)
|
||||||
|
];
|
||||||
|
|
||||||
|
$data[] = implode(',', $pullData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are no pulls to insert then bail, assume we're finished
|
// If there are no pulls to insert then bail, assume we're finished
|
||||||
@ -484,7 +490,7 @@ class PullsModel extends ListModel
|
|||||||
->insert('#__patchtester_pulls')
|
->insert('#__patchtester_pulls')
|
||||||
->columns(
|
->columns(
|
||||||
['pull_id', 'title', 'description', 'pull_url',
|
['pull_id', 'title', 'description', 'pull_url',
|
||||||
'is_rtc', 'is_npm', 'branch']
|
'is_rtc', 'is_npm', 'branch', 'is_draft']
|
||||||
)
|
)
|
||||||
->values($data)
|
->values($data)
|
||||||
);
|
);
|
||||||
|
@ -21,6 +21,11 @@ foreach ($this->items as $i => $item) :
|
|||||||
<tr<?php echo $status; ?>>
|
<tr<?php echo $status; ?>>
|
||||||
<th scope="row" class="text-center">
|
<th scope="row" class="text-center">
|
||||||
<?php echo $item->pull_id; ?>
|
<?php echo $item->pull_id; ?>
|
||||||
|
<?php if ($item->is_draft) : ?>
|
||||||
|
<span class="badge" style="color: #FFFFFF; background-color: #6e7681">
|
||||||
|
<?php echo Text::_('COM_PATCHTESTER_IS_DRAFT'); ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<span><?php echo $this->escape($item->title); ?></span>
|
<span><?php echo $this->escape($item->title); ?></span>
|
||||||
|
@ -46,6 +46,18 @@
|
|||||||
<option value="0">JNO</option>
|
<option value="0">JNO</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="draft"
|
||||||
|
type="list"
|
||||||
|
default=""
|
||||||
|
validate="options"
|
||||||
|
onchange="this.form.submit();"
|
||||||
|
>
|
||||||
|
<option value="">COM_PATCHTESTER_FILTER_DRAFT_PATCHES</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="label"
|
name="label"
|
||||||
type="Label"
|
type="Label"
|
||||||
|
@ -9,6 +9,7 @@ CREATE TABLE IF NOT EXISTS `#__patchtester_pulls`
|
|||||||
`is_rtc` tinyint(1) NOT NULL DEFAULT 0,
|
`is_rtc` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`is_npm` tinyint(1) DEFAULT 0,
|
`is_npm` tinyint(1) DEFAULT 0,
|
||||||
`branch` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
`branch` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||||
|
`is_draft` tinyint(1) unsigned DEFAULT 0 COMMENT 'If the pull request is a draft PR',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
@ -9,6 +9,7 @@ CREATE TABLE IF NOT EXISTS "#__patchtester_pulls"
|
|||||||
"is_rtc" smallint DEFAULT 1 NOT NULL,
|
"is_rtc" smallint DEFAULT 1 NOT NULL,
|
||||||
"is_npm" smallint DEFAULT 1 NOT NULL,
|
"is_npm" smallint DEFAULT 1 NOT NULL,
|
||||||
"branch" character varying(255) DEFAULT '' NOT NULL,
|
"branch" character varying(255) DEFAULT '' NOT NULL,
|
||||||
|
"is_draft" smallint DEFAULT 0 NOT NULL,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE #__patchtester_pulls ADD is_draft TINYINT(1) UNSIGNED DEFAULT 0 NULL COMMENT 'If the pull request is a draft PR';
|
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "#__patchtester_pulls" ADD COLUMN "is_draft" smallint DEFAULT 0 NOT NULL;
|
@ -37,6 +37,12 @@ COM_PATCHTESTER_FETCH_PAGE_NUMBER="Processing page %s of GitHub data"
|
|||||||
COM_PATCHTESTER_FETCH_PAGE_NUMBER_OF_TOTAL="Processing page %1$s of %2$s pages of GitHub data"
|
COM_PATCHTESTER_FETCH_PAGE_NUMBER_OF_TOTAL="Processing page %1$s of %2$s pages of GitHub data"
|
||||||
COM_PATCHTESTER_FETCH_PROCESSING="Processing data from GitHub"
|
COM_PATCHTESTER_FETCH_PROCESSING="Processing data from GitHub"
|
||||||
COM_PATCHTESTER_FETCH_SUCCESSFUL="Successfully retrieved pull requests"
|
COM_PATCHTESTER_FETCH_SUCCESSFUL="Successfully retrieved pull requests"
|
||||||
|
COM_PATCHTESTER_FIELDSET_AUTHENTICATION_DESC="Configuration Values for GitHub Authentication"
|
||||||
|
COM_PATCHTESTER_FIELDSET_AUTHENTICATION_LABEL="GitHub Authentication"
|
||||||
|
COM_PATCHTESTER_FIELDSET_CI_SETTINGS="CI Server Settings"
|
||||||
|
COM_PATCHTESTER_FIELDSET_CI_SETTINGS_DESC="Configuration Values for CI Server Patching"
|
||||||
|
COM_PATCHTESTER_FIELDSET_REPOSITORIES_DESC="Configuration Values for GitHub Repository"
|
||||||
|
COM_PATCHTESTER_FIELDSET_REPOSITORIES_LABEL="GitHub Repository"
|
||||||
COM_PATCHTESTER_FIELD_CI_SERVER_NAME="CI Server Address"
|
COM_PATCHTESTER_FIELD_CI_SERVER_NAME="CI Server Address"
|
||||||
COM_PATCHTESTER_FIELD_CI_SERVER_NAME_DESC="Server address for compiled patches."
|
COM_PATCHTESTER_FIELD_CI_SERVER_NAME_DESC="Server address for compiled patches."
|
||||||
COM_PATCHTESTER_FIELD_CI_SERVER_SWITCH="Switch CI Integration"
|
COM_PATCHTESTER_FIELD_CI_SERVER_SWITCH="Switch CI Integration"
|
||||||
@ -50,8 +56,6 @@ COM_PATCHTESTER_FIELD_GH_TOKEN_DESC="Use this field to input a GitHub API Token
|
|||||||
COM_PATCHTESTER_FIELD_GH_TOKEN_LABEL="GitHub Token"
|
COM_PATCHTESTER_FIELD_GH_TOKEN_LABEL="GitHub Token"
|
||||||
COM_PATCHTESTER_FIELD_ORG_DESC="A username or organisation on GitHub to monitor pull requests for."
|
COM_PATCHTESTER_FIELD_ORG_DESC="A username or organisation on GitHub to monitor pull requests for."
|
||||||
COM_PATCHTESTER_FIELD_ORG_LABEL="Custom Project Owner"
|
COM_PATCHTESTER_FIELD_ORG_LABEL="Custom Project Owner"
|
||||||
COM_PATCHTESTER_FIELD_REPO_DESC="Name of a repository on GitHub to monitor pull requests for."
|
|
||||||
COM_PATCHTESTER_FIELD_REPO_LABEL="Custom Project Repository"
|
|
||||||
COM_PATCHTESTER_FIELD_REPOSITORY_CUSTOM="Custom"
|
COM_PATCHTESTER_FIELD_REPOSITORY_CUSTOM="Custom"
|
||||||
COM_PATCHTESTER_FIELD_REPOSITORY_DESC="Available Joomla! repositories. Select to autopopulate the organisation and repository fields values."
|
COM_PATCHTESTER_FIELD_REPOSITORY_DESC="Available Joomla! repositories. Select to autopopulate the organisation and repository fields values."
|
||||||
COM_PATCHTESTER_FIELD_REPOSITORY_LABEL="GitHub Repository"
|
COM_PATCHTESTER_FIELD_REPOSITORY_LABEL="GitHub Repository"
|
||||||
@ -59,42 +63,40 @@ COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_INSTALL_FROM_WEB="Joomla! Install From W
|
|||||||
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_JOOMLA_CMS="Joomla! CMS"
|
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_JOOMLA_CMS="Joomla! CMS"
|
||||||
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_PATCHTESTER="Joomla! Patch Tester Component"
|
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_PATCHTESTER="Joomla! Patch Tester Component"
|
||||||
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_WEBLINKS="Joomla! Weblinks Package"
|
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_WEBLINKS="Joomla! Weblinks Package"
|
||||||
COM_PATCHTESTER_FIELDSET_AUTHENTICATION_DESC="Configuration Values for GitHub Authentication"
|
COM_PATCHTESTER_FIELD_REPO_DESC="Name of a repository on GitHub to monitor pull requests for."
|
||||||
COM_PATCHTESTER_FIELDSET_AUTHENTICATION_LABEL="GitHub Authentication"
|
COM_PATCHTESTER_FIELD_REPO_LABEL="Custom Project Repository"
|
||||||
COM_PATCHTESTER_FIELDSET_CI_SETTINGS="CI Server Settings"
|
|
||||||
COM_PATCHTESTER_FIELDSET_CI_SETTINGS_DESC="Configuration Values for CI Server Patching"
|
|
||||||
COM_PATCHTESTER_FIELDSET_REPOSITORIES_DESC="Configuration Values for GitHub Repository"
|
|
||||||
COM_PATCHTESTER_FIELDSET_REPOSITORIES_LABEL="GitHub Repository"
|
|
||||||
COM_PATCHTESTER_FILE_DELETED_DOES_NOT_EXIST_S="The file marked for deletion does not exist: %s"
|
COM_PATCHTESTER_FILE_DELETED_DOES_NOT_EXIST_S="The file marked for deletion does not exist: %s"
|
||||||
COM_PATCHTESTER_FILE_MODIFIED_DOES_NOT_EXIST_S="The file marked for modification does not exist: %s"
|
COM_PATCHTESTER_FILE_MODIFIED_DOES_NOT_EXIST_S="The file marked for modification does not exist: %s"
|
||||||
COM_PATCHTESTER_FILTER_APPLIED_PATCHES="Filter Applied Patches"
|
COM_PATCHTESTER_FILTER_APPLIED_PATCHES="Filter Applied Patches"
|
||||||
COM_PATCHTESTER_FILTER_BRANCH="Filter Target Branch"
|
COM_PATCHTESTER_FILTER_BRANCH="Filter Target Branch"
|
||||||
|
COM_PATCHTESTER_FILTER_DRAFT_PATCHES="Filter Draft Patches"
|
||||||
COM_PATCHTESTER_FILTER_LABEL="Filter Label"
|
COM_PATCHTESTER_FILTER_LABEL="Filter Label"
|
||||||
COM_PATCHTESTER_FILTER_NPM_PATCHES="Filter NPM Patches"
|
COM_PATCHTESTER_FILTER_NPM_PATCHES="Filter NPM Patches"
|
||||||
COM_PATCHTESTER_FILTER_RTC_PATCHES="Filter RTC Patches"
|
COM_PATCHTESTER_FILTER_RTC_PATCHES="Filter RTC Patches"
|
||||||
COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION="Search the list by title or prefix with 'id:' to search by Pull ID."
|
COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION="Search the list by title or prefix with 'id:' to search by Pull ID."
|
||||||
COM_PATCHTESTER_GITHUB="GitHub"
|
COM_PATCHTESTER_GITHUB="GitHub"
|
||||||
COM_PATCHTESTER_HEADING_FETCH_DATA="Fetching GitHub Data"
|
COM_PATCHTESTER_HEADING_FETCH_DATA="Fetching GitHub Data"
|
||||||
|
COM_PATCHTESTER_IS_DRAFT="Draft"
|
||||||
COM_PATCHTESTER_JISSUE="J! Issue"
|
COM_PATCHTESTER_JISSUE="J! Issue"
|
||||||
COM_PATCHTESTER_JISSUES="Issue Tracker"
|
COM_PATCHTESTER_JISSUES="Issue Tracker"
|
||||||
COM_PATCHTESTER_NO_CREDENTIALS="You have not entered your GitHub API token in the Options. This will limit you to only 60 requests to the GitHub API per hour. Configuring authentication via an API token will allow 5,000 requests per hour."
|
|
||||||
COM_PATCHTESTER_NO_FILES_TO_PATCH="There are no files to patch from this pull request. This may mean that the files in the pull request are not present in your installation."
|
|
||||||
COM_PATCHTESTER_NO_ITEMS="No data has been retrieved from GitHub, please click the 'Fetch Data' button in the toolbar to retrieve the open pull requests."
|
|
||||||
COM_PATCHTESTER_NOT_APPLIED="Not Applied"
|
COM_PATCHTESTER_NOT_APPLIED="Not Applied"
|
||||||
COM_PATCHTESTER_NOT_NPM="Not NPM"
|
COM_PATCHTESTER_NOT_NPM="Not NPM"
|
||||||
COM_PATCHTESTER_NOT_RTC="Not RTC"
|
COM_PATCHTESTER_NOT_RTC="Not RTC"
|
||||||
|
COM_PATCHTESTER_NO_CREDENTIALS="You have not entered your GitHub API token in the Options. This will limit you to only 60 requests to the GitHub API per hour. Configuring authentication via an API token will allow 5,000 requests per hour."
|
||||||
|
COM_PATCHTESTER_NO_FILES_TO_PATCH="There are no files to patch from this pull request. This may mean that the files in the pull request are not present in your installation."
|
||||||
|
COM_PATCHTESTER_NO_ITEMS="No data has been retrieved from GitHub, please click the 'Fetch Data' button in the toolbar to retrieve the open pull requests."
|
||||||
COM_PATCHTESTER_NPM="NPM"
|
COM_PATCHTESTER_NPM="NPM"
|
||||||
COM_PATCHTESTER_PATCH_BREAKS_SITE="The patch could not be applied because it would break the site. Check the pull request to see if it is up-to-date."
|
COM_PATCHTESTER_PATCH_BREAKS_SITE="The patch could not be applied because it would break the site. Check the pull request to see if it is up-to-date."
|
||||||
|
COM_PATCHTESTER_PULLS_TABLE_CAPTION="Table of Pull Requests"
|
||||||
COM_PATCHTESTER_PULL_ID="Pull ID"
|
COM_PATCHTESTER_PULL_ID="Pull ID"
|
||||||
COM_PATCHTESTER_PULL_ID_ASC="Pull ID ascending"
|
COM_PATCHTESTER_PULL_ID_ASC="Pull ID ascending"
|
||||||
COM_PATCHTESTER_PULL_ID_DESC="Pull ID descending"
|
COM_PATCHTESTER_PULL_ID_DESC="Pull ID descending"
|
||||||
COM_PATCHTESTER_PULLS_TABLE_CAPTION="Table of Pull Requests"
|
|
||||||
COM_PATCHTESTER_READY_TO_COMMIT="Ready to Commit"
|
COM_PATCHTESTER_READY_TO_COMMIT="Ready to Commit"
|
||||||
COM_PATCHTESTER_REPO_IS_GONE="The patch could not be applied because the repository is missing"
|
COM_PATCHTESTER_REPO_IS_GONE="The patch could not be applied because the repository is missing"
|
||||||
COM_PATCHTESTER_REQUIREMENT_HTTPS="HTTPS wrappers must be enabled"
|
|
||||||
COM_PATCHTESTER_REQUIREMENT_OPENSSL="The OpenSSL extension must be installed and enabled in your php.ini"
|
|
||||||
COM_PATCHTESTER_REQUIREMENTS_HEADING="Requirements Not Met"
|
COM_PATCHTESTER_REQUIREMENTS_HEADING="Requirements Not Met"
|
||||||
COM_PATCHTESTER_REQUIREMENTS_NOT_MET="Your system does not meet the requirements to run the Patch Tester component:"
|
COM_PATCHTESTER_REQUIREMENTS_NOT_MET="Your system does not meet the requirements to run the Patch Tester component:"
|
||||||
|
COM_PATCHTESTER_REQUIREMENT_HTTPS="HTTPS wrappers must be enabled"
|
||||||
|
COM_PATCHTESTER_REQUIREMENT_OPENSSL="The OpenSSL extension must be installed and enabled in your php.ini"
|
||||||
COM_PATCHTESTER_RESET_HAS_ERRORS="The reset process has completed however it encountered errors. Please remove any .txt files in the '%1$s' directory and truncate the '%2$s' database table."
|
COM_PATCHTESTER_RESET_HAS_ERRORS="The reset process has completed however it encountered errors. Please remove any .txt files in the '%1$s' directory and truncate the '%2$s' database table."
|
||||||
COM_PATCHTESTER_RESET_OK="The reset process has completed successfully."
|
COM_PATCHTESTER_RESET_OK="The reset process has completed successfully."
|
||||||
COM_PATCHTESTER_REVERT_OK="Patch successfully reverted"
|
COM_PATCHTESTER_REVERT_OK="Patch successfully reverted"
|
||||||
|
Loading…
Reference in New Issue
Block a user