Compare commits

...

12 Commits

  1. 14
      Dockerfile
  2. 54
      components/Typ.vue
  3. 6
      nuxt.config.js

14
Dockerfile

@ -0,0 +1,14 @@
FROM node:18.16-alpine
WORKDIR /app
RUN apk update && apk upgrade
RUN apk add git
COPY . .
RUN npm install
RUN npm run build
EXPOSE 80
ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=80
CMD ["npm", "start"]

54
components/Typ.vue

@ -5,34 +5,19 @@
<b-form-group
id="ip-g-1"
label="Name:"
label-for="name"
description="Name des Zertifikat-Typs:"
label="Bezeichnung:"
label-for="bezeichnung"
description="Bezeichnung des Kleidungs-Typs:"
>
<b-form-input
id="name"
v-model="form.name"
id="bezeichnung"
v-model="form.bezeichnung"
required
placeholder="Name eingeben"
placeholder="Bezeichnung eingeben"
size="50"
>
</b-form-input>
</b-form-group>
<b-form-group
id="ip-g-2"
label="Laufzeit (in Tagen):"
label-for="laufzeit"
description="Laufzeit des Zertifikats:"
>
<b-form-input
id="laufzeit"
v-model="form.laufzeit"
required
placeholder="Laufzeit eingeben"
size="50"
>
</b-form-input>
</b-form-group>
</b-form-group>
<b-button variant="primary" @click="onSubmit()">Neu eintragen</b-button>
<b-button variant="secondary" @click="onUpdate()">Aktualisieren</b-button>
@ -56,8 +41,7 @@
certs: [],
form:{
id: "",
name: "",
laufzeit: 0,
bezeichnung: "",
},
fields: [
{
@ -65,11 +49,7 @@
sortable: true
},
{
key: 'name',
sortable: true
},
{
key: 'laufzeit',
key: 'bezeichnung',
sortable: true
},
]
@ -88,14 +68,14 @@
async fetch() {
console.log("fetching...");
this.certs = await fetch(
'http://localhost:8081/api/typ'
'http://ubodroid-2:8080/api/v1/typ'
).then(res => res.json())
},
async onSubmit() {
// event.preventDefault();
this.form.id = "";
console.log("submitting...");
await this.$http.$post('http://localhost:3000/api/typ', this.form);
await this.$http.$post('http://ubodroid-2:8080/api/v1/typ', this.form);
// return result;
// this.subm(this.form);
this.fetch();
@ -107,7 +87,7 @@
console.log("updating...");
console.log("Laufzeit: ", this.form.laufzeit)
console.log(this.form);
await this.$http.$put('http://localhost:3000/api/typ/'+this.form.id, this.form);
await this.$http.$put('http://ubodroid-2:8080/api/v1/typ/'+this.form.id, this.form);
// return result;
// this.subm(this.form);
this.fetch();
@ -117,7 +97,7 @@
async onDelete() {
// event.preventDefault();
console.log("updating...");
await this.$http.$delete('http://localhost:3000/api/typ/'+this.form.id);
await this.$http.$delete('http://ubodroid-2:8080/api/v1/typ/'+this.form.id);
// return result;
// this.subm(this.form);
this.fetch();
@ -127,17 +107,15 @@
onReset(event) {
event.preventDefault();
this.form.name = '';
this.form.laufzeit = 0;
this.form.bezeichnung = '';
},
onFill(item) {
// alert(JSON.stringify(item));
if(item.length !== 0) {
this.form.name = item[0].name;
this.form.bezeichnung = item[0].bezeichnung;
this.form.id = item[0].id;
this.form.laufzeit = parseInt(item[0].laufzeit);
console.log(JSON.stringify(item[0].name));
console.log(JSON.stringify(item[0].bezeichnung));
}
}
}

6
nuxt.config.js

@ -49,12 +49,14 @@ export default {
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {
// Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
baseURL: '/',
//baseURL: '/',
//browserBaseURL: '/',
proxy: true
},
proxy: {
'/api/': { target: 'http://localhost:8081/', changeOrigin: true },
'/api/v1/': { target: 'http://10.1.1.13:8081/', changeOrigin: true },
},
// Build Configuration: https://go.nuxtjs.dev/config-build

Loading…
Cancel
Save