created branch to locally source mockup
This commit is contained in:
parent
eb56af74e6
commit
ff2d6c82c9
6 changed files with 19 additions and 73 deletions
|
@ -39,7 +39,7 @@ async fn main() -> std::io::Result<()> {
|
|||
let cors = if cfg!(debug_assertions) {
|
||||
actix_cors::Cors::permissive()
|
||||
} else {
|
||||
actix_cors::Cors::default()
|
||||
actix_cors::Cors::permissive() //change to default on push
|
||||
};
|
||||
App::new()
|
||||
.wrap(cors)
|
||||
|
|
|
@ -43,7 +43,7 @@ docker image remove apfelnetzwerk-backend
|
|||
docker ps
|
||||
```
|
||||
|
||||
3. attach a shell to the running postgres docker container
|
||||
3. attach a shell to the running backend docker container
|
||||
```bash
|
||||
docker exec -it <it/name> /bin/bash
|
||||
```
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import axios from "axios";
|
||||
import { store } from "@/store";
|
||||
let axiosInstance = axios.create({
|
||||
baseURL: import.meta.env.VITE_BACKEND_URL,
|
||||
});
|
||||
axiosInstance.interceptors.request.use((config) => {
|
||||
config.headers.Authorization = `Bearer ${store.token}`;
|
||||
return config;
|
||||
});
|
||||
|
||||
export { axiosInstance };
|
||||
export { axiosInstance };
|
|
@ -3,29 +3,9 @@
|
|||
<v-toolbar color="main" dark prominent>
|
||||
<img src="../assets/turbologo.svg" alt="logo" class="logo" width="75" />
|
||||
<v-spacer></v-spacer>
|
||||
<!-- Users, Groups, Licenses -->
|
||||
<div>
|
||||
<!-- USER MANAGEMENT -->
|
||||
<template v-if="!user" />
|
||||
<UsersDialog v-else-if="user.admin" />
|
||||
<UsersEditActions v-else :admin-menu="false" :user="user!" />
|
||||
</div>
|
||||
<!-- Search -->
|
||||
<v-text-field
|
||||
class="compact-form mr-2"
|
||||
label="Search"
|
||||
variant="solo"
|
||||
density="compact"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
hide-details
|
||||
single-line
|
||||
clearable
|
||||
v-model="search"
|
||||
rounded="pill"
|
||||
></v-text-field>
|
||||
|
||||
<!-- Logout -->
|
||||
<v-btn icon variant="outlined" @click="handlelogout">
|
||||
<v-btn @click="handlelogout">
|
||||
<LogOut />
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
@ -46,13 +26,7 @@ import { axiosInstance } from "@/client";
|
|||
import { User } from "@/types";
|
||||
import { search } from "@/store";
|
||||
|
||||
const { data: user } = useQuery({
|
||||
queryKey: ["user"],
|
||||
queryFn: async () => {
|
||||
const res = await axiosInstance.get<User>("/users/me");
|
||||
return res.data;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
function handlelogout() {
|
||||
store.setToken(null);
|
||||
|
|
|
@ -9,54 +9,28 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import HeaderBar from "./HeaderBar.vue";
|
||||
import CategoryContainer from "./CategoryContainer.vue";
|
||||
import { useQuery } from "@tanstack/vue-query";
|
||||
import { axiosInstance } from "@/client";
|
||||
import { LicenseGroup, License } from "@/types";
|
||||
import { search, key } from "@/store";
|
||||
import MiniSearch from "minisearch";
|
||||
import { computed, provide } from "vue";
|
||||
import { NodeGroup } from "@/types";
|
||||
import TableCategory from "./TableCategory.vue";
|
||||
|
||||
const { isPending, isError, data, error } = useQuery({
|
||||
queryKey: ["licenses"],
|
||||
|
||||
const { data } = useQuery({
|
||||
queryKey: ["nodes"],
|
||||
queryFn: async () => {
|
||||
const res = await axiosInstance.get<LicenseGroup[]>("/licenses");
|
||||
console.log(res.data);
|
||||
const res = await axiosInstance.get<NodeGroup[]>("/nodes");
|
||||
return res.data;
|
||||
},
|
||||
refetchInterval: 60 * 1000,
|
||||
select: (data) => {
|
||||
return data.map((group) => {
|
||||
return {
|
||||
title: group.name,
|
||||
value: group.nodes,
|
||||
};
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const searchEngine = computed(() => {
|
||||
let minisearch = new MiniSearch({
|
||||
fields: ["name", "description", "id"],
|
||||
searchOptions: {
|
||||
boost: { name: 2 },
|
||||
prefix: true,
|
||||
},
|
||||
});
|
||||
let licenses: License[] = [];
|
||||
data.value?.forEach((group) => {
|
||||
group.licenses.forEach((license) => licenses.push(license));
|
||||
});
|
||||
console.log(licenses);
|
||||
minisearch.addAll(licenses);
|
||||
return minisearch;
|
||||
});
|
||||
|
||||
const searching = computed(() => search.value !== "");
|
||||
|
||||
const visibleIds = computed(() => {
|
||||
return searchEngine.value.search(search.value).map((searchResult) => {
|
||||
return searchResult.id;
|
||||
});
|
||||
});
|
||||
|
||||
provide(key, {
|
||||
visibleIds,
|
||||
searching,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -19,7 +19,7 @@ export default createVuetify({
|
|||
light: {
|
||||
dark: false,
|
||||
colors: {
|
||||
main: "#024950",
|
||||
main: "#353A43",
|
||||
darker: "#003135",
|
||||
contrast: "#964734",
|
||||
accent: "#0FA4AF",
|
||||
|
|
Loading…
Add table
Reference in a new issue