Skip to content
Snippets Groups Projects
Verified Commit 0544e2a3 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Add a clean base layout and remove the sidebar

#12
parent 31d1b33b
No related branches found
No related tags found
2 merge requests!22Version 1.0.0,!8Clean base layout
...@@ -32,7 +32,7 @@ onBeforeMount(() => { ...@@ -32,7 +32,7 @@ onBeforeMount(() => {
<template> <template>
<NavbarTop /> <NavbarTop />
<div class="container-fluid" style="min-height: 90vh"> <div class="container">
<router-view></router-view> <router-view></router-view>
</div> </div>
</template> </template>
......
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
body { body {
padding-top: 4rem; padding-top: 4rem;
max-height: 100vh; max-height: 100vh;
background: #181818;
} }
...@@ -15,18 +15,6 @@ const props = defineProps<{ ...@@ -15,18 +15,6 @@ const props = defineProps<{
subFolders: string[] | string; subFolders: string[] | string;
}>(); }>();
const currentSubFolders: ComputedRef<string[]> = computed(() => {
/**
* Transform a single sub folder from a string to an array containing the string and
* replace an empty string with an empty list
*/
return props.subFolders instanceof Array
? props.subFolders
: props.subFolders.length > 0
? [props.subFolders]
: [];
});
// Typescript types // Typescript types
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
interface S3ObjectWithFolder extends S3ObjectMetaInformation { interface S3ObjectWithFolder extends S3ObjectMetaInformation {
...@@ -135,6 +123,18 @@ const objectsWithFolders: ComputedRef<S3ObjectWithFolder[]> = computed(() => { ...@@ -135,6 +123,18 @@ const objectsWithFolders: ComputedRef<S3ObjectWithFolder[]> = computed(() => {
}); });
}); });
const currentSubFolders: ComputedRef<string[]> = computed(() => {
/**
* Transform a single sub folder from a string to an array containing the string and
* replace an empty string with an empty list
*/
return props.subFolders instanceof Array
? props.subFolders
: props.subFolders.length > 0
? [props.subFolders]
: [];
});
const subFolderInUrl: ComputedRef<boolean> = computed( const subFolderInUrl: ComputedRef<boolean> = computed(
() => currentSubFolders.value.length > 0 () => currentSubFolders.value.length > 0
); );
...@@ -270,7 +270,7 @@ function isS3Object( ...@@ -270,7 +270,7 @@ function isS3Object(
}" }"
>{{ props.bucketName }} >{{ props.bucketName }}
</router-link> </router-link>
<span v-else>{{ props.bucketName }}</span> <span v-else class="text-secondary">{{ props.bucketName }}</span>
</li> </li>
<li <li
class="breadcrumb-item" class="breadcrumb-item"
...@@ -289,7 +289,7 @@ function isS3Object( ...@@ -289,7 +289,7 @@ function isS3Object(
}" }"
>{{ folder }} >{{ folder }}
</router-link> </router-link>
<span v-else>{{ folder }}</span> <span v-else class="text-secondary">{{ folder }}</span>
</li> </li>
</ol> </ol>
</nav> </nav>
......
...@@ -28,7 +28,6 @@ let createBucketModal: Modal | null = null; ...@@ -28,7 +28,6 @@ let createBucketModal: Modal | null = null;
onMounted(() => { onMounted(() => {
createBucketModal = new Modal("#" + props.modalID); createBucketModal = new Modal("#" + props.modalID);
console.log("Modal ID", props.modalID);
}); });
function createBucket() { function createBucket() {
......
...@@ -3,12 +3,14 @@ import BootstrapIcon from "@/components/BootstrapIcon.vue"; ...@@ -3,12 +3,14 @@ import BootstrapIcon from "@/components/BootstrapIcon.vue";
import { reactive, onBeforeUnmount, onMounted } from "vue"; import { reactive, onBeforeUnmount, onMounted } from "vue";
import { MiscellaneousService } from "@/client"; import { MiscellaneousService } from "@/client";
import { useAuthStore } from "@/stores/auth"; import { useAuthStore } from "@/stores/auth";
import { useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useCookies } from "vue3-cookies"; import { useCookies } from "vue3-cookies";
import { watch, ref } from "vue";
const router = useRouter(); const router = useRouter();
const store = useAuthStore(); const store = useAuthStore();
const { cookies } = useCookies(); const { cookies } = useCookies();
const route = useRoute();
const api_connection = reactive({ connected: true, timer: null }); const api_connection = reactive({ connected: true, timer: null });
let timer: ReturnType<typeof setInterval> | undefined = undefined; let timer: ReturnType<typeof setInterval> | undefined = undefined;
...@@ -28,6 +30,25 @@ function logout() { ...@@ -28,6 +30,25 @@ function logout() {
router.push({ name: "login" }); router.push({ name: "login" });
} }
const activeRoute = ref("");
watch(
() => route.name,
(to) => {
if (typeof to === "string") {
if (to.startsWith("bucket")) {
activeRoute.value = "buckets";
} else if (to.startsWith("s3_keys")) {
activeRoute.value = "s3_keys";
} else {
activeRoute.value = "";
}
} else {
activeRoute.value = "";
}
}
);
onMounted(() => { onMounted(() => {
checkApiHealth(); checkApiHealth();
timer = setInterval(checkApiHealth, 10000); timer = setInterval(checkApiHealth, 10000);
...@@ -38,9 +59,9 @@ onBeforeUnmount(() => { ...@@ -38,9 +59,9 @@ onBeforeUnmount(() => {
</script> </script>
<template> <template>
<nav class="navbar fixed-top navbar-expand-lg text-bg-dark"> <nav class="navbar navbar-dark fixed-top navbar-expand-lg bg-dark">
<div class="container-fluid"> <div class="container-fluid text-light">
<router-link class="navbar-brand ms-3 text-light" to="/"> <router-link class="navbar-brand ms-3" to="/">
<img <img
src="/src/assets/images/denbi.svg" src="/src/assets/images/denbi.svg"
alt="" alt=""
...@@ -50,6 +71,43 @@ onBeforeUnmount(() => { ...@@ -50,6 +71,43 @@ onBeforeUnmount(() => {
/> />
S3 Proxy S3 Proxy
</router-link> </router-link>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNavAltMarkup"
aria-controls="navbarNavAltMarkup"
aria-expanded="false"
aria-label="Toggle navigation"
v-if="store.authenticated && store.user != null"
>
<span class="navbar-toggler-icon"></span>
</button>
<div
class="collapse navbar-collapse"
id="navbarNavAltMarkup"
v-if="store.authenticated && store.user != null"
>
<div class="navbar-nav">
<router-link
class="nav-link"
:aria-current="activeRoute === 'buckets' ? 'page' : null"
:to="{ name: 'buckets' }"
:class="{ active: activeRoute === 'buckets' }"
>
Buckets
</router-link>
<router-link
class="nav-link"
:to="{ name: 's3_keys' }"
:aria-current="activeRoute === 's3_keys' ? 'page' : null"
:class="{ active: activeRoute === 's3_keys' }"
>
S3 Keys
</router-link>
</div>
</div>
<span <span
v-if="!api_connection.connected" v-if="!api_connection.connected"
class="navbar-text text-bg-danger p-1" class="navbar-text text-bg-danger p-1"
......
<script setup lang="ts"></script>
<template>
<div
class="d-flex flex-column flex-shrink-0 p-3 text-white bg-dark position-fixed top-50 start-0 translate-middle-y min-vh-90"
style="width: 200px"
>
<ul class="nav nav-pills flex-column mb-auto">
<li class="nav-item mb-1">
<button
class="btn btn-lg btn-toggle align-items-center rounded collapsed text-white"
data-bs-toggle="collapse"
data-bs-target="#os-collapse"
aria-expanded="true"
>
Object Storage
</button>
<div class="collapse show fs-5" id="os-collapse">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
<li>
<router-link :to="{ name: 'buckets' }" class="link-light rounded"
>Buckets</router-link
>
</li>
<li>
<router-link :to="{ name: 's3_keys' }" class="link-light rounded"
>S3 Keys</router-link
>
</li>
</ul>
</div>
</li>
</ul>
</div>
</template>
<style scoped>
a {
text-decoration: none;
}
.min-vh-90 {
min-height: 90vh;
}
</style>
<script setup lang="ts"> <script setup lang="ts"></script>
import SidebarLeft from "@/components/SidebarLeft.vue";
</script>
<template> <template>
<div class="row"> <router-view />
<SidebarLeft class="col-2" />
<div class="col-10 offset-md-2">
<router-view />
</div>
</div>
</template> </template>
<style scoped></style> <style scoped></style>
...@@ -18,12 +18,14 @@ onBeforeMount(() => { ...@@ -18,12 +18,14 @@ onBeforeMount(() => {
<template> <template>
<div <div
class="card text-center bg-dark ms-md-auto position-absolute top-50 start-50 translate-middle" class="card text-center bg-dark ms-md-auto position-fixed top-50 start-50 translate-middle"
> >
<div class="card-header text-dark bg-light">LoginView</div> <div class="card-header text-dark bg-light">LoginView</div>
<div class="card-body p-5"> <div class="card-body p-5">
<h5 class="card-title">Login</h5> <h5 class="card-title text-light">Login</h5>
<p class="card-text">Login to this service with LifeScience</p> <p class="card-text text-secondary">
Login to this service with LifeScience
</p>
<a :href="OpenAPI.BASE + '/auth/login'" class="m-2"> <a :href="OpenAPI.BASE + '/auth/login'" class="m-2">
<img src="/src/assets/images/ls-login.png" alt="[LS Login]" /> <img src="/src/assets/images/ls-login.png" alt="[LS Login]" />
</a> </a>
......
...@@ -2,13 +2,20 @@ ...@@ -2,13 +2,20 @@
<template> <template>
<div <div
class="container p-3 top-50 left-50 translate-middle position-fixed text-center" class="card min-w-25 text-center bg-dark ms-md-auto position-fixed top-50 start-50 translate-middle"
> >
<span class="fs-1 mb-5">Page Not Found</span><br /> <div class="card-header text-dark bg-light fs-4">Something went wrong</div>
<span class="fs-3" <div class="card-body p-5">
>Back to the <router-link to="/">HomePage</router-link></span <h1 class="card-title text-light mb-5">Page Not Found</h1>
> <p class="card-text text-secondary fs-4">
Back to the <router-link to="/">HomePage</router-link>
</p>
</div>
</div> </div>
</template> </template>
<style scoped></style> <style scoped>
.min-w-25 {
min-width: 25%;
}
</style>
...@@ -47,12 +47,12 @@ onMounted(() => { ...@@ -47,12 +47,12 @@ onMounted(() => {
</script> </script>
<template> <template>
<div class="row m-2 border-bottom border-light"> <div class="row m-2 border-bottom border-light mt-4">
<div class="col-12"></div> <div class="col-12"></div>
<h1 class="mb-2">Buckets</h1> <h1 class="mb-2 text-light">Buckets</h1>
</div> </div>
<div class="row m-2 mt-4"> <div class="row m-2 mt-4">
<div class="col-2"> <div class="col-3">
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<button <button
type="button" type="button"
...@@ -116,7 +116,7 @@ onMounted(() => { ...@@ -116,7 +116,7 @@ onMounted(() => {
</div> </div>
</div> </div>
</div> </div>
<div class="col-8"> <div class="col-9">
<router-view></router-view> <router-view></router-view>
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment