Skip to content

Commit

Permalink
Merge pull request #192 from arhimede/master
Browse files Browse the repository at this point in the history
4 columns Maintenance status page
  • Loading branch information
arhimede authored Jul 31, 2024
2 parents fe1be8a + f5a366f commit 19748c2
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 25 deletions.
16 changes: 12 additions & 4 deletions bootstrap/scss/_custom-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,24 @@ article {
--prop-value-color: #d43442;
}

.repository-organization.mezzio {
order: 0;
--org-color: #009655FF;
}

.repository-organization.laminas {
order: 1;
--org-color: #E64010FF;
}

.repository-organization.laminas-api-tools {
--org-color: #e5007d;
.repository-organization.laminas-mvc {
order: 2;
--org-color: #009ee3;
}

.repository-organization.mezzio {
--org-color: #009655FF;
.repository-organization.laminas-api-tools {
order: 3;
--org-color: #e5007d;
}

.repository-organization {
Expand Down
4 changes: 0 additions & 4 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@
</MixedAssignment>
</file>
<file src="src/App/Console/WriteRepositoryData.php">
<MissingClassConstType>
<code><![CDATA[ARGUMENT_TOKEN = 'token']]></code>
<code><![CDATA[ARGUMENT_USER_AGENT = 'userAgent']]></code>
</MissingClassConstType>
<MixedAssignment>
<code><![CDATA[$token]]></code>
</MixedAssignment>
Expand Down
39 changes: 29 additions & 10 deletions src/App/Console/WriteRepositoryData.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use function date;
use function file_put_contents;
use function getcwd;
use function in_array;
use function is_array;
use function is_string;
use function json_decode;
Expand All @@ -39,8 +40,8 @@

class WriteRepositoryData extends Command
{
private const ARGUMENT_USER_AGENT = 'userAgent';
private const ARGUMENT_TOKEN = 'token';
private const string ARGUMENT_USER_AGENT = 'userAgent';
private const string ARGUMENT_TOKEN = 'token';

private array $orgs = [
'laminas',
Expand Down Expand Up @@ -100,7 +101,8 @@ private function generateDataFile(string $userAgent, string $token): void
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$singleResult = ['last_updated' => date('Y-m-d H:i:s')];

$singleResult = [];

/** @var string $org */
foreach ($this->orgs as $org) {
Expand Down Expand Up @@ -142,20 +144,37 @@ private function generateDataFile(string $userAgent, string $token): void
}
}

$singleResult[$org][] = [
'name' => $value['repository_name'],
'properties' => $value['properties'],
];
if (
$org === 'laminas'
&& in_array(
$value['repository_name'],
MaintenanceOverviewHandler::MVC_COMPONENTS,
true
)
) {
$singleResult['laminas-mvc'][] = [
'name' => $value['repository_name'],
'properties' => $value['properties'],
];
} else {
$singleResult[$org][] = [
'name' => $value['repository_name'],
'properties' => $value['properties'],
];
}
}
$page++;
} while (count($decodedRes) === $perPage);
assert(is_array($singleResult[$org]));
}
curl_close($curl);

usort($singleResult[$org], function (array $a, array $b) {
foreach ($singleResult as $key => $value) {
usort($singleResult[$key], function (array $a, array $b) {
return $a['name'] <=> $b['name'];
});
}
curl_close($curl);

$singleResult['last_updated'] = date('Y-m-d H:i:s');

file_put_contents(
sprintf(
Expand Down
23 changes: 23 additions & 0 deletions src/App/Handler/MaintenanceOverviewHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ class MaintenanceOverviewHandler implements RequestHandlerInterface
public const string CUSTOM_PROPERTIES_FILE = 'maintenance-status.json';
public const string CUSTOM_PROPERTIES_DIRECTORY = '/public/share';

public const array MVC_COMPONENTS = [
'laminas-developer-tools',
'laminas-mvc',
'laminas-mvc-console',
'laminas-mvc-form',
'laminas-mvc-plugin-fileprg',
'laminas-mvc-plugin-flashmessenger',
'laminas-mvc-plugin-identity',
'laminas-mvc-plugin-prg',
'laminas-mvc-plugins',
'laminas-mvc-middleware',
'laminas-mvc-i18n',
'laminas-mvc-view',
'laminas-test',
];

public const array GITHUB_ORGANIZATIONS = [
'mezzio' => 'Mezzio',
'laminas' => 'Components',
'laminas-mvc' => 'MVC',
'laminas-api-tools' => 'API Tools',
];

public function __construct(
private array $repositoryData,
private string $lastUpdated,
Expand Down
21 changes: 14 additions & 7 deletions templates/app/maintenance-overview.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $this->end();
<div class="repository-container">
<?php foreach($repositoryData as $organization => $orgData): ?>
<div class="repository-organization <?= $organization ?>">
<h1><?= $organization ?></h1>
<h1><?= MaintenanceOverviewHandler::GITHUB_ORGANIZATIONS[$organization] ?? $organization ?></h1>
<div class="repository-card-container">
<?php
/** @var array $data */
Expand All @@ -86,10 +86,14 @@ $this->end();
<div class="repository-card">
<div class="card-body">
<h5 class="card-title">
<a
target="_blank"
href="<?= GITHUB_URL . $organization . DIRECTORY_SEPARATOR . $data['name']
?>">
<a target="_blank"
href="<?= sprintf(
'%s%s/%s',
GITHUB_URL,
$organization !== 'laminas-mvc' ? $organization : 'laminas',
$data['name']
)
?>">
<?= $data['name'] ?>
</a>
</h5>
Expand All @@ -112,8 +116,11 @@ $this->end();

if ($property['property_name'] === 'maintenance-mode-minutes') {
$minutesFile = $property['value'];
$minutesUrl = sprintf('https://github.com/%s/technical-steering-committee/blob/main/meetings/minutes/%s', $organization, $minutesFile);
}
$minutesUrl = sprintf(
'https://github.com/%s/technical-steering-committee/blob/main/meetings/minutes/%s',
$organization !== 'laminas-mvc' ? $organization : 'laminas',
$minutesFile
); }
}
?>

Expand Down

0 comments on commit 19748c2

Please sign in to comment.