feat(components): wip form components
This commit is contained in:
parent
0d30926eeb
commit
2c5305b5cd
13 changed files with 530 additions and 276 deletions
|
@ -2,4 +2,20 @@
|
||||||
import DefaultTheme from 'vitepress/theme'
|
import DefaultTheme from 'vitepress/theme'
|
||||||
import './custom.css'
|
import './custom.css'
|
||||||
|
|
||||||
export default DefaultTheme
|
/** @type {import('vitepress').Theme} */
|
||||||
|
export default {
|
||||||
|
extends: DefaultTheme,
|
||||||
|
enhanceApp({ app }) {
|
||||||
|
const components = import.meta.glob('./components/*.vue', { eager: true })
|
||||||
|
for (const path in components) {
|
||||||
|
mcomponents[path]().then((c) => {
|
||||||
|
console.log(path, c)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Object.entries(components).forEach(([path, definition]) => {
|
||||||
|
const componentName = path.split('/').pop().replace(/\.\w+$/, '')
|
||||||
|
console.log(componentName)
|
||||||
|
app.component(componentName, definition.default)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# NixiN Web
|
# NixiN Web
|
||||||
|
|
||||||
|
|
||||||
## Building the web site
|
## Building the web site
|
||||||
npm run docs:build
|
npm run docs:build
|
||||||
|
|
||||||
|
@ -21,4 +20,4 @@ if you forked this repository, you need to create the secrets needed by the depl
|
||||||
- DEPLOY_USER : OS user to connect to production server
|
- DEPLOY_USER : OS user to connect to production server
|
||||||
- DEPLOY_TARGET : sftp target where the web site has to be deployed, in the form of server.domain.tld:path
|
- DEPLOY_TARGET : sftp target where the web site has to be deployed, in the form of server.domain.tld:path
|
||||||
- DEPLOY_SSH_PRIVATE_KEY : private ssh key used to authenticate with the server
|
- DEPLOY_SSH_PRIVATE_KEY : private ssh key used to authenticate with the server
|
||||||
and configure the server witht the public key corresponding to DEPLOY_SSH_PRIVATE_KEY
|
and configure the server with the public key corresponding to DEPLOY_SSH_PRIVATE_KEY
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
|
<script setup>
|
||||||
|
import NixCode from "./NixCode.vue"
|
||||||
|
import NixForm from "./NixForm.vue"
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.availableServices.forEach((s, i) => {
|
this.availableServices.forEach((s) => {
|
||||||
s.inBundle = []
|
s.inBundle = []
|
||||||
})
|
})
|
||||||
this.availableBundles.forEach((b, i) => {
|
this.availableBundles.forEach((b) => {
|
||||||
b.services.forEach((s) => {
|
b.services.forEach((s) => {
|
||||||
this.availableServices.find(item => item.id === s).inBundle.push(b.id);
|
this.availableServices.find(item => item.id === s).inBundle.push(b.id);
|
||||||
})
|
})
|
||||||
|
@ -108,8 +114,6 @@ export default {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h2>Networking</h2>
|
<h2>Networking</h2>
|
||||||
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-cell">
|
<div class="form-cell">
|
||||||
<strong>Choose your network configuration</strong>
|
<strong>Choose your network configuration</strong>
|
||||||
<label>
|
<label>
|
||||||
|
@ -125,11 +129,9 @@ export default {
|
||||||
router is set so that my local machine is accessible on the public network
|
router is set so that my local machine is accessible on the public network
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" v-model="netconf" name="netconf" value="wireguard" @click="netconfHasBeenChanged">My server
|
<input type="radio" v-model="netconf" name="netconf" value="wireguard" @click="netconfHasBeenChanged">My server can use a wireguard server i can configure
|
||||||
can use a wireguard server i can configure
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-cell">
|
<div class="form-cell">
|
||||||
|
@ -150,7 +152,7 @@ export default {
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-cell">
|
<div class="form-cell">
|
||||||
<strong>Choose your usage bundles (multiple choices possible if your machine can handle it)</strong>
|
<strong>Choose your usage bundles (multiple choices possible if your machine can handle it)</strong>
|
||||||
<div v-for="bundle in availableBundles">
|
<div v-for="bundle in availableBundles" :key="bundle">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" v-model="nixinBundles" :id="bundle.id" :value="bundle.id"
|
<input type="checkbox" v-model="nixinBundles" :id="bundle.id" :value="bundle.id"
|
||||||
@change="selectServices(bundle.id, bundle.services)" />
|
@change="selectServices(bundle.id, bundle.services)" />
|
||||||
|
@ -162,8 +164,9 @@ export default {
|
||||||
|
|
||||||
<h2>Services</h2>
|
<h2>Services</h2>
|
||||||
<div v-if="nixinBundles.length === 0">👆 Choose any upper bundle to make associated services appear.</div>
|
<div v-if="nixinBundles.length === 0">👆 Choose any upper bundle to make associated services appear.</div>
|
||||||
<div v-for="service in availableServices">
|
<div v-for="service in availableServices" :key="service">
|
||||||
<label v-if="service.inBundle && service.inBundle.some(ai => nixinBundles.includes(ai))">
|
<label v-if="service.inBundle && service.inBundle.some(ai => nixinBundles.includes(ai))">
|
||||||
|
<NixForm :service="service.id" />
|
||||||
<input type="checkbox" v-model="nixinServices" :id="service.id" :value="service.id" />
|
<input type="checkbox" v-model="nixinServices" :id="service.id" :value="service.id" />
|
||||||
{{ service.name }}
|
{{ service.name }}
|
||||||
</label>
|
</label>
|
||||||
|
@ -231,7 +234,9 @@ export default {
|
||||||
|
|
||||||
time.timeZone = "{{ timezone }}";
|
time.timeZone = "{{ timezone }}";
|
||||||
i18n.defaultLocale = "{{ locale }}";
|
i18n.defaultLocale = "{{ locale }}";
|
||||||
|
<div v-for="(service) in nixinServices" :key="service">
|
||||||
|
<NixCode :service-name="service" />
|
||||||
|
</div>
|
||||||
<div v-if="nixinServices.includes('gotosocial')">
|
<div v-if="nixinServices.includes('gotosocial')">
|
||||||
{
|
{
|
||||||
services.gotosocial = {
|
services.gotosocial = {
|
||||||
|
|
18
components/DynamicComponent.vue
Normal file
18
components/DynamicComponent.vue
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<template>
|
||||||
|
<component :is="type"></component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import * as components from './all'
|
||||||
|
console.log(components)
|
||||||
|
export default {
|
||||||
|
|
||||||
|
components: {
|
||||||
|
...components
|
||||||
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
type: { type: String, required: true }
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
7
components/NixCode.vue
Normal file
7
components/NixCode.vue
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps(['service-name'])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
nixcode {{ serviceName }}
|
||||||
|
</template>
|
3
components/NixForm-forgejo.vue
Normal file
3
components/NixForm-forgejo.vue
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<template>
|
||||||
|
forgejo
|
||||||
|
</template>
|
3
components/NixForm-forgejorunner.vue
Normal file
3
components/NixForm-forgejorunner.vue
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<template>
|
||||||
|
forgejo runner
|
||||||
|
</template>
|
3
components/NixForm-hedgedoc.vue
Normal file
3
components/NixForm-hedgedoc.vue
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<template>
|
||||||
|
hedgedoc form
|
||||||
|
</template>
|
3
components/NixForm-nextcloud.vue
Normal file
3
components/NixForm-nextcloud.vue
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<template>
|
||||||
|
nextcloud form
|
||||||
|
</template>
|
3
components/NixForm-nixin.vue
Normal file
3
components/NixForm-nixin.vue
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<template>
|
||||||
|
nixin
|
||||||
|
</template>
|
12
components/NixForm.vue
Normal file
12
components/NixForm.vue
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<script setup>
|
||||||
|
import {ref} from 'vue'
|
||||||
|
import DynamicComponent from "./DynamicComponent.vue"
|
||||||
|
|
||||||
|
const props = defineProps(['service'])
|
||||||
|
let serviceComponent = 'NixForm'+props.service
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<dynamic-component :type="serviceComponent" />
|
||||||
|
</template>
|
||||||
|
|
5
components/all.js
Normal file
5
components/all.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export { default as NixFormnextcloud } from './NixForm-nextcloud.vue'
|
||||||
|
export { default as NixFormhedgedoc } from './NixForm-hedgedoc.vue'
|
||||||
|
export { default as NixFormforgejo } from './NixForm-forgejo.vue'
|
||||||
|
export { default as NixFormforgejorunner } from './NixForm-forgejorunner.vue'
|
||||||
|
export { default as NixFormnixin } from './NixForm-nixin.vue'
|
703
package-lock.json
generated
703
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue