Skip to content

Commit ef9fcd2

Browse files
committed
patch
1 parent 044d7a3 commit ef9fcd2

13 files changed

Lines changed: 169 additions & 186 deletions

File tree

www/controllers/Repo/Task/Create.php

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -167,50 +167,39 @@ private function local(): void
167167

168168
$this->taskLogSubStepController->new('updating-database', 'UPDATING DATABASE');
169169

170-
// Check if repository already exists in database
170+
// If currently no rpm repo of this name exists in the database then we add it
171171
if ($this->repoController->getPackageType() == 'rpm') {
172-
$exists = $this->rpmRepoController->exists($this->repoController->getName(), $this->repoController->getReleasever());
173-
}
174-
if ($this->repoController->getPackageType() == 'deb') {
175-
$exists = $this->debRepoController->exists($this->repoController->getName(), $this->repoController->getDist(), $this->repoController->getSection());
176-
}
177-
178-
/**
179-
* If no repo of this name exists in database then we add it
180-
* Note: here we set the source as $this->repoController->getName()
181-
*/
182-
if ($exists === false) {
183-
// Retrieve repo Id from the last insert row
184-
if ($this->repoController->getPackageType() == 'rpm') {
172+
if (!$this->rpmRepoController->exists($this->repoController->getName(), $this->repoController->getReleasever())) {
173+
// Note: for local repositories, source is set to repo name
185174
$this->rpmRepoController->add($this->repoController->getName(), $this->repoController->getReleasever(), $this->repoController->getName());
175+
176+
// Repository Id becomes the Id of the last inserted row in the database
186177
$this->repoController->setRepoId($this->rpmRepoController->getLastInsertRowID());
187-
}
188-
if ($this->repoController->getPackageType() == 'deb') {
189-
$this->debRepoController->add($this->repoController->getName(), $this->repoController->getDist(), $this->repoController->getSection(), $this->repoController->getName());
190-
$this->repoController->setRepoId($this->debRepoController->getLastInsertRowID());
191-
}
192178

193-
/**
194-
* Else if a repo of this name exists, we attach this new snapshot and this new env to this repo
195-
*/
196-
} else {
197-
// Retrieve and set repo Id from database
198-
if ($this->repoController->getPackageType() == 'rpm') {
199-
$repoId = $this->rpmRepoController->getIdByNameReleasever($this->repoController->getName(), $this->repoController->getReleasever());
179+
// Otherwise, if a repo of the same name exists, we retrieve its Id from the database
180+
} else {
181+
$this->repoController->setRepoId($this->rpmRepoController->getIdByNameReleasever($this->repoController->getName(), $this->repoController->getReleasever()));
200182
}
183+
}
201184

202-
if ($this->repoController->getPackageType() == 'deb') {
203-
$repoId = $this->debRepoController->getIdByNameDistComponent($this->repoController->getName(), $this->repoController->getDist(), $this->repoController->getSection());
204-
}
185+
// If currently no deb repo of this name exists in the database then we add it
186+
if ($this->repoController->getPackageType() == 'deb') {
187+
if (!$this->debRepoController->exists($this->repoController->getName(), $this->repoController->getDist(), $this->repoController->getSection())) {
188+
// Note: for local repositories, source is set to repo name
189+
$this->debRepoController->add($this->repoController->getName(), $this->repoController->getDist(), $this->repoController->getSection(), $this->repoController->getName());
205190

206-
if (empty($repoId)) {
207-
throw new Exception('Could not retrieve repository Id from database');
208-
}
191+
// Repository Id becomes the Id of the last inserted row in the database
192+
$this->repoController->setRepoId($this->debRepoController->getLastInsertRowID());
209193

210-
$this->repoController->setRepoId($repoId);
194+
// Otherwise, if a repo of the same name exists, we retrieve its Id from the database
195+
} else {
196+
$this->repoController->setRepoId($this->debRepoController->getIdByNameDistComponent($this->repoController->getName(), $this->repoController->getDist(), $this->repoController->getSection()));
197+
}
211198
}
212199

213-
unset($exists, $repoId);
200+
// Apply description and tags after the repository Id has been determined,
201+
$this->repoController->updateDescription($this->repoController->getRepoId(), (string) $this->repoController->getDescription());
202+
$this->repoController->updateTags($this->repoController->getRepoId(), $this->repoController->getTags());
214203

215204
// Add snapshot to database
216205
$this->repoSnapshotController->add($this->repoController->getDate(), $this->repoController->getTime(), 'false', $this->repoController->getArch(), $this->repoController->getAdvancedParams(), $this->repoController->getType(), 'active', $this->repoController->getRepoId());

www/controllers/Repo/Task/Duplicate.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ public function execute()
230230
$targetRepoId = $this->debRepoController->getLastInsertRowID();
231231
}
232232

233+
// Repository Id becomes the Id of the last inserted row in the database
234+
$this->repoController->setRepoId($targetRepoId);
235+
233236
// Add the new repo snapshot in database
234237
$this->repoSnapshotController->add($this->repoController->getDate(), $this->repoController->getTime(), $this->repoController->getSigned(), $this->repoController->getArch(), $this->repoController->getAdvancedParams(), $this->repoController->getType(), $this->repoController->getStatus(), $targetRepoId);
235238

@@ -243,9 +246,13 @@ public function execute()
243246
}
244247
}
245248

249+
// Apply description and tags after the repository Id has been determined,
250+
$this->repoController->updateDescription($this->repoController->getRepoId(), (string) $this->repoController->getDescription());
251+
$this->repoController->updateTags($this->repoController->getRepoId(), $this->repoController->getTags());
252+
246253
// Add the new repo to a group if a group has been specified
247254
if (!empty($this->repoController->getGroup())) {
248-
$this->repoController->addRepoIdToGroup($targetRepoId, $this->repoController->getGroup());
255+
$this->repoController->addRepoIdToGroup($this->repoController->getRepoId(), $this->repoController->getGroup());
249256
}
250257

251258
$this->taskLogSubStepController->completed();

www/public/resources/js/events/repo/install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $(document).on('change','#repo-install-select-env',function (e) {
3232

3333
// deb822 syntax
3434
if (packageType == 'deb-alt') {
35-
html = 'cat << EOF > /etc/apt/sources.list.d/' + prefix + name + '-' + dist + '-' + component + '.list\n';
35+
html = 'cat << EOF > /etc/apt/sources.list.d/' + prefix + name + '-' + dist + '-' + component + '.sources\n';
3636
html += 'Types: deb\n';
3737
html += 'URIs: ' + url + '/deb/' + name + '/' + dist + '/' + component + '/' + env + '\n';
3838
html += 'Suites: ' + dist + '\n';

www/public/resources/styles/tasks.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@
165165
}
166166

167167
.task-step[status="running"] {
168-
border-left-color: #5473e8;
169-
background: linear-gradient(135deg, rgba(84, 115, 232, 0.12), rgba(84, 115, 232, 0.03));
170-
border-color: rgba(84, 115, 232, 0.3);
168+
border: 1px solid #1a4a6a;
169+
background: #182b3e;
171170
}
172171

173172
.task-step[status="completed"] .task-step-status p {

www/views/includes/containers/repos/repo.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<p class="note repo-description-input width-100 <?= $descriptionClass ?>" repo-id="<?= $repo['repoId'] ?>" env-id="<?= $repo['envId'] ?>" title="Double-click to edit the description"><?= $repo['Description'] ?></p>
9898
</div>
9999

100-
<div class="repo-snapshots flex flex-1 flex-direction-column row-gap-10 margin-top-20">
100+
<div class="repo-snapshots flex flex-1 flex-direction-column row-gap-10 margin-top-20 margin-bottom-5">
101101
<?php
102102
foreach ($repoListingController->listSnapshots($repo['repoId']) as $snapshot) :
103103
// Generate repo relative path

www/views/templates/tasks/create.inc.php

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1+
<?php
2+
use \Controllers\Utils\Generate\Html\Label; ?>
3+
14
<div id="task-details" class="div-generic-blue margin-bottom-15">
25
<div class="grid grid-2 row-gap-10 column-gap-20">
36
<div>
47
<h6 class="margin-top-0">REPOSITORY</h6>
5-
<p>
6-
<span class="label-white">
7-
<?php
8-
if ($repoController->getPackageType() == 'deb') {
9-
echo $repoController->getName() . '' . $repoController->getDist() . '' . $repoController->getSection();
10-
}
8+
<?php
9+
if ($repoController->getPackageType() == 'deb') {
10+
echo Label::white($repoController->getName() . '' . $repoController->getDist() . '' . $repoController->getSection());
11+
}
1112

12-
if ($repoController->getPackageType() == 'rpm') {
13-
echo $repoController->getName();
14-
} ?>
15-
</span>
16-
</p>
13+
if ($repoController->getPackageType() == 'rpm') {
14+
echo Label::white($repoController->getName());
15+
} ?>
1716
</div>
1817

1918
<?php
2019
if ($repoController->getType() == 'mirror') : ?>
2120
<div>
2221
<h6 class="margin-top-0">SOURCE REPOSITORY</h6>
23-
<p class="copy"><span class="label-white"><?= $repoController->getSource() ?></span></p>
22+
<p class="copy"><?= Label::white($repoController->getSource()) ?></p>
2423
</div>
2524
<?php
2625
endif ?>
@@ -45,7 +44,7 @@
4544
<div class="flex column-gap-5 row-gap-5 flex-wrap">
4645
<?php
4746
foreach ($repoController->getArch() as $arch) {
48-
echo '<span class="label-black">' . $arch . '</span>';
47+
echo Label::white($arch);
4948
} ?>
5049
</div>
5150
</div>
@@ -59,7 +58,7 @@
5958
<div class="flex column-gap-5 row-gap-5 flex-wrap">
6059
<?php
6160
foreach ($rawParams['env'] as $env) {
62-
echo \Controllers\Utils\Generate\Html\Label::envtag($env);
61+
echo Label::envtag($env);
6362
} ?>
6463
</div>
6564
</div>
@@ -76,7 +75,7 @@
7675
<div class="flex column-gap-5 row-gap-5 flex-wrap">
7776
<?php
7877
foreach ($repoController->getAdvancedParams()['packages']['include'] as $package) {
79-
echo '<span class="label-black">' . $package . '</span>';
78+
echo Label::white($package);
8079
} ?>
8180
</div>
8281
</div>
@@ -89,7 +88,7 @@
8988
<div class="flex column-gap-5 row-gap-5 flex-wrap">
9089
<?php
9190
foreach ($repoController->getAdvancedParams()['packages']['exclude'] as $package) {
92-
echo '<span class="label-black">' . $package . '</span>';
91+
echo Label::white($package);
9392
} ?>
9493
</div>
9594
</div>
@@ -106,7 +105,7 @@
106105
<div class="flex column-gap-5 row-gap-5 flex-wrap">
107106
<?php
108107
foreach ($rawParams['advanced-params']['packages']['include'] as $package) {
109-
echo '<span class="label-black">' . $package . '</span>';
108+
echo Label::white($package);
110109
} ?>
111110
</div>
112111
</div>
@@ -119,7 +118,7 @@
119118
<div class="flex column-gap-5 row-gap-5 flex-wrap">
120119
<?php
121120
foreach ($rawParams['advanced-params']['packages']['exclude'] as $package) {
122-
echo '<span class="label-black">' . $package . '</span>';
121+
echo Label::white($package);
123122
} ?>
124123
</div>
125124
</div>
@@ -155,7 +154,7 @@
155154
}
156155

157156
$displayName = $metadataMap[$metadata] ?? $metadata;
158-
echo '<span class="label-black">' . $displayName . '</span>';
157+
echo Label::white($displayName);
159158
} ?>
160159
</div>
161160
</div>
@@ -227,8 +226,8 @@
227226
<h6>TAGS</h6>
228227
<div class="flex column-gap-5 row-gap-5 flex-wrap">
229228
<?php
230-
foreach ($repoController->getTags() as $arch) {
231-
echo '<span class="label-white">' . $arch . '</span>';
229+
foreach ($repoController->getTags() as $tag) {
230+
echo Label::white($tag);
232231
} ?>
233232
</div>
234233
</div>
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1+
<?php
2+
use \Controllers\Utils\Generate\Html\Label; ?>
3+
14
<div id="task-details" class="div-generic-blue margin-bottom-15">
25
<div class="grid grid-2 row-gap-10 column-gap-20">
36
<div>
47
<h6 class="margin-top-0">REPOSITORY</h6>
5-
<p>
6-
<span class="label-white">
7-
<?php
8-
if ($repoController->getPackageType() == 'deb') {
9-
echo $repoController->getName() . '' . $repoController->getDist() . '' . $repoController->getSection();
10-
}
11-
if ($repoController->getPackageType() == 'rpm') {
12-
echo $repoController->getName() . '' . $repoController->getReleasever();
13-
} ?>
14-
</span>
15-
</p>
8+
<?php
9+
if ($repoController->getPackageType() == 'deb') {
10+
echo Label::white($repoController->getName() . '' . $repoController->getDist() . '' . $repoController->getSection());
11+
}
12+
if ($repoController->getPackageType() == 'rpm') {
13+
echo Label::white($repoController->getName() . '' . $repoController->getReleasever());
14+
} ?>
1615
</div>
1716

1817
<div>
1918
<h6 class="margin-top-0">DATE</h6>
20-
<p class="label-black"><?= $repoController->getDateFormatted() ?></p>
19+
<?= Label::white($repoController->getDateFormatted()) ?>
2120
</div>
2221
</div>
2322
</div>

www/views/templates/tasks/duplicate.inc.php

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,35 @@
1+
<?php
2+
use \Controllers\Utils\Generate\Html\Label; ?>
3+
14
<div id="task-details" class="div-generic-blue margin-bottom-15">
25
<div class="grid grid-2 row-gap-10 column-gap-20">
36
<div>
47
<h6 class="margin-top-0">REPOSITORY</h6>
5-
<p>
6-
<span class="label-white">
7-
<?php
8-
if ($repoController->getPackageType() == 'rpm') {
9-
echo $repoController->getName() . '' . $repoController->getReleasever();
10-
}
11-
if ($repoController->getPackageType() == 'deb') {
12-
echo $repoController->getName() . '' . $repoController->getDist() . '' . $repoController->getSection();
13-
} ?>
14-
</span>
15-
</p>
8+
<?php
9+
if ($repoController->getPackageType() == 'rpm') {
10+
echo Label::white($repoController->getName() . '' . $repoController->getReleasever());
11+
}
12+
if ($repoController->getPackageType() == 'deb') {
13+
echo Label::white($repoController->getName() . '' . $repoController->getDist() . '' . $repoController->getSection());
14+
} ?>
1615
</div>
1716

1817
<div>
1918
<h6 class="margin-top-0">SNAPSHOT</h6>
20-
<p>
21-
<span class="label-black"><?= $repoController->getDateFormatted() ?></span>
22-
</p>
19+
<?= Label::white($repoController->getDateFormatted()) ?>
2320
</div>
2421
</div>
2522

2623
<div class="grid grid-2 row-gap-10 column-gap-20">
2724
<div>
2825
<h6>DUPLICATE TO</h6>
29-
<p>
30-
<span class="label-white">
31-
<?php
32-
if ($repoController->getPackageType() == 'rpm') {
33-
echo $rawParams['name'] . '' . $repoController->getReleasever();
34-
}
35-
if ($repoController->getPackageType() == 'deb') {
36-
echo $rawParams['name'] . '' . $repoController->getDist() . '' . $repoController->getSection();
37-
} ?>
38-
</span>
39-
</p>
26+
<?php
27+
if ($repoController->getPackageType() == 'rpm') {
28+
echo Label::white($rawParams['name'] . '' . $repoController->getReleasever());
29+
}
30+
if ($repoController->getPackageType() == 'deb') {
31+
echo Label::white($rawParams['name'] . '' . $repoController->getDist() . '' . $repoController->getSection());
32+
} ?>
4033
</div>
4134

4235
<?php
@@ -46,20 +39,30 @@
4639
<div class="flex column-gap-5 row-gap-5 flex-wrap">
4740
<?php
4841
foreach ($rawParams['env'] as $env) {
49-
echo \Controllers\Utils\Generate\Html\Label::envtag($env) . ' ';
42+
echo Label::envtag($env) . ' ';
5043
} ?>
5144
</div>
5245
</div>
5346
<?php
54-
endif ?>
55-
</div>
47+
endif;
5648

57-
<div class="grid grid-2 row-gap-10 column-gap-20">
58-
<?php
59-
if (!empty($repoController->getDescription())) : ?>
49+
if (!empty($rawParams['description'])) : ?>
6050
<div>
6151
<h6>DESCRIPTION</h6>
62-
<p><?= $repoController->getDescription() ?></p>
52+
<p><?= $rawParams['description'] ?></p>
53+
</div>
54+
<?php
55+
endif;
56+
57+
if (!empty($rawParams['tags'])) : ?>
58+
<div>
59+
<h6>TAGS</h6>
60+
<div class="flex column-gap-5 row-gap-5 flex-wrap">
61+
<?php
62+
foreach ($rawParams['tags'] as $tag) {
63+
echo Label::white($tag);
64+
} ?>
65+
</div>
6366
</div>
6467
<?php
6568
endif;

0 commit comments

Comments
 (0)