|
6 | 6 | <div class="text-h6">Create New Advisory</div> |
7 | 7 | </q-card-section> |
8 | 8 | <q-card-section class="row q-gutter-md" style="max-width: 100%"> |
9 | | - <q-input |
10 | | - label="ID" |
11 | | - v-model="advisoryId" |
12 | | - class="col" |
13 | | - hint="Example: ALSA-2024:A001" |
14 | | - :rules="[(val) => !!val || 'ID is required']" |
15 | | - /> |
16 | 9 | <q-select |
17 | 10 | v-model="platform" |
18 | 11 | :options="platforms" |
|
21 | 14 | clearable |
22 | 15 | :rules="[(val) => !!val.value || 'Platform is required']" |
23 | 16 | /> |
| 17 | + <q-input |
| 18 | + label="ID" |
| 19 | + v-model="advisoryId" |
| 20 | + class="col" |
| 21 | + hint="Example: ALSA-2024:A001" |
| 22 | + hide-hint |
| 23 | + :rules="[isValidId]" |
| 24 | + /> |
24 | 25 | <q-input |
25 | 26 | v-model="issued_date" |
26 | 27 | type="date" |
|
43 | 44 | class="col" |
44 | 45 | hint="Can be empty" |
45 | 46 | /> |
46 | | - <q-input |
47 | | - label="Version" |
48 | | - v-model="version" |
49 | | - class="col" |
50 | | - hint="'3' by default" |
51 | | - :rules="[(val) => !!val || 'Version is required']" |
52 | | - /> |
53 | | - <q-input |
54 | | - label="Status" |
55 | | - v-model="status" |
56 | | - class="col" |
57 | | - hint="'final' by default" |
58 | | - :rules="[(val) => !!val || 'Status is required']" |
59 | | - /> |
60 | 47 | <q-select |
61 | 48 | ref="refSeverity" |
62 | 49 | v-model="severity" |
|
109 | 96 | <template v-slot:body="props"> |
110 | 97 | <q-tr :props="props"> |
111 | 98 | <q-td key="id" :props="props"> |
112 | | - {{ props.row.ref_id }} |
| 99 | + {{ props.row.title }} |
113 | 100 | </q-td> |
114 | 101 | <q-td key="ref_type" :props="props"> |
115 | 102 | {{ props.row.ref_type.toUpperCase() }} |
|
362 | 349 | return { |
363 | 350 | advisoryId: '', |
364 | 351 | platform: '', |
365 | | - version: '3', |
366 | | - status: 'final', |
367 | 352 | severity: '', |
368 | 353 | issued_date: '', |
369 | 354 | updated_date: '', |
|
379 | 364 | { |
380 | 365 | name: 'id', |
381 | 366 | required: true, |
382 | | - label: 'ID', |
| 367 | + label: 'Title', |
383 | 368 | align: 'left', |
384 | | - field: (row) => row.ref_id, |
| 369 | + field: (row) => row.title, |
385 | 370 | sortable: true, |
386 | 371 | }, |
387 | 372 | { |
|
455 | 440 | }, |
456 | 441 | }, |
457 | 442 | methods: { |
| 443 | + isValidId(val) { |
| 444 | + if (!this.platform) { |
| 445 | + return 'Select a platform first' |
| 446 | + } |
| 447 | + if (!val) { |
| 448 | + return 'ID is required' |
| 449 | + } |
| 450 | + const regex = /^AL[B|E|S]A-\d{4}:A\d{3,4}$/ |
| 451 | + if (!regex.test(val)) { |
| 452 | + return 'ID is invalid. Example: ALSA-2024:A001' |
| 453 | + } |
| 454 | + return this.$api |
| 455 | + .get(`/errata/query/?id=${val}&platform_id=${this.platform.value}`) |
| 456 | + .then((response) => { |
| 457 | + if (response.data.total_records > 0) { |
| 458 | + return 'ID already exists, please choose another one' |
| 459 | + } |
| 460 | + return true |
| 461 | + }) |
| 462 | + .catch((error) => { |
| 463 | + console.log(error) |
| 464 | + return false |
| 465 | + }) |
| 466 | + }, |
458 | 467 | goToBuild(build_id) { |
459 | 468 | window.open(`/build/${build_id}`, '_blank') |
460 | 469 | }, |
|
551 | 560 | let build = response.data |
552 | 561 | this.uniqueBuildsId.add(+buildId) |
553 | 562 | let buildRunning = false |
| 563 | + let wrongPlatform = false |
554 | 564 |
|
555 | | - build.tasks.forEach((task) => { |
| 565 | + for (const task of build.tasks) { |
| 566 | + if (task.platform.id !== this.platform.value) { |
| 567 | + wrongPlatform = true |
| 568 | + break |
| 569 | + } |
556 | 570 | switch (task.status) { |
557 | 571 | case BuildStatus.COMPLETED: |
558 | 572 | for (let artifact of task.artifacts) { |
559 | 573 | if ( |
560 | 574 | artifact.type !== 'rpm' || |
561 | | - artifact.name.includes('.src.') |
| 575 | + artifact.name.includes('.src.') || |
| 576 | + artifact.name.includes('debugsource') || |
| 577 | + artifact.name.includes('debuginfo') |
562 | 578 | ) |
563 | 579 | continue |
564 | 580 | let pkg = artifact.meta |
|
567 | 583 | pkg = splitRpmFileName(artifact.name) |
568 | 584 | pkg.epoch = 0 |
569 | 585 | } |
| 586 | + let alreadyAdded = pkgs.find((p) => { |
| 587 | + return ( |
| 588 | + p.name === pkg.name && |
| 589 | + p.version === pkg.version && |
| 590 | + p.release === pkg.release |
| 591 | + ) |
| 592 | + }) |
| 593 | + if (alreadyAdded) continue |
570 | 594 | pkgs.push({ |
571 | 595 | name: pkg.name, |
572 | 596 | epoch: pkg.epoch, |
|
585 | 609 | default: |
586 | 610 | buildRunning = true |
587 | 611 | } |
588 | | - }) |
| 612 | + } |
589 | 613 | if (buildRunning) { |
590 | 614 | Notify.create({ |
591 | 615 | message: `Build ${buildId} is still running`, |
|
595 | 619 | ], |
596 | 620 | }) |
597 | 621 | this.uniqueBuildsId.delete(+buildId) |
| 622 | + } else if (wrongPlatform) { |
| 623 | + Notify.create({ |
| 624 | + message: `Packages in build ${buildId} do not match the selected platform`, |
| 625 | + type: 'negative', |
| 626 | + actions: [ |
| 627 | + {label: 'Dismiss', color: 'white', handler: () => {}}, |
| 628 | + ], |
| 629 | + }) |
| 630 | + this.uniqueBuildsId.delete(+buildId) |
598 | 631 | } else if (pkgs.length === 0) { |
599 | 632 | Notify.create({ |
600 | 633 | message: `Build ${buildId} failed`, |
|
0 commit comments