12 changed files with 155 additions and 380 deletions
@ -1,207 +0,0 @@
@@ -1,207 +0,0 @@
|
||||
<template> |
||||
<v-card> |
||||
<v-card-title> |
||||
Virtual machines |
||||
<v-spacer></v-spacer> |
||||
<v-text-field |
||||
v-model="search" |
||||
append-icon="mdi-magnify" |
||||
label="Search" |
||||
single-line |
||||
hide-details |
||||
/> |
||||
</v-card-title> |
||||
<v-radio-group v-model="formData.profileId"> |
||||
<v-data-table |
||||
multi-sort |
||||
hide-default-footer |
||||
:headers="headers" |
||||
:items="profiles" |
||||
:search="search" |
||||
:custom-filter="customFilter" |
||||
@click:row="navigateToRow" |
||||
> |
||||
<template #item.name="{ item }"> |
||||
{{item.name}} |
||||
</template> |
||||
<template #item.os="{ item }"> |
||||
{{item.os.name}} |
||||
</template> |
||||
<template #item.ram="{ item }"> |
||||
{{item.memory_amount}} x {{item.memory_type.name}} |
||||
</template> |
||||
<template #item.storage="{ item }"> |
||||
{{item.storage_amount}} x {{item.storage_type.name}} |
||||
</template> |
||||
<template #item.actions="{ item }"> |
||||
<v-radio |
||||
:key="item.id" |
||||
:value="item.id" |
||||
/> |
||||
</template> |
||||
</v-data-table> |
||||
</v-radio-group> |
||||
|
||||
<v-autocomplete |
||||
v-model="formData.contributorId" |
||||
:items="study.contributors" |
||||
filled |
||||
chips |
||||
label="Kies researcher" |
||||
item-text="name" |
||||
item-value="id" |
||||
> |
||||
<template #selection="data"> |
||||
<v-chip |
||||
v-bind="data.attrs" |
||||
:input-value="data.selected" |
||||
close |
||||
@click="data.select" |
||||
@click:close="remove(data.item)" |
||||
> |
||||
<v-avatar left> |
||||
<v-img :src="data.item.avatar"></v-img> |
||||
</v-avatar> |
||||
{{ data.item.name }} |
||||
</v-chip> |
||||
</template> |
||||
|
||||
</v-autocomplete> |
||||
|
||||
<v-autocomplete |
||||
v-model="friends" |
||||
:disabled="isUpdating" |
||||
:items="people" |
||||
filled |
||||
chips |
||||
color="blue-grey lighten-2" |
||||
label="Select" |
||||
item-text="name" |
||||
item-value="name" |
||||
multiple |
||||
> |
||||
<template #selection="data"> |
||||
<v-chip |
||||
v-bind="data.attrs" |
||||
:input-value="data.selected" |
||||
close |
||||
@click="data.select" |
||||
@click:close="remove(data.item)" |
||||
> |
||||
<v-avatar left> |
||||
<v-img :src="data.item.avatar"></v-img> |
||||
</v-avatar> |
||||
{{ data.item.name }} |
||||
</v-chip> |
||||
</template> |
||||
<template #item="data"> |
||||
<template v-if="typeof data.item !== 'object'"> |
||||
<v-list-item-content v-text="data.item"></v-list-item-content> |
||||
</template> |
||||
<template v-else> |
||||
<v-list-item-avatar> |
||||
<img :src="data.item.avatar"> |
||||
</v-list-item-avatar> |
||||
<v-list-item-content> |
||||
<v-list-item-title>{{data.item.name}}></v-list-item-title> |
||||
<v-list-item-subtitle>{{data.item.group}}</v-list-item-subtitle> |
||||
</v-list-item-content> |
||||
</template> |
||||
</template> |
||||
</v-autocomplete> |
||||
|
||||
contributorId |
||||
|
||||
CREATE FORM |
||||
kies profile |
||||
kies contributor |
||||
|
||||
</v-card> |
||||
</template> |
||||
|
||||
<script> |
||||
import { mapActions } from 'vuex'; |
||||
import Form from '@/lib/form'; |
||||
|
||||
export default { |
||||
async asyncData({ store, route }) { |
||||
const studyId = route.params.studyId; |
||||
await Promise.all([ |
||||
// TODO vm? |
||||
store.dispatch('virtualmachines/getProfiles'), |
||||
store.dispatch('study/getStudy', {studyId}), |
||||
]) |
||||
return { |
||||
studyId, |
||||
// TODO vm? |
||||
profiles: store.getters['virtualmachines/getProfiles'], |
||||
study: store.getters['study/getActiveStudy'], |
||||
} |
||||
}, |
||||
data ({ $route }) { |
||||
return { |
||||
formData: { |
||||
studyId: $route.params.studyId, |
||||
profileId: null, |
||||
contributorId: null, |
||||
}, |
||||
form: new Form({ |
||||
vm: this, |
||||
// TODO changeme |
||||
action: this['studies/createStudy'], |
||||
schema: { |
||||
type: 'object', |
||||
properties: { |
||||
profileId: { |
||||
type: 'integer', |
||||
}, |
||||
studyId: { |
||||
type: 'integer', |
||||
}, |
||||
contributorId: { |
||||
type: 'integer', |
||||
}, |
||||
}, |
||||
required: ['profileId', 'studyId', 'contributorId', ], |
||||
}, |
||||
onResponse() { |
||||
this.vm.$router.push(this.localePath(`/researchStudies/${$route.params.studyId}/apps/windows-vdi/`)) |
||||
} |
||||
}), |
||||
search: '', |
||||
headers: [ |
||||
{ |
||||
text: 'Name', |
||||
value: 'name', |
||||
}, |
||||
{ |
||||
text: 'RAM', |
||||
value: 'ram' |
||||
}, |
||||
{ |
||||
text: 'Storage', |
||||
value: 'storage' |
||||
}, |
||||
{ |
||||
text: 'Kies configuratie', |
||||
value: 'actions' |
||||
} |
||||
], |
||||
} |
||||
}, |
||||
methods: { |
||||
navigateToRow() {}, |
||||
customFilter(_, search, item) { |
||||
search = search.toString().toLowerCase(); |
||||
return ( |
||||
item.name.toLowerCase().includes(search) |
||||
|| item.name.toLowerCase().includes(search) |
||||
|| item.os.name.toLowerCase().includes(search) |
||||
|| item.memory_amount.toString().includes(search) |
||||
|| item.storage_amount.toString().includes(search) |
||||
) |
||||
}, |
||||
...mapActions(['studies/createStudy']), |
||||
} |
||||
} |
||||
</script> |
Loading…
Reference in new issue