|
574 | 574 | <br> |
575 | 575 |
|
576 | 576 | <!-- Display comments for this build --> |
577 | | - <div |
578 | | - v-if="cdash.notes.length > 0 || cdash.user.id > 0" |
579 | | - class="title-divider" |
580 | | - > |
581 | | - Comments ({{ cdash.notes.length }}) |
582 | | - </div> |
583 | | - |
584 | | - <div v-if="cdash.notes.length > 0"> |
585 | | - <div v-for="note in cdash.notes"> |
586 | | - <b>{{ note.status }}</b> by <b>{{ note.user }}</b> at {{ note.date }} |
587 | | - <code-box :text="note.text" /> |
588 | | - <hr> |
| 577 | + <loading-indicator :is-loading="!comments"> |
| 578 | + <div |
| 579 | + v-if="comments.length > 0 || cdash.user.id > 0" |
| 580 | + class="title-divider" |
| 581 | + > |
| 582 | + Comments ({{ comments.length }}) |
589 | 583 | </div> |
590 | | - </div> |
591 | 584 |
|
| 585 | + <div v-if="comments.length > 0"> |
| 586 | + <div v-for="{node: comment} in comments"> |
| 587 | + <b>{{ comment.user.firstname }} {{ comment.user.lastname }}</b> {{ Utils.formatRelativeTimestamp(comment.timestamp) }} |
| 588 | + <code-box :text="comment.text" /> |
| 589 | + <hr> |
| 590 | + </div> |
| 591 | + <br> |
| 592 | + </div> |
592 | 593 |
|
593 | | - <div v-if="cdash.user.id > 0"> |
594 | | - <!-- Add Comments --> |
595 | | - <div class="tw-flex tw-flex-row"> |
596 | | - <img |
597 | | - width="20" |
598 | | - height="20" |
599 | | - :src="$baseURL + '/img/document.png'" |
600 | | - title="graph" |
601 | | - > |
602 | | - <a |
603 | | - id="toggle_note" |
604 | | - class="tw-link tw-link-hover" |
605 | | - @click="toggleNote()" |
| 594 | + <div v-if="cdash.user.id > 0"> |
| 595 | + <!-- Add Comments --> |
| 596 | + <div class="tw-flex tw-flex-row"> |
| 597 | + <img |
| 598 | + width="20" |
| 599 | + height="20" |
| 600 | + :src="$baseURL + '/img/document.png'" |
| 601 | + title="graph" |
| 602 | + > |
| 603 | + <a |
| 604 | + id="toggle_note" |
| 605 | + class="tw-link tw-link-hover" |
| 606 | + @click="toggleNote()" |
| 607 | + > |
| 608 | + Add a comment to this Build |
| 609 | + </a> |
| 610 | + </div> |
| 611 | + <div |
| 612 | + v-show="showNote" |
| 613 | + id="new_note_div" |
606 | 614 | > |
607 | | - Add a comment to this Build |
608 | | - </a> |
609 | | - </div> |
610 | | - <div |
611 | | - v-show="showNote" |
612 | | - id="new_note_div" |
613 | | - > |
614 | | - <table> |
615 | | - <tbody> |
616 | | - <tr> |
617 | | - <td><b>Comment:</b></td> |
618 | | - <td> |
619 | | - <textarea |
620 | | - id="note_text" |
621 | | - v-model="cdash.noteText" |
622 | | - class="tw-textarea tw-textarea-bordered" |
623 | | - cols="50" |
624 | | - rows="5" |
625 | | - /> |
626 | | - </td> |
627 | | - </tr> |
628 | | - <tr> |
629 | | - <td><b>Status:</b></td> |
630 | | - <td> |
631 | | - <select |
632 | | - id="note_status" |
633 | | - v-model="cdash.noteStatus" |
634 | | - class="tw-select tw-select-bordered" |
635 | | - > |
636 | | - <option value="0"> |
637 | | - Simple Note |
638 | | - </option> |
639 | | - <option value="1"> |
640 | | - Fix in progress |
641 | | - </option> |
642 | | - <option value="2"> |
643 | | - Fixed |
644 | | - </option> |
645 | | - </select> |
646 | | - </td> |
647 | | - </tr> |
648 | | - <tr> |
649 | | - <td /> |
650 | | - <td> |
651 | | - <button |
652 | | - id="add_note" |
653 | | - class="tw-btn" |
654 | | - :disabled="!cdash.noteText" |
655 | | - @click="addNote()" |
656 | | - > |
657 | | - Add Note |
658 | | - </button> |
659 | | - </td> |
660 | | - </tr> |
661 | | - </tbody> |
662 | | - </table> |
| 615 | + <table> |
| 616 | + <tbody> |
| 617 | + <tr> |
| 618 | + <td><b>Comment:</b></td> |
| 619 | + <td> |
| 620 | + <textarea |
| 621 | + id="note_text" |
| 622 | + v-model="cdash.noteText" |
| 623 | + class="tw-textarea tw-textarea-bordered" |
| 624 | + cols="50" |
| 625 | + rows="5" |
| 626 | + /> |
| 627 | + </td> |
| 628 | + </tr> |
| 629 | + <tr> |
| 630 | + <td /> |
| 631 | + <td> |
| 632 | + <button |
| 633 | + id="add_note" |
| 634 | + class="tw-btn" |
| 635 | + :disabled="!cdash.noteText" |
| 636 | + @click="addNote()" |
| 637 | + > |
| 638 | + Add Note |
| 639 | + </button> |
| 640 | + </td> |
| 641 | + </tr> |
| 642 | + </tbody> |
| 643 | + </table> |
| 644 | + </div> |
| 645 | + <br> |
663 | 646 | </div> |
664 | | - <br> |
665 | | - </div> |
| 647 | + </loading-indicator> |
666 | 648 |
|
667 | 649 | <!-- Graphs --> |
668 | 650 | <div class="title-divider"> |
@@ -1029,6 +1011,9 @@ import { |
1029 | 1011 | import CodeBox from './shared/CodeBox.vue'; |
1030 | 1012 | import LoadingIndicator from './shared/LoadingIndicator.vue'; |
1031 | 1013 | import BuildSummaryCard from './shared/BuildSummaryCard.vue'; |
| 1014 | +import gql from 'graphql-tag'; |
| 1015 | +import Utils from './shared/Utils'; |
| 1016 | +
|
1032 | 1017 | export default { |
1033 | 1018 | name: 'BuildSummary', |
1034 | 1019 | components: {BuildSummaryCard, LoadingIndicator, CodeBox, FontAwesomeIcon}, |
@@ -1067,12 +1052,48 @@ export default { |
1067 | 1052 | }; |
1068 | 1053 | }, |
1069 | 1054 |
|
| 1055 | + apollo: { |
| 1056 | + comments: { |
| 1057 | + query: gql` |
| 1058 | + query($buildId: ID) { |
| 1059 | + build(id: $buildId) { |
| 1060 | + id |
| 1061 | + comments { |
| 1062 | + edges { |
| 1063 | + node { |
| 1064 | + id |
| 1065 | + text |
| 1066 | + timestamp |
| 1067 | + user { |
| 1068 | + id |
| 1069 | + firstname |
| 1070 | + lastname |
| 1071 | + } |
| 1072 | + } |
| 1073 | + } |
| 1074 | + } |
| 1075 | + } |
| 1076 | + } |
| 1077 | + `, |
| 1078 | + update: data => data?.build?.comments?.edges, |
| 1079 | + variables() { |
| 1080 | + return { |
| 1081 | + buildId: this.buildId, |
| 1082 | + }; |
| 1083 | + }, |
| 1084 | + }, |
| 1085 | + }, |
| 1086 | +
|
1070 | 1087 | computed: { |
1071 | 1088 | FA() { |
1072 | 1089 | return { |
1073 | 1090 | faQuestionCircle, |
1074 | 1091 | }; |
1075 | 1092 | }, |
| 1093 | +
|
| 1094 | + Utils() { |
| 1095 | + return Utils; |
| 1096 | + }, |
1076 | 1097 | }, |
1077 | 1098 |
|
1078 | 1099 | async mounted () { |
@@ -1302,17 +1323,16 @@ export default { |
1302 | 1323 | Status: this.cdash.noteStatus, |
1303 | 1324 | AddNote: this.cdash.noteText, |
1304 | 1325 | }) |
1305 | | - .then(response => { |
1306 | | - // Add the newly created note to our list. |
1307 | | - this.cdash.notes.push(response.data.note); |
| 1326 | + .then(() => { |
| 1327 | + // Add the newly created note to our list. |
| 1328 | + this.$apollo.queries.comments.refetch(); |
1308 | 1329 | }) |
1309 | 1330 | .catch(error => { |
1310 | 1331 | // Display the error. |
1311 | 1332 | this.cdash.error = error; |
1312 | 1333 | console.log(error); |
1313 | 1334 | }); |
1314 | 1335 | }, |
1315 | | -
|
1316 | 1336 | }, |
1317 | 1337 | }; |
1318 | 1338 | </script> |
|
0 commit comments