fix typing errors
Signed-off-by: garionion <github@entr0py.de>
This commit is contained in:
parent
736edcd8a6
commit
f0d147ab27
14 changed files with 74 additions and 122 deletions
|
@ -1,4 +1,3 @@
|
||||||
# Radiator-Web
|
# Radiator-Web
|
||||||
|
|
||||||
API URL must be set on Build Time, either via Env `API_URL`(prefered), or via `VITE_API_URL` from [`.env.production`](.env.production)
|
API URL must be set on Build Time, either via Env `API_URL`(prefered), or via `VITE_API_URL` from [`.env.production`](.env.production)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<main class="container mx-auto px-2 sm:px-6 pt-8">
|
<main class="container mx-auto px-2 sm:px-6 pt-8">
|
||||||
<suspense>
|
<suspense>
|
||||||
<template #default><router-view></router-view> </template>
|
<template #default><router-view></router-view> </template>
|
||||||
<template #fallback>Loading</template>
|
<template #fallback><VSpinner /></template>
|
||||||
</suspense>
|
</suspense>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,11 +13,13 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import VNav from "./components/VNav.vue";
|
import VNav from "./components/VNav.vue";
|
||||||
|
import VSpinner from "./components/VSpinner.vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "App",
|
name: "App",
|
||||||
components: {
|
components: {
|
||||||
VNav,
|
VNav,
|
||||||
|
VSpinner,
|
||||||
},
|
},
|
||||||
setup() {},
|
setup() {},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
<template>
|
|
||||||
<h1>{{ msg }}</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Recommended IDE setup:
|
|
||||||
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
|
|
||||||
+
|
|
||||||
<a
|
|
||||||
href="https://marketplace.visualstudio.com/items?itemName=octref.vetur"
|
|
||||||
target="_blank"
|
|
||||||
>Vetur</a
|
|
||||||
>
|
|
||||||
or
|
|
||||||
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
|
||||||
(if using
|
|
||||||
<code><script setup></code>)
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>See <code>README.md</code> for more information.</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="https://vitejs.dev/guide/features.html" target="_blank"
|
|
||||||
>Vite Docs</a
|
|
||||||
>
|
|
||||||
|
|
|
||||||
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<button @click="count++">count is: {{ count }}</button>
|
|
||||||
<p>
|
|
||||||
Edit
|
|
||||||
<code>components/HelloWorld.vue</code> to test hot module replacement.
|
|
||||||
</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
import { ref, defineComponent } from "vue";
|
|
||||||
export default defineComponent({
|
|
||||||
name: "HelloWorld",
|
|
||||||
props: {
|
|
||||||
msg: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
setup: () => {
|
|
||||||
const count = ref(0);
|
|
||||||
return { count };
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
a {
|
|
||||||
color: #42b983;
|
|
||||||
}
|
|
||||||
|
|
||||||
label {
|
|
||||||
margin: 0 0.5em;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
background-color: #eee;
|
|
||||||
padding: 2px 4px;
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #304455;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -124,11 +124,11 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
//stolen from https://git.max-site.de/Eulinchen/eulinchen-frontend/src/branch/master/src/components/VNav.vue
|
//stolen from https://git.max-site.de/Eulinchen/eulinchen-frontend/src/branch/master/src/components/VNav.vue
|
||||||
|
|
||||||
import { ref, reactive, computed, watch } from "vue";
|
import { ref, reactive, computed, watch, defineComponent } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import { isLoggedIn as isLoggedinFromAPI } from "../api";
|
import { isLoggedIn as isLoggedinFromAPI } from "../api";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: "VNav",
|
name: "VNav",
|
||||||
setup() {
|
setup() {
|
||||||
const title = "radiator";
|
const title = "radiator";
|
||||||
|
@ -170,7 +170,7 @@ export default {
|
||||||
|
|
||||||
return { title, open, items, activeRoute, isLoggedIn };
|
return { title, open, items, activeRoute, isLoggedIn };
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
9
src/components/VSpinner.vue
Normal file
9
src/components/VSpinner.vue
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<template>Loading…</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "VSpinner",
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
|
@ -2,39 +2,40 @@
|
||||||
<div
|
<div
|
||||||
class="border-yellow-300 p-8 border-t-8 bg-white mb-6 rounded-lg shadow-lg text-left"
|
class="border-yellow-300 p-8 border-t-8 bg-white mb-6 rounded-lg shadow-lg text-left"
|
||||||
>
|
>
|
||||||
<span class="block w-full">{{ apName }}</span>
|
<span class="block w-full" v-text="apName" />
|
||||||
<div v-if="state.result === undefined">
|
<div v-if="stateOfTask.result === undefined">
|
||||||
<span class="block w-full">{{ state.state }}</span>
|
<span class="block w-full" v-text="stateOfTask.state" />
|
||||||
<progress
|
<progress
|
||||||
class="block w-full"
|
class="block w-full"
|
||||||
:max="state.total"
|
:max="stateOfTask.total"
|
||||||
:value="state.current"
|
:value="stateOfTask.current"
|
||||||
></progress>
|
></progress>
|
||||||
<span class="block w-full">{{ state.status }}</span>
|
<span class="block w-full" v-text="stateOfTask.status" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="w-full flex">
|
<div v-else class="w-full flex">
|
||||||
<span class="flex-1 mr-2"
|
<span class="flex-1 mr-2"
|
||||||
>SwitchPortID {{ state.result.switchportid }}</span
|
>SwitchPortID {{ stateOfTask.result.switchportid }}</span
|
||||||
>
|
>
|
||||||
<span class="flex-1 mr-2"
|
<span class="flex-1 mr-2"
|
||||||
>New SwitchPortID {{ state.result.switchportid_new }}</span
|
>New SwitchPortID {{ stateOfTask.result.switchportid_new }}</span
|
||||||
>
|
>
|
||||||
<span class="flex-1 mr-2">UserPortID {{ state.result.userportid }}</span>
|
|
||||||
<span class="flex-1 mr-2"
|
<span class="flex-1 mr-2"
|
||||||
>SwitchPortID {{ state.result.userportid_new }}</span
|
>UserPortID {{ stateOfTask.result.userportid }}</span
|
||||||
|
>
|
||||||
|
<span class="flex-1 mr-2"
|
||||||
|
>SwitchPortID {{ stateOfTask.result.userportid_new }}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { reactive, toRefs } from "vue";
|
import { reactive, toRefs, defineComponent } from "vue";
|
||||||
import { useIntervalFn } from "@vueuse/core";
|
import { useIntervalFn } from "@vueuse/core";
|
||||||
import { getStateOfTask, StateOfTask } from "../api";
|
import { getStateOfTask, StateOfTask } from "../api";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: "VTaskState",
|
name: "VTaskState",
|
||||||
emits: ["finished"],
|
|
||||||
props: {
|
props: {
|
||||||
taskID: {
|
taskID: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -45,26 +46,29 @@ export default {
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props: { taskID: string }) {
|
setup(props: { taskID: string; apName: string }) {
|
||||||
const { taskID } = toRefs(props);
|
const { taskID, apName } = toRefs(props);
|
||||||
|
|
||||||
const state = reactive<StateOfTask>({
|
const stateOfTask = reactive<StateOfTask>({
|
||||||
state: "",
|
state: "",
|
||||||
current: "",
|
current: "",
|
||||||
total: undefined,
|
total: 0,
|
||||||
result: undefined,
|
status: "",
|
||||||
status: null,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { pause, resume } = useIntervalFn(async () => {
|
const { pause } = useIntervalFn(
|
||||||
const s = await getStateOfTask(taskID.value);
|
async () => {
|
||||||
Object.assign(state, s);
|
const s = await getStateOfTask(taskID.value);
|
||||||
if (s.result !== undefined) pause();
|
Object.assign(stateOfTask, s);
|
||||||
}, 300);
|
if (s.result !== undefined) pause();
|
||||||
|
},
|
||||||
|
300,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
return { state };
|
return { stateOfTask, apName };
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -55,7 +55,10 @@ const routes: RouteRecordRaw[] = [
|
||||||
path: "/registerAccessPoint",
|
path: "/registerAccessPoint",
|
||||||
name: "RegisterAccessPoint",
|
name: "RegisterAccessPoint",
|
||||||
component: RegisterAccessPoint,
|
component: RegisterAccessPoint,
|
||||||
props: (route) => ({ apID: Number(route.query["ap-id"]).valueOf() }),
|
props: (route) =>
|
||||||
|
route.query["ap-id"]
|
||||||
|
? { apID: Number(route.query["ap-id"]).valueOf() }
|
||||||
|
: {},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { reactive, toRefs } from "vue";
|
import { reactive, toRefs, defineComponent } from "vue";
|
||||||
import { getAccessPointDetails, AccessPoint } from "../api";
|
import { getAccessPointDetails, AccessPoint } from "../api";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: "AccessPoints",
|
name: "AccessPoints",
|
||||||
props: {
|
props: {
|
||||||
siteID: {
|
siteID: {
|
||||||
|
@ -72,7 +72,7 @@ export default {
|
||||||
|
|
||||||
return { aps };
|
return { aps };
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, toRefs, reactive } from "vue";
|
import { ref, toRefs, reactive, defineComponent } from "vue";
|
||||||
import {
|
import {
|
||||||
AccessPoint,
|
AccessPoint,
|
||||||
getAccessPointByID,
|
getAccessPointByID,
|
||||||
|
@ -110,7 +110,7 @@ import {
|
||||||
import AccessPoints from "./AccessPoints.vue";
|
import AccessPoints from "./AccessPoints.vue";
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: "CreateAccessPoint",
|
name: "CreateAccessPoint",
|
||||||
props: {
|
props: {
|
||||||
siteID: {
|
siteID: {
|
||||||
|
@ -183,7 +183,7 @@ export default {
|
||||||
|
|
||||||
return { isEdit, ap, sites, getSites, createAccessPoint };
|
return { isEdit, ap, sites, getSites, createAccessPoint };
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<template>Mi casa e tu casa</template>
|
<template>Mi casa e tu casa</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
import { defineComponent } from "vue";
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
name: "Home",
|
name: "Home",
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -45,11 +45,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, toRefs } from "vue";
|
import { ref, toRefs, defineComponent } from "vue";
|
||||||
import { login as apiLogin, logout as apiLogout } from "../api";
|
import { login as apiLogin, logout as apiLogout } from "../api";
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: "Login",
|
name: "Login",
|
||||||
props: {
|
props: {
|
||||||
logout: {
|
logout: {
|
||||||
|
@ -84,7 +84,7 @@ export default {
|
||||||
login,
|
login,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -33,14 +33,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { reactive, ref, toRefs } from "vue";
|
import { reactive, ref, toRefs, defineComponent } from "vue";
|
||||||
import {
|
import {
|
||||||
getAccessPointByID,
|
getAccessPointByID,
|
||||||
registerAccessPoint as apiRegisterAccessPoint,
|
registerAccessPoint as apiRegisterAccessPoint,
|
||||||
} from "../api";
|
} from "../api";
|
||||||
import VTaskState from "../components/VTaskState.vue";
|
import VTaskState from "../components/VTaskState.vue";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: "RegisterAccessPoint",
|
name: "RegisterAccessPoint",
|
||||||
components: { VTaskState },
|
components: { VTaskState },
|
||||||
props: {
|
props: {
|
||||||
|
@ -62,7 +62,7 @@ export default {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isNaN(apID?.value)) {
|
if (apID?.value !== undefined) {
|
||||||
getAccessPointSettings(apID.value);
|
getAccessPointSettings(apID.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
||||||
|
|
||||||
return { apName, registerAccessPoint, tasks, finishedTasks };
|
return { apName, registerAccessPoint, tasks, finishedTasks };
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<template>settierungsmöglichkeiten</template>
|
<template>settierungsmöglichkeiten</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
export default {
|
import { defineComponent } from "vue";
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
name: "Settings",
|
name: "Settings",
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -79,9 +79,9 @@ import {
|
||||||
Site,
|
Site,
|
||||||
createSite as apiCreateSite,
|
createSite as apiCreateSite,
|
||||||
} from "../api";
|
} from "../api";
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref, defineComponent } from "vue";
|
||||||
|
|
||||||
export default {
|
export default defineComponent({
|
||||||
name: "Sites",
|
name: "Sites",
|
||||||
async setup() {
|
async setup() {
|
||||||
const sites = reactive<Site[]>([]);
|
const sites = reactive<Site[]>([]);
|
||||||
|
@ -110,7 +110,7 @@ export default {
|
||||||
|
|
||||||
return { sites, newSiteName, newDefaultPrefix, createSite };
|
return { sites, newSiteName, newDefaultPrefix, createSite };
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
Loading…
Add table
Reference in a new issue