Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #403 from OBDDimal/394-display-uploaded-models-doe…
Browse files Browse the repository at this point in the history
…s-not-work-for-vue3

394 display uploaded models does not work for vue3
  • Loading branch information
MeisterSeSe authored Sep 15, 2023
2 parents bbd4b4b + d91e442 commit 345a83b
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 140 deletions.
168 changes: 79 additions & 89 deletions frontendVue3/src/components/FeatureModelTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,65 +31,67 @@
density="comfortable"
>
</v-text-field>
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-btn
id="feature-model-upload"
v-if="addable"
class="mb-2 ml-4"
color="primary"
variant="tonal"
size="small"
icon="mdi-upload"
v-bind="props"
@click="createDialog = true"
>
</v-btn>
</template>
<span>Upload feature model</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn
id="feature-model-create"
v-if="addable"
class="mb-2 ml-2"
color="success"
variant="tonal"
size="small"
icon="mdi-plus"
v-bind="attrs"
v-on="on"
to="/feature-model/new"
>
</v-btn>
</template>
<span>Create feature model</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn
id="feature-model-ls"
v-if="addable"
:disabled="!checkLocalStorage"
class="mb-2 ml-2"
color="secondary"
variant="tonal"
size="small"
icon="mdi-server"
v-bind="attrs"
v-on="on"
to="/feature-model/local"
>
</v-btn>
</template>
<span>Upload from local storage</span>
</v-tooltip>
<v-tooltip location='top'>
<template v-slot:activator='{ props }'>
<v-btn
id='feature-model-upload'
v-if='addable'
class='mb-2 ml-4'
color='primary'
variant='tonal'
size='small'
icon='mdi-upload'
v-bind='props'
@click='createDialog = true'
>
</v-btn>
</template>
<span>Upload feature model</span>
</v-tooltip>

<v-tooltip location='top'>
<template v-slot:activator='{ props }'>
<v-btn
id='feature-model-create'
v-if='addable'
class='mb-2 ml-2'
color='success'
variant='tonal'
size='small'
icon='mdi-plus'
v-bind='props'
v-on='on'
to='/feature-model/new'
>
</v-btn>
</template>
<span>Create feature model</span>
</v-tooltip>

<v-tooltip location='top'>
<template v-slot:activator='{ props }'>
<v-btn
id='feature-model-ls'
v-if='addable'
:disabled='!checkLocalStorage'
class='mb-2 ml-2'
color='secondary'
variant='tonal'
size='small'
icon='mdi-server'
v-bind='props'
v-on='on'
to='/feature-model/local'
>
</v-btn>
</template>
<span>Upload from local storage</span>
</v-tooltip>
<v-dialog v-model="dialogDelete" max-width="400px">
<v-card>
<v-card-title
class="text-h5"
style="word-break: break-word"
style="white-space: normal;"
>
Are you sure you want to delete this feature
model?
Expand Down Expand Up @@ -156,6 +158,7 @@
variant="tonal"
size="small"
icon="mdi-play"
@click="handleClick(item.raw)"
>
</v-btn>
<v-btn
Expand All @@ -174,7 +177,7 @@
variant="tonal"
icon="mdi-eye"
size="small"
:to="'/feature-model/' + item.id"
:to="'/feature-model/' + item.raw.id"
>
</v-btn>
<!-- <v-btn small rounded color="error" class="mr-2"> <v-icon>mdi-delete</v-icon></v-btn> -->
Expand Down Expand Up @@ -228,12 +231,13 @@

<script setup>
import FileCreate from '@/components/upload_cards/FileCreate.vue';
import { useAuthStore } from '@/store/auth';
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useFileStore } from '@/store/file';
const emit = defineEmits(['onDelete']);
const router = useRouter();
const authStore = useAuthStore();
const fileStore = useFileStore();
const props = defineProps({
headline: {
Expand Down Expand Up @@ -283,47 +287,34 @@ const headers = [
sortable: false,
},
];
const search = '';
const removeLoading = false;
const dialog = false;
const search = ref('');
const removeLoading = ref(false);
const createDialog = ref(false);
const dialogDelete = false;
const dialogAnalysis = false;
const dialogDelete = ref(false);
const editedItem = ref(null);
const defaultItem = ref(undefined);
const checkLocalStorage = computed(() => {
return !!localStorage.featureModelData;
});
async function deleteItemConfirm() {
this.removeLoading = true;
/*await this.$store.dispatch(
'deleteFeatureModel',
this.editedItem.id
);
await this.$store.dispatch('fetchFiles');
this.$emit('onDelete');*/
this.removeLoading = false;
removeLoading.value = true;
await fileStore.deleteFeatureModel(
editedItem.value.id
);
await fileStore.fetchConfirmedFeatureModels();
emit('onDelete');
removeLoading.value = false;
this.closeDelete();
}
function close() {
this.dialog = false;
/*this.$nextTick(() => {
this.editedItem = Object.assign({}, this.defaultItem);
this.editedIndex = -1;
});*/
closeDelete();
}
function closeDelete() {
this.dialogDelete = false;
/*this.$nextTick(() => {
this.editedItem = Object.assign({}, this.defaultItem);
this.editedIndex = -1;
});*/
dialogDelete.value = false;
editedItem.value = { ...defaultItem };
}
function deleteItem(item) {
this.editedIndex = this.items.indexOf(item);
this.editedItem = Object.assign({}, item);
this.dialogDelete = true;
editedItem.value = { ...item.raw };
dialogDelete.value = true;
}
function handleClick(value) {
console.log(value);
Expand All @@ -332,7 +323,6 @@ function handleClick(value) {
params: { id: value.id, slug: value.slug },
});
}
function setHovered() {}
</script>

<style>
Expand Down
3 changes: 2 additions & 1 deletion frontendVue3/src/store/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const useFileStore = defineStore('file', {
},
actions: {
fetchConfirmedFeatureModels() {
api.get(`${API_URL}files/uploaded/confirmed/`).then((response) => {
//api.get(`${API_URL}files/uploaded/confirmed/`).then((response) => {
api.get(`${API_URL}files/`).then((response) => {
this.confirmedFeatureModels = response.data;
console.log(response.data[0]);
});
Expand Down
4 changes: 2 additions & 2 deletions frontendVue3/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<script setup>
import FeatureModelTable from '@/components/FeatureModelTable.vue';
import { onMounted } from 'vue';
import { onMounted, ref } from 'vue';
import { storeToRefs } from 'pinia';
import { useFileStore } from '@/store/file';
Expand Down Expand Up @@ -83,7 +83,7 @@ const tags = [];
const check1 = false;
const check2 = false;
const check3 = false;
const loading = true;
const loading = ref(false);
const info = '';
const showTutorial = false;
const tutorialSteps = [
Expand Down
53 changes: 5 additions & 48 deletions frontendVue3/src/views/Models.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<script setup>
import FeatureModelTable from '@/components/FeatureModelTable.vue';
import { onMounted } from 'vue';
import { onMounted, ref } from 'vue';
import { storeToRefs } from 'pinia';
import { useFileStore } from '@/store/file';
import { useAppStore } from '@/store/app';
Expand All @@ -54,52 +54,9 @@ const appStore = useAppStore();
const { confirmedFeatureModels } = storeToRefs(useFileStore());
const fileStore = useFileStore();
const search = '';
const dialog = false;
const createDialog = false;
const editedIndex = -1;
const headers = [
{
text: 'ID',
align: 'start',
sortable: false,
value: 'id',
},
{ text: 'Label', value: 'label' },
{ text: 'Description', value: 'description' },
{ text: 'License', value: 'license' },
{ text: 'Tags', value: 'tags' },
{ text: 'Uploaded on', value: 'uploaded' },
{
text: 'Actions',
align: 'center',
value: 'actions',
sortable: false,
},
];
const editedItem = {
label: '',
description: '',
license: 'CC-BY Mention',
tags: null,
uploaded: 'Today',
};
const defaultItem = {
label: '',
description: '',
license: 'CC-BY Mention',
tags: null,
uploaded: 'Today',
};
const licenses = [];
const families = [];
const tags = [];
const check1 = false;
const check2 = false;
const check3 = false;
const loading = true;
const info = '';
const showTutorial = false;
const loading = ref(false);
/*const showTutorial = false;
const tutorialSteps = [
{
title: 'Welcome to the tutorial!',
Expand Down Expand Up @@ -137,7 +94,7 @@ const tutorialSteps = [
'If there is a feature model in the local storage, you can view it by clicking this button.',
elementCssSelector: '#feature-model-ls',
},
];
];*/
onMounted(() => {
fileStore.fetchConfirmedFeatureModels();
Expand Down

0 comments on commit 345a83b

Please sign in to comment.