<template>
  <v-row v-if="this.formState.ready">
    <gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
    <v-col>
      <v-textarea v-model="logText" full-width readonly auto-grow></v-textarea>
    </v-col>
  </v-row>
</template>

<script>
/*  Xeslint-disable */
export default {
  created() {
    let vm = this;
    window.$gz.eventBus.$emit("menu-change", {
      isMain: false,
      icon: "fa-info-circle",
      title: this.$ay.t("Log"),
      helpUrl: "form-ay-log",

      menuItems: []
    });

    let outText = "";
    window.$gz._.forEach(vm.$store.state.logArray, function appendLogItem(
      value
    ) {
      outText += value + "\n";
    });
    this.logText = outText;
    window.$gz.translation
      .fetch(["Log"])
      .then(() => (vm.formState.ready = true))
      .catch(err => {
        vm.formState.ready = true;
        window.$gz.errorHandler.handleFormError(err, vm);
      });
  },
  data() {
    return {
      logText: "",
      formState: {
        ready: false,
        loading: true,
        errorBoxMessage: null,
        appError: null,
        serverError: {}
      }
    };
  }
};
</script>
