archive retrieval now works
This commit is contained in:
1087
package-lock.json
generated
1087
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import useArchiveStore from "@/stores/archive";
|
||||||
|
import { versionNotes } from "@/utils/types";
|
||||||
import {
|
import {
|
||||||
IonButton,
|
IonButton,
|
||||||
IonCard,
|
IonCard,
|
||||||
@@ -13,8 +14,11 @@ IonLabel, IonItem,
|
|||||||
IonList
|
IonList
|
||||||
} from "@ionic/vue";
|
} from "@ionic/vue";
|
||||||
import {chevronForward} from "ionicons/icons";
|
import {chevronForward} from "ionicons/icons";
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
|
||||||
|
const archive = useArchiveStore();
|
||||||
const emit = defineEmits<{(e: "back"): void, (e: "disconnect"): void, (e: "details"):void}>();
|
const emit = defineEmits<{(e: "back"): void, (e: "disconnect"): void, (e: "details"):void}>();
|
||||||
|
const versions = ref<versionNotes[]>([]);
|
||||||
|
|
||||||
const back = () => {
|
const back = () => {
|
||||||
emit("back");
|
emit("back");
|
||||||
@@ -24,10 +28,13 @@ const disconnect = () => {
|
|||||||
emit("disconnect");
|
emit("disconnect");
|
||||||
};
|
};
|
||||||
|
|
||||||
const details = () => {
|
const details = (index: number) => {
|
||||||
|
archive.setShownI(index);
|
||||||
emit("details");
|
emit("details");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(() => archive.getArchive, (newValue) => versions.value = newValue, {immediate: true});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -47,10 +54,10 @@ const details = () => {
|
|||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
<ion-button @click="back">Back</ion-button>
|
<ion-button @click="back">Back</ion-button>
|
||||||
<ion-list lines="full" class="item-scroll">
|
<ion-list lines="full" class="item-scroll">
|
||||||
<ion-item :button="true" v-for="i in 10" :key="i" @click="details">
|
<ion-item :button="true" v-for="(version, index) in versions" :key="index" @click="details(index)">
|
||||||
<ion-label>
|
<ion-label>
|
||||||
<strong>v{{i}}</strong> <br>
|
<strong>{{version.title}}</strong> <br>
|
||||||
<ion-note>date</ion-note>
|
<ion-note>{{ version.date }}</ion-note>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<div slot="end" class="metadata-end-wrapper">
|
<div slot="end" class="metadata-end-wrapper">
|
||||||
<ion-icon color="medium" :icon="chevronForward"></ion-icon>
|
<ion-icon color="medium" :icon="chevronForward"></ion-icon>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import useArchiveStore from "@/stores/archive";
|
||||||
import {
|
import {
|
||||||
IonButton,
|
IonButton,
|
||||||
IonCard,
|
IonCard,
|
||||||
@@ -7,8 +8,12 @@ import {
|
|||||||
IonCardSubtitle,
|
IonCardSubtitle,
|
||||||
IonCardTitle,
|
IonCardTitle,
|
||||||
} from "@ionic/vue";
|
} from "@ionic/vue";
|
||||||
|
import { versionNotes } from "@/utils/types";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
const archive = useArchiveStore();
|
||||||
const emit = defineEmits<{(e:"back"):void, (e: "disconnect"): void, (e:"choose"): void}>();
|
const emit = defineEmits<{(e:"back"):void, (e: "disconnect"): void, (e:"choose"): void}>();
|
||||||
|
const record = ref<versionNotes>(archive.getArchive[archive.getShownI]);
|
||||||
|
|
||||||
const back = () => {
|
const back = () => {
|
||||||
emit("back");
|
emit("back");
|
||||||
@@ -22,6 +27,7 @@ const choose = () => {
|
|||||||
emit("choose");
|
emit("choose");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(archive.getArchive)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -40,10 +46,11 @@ const choose = () => {
|
|||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
<ion-card>
|
<ion-card>
|
||||||
<ion-card-header>
|
<ion-card-header>
|
||||||
<ion-card-title>Update Name</ion-card-title>
|
<ion-card-title :href="record.link">{{ record.title }}</ion-card-title>
|
||||||
</ion-card-header>
|
</ion-card-header>
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
<p>Some blurb about the update</p>
|
<p>{{ record.date as Date }}</p>
|
||||||
|
<p v-html="record.html"></p> <br/>
|
||||||
<ion-button @click="choose">Select</ion-button>
|
<ion-button @click="choose">Select</ion-button>
|
||||||
<ion-button @click="back">Cancel</ion-button>
|
<ion-button @click="back">Cancel</ion-button>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {ref} from "vue";
|
|||||||
|
|
||||||
const emit = defineEmits<{(e: "disconnect"): void, (e: "back"): void}>();
|
const emit = defineEmits<{(e: "disconnect"): void, (e: "back"): void}>();
|
||||||
const archive = useArchiveStore();
|
const archive = useArchiveStore();
|
||||||
const url = ref<string>("");
|
const url = ref<string>(archive.getUrl);
|
||||||
|
|
||||||
const disconnect = () => {
|
const disconnect = () => {
|
||||||
emit("disconnect")
|
emit("disconnect")
|
||||||
@@ -19,7 +19,6 @@ const back = () => {
|
|||||||
const setSource = () => {
|
const setSource = () => {
|
||||||
console.log(url.value)
|
console.log(url.value)
|
||||||
archive.setUrl(url.value);
|
archive.setUrl(url.value);
|
||||||
archive.testArchive();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,22 +1,33 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import Updater from "updaterweblibrary";
|
import Updater from "updaterweblibrary";
|
||||||
|
import type { versionNotes } from "@/utils/types";
|
||||||
|
|
||||||
const useArchiveStore = defineStore("archive", {
|
const useArchiveStore = defineStore("archive", {
|
||||||
state: () => (
|
state: () => (
|
||||||
{updater: new Updater()}
|
{updater: new Updater(), archive: <versionNotes[]>[], shownI: 0}
|
||||||
),
|
),
|
||||||
getters: {
|
getters: {
|
||||||
getUrl(): string {
|
getUrl(): string {
|
||||||
|
if (this.updater.archiveURL == "/")
|
||||||
|
return ""
|
||||||
|
else
|
||||||
return this.updater.archiveURL;
|
return this.updater.archiveURL;
|
||||||
|
},
|
||||||
|
getArchive(): versionNotes[] {
|
||||||
|
console.log(this.archive)
|
||||||
|
return this.archive;
|
||||||
|
},
|
||||||
|
getShownI(): number {
|
||||||
|
return this.shownI;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setUrl(value: string): void {
|
async setUrl(value: string): Promise<void> {
|
||||||
this.updater = new Updater(value, "rss");
|
this.updater = new Updater(value, "atom");
|
||||||
|
this.archive = await this.updater.getArchive()
|
||||||
},
|
},
|
||||||
async testArchive(): Promise<void> {
|
setShownI(value: number): void {
|
||||||
console.log(await this.updater.getArchive());
|
this.shownI = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
6
src/utils/types.ts
Normal file
6
src/utils/types.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export type versionNotes = {
|
||||||
|
title: string;
|
||||||
|
date: Date | string;
|
||||||
|
link: string;
|
||||||
|
html: string;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user