<commit_before><template>
 <v-ons-page> 
  <div v-if="addMode === false">
   <v-ons-card>
    <div>{{thing.name}}</div>
  </v-ons-card>
  </div> 
  <div v-else>
   <v-ons-list>
      <v-ons-list-item v-for="thing in getThingTemplatesList" :key="thing.name"
        modifier="chevron"
        tappable
        @click="addNewThing(thing.name)"
      >
       <div class="left">
         <img src="../../../assets/plugin-running.png" class="template-icon" alt="thing.name">
       </div>
        <div class="center">{{thing.name}}</div>
      </v-ons-list-item>
    </v-ons-list>
  </div>
 </v-ons-page> 
</template>

<script>
  export default {
    props: {
      thing: {},
      addMode: Boolean
    },
    mounted () {
      this.$store.dispatch('getThingTemplatesList')
    },
    computed: {
      getThingTemplatesList: function () {
        return this.$store.state.thingTemplatesList
      }
    },
    methods: {
      addNewThing: function (template) {
        return this.$store.dispatch('addNewThing', template)
      }
    }
}
</script>
<style scoped>
  .template-icon {
      width: 30px;
      margin: 1%;
   } 
</style>
<commit_msg>Some improvements to mobile Thing component<commit_after><template>
 <v-ons-page> 
  <div v-if="addMode === false">
   <v-ons-card>
    <v-ons-list>
      <v-ons-list-item>
        <div class="center">
          <v-ons-select style="width: 40%"
            v-model="selectedSection"
          >
            <option v-for="section in sections" :value="section.value">
              {{ $t(section.text) }}
            </option>
          </v-ons-select>
        </div>
      </v-ons-list-item>
     </v-ons-list>
    </v-ons-card>
   <v-ons-card v-if="selectedSection ==='properties'">
    <v-ons-list>
     <v-ons-list-item>
       <div class="center">
         <label v-if="this.$ons.platform.isIOS()" for="UUID">UUID</label>
         <v-ons-input input-id="UUID" v-model="UUID" placeholder="UUID" float>
         </v-ons-input>
     </div> 
     </v-ons-list-item>
     <v-ons-list-item>
       <div class="center">
         <label v-if="this.$ons.platform.isIOS()" for="Name">Name</label>
         <v-ons-input input-id="Name" v-model="name" placeholder="Name" float>
         </v-ons-input>
       </div> 
     </v-ons-list-item>
     <v-ons-list-item>
       <div class="center">
         <label v-if="this.$ons.platform.isIOS()" for="Description">Description</label> 
         <v-ons-input input-id="Description" v-model="description" placeholder="Description" float>
         </v-ons-input>
       </div>
     </v-ons-list-item>
     <v-ons-list-item>
       <div class="center">
         <label v-if="this.$ons.platform.isIOS()" for="Protocol">Protocol</label> 
         <v-ons-input input-id="Protocol" v-model="protocol" placeholder="Protocol" float>
         </v-ons-input>
       </div>
     </v-ons-list-item>
     <v-ons-list-item>
       <div class="center">
         <label v-if="this.$ons.platform.isIOS()" for="Address">Address</label> 
         <v-ons-input input-id="Address" v-model="address" placeholder="Address" float>
         </v-ons-input>
       </div>
     </v-ons-list-item>
     <v-ons-list-item>
      <v-ons-button modifier="large">{{$t('create_copy')}}</v-ons-button>
     </v-ons-list-item>
     <v-ons-list-item>
      <v-ons-button @click="deleteThing(thing.name, thing.uuid)" modifier="large">{{$t('delete_thing')}}</v-ons-button>   
     </v-ons-list-item>
    </v-ons-list>
   </v-ons-card>
  </div> 
  <div v-else>
   <v-ons-list>
      <v-ons-list-item v-for="thing in getThingTemplatesList" :key="thing.name"
        modifier="chevron"
        tappable
        @click="addNewThing(thing.name)"
      >
       <div class="left">
         <img src="../../../assets/plugin-running.png" class="template-icon" alt="thing.name">
       </div>
        <div class="center">{{thing.name}}</div>
      </v-ons-list-item>
    </v-ons-list>
  </div>
  <v-ons-fab position="bottom right">
        <v-ons-icon icon="md-check"></v-ons-icon>
  </v-ons-fab>
 </v-ons-page> 
</template>

<script>
  export default {
    props: {
      thing: {},
      addMode: Boolean
    },
    data () {
      return {
        sections: [
          { text: 'properties', value: 'properties' },
          { text: 'appearance', value: 'appearance' },
          { text: 'data_source', value: 'data_source' },
          { text: 'actions', value: 'actions' },
          { text: 'control_panel', value: 'control_panel' },
          { text: 'automations', value: 'automations' }
        ],
        selectedSection: 'properties',
        UUID: this.thing.uuid,
        name: this.thing.name,
        description: this.thing.description,
        protocol: this.thing.protocol,
        address: this.thing.address
      }
    },
    mounted () {
      this.$store.dispatch('getThingTemplatesList')
    },
    computed: {
      getThingTemplatesList: function () {
        return this.$store.state.thingTemplatesList
      }
    },
    methods: {
      deleteThing: function (thingName, thingId) {
        const self = this
        this.$ons.notification.confirm({
          title: 'Delete thing',
          message: 'Do you want to delete "' + thingName + "'?",
          buttonLabels: ['Cancel', 'Delete'],
          callback: function (idx) {
            switch (idx) {
              case 0:
                break
              case 1:
                self.$store.dispatch('deleteThing', thingId)
                break
            }
          }
        })
      },
      addNewThing: function (template) {
        return this.$store.dispatch('addNewThing', template)
      }
    }
}
</script>
<style scoped>
  .template-icon {
      width: 30px;
      margin: 1%;
   } 
</style>

{'fraction_non_alphanumeric': 0.18159594901344508, 'fraction_numerical': 0.001746114894360049, 'mean_word_length': 2.035506094329624, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 117, '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': '2880455', 'n_tokens_mistral': 1949, 'n_tokens_neox': 1912, 'n_words': 316}