11<script setup lang="ts">
2- import { ref , onMounted } from ' vue' ;
32import { useI18n } from ' vue-i18n' ;
43import { useUpdateOsStore } from ' ~/store/updateOs' ;
54import { storeToRefs } from ' pinia' ;
65
7- const changelog = ref (' ' );
8- const changelogPretty = ref (' ' );
96const updateOsStore = useUpdateOsStore ();
107const { changelogModalVisible } = storeToRefs (updateOsStore );
118const { t } = useI18n ();
129
13- onMounted (async () => {
14- const response = await fetch (' https://releases.unraid.net/json' );
10+
11+ async function showChangelogModalFromReleasesEndpoint() {
12+ const response = await fetch (' https://releases.unraid.net/os?branch=stable¤t_version=6.12.3' );
1513 const data = await response .json ();
16- console .debug (' [changelog] data' , data );
17- if (data .length > 0 ) {
18- changelog .value = data [0 ].changelog ;
19- changelogPretty .value = data [0 ].changelog_pretty ;
20- }
21- });
14+ updateOsStore .setReleaseForUpdate (data );
15+ }
2216
23- function showChangelogModal () {
17+ function showChangelogModalWithTestData () {
2418 updateOsStore .setReleaseForUpdate ({
2519 version: ' 6.12.3' ,
2620 date: ' 2023-07-15' ,
27- changelog: changelog . value ,
28- changelogPretty: changelogPretty . value ,
21+ changelog: ' https://raw.githubusercontent.com/unraid/docs/main/docs/unraid-os/release-notes/6.12.3.md ' ,
22+ changelogPretty: ' https://docs.unraid.net/go/release-notes/6.12.3 ' ,
2923 name: ' 6.12.3' ,
3024 isEligible: true ,
3125 isNewer: true ,
3226 sha256: ' 1234567890'
3327 });
3428}
35-
3629function showChangelogWithoutPretty() {
3730 updateOsStore .setReleaseForUpdate ({
3831 version: ' 6.12.3' ,
3932 date: ' 2023-07-15' ,
40- changelog: changelog . value ,
33+ changelog: ' https://raw.githubusercontent.com/unraid/docs/main/docs/unraid-os/release-notes/6.12.3.md ' ,
4134 changelogPretty: ' ' ,
4235 name: ' 6.12.3' ,
4336 isEligible: true ,
@@ -65,12 +58,18 @@ function showChangelogBrokenParse() {
6558 <div class =" container mx-auto p-6" >
6659 <h1 class =" text-2xl font-bold mb-6" >Changelog</h1 >
6760 <UpdateOsChangelogModal :t =" t" :open =" changelogModalVisible" />
68- <div class =" mb-6 flex gap-4" >
61+ <div class =" mb-6 flex flex-col gap-4 max-w-md " >
6962 <button
7063 class =" px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
71- @click =" showChangelogModal "
64+ @click =" showChangelogModalFromReleasesEndpoint "
7265 >
73- Test Changelog Modal
66+ Test Changelog Modal (from releases endpoint)
67+ </button >
68+ <button
69+ class =" px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600"
70+ @click =" showChangelogModalWithTestData"
71+ >
72+ Test Changelog Modal (with test data)
7473 </button >
7574 <button
7675 class =" px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600"
@@ -85,9 +84,5 @@ function showChangelogBrokenParse() {
8584 Test Broken Parse Changelog
8685 </button >
8786 </div >
88-
89- <div class =" prose max-w-none" >
90- <div v-html =" changelog" ></div >
91- </div >
9287 </div >
9388</template >
0 commit comments