Commit cbe76113 authored by Simon Gilli's avatar Simon Gilli
Browse files

Merge branch...

Merge branch '520-add-filter-to-show-only-versions-in-version-history-that-support-given-typo3-version' into 'develop'

Resolve "Add filter to show only versions in version history that support given TYPO3 version"

Closes #520

See merge request !669
parents f10f5381 cc55bc10
Pipeline #11642 passed with stages
in 9 minutes
......@@ -845,6 +845,11 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
return $supportedTypo3Versions;
}
public function getMatrixOfSupportedTypo3VersionsAsList(): string
{
return implode(',', array_column($this->getMatrixOfSupportedTypo3Versions(), 'label'));
}
public function doesSupportTypo3Version(int $versionNumber): bool
{
if ($this->getTypo3Dependency() === null || $this->getReviewState() === \T3o\TerFe2\Domain\Model\Version::VERSION_IS_INSECURE) {
......
<html xmlns:terfe2="http://typo3.org/ns/T3o/TerFe2/ViewHelpers" data-namespace-typo3-fluid="true">
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<f:then>
<f:form action="update" method="post" controller="Review" name="extension" object="{extension}">
<table class="table table-hover table-responsive">
<thead>
<tr>
<th class="w-5 text-center"><i class="fa fa-bug"></i></th>
<th class="w-10">Version</th>
<th class="w-45">Upload comment</th>
<th class="w-30">Supports TYPO3 version</th>
<th class="w-10">Download</th>
</tr>
</thead>
<tbody>
<f:for each="{versionHistory}" as="version">
<tr id="v{version.versionString}"{f:if(condition:'{version} == {version.extension.lastVersion} && {version.reviewState} != -1',then:' class="table-success"')}{f:if(condition:'{version.reviewState} == -1',then:' class="table-danger"')} >
<td class="align-middle text-center">
<f:form.checkbox name="insecureVersions[]" value="{version.uid}" checked="{version.reviewState} == -1" />
</td>
<td class="align-middle">
<strong>{version.versionString}</strong> /
<span class="ter-ext-state-{version.state}">{version.state}</span>
<br />
<small>
<f:format.date format="F d, Y">{version.uploadDate}</f:format.date>
</small>
</td>
<td class="align-middle">
<f:format.nl2br>{version.uploadComment}</f:format.nl2br>
</td>
<td class="align-middle">
<f:if condition="{version.typo3Dependency}">
<strong>{version.typo3Dependency.versionString}</strong>
</f:if>
</td>
<td class="align-middle">
<f:if condition="{version.reviewState} != -1">
<f:then>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}"
class="btn btn-primary">
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
<f:else>
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<f:then>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
class="btn btn-primary"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}">
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
</f:security.ifHasRole>
</f:else>
</f:if>
</td>
</tr>
</f:for>
</tbody>
</table>
<div>
<label for="securityTeamNotice">Security Team Notice</label>
<f:form.textarea property="securityTeamNotice" name="securityTeamNotice" class="form-control" />
</div>
<button type="submit" class="btn btn-primary"><strong>Update Extension</strong></button>
</f:form>
</f:then>
<f:else>
<table class="table table-hover">
<thead>
<tr>
<th class="w-10">Version</th>
<th class="w-50">Upload comment</th>
<th class="w-30">Works with TYPO3</th>
<th class="w-10">Download</th>
</tr>
</thead>
<tbody>
<f:for each="{versionHistory}" as="version">
<tr id="v{version.versionString}" {f:if(condition:'{version} == {version.extension.lastVersion} && {version.reviewState} != -1',then:' class="table-success"')}{f:if(condition:'{version.reviewState} == -1',then:' class="table-danger"')}>
<td class="align-middle">
<strong>{version.versionString}</strong> /
<span class="ter-ext-state-{version.state}">{version.state}</span>
<br />
<small>
<f:format.date format="F d, Y">{version.uploadDate}</f:format.date>
</small>
</td>
<td class="align-middle">
<f:format.nl2br>{version.uploadComment}</f:format.nl2br>
</td>
<td class="align-middle">
<f:if condition="{version.typo3Dependency}">
<strong>{version.typo3Dependency.versionString}</strong>
</f:if>
</td>
<td class="align-middle">
<f:if condition="{version.reviewState} != -1">
<f:then>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}"
class="btn btn-primary">
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
<f:else>
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<f:then>
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
class="ter-download-icon ter-download-icon-zip"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}">
<strong>
<f:translate key="download_zip" />
</strong>
</f:link.action>
</f:then>
</f:security.ifHasRole>
</f:else>
</f:if>
</td>
</tr>
</f:for>
</tbody>
</table>
</f:else>
<f:then>
<f:form action="update" method="post" controller="Review" name="extension" object="{extension}">
<table class="table table-hover table-responsive">
<thead>
<tr>
<th class="w-5 text-center"><i class="fa fa-bug"></i></th>
<th class="w-10">Version</th>
<th class="w-45">Upload comment</th>
<th class="w-30">Supports TYPO3 version</th>
<th class="w-10">Download</th>
</tr>
</thead>
<tbody>
<f:for each="{versionHistory}" as="version">
<f:render section="TableRowContents" arguments="{_all}" />
</f:for>
</tbody>
</table>
<div>
<label for="securityTeamNotice">Security Team Notice</label>
<f:form.textarea property="securityTeamNotice" name="securityTeamNotice" class="form-control" />
</div>
<button type="submit" class="btn btn-primary"><strong>Update Extension</strong></button>
</f:form>
</f:then>
<f:else>
<table class="table table-hover table-responsive">
<thead>
<tr>
<th class="w-10">Version</th>
<th class="w-50">Upload comment</th>
<th class="w-30">Works with TYPO3</th>
<th class="w-10">Download</th>
</tr>
</thead>
<tbody>
<f:for each="{versionHistory}" as="version">
<f:render section="TableRowContents" arguments="{_all}" />
</f:for>
</tbody>
</table>
</f:else>
</f:security.ifHasRole>
</html>
<f:section name="TableRowContents">
<tr id="v{version.versionString}" data-versions="{version.matrixOfSupportedTypo3VersionsAsList}" {f:if(condition:'{version} == {version.extension.lastVersion} && {version.reviewState} != -1',then:' class="table-success"')}{f:if(condition:'{version.reviewState} == -1',then:' class="table-danger"')}>
<f:security.ifHasRole role="{settings.reviewerGroupUid}">
<f:then>
<td class="align-middle text-center">
<f:form.checkbox name="insecureVersions[]" value="{version.uid}" checked="{version.reviewState} == -1" />
</td>
</f:then>
</f:security.ifHasRole>
<td class="align-middle">
<strong>{version.versionString}</strong> /
<span class="ter-ext-state-{version.state}">{version.state}</span>
<br />
<small>
<f:format.date format="F d, Y">{version.uploadDate}</f:format.date>
</small>
</td>
<td class="align-middle">
<f:format.nl2br>{version.uploadComment}</f:format.nl2br>
<br>
<f:for each="{version.matrixOfSupportedTypo3Versions}" as="t3Version">
<button class="btn btn-{t3Version.badgeClass} btn-sm mr-2" disabled title="{f:translate(key:'title_{t3Version.badgeClass}', arguments: {0: t3Version.label})}">{t3Version.label}</button>
</f:for>
</td>
<td class="align-middle">
<f:if condition="{version.typo3Dependency}">
<strong>{version.typo3Dependency.versionString}</strong>
</f:if>
</td>
<td class="align-middle">
<f:if condition="{version.reviewState} != -1 || {f:security.ifHasRole(role: settings.reviewerGroupUid)}">
<f:link.action controller="Extension" action="download"
arguments="{extension : extension, versionString : version.versionString, format : 'zip'}"
title="{f:translate(key:'filesize')}: {version.zipFileSize -> terfe2:filesize()}"
class="btn btn-primary">
<strong>
Download
</strong>
</f:link.action>
</f:if>
</td>
</tr>
</f:section>
......@@ -238,6 +238,19 @@
<f:translate key="version_history" />
</h3>
<div class="ter-ext-single-versionhistory ter-toggle-hide">
<form id="version-filter">
<div class="filter btn-group btn-group-toggle mb-3" data-toggle="buttons">
<button class="btn btn-outline-primary btn-sm mr-4" disabled>Filter for TYPO3 versions</button>
<label class="btn btn-secondary btn-sm mr-2">
<input type="radio" name="versions" checked data-version="" />Show all
</label>
<f:for each="{extension.allSupportedVersions}" as="version">
<label class="btn btn-{version.badgeClass} btn-sm mr-2">
<input type="radio" name="versions" data-version="{version.label}" />{version.label}
</label>
</f:for>
</div>
</form>
<f:render partial="ExtensionUploadHistoryList" arguments="{versionHistory: extension.reverseVersionsByVersionNumber, extension: extension}" />
</div>
......
......@@ -226,6 +226,39 @@ jQuery(document).ready(function ($) {
});
}
let _version_filter = $('#version-filter');
if (_version_filter.length > 0) {
$(_version_filter).find('input[type=radio]').on('click', function () {
let _searchFor = $(this).data('version');
if (_searchFor === "") {
$('.ter-ext-single-versionhistory table tbody tr').each(function (index, item) {
$(item).show();
});
$(item).button('toggle');
return false;
}
$('.ter-ext-single-versionhistory table tbody tr').each(function (index, item) {
let _versions = $(item).data('versions');
if (_versions === "") {
$(item).hide();
return;
} else {
let _found = false;
$(item).data('versions').split(',').forEach(function (version) {
if (_searchFor.toString().indexOf(version) !== -1) {
_found = true;
}
});
if (_found) {
$(item).show();
} else {
$(item).hide();
}
}
});
});
}
});
function copyToClipboard(el) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment