<commit_before><template>
  <v-dialog
    :value="value"
    @input="close"
    max-width="500px"
  >
    <slot slot="activator" />
    
    <v-card>
      <v-card-text>
        <v-form
          lazy-validation
          v-model="isValid"
          @keydown.native.prevent.enter="submit"
        >
          <v-text-field
            autofocus
            class="mb-2"
            label="Title"
            :rules="inputValidationRules"
            v-model="title"
          />
          <v-text-field
            autofocus
            class="mb-2"
            label="Group"
            :rules="inputValidationRules"
            v-model="group"
          />
          <v-select 
            :items="categoryStatuses"
            item-text="name"
            item-value="value"
            v-model="categoryStatus"
            label="Status"
            class="mb-2"
          />
          <v-checkbox
            v-model="checkboxSections"
            label="Pros/cons enabled"
            value="ItemProsConsSection"
            class="mb-2"
            append-icon=""
          />
          <v-checkbox 
            v-model="checkboxSections"
            label="Ecosystem field enabled"
            value="ItemEcosystemSection"
            class="mb-2"
          />
          <v-checkbox 
            v-model="checkboxSections"
            label="Notes field enabled"
            value="ItemNotesSection"
            class="mb-2"
          />
        </v-form>
      </v-card-text>
      <v-card-actions>
        <v-spacer />
        <v-btn
          flat
          color="primary"
          title="Submit"
          class="add-cat-submit"
          :disabled="!isValid"
          @click="updateCategoryInfo"
        >
          Submit
        </v-btn>
        <v-btn
          flat
          title="Cancel"
          color="primary"
          @click.native="close"
        >
          Cancel
        </v-btn>
      </v-card-actions>
    </v-card>
  </v-dialog>
</template>

<script lang="ts">
import Vue from 'vue'
import Component from 'vue-class-component'
import { Prop, Watch } from 'vue-property-decorator';
import { CategoryStatus } from 'client/service/Category'

@Component
export default class CategoryInfoEdit extends Vue {
  @Prop(Boolean) value!: boolean
  @Prop(String) categoryId!: string

  title: string = ''
  group: string = ''
  categoryStatus: object = {}
  checkboxSections: any[] = []
  isValid: boolean = false

  categoryStatuses = [
    { name: 'Complete', value: 'CategoryFinished' }, 
    { name: 'Work in progress', value: 'CategoryWIP' }, 
    { name: 'Stub', value: 'CategoryStub' }
  ]

  inputValidationRules: Function[] = [
    (x: string) => !!x || 'Input can not be empty'
  ]

  @Watch('value')
  onOpen () {
    const category = this.$store.state.category.category
    this.title = category.title
    this.group = category.group
    this.checkboxSections = category.sections
    this.categoryStatus = { name: this.transformCategoryStatus(category.status), value: category.status }
  }

  transformCategoryStatus (status: string) {
    switch(status) {
      case CategoryStatus.finished:
        return 'Complete'
      case CategoryStatus.inProgress:
        return 'Work in progress'
      default:
        return 'Stub'
    }<commit_msg>Excess semicolon removed<commit_after><template>
  <v-dialog
    :value="value"
    @input="close"
    max-width="500px"
  >
    <slot slot="activator" />

    <v-card>
      <v-card-text>
        <v-form
          lazy-validation
          v-model="isValid"
          @keydown.native.prevent.enter="submit"
        >
          <v-text-field
            autofocus
            class="mb-2"
            label="Title"
            :rules="inputValidationRules"
            v-model="title"
          />
          <v-text-field
            autofocus
            class="mb-2"
            label="Group"
            :rules="inputValidationRules"
            v-model="group"
          />
          <v-select
            :items="categoryStatuses"
            item-text="name"
            item-value="value"
            v-model="categoryStatus"
            label="Status"
            class="mb-2"
          />
          <v-checkbox
            v-model="checkboxSections"
            label="Pros/cons enabled"
            value="ItemProsConsSection"
            class="mb-2"
            append-icon=""
          />
          <v-checkbox
            v-model="checkboxSections"
            label="Ecosystem field enabled"
            value="ItemEcosystemSection"
            class="mb-2"
          />
          <v-checkbox
            v-model="checkboxSections"
            label="Notes field enabled"
            value="ItemNotesSection"
            class="mb-2"
          />
        </v-form>
      </v-card-text>
      <v-card-actions>
        <v-spacer />
        <v-btn
          flat
          color="primary"
          title="Submit"
          class="add-cat-submit"
          :disabled="!isValid"
          @click="updateCategoryInfo"
        >
          Submit
        </v-btn>
        <v-btn
          flat
          title="Cancel"
          color="primary"
          @click.native="close"
        >
          Cancel
        </v-btn>
      </v-card-actions>
    </v-card>
  </v-dialog>
</template>

<script lang="ts">
import Vue from 'vue'
import Component from 'vue-class-component'
import { Prop, Watch } from 'vue-property-decorator'
import { CategoryStatus } from 'client/service/Category'

@Component
export default class CategoryInfoEdit extends Vue {
  @Prop(Boolean) value!: boolean
  @Prop(String) categoryId!: string

  title: string = ''
  group: string = ''
  categoryStatus: object = {}
  checkboxSections: any[] = []
  isValid: boolean = false

  categoryStatuses = [
    { name: 'Complete', value: 'CategoryFinished' },
    { name: 'Work in progress', value: 'CategoryWIP' },
    { name: 'Stub', value: 'CategoryStub' }
  ]

  inputValidationRules: Function[] = [
    (x: string) => !!x || 'Input can not be empty'
  ]

  @Watch('value')
  onOpen () {
    const category = this.$store.state.category.category
    this.title = category.title
    this.group = category.group
    this.checkboxSections = category.sections
    this.categoryStatus = { name: this.transformCategoryStatus(category.status), value: category.status }
  }

  transformCategoryStatus (status: string) {
    switch(status) {
      case CategoryStatus.finished:
        return 'Complete'
      case CategoryStatus.inProgress:
        return 'Work in progress'
      default:
        return 'Stub'
    }
{'fraction_non_alphanumeric': 0.1257047082127076, 'fraction_numerical': 0.0027426481791863475, 'mean_word_length': 1.7304492512479202, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '360239', 'n_tokens_mistral': 1902, 'n_tokens_neox': 1878, 'n_words': 358}