summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/GroupModuleClientList.vue
blob: 20ae33292cdac2f231dc71771bb6a6c96535e82f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<i18n>
{
  "en": {
  },
  "de": {
  }
}
</i18n>

<template>
  <div>
    <v-card>
      <v-data-table stlye="width: 100px"
        :headers="headers"
        :items="clients"
        item-key="id"
        hide-actions
        select-all
        v-model="selected"
      >
        <template slot="items" slot-scope="props">
          <tr @click="loadClient(props.item.id)">
            <td class="narrow-td">
              <v-checkbox
                color="primary"
                v-model="props.selected"
                hide-details
                @click.native.stop
              ></v-checkbox>
            </td>
            <td class="narrow-td">{{ props.item.id }}</td>
            <td>{{ props.item.name }}</td>
            <td>{{ props.item.ip }}</td>
            <td>{{ props.item.mac }}</td>
            <td>{{ props.item.uuid }}</td>
            <td class="narrow-td">
              <v-btn class="next-arrow" icon><v-icon>keyboard_arrow_right</v-icon></v-btn>
            </td>
          </tr>
        </template>
      </v-data-table>
    </v-card>
    <div v-if="tabIndex > 0" class="text-xs-right">
      <v-btn flat color="error"><v-icon left>remove_circle_outline</v-icon>Remove selected clients</v-btn>
      <v-btn flat color="success"><v-icon left>add_circle_outline</v-icon>Add clients</v-btn>
    </div>
    <div v-else class="text-xs-right">
      <v-btn flat color="error"><v-icon left>delete</v-icon>Delete selected clients</v-btn>
      <v-btn flat color="success"><v-icon left>create</v-icon>Create client</v-btn>
    </div>
  </div>
</template>

<script>
export default {
  name: 'GroupModuleClientList',
  props: ['tabIndex', 'clients'],
  data () {
    return {
      headers: [
        { text: 'ID', value: 'id' },
        { text: 'Name', value: 'name' },
        { text: 'IP Address', value: 'ip' },
        { text: 'MAC Address', value: 'mac' },
        { text: 'UUID', value: 'uuid' },
        { sortable: false }
      ],
      selected: []
    }
  },
  methods: {
    loadClient (id) {
      this.$store.dispatch('groups/loadClient', { id, tabIndex: this.tabIndex + 1, switchTab: true })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.narrow-td {
  width: 10px;
}

.next-arrow {
  margin-left: 20px;
  margin-right: -10px;
}
</style>