Browse Source

Updates

master
Joshua Rubingh 6 months ago
parent
commit
13c989137d
  1. 43
      pages/researchStudies/_studyId/apps/index.vue
  2. 0
      pages/researchStudies/_studyId/apps/windows-vdi/create.vue
  3. 9
      pages/researchStudies/_studyId/apps/windows-vdi/index.vue
  4. 6
      pages/researchStudies/_studyId/index.vue
  5. 110
      store/apps.js
  6. 27
      store/virtualmachines.js

43
pages/researchStudies/_studyId/apps/index.vue

@ -10,50 +10,7 @@ @@ -10,50 +10,7 @@
<script>
/*
export default {
async asyncData({ store, route }) {
const studyId = route.params.studyId
await Promise.all([
store.dispatch('studies/getStudy', { studyId }),
store.dispatch('studies/getStudyFields'),
store.dispatch('apps/getApps'),
])
return {
study: store.getters['studies/getActiveStudy'],
studyFields: store.getters['studies/getStudyFields'],
apps: store.getters['apps/getAppsForStudy'](studyId),
studyId,
}
},
head() {
const $t = this.$t.bind(this)
return {
title: $t('page.researchStudies.studyId.index.title', {
study_name: this.study.name,
}),
}
},
}
*/
export default {
/*
async asyncData({ store, route }) {
const studyId = route.params.studyId;
await store.dispatch('apps/getApps');
return {
studyId,
apps: store.getters['apps/getApps'],
}
// return {
// // apps: store.getters['apps/getAppsForStudy'](studyId),
// studyId,
// };
},
}
*/
async asyncData({ store, route }) {
const studyId = route.params.studyId
await Promise.all([

0
pages/researchStudies/_studyId/apps/windows10-vdi/create.vue → pages/researchStudies/_studyId/apps/windows-vdi/create.vue

9
pages/researchStudies/_studyId/apps/windows10-vdi/index.vue → pages/researchStudies/_studyId/apps/windows-vdi/index.vue

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
{{ item.os }}
</template>
<template #item.memory="{ item }">
{{ item.title }}
{{ item.memory }}
</template>
<template #item.disk="{ item }">
{{ item.disk }}
@ -45,15 +45,20 @@ @@ -45,15 +45,20 @@
/* import { mapActions } from 'vuex' */
import Form from '@/lib/form'
/* TODO: Make this function system wide available in a general include ?? https://stackoverflow.com/a/55641743 */
const trim = (str, chars) => str.split(chars).filter(Boolean).join(chars)
export default {
async asyncData({ store, route }) {
const studyId = route.params.studyId
const appType = trim(route.path, '/').split('/').pop()
await Promise.all([
store.dispatch('studies/getStudy', { studyId }),
store.dispatch({
type: 'apps/getAppTypeProfiles',
studyId: studyId.toString(),
appType: 'windows10-vdi',
appType: appType.toString(),
}),
])

6
pages/researchStudies/_studyId/index.vue

@ -60,13 +60,11 @@ export default { @@ -60,13 +60,11 @@ export default {
const studyId = route.params.studyId
await Promise.all([
store.dispatch('studies/getStudy', { studyId }),
store.dispatch('studies/getStudyFields'),
store.dispatch('apps/getAvailableAppTypes', { studyId }),
store.dispatch('apps/getMyStudyApps', { studyId }),
])
return {
study: store.getters['studies/getActiveStudy'],
studyFields: store.getters['studies/getStudyFields'],
apps: store.getters['apps/getAvailableAppTypes'],
apps: store.getters['apps/getMyStudyApps'],
studyId,
}
},

110
store/apps.js

@ -2,14 +2,7 @@ import { actionCreator } from '@/lib/store'; @@ -2,14 +2,7 @@ import { actionCreator } from '@/lib/store';
export const state = () => ({
apps: [],
/*
appTypeMap: {
WINDOWS_10_WORKSPACE: {
component: 'windows-10-workspace',
slug: 'windows-vdi',
},
},
*/
app_profiles: [],
})
export const actions = {
@ -20,13 +13,21 @@ export const actions = { @@ -20,13 +13,21 @@ export const actions = {
},
}),
getStudyApps: actionCreator({
name: 'getStudyApps',
method({ studyId, appType }) {
return this.$axios.get(`/api/v1/studies/${studyId}/app-types/${appType}/`)
},
getMyStudyApps: actionCreator({
name: 'getMyStudyApps',
method({ studyId }) {
return this.$axios.get(`/api/v1/studies/${studyId}/apps/me/`)
}
}),
/*
getStudyApps: actionCreator({
name: 'getStudyApps',
method({ studyId, appType }) {
return this.$axios.get(`/api/v1/studies/${studyId}/app-types/${appType}/`)
},
}),
*/
getAppTypeProfiles: actionCreator({
name: 'getAppTypeProfiles',
method(data) {
@ -34,24 +35,7 @@ export const actions = { @@ -34,24 +35,7 @@ export const actions = {
}
}),
/*
getAppsTest: actionCreator({
name: 'getAppsTest',
method() {
return Promise.resolve({
data: [
{
id: 1,
name: 'Windows 10 workspace',
description: 'Windows VDI',
avatar: 'https://banner2.cleanpng.com/20180328/skq/kisspng-logo-windows-8-windows-7-microsoft-8-5abc1c77a59fe7.0872489215222774956784.jpg',
type: 'WINDOWS_10_WORKSPACE',
}
]
})
}
}),
*/
}
export const mutations = {
@ -69,8 +53,8 @@ export const mutations = { @@ -69,8 +53,8 @@ export const mutations = {
})
},
getStudyAppsSuccess(state, { result }) {
state.apps = result.map((app) => {
getMyStudyAppsSuccess(state, { result }) {
state.study_apps = result.map((app) => {
return {
id: app.id,
src: app.avatar,
@ -78,9 +62,9 @@ export const mutations = { @@ -78,9 +62,9 @@ export const mutations = {
login: app.login_url
}
})
},
getAppTypeProfilesSuccess(state, { result }) {
state.app_profiles = result.map((profile) => {
return {
@ -98,64 +82,18 @@ export const getters = { @@ -98,64 +82,18 @@ export const getters = {
getAvailableAppTypes(state) {
return state.apps;
},
getMyStudyApps(state) {
console.log('getMyStudyApps', state.study_apps)
return state.study_apps;
},
getAppsForStudy: state => studyId => {
// studyId = parseInt(studyId, 10);
// return state.apps.filter(app => app.study.id === studyId)
return []
},
getAppTypeProfiles(state) {
console.log(state.app_profiles)
return state.app_profiles;
},
}
/*
export const state = () => ({
appTypeMap: {
WINDOWS_10_WORKSPACE: {
component: 'windows-10-workspace',
slug: 'windows-vdi',
},
},
apps: [],
})
export const actions = {
getApps: actionCreator({
name: 'getApps',
method() {
return Promise.resolve({data: [
{
id: 1,
name: 'Windows 10 workspace',
description: 'Windows VDI',
avatar: 'https://banner2.cleanpng.com/20180328/skq/kisspng-logo-windows-8-windows-7-microsoft-8-5abc1c77a59fe7.0872489215222774956784.jpg',
type: 'WINDOWS_10_WORKSPACE',
}
]})
}
}),
}
export const mutations = {
getAppsSuccess(state, {result}) {
state.apps = result.map(mappers.addComponentToApp(state))
},
}
export const getters = {
getApps: state => {
return state.apps;
},
getAppsForStudy: state => studyId => {
// studyId = parseInt(studyId, 10);
// return state.apps.filter(app => app.study.id === studyId)
return []
},
}
export const mappers = {Profiles
}
}
*/

27
store/virtualmachines.js

@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
import { actionCreator } from '@/lib/store';
export const state = () => ({
profiles: []
})
export const actions = {
getProfiles: actionCreator({
name: 'getProfiles',
method() {
return this.$axios.get(`/api/v1/virtualmachines/profiles/`)
}
}),
}
export const mutations = {
getProfilesSuccess(state, {result}) {
state.profiles = result
},
}
export const getters = {
getProfiles: state => {
return state.profiles;
},
}
Loading…
Cancel
Save