-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f50756
commit f288720
Showing
6 changed files
with
94 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,66 @@ | ||
<template> | ||
<v-app> | ||
<Navbar /> | ||
<v-main> </v-main> | ||
<v-main> | ||
<v-data-table | ||
v-if="loggedInUser" | ||
:items="currentUserFlists" | ||
:headers="tableHeader" | ||
hover | ||
> | ||
<template #item.last_modified="{ value }"> | ||
{{ new Date(value * 1000).toString() }} | ||
</template> | ||
<template #item.progress="{ value }"> | ||
<v-progress-linear | ||
:model-value="value" | ||
color="purple-darken-1" | ||
class="w-75" | ||
> | ||
</v-progress-linear> | ||
<span> {{ value }}% </span> | ||
</template> | ||
</v-data-table> | ||
</v-main> | ||
<Footer /> | ||
</v-app> | ||
</template> | ||
<script setup lang="ts"> | ||
import Navbar from "./Navbar.vue"; | ||
import Footer from "./Footer.vue"; | ||
import { FlistsResponseInterface } from "../types/Flists.ts"; | ||
import { computed, inject } from "vue"; | ||
import { onMounted, ref } from "vue"; | ||
import axios from "axios"; | ||
import { LoggedInUser } from "../types/User.ts"; | ||
const tableHeader = [ | ||
{ title: "Name", key: "name" }, | ||
{ title: "Is File", key: "is_file" }, | ||
{ title: "Last Modified", key: "last_modified" }, | ||
{ title: "Download Link", key: "path_uri", sortable: false }, | ||
{ title: "Progress", key: "progress" }, | ||
]; | ||
const loggedInUser = inject<LoggedInUser>("loggedInUser"); | ||
var flists = ref<FlistsResponseInterface>({}); | ||
const api = axios.create({ | ||
baseURL: "http://localhost:4000", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
onMounted(async () => { | ||
try { | ||
flists.value = (await api.get<FlistsResponseInterface>("/v1/api/fl")).data; | ||
} catch (error) { | ||
console.error("Failed to fetch flists", error); | ||
} | ||
}); | ||
const currentUserFlists = computed(() => { | ||
return loggedInUser && loggedInUser.loggedInUser | ||
? flists.value[loggedInUser.loggedInUser.value] | ||
: []; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { Ref } from "vue"; | ||
|
||
export interface User { | ||
username: string; | ||
password: string; | ||
} | ||
|
||
username: string; | ||
password: string; | ||
} | ||
|
||
export interface LoggedInUser { | ||
loggedInUser: Ref<string>; | ||
updateLoggedInUser: (user: string) => void; | ||
} |