improve_layout + debug_modal

This commit is contained in:
paola.trabucco
2024-08-02 18:54:40 +02:00
parent ac588462d6
commit 2f3652f4a9
6 changed files with 720 additions and 118 deletions

View File

@@ -1,5 +1,10 @@
<template>
<div v-if="loading">Loading...</div>
<div>
<h1>Available Scenarios</h1>
</div>
<div v-if="loading" class="flex justify-center">
<ProgressSpinner style="width: 50px; height: 50px; margin-top: 50px" strokeWidth="3" fill="transparent"/>
</div>
<div v-else>
<DataView :value="scenarios" :layout="layout" paginator :rows="5">
<template #header>
@@ -13,40 +18,37 @@
</template>
<template #list="slotProps">
<div class="flex flex-col">
<div class="flex flex-col space-y-4 mt-2">
<div v-for="(item, index) in slotProps.items" :key="index">
<div class="flex flex-col sm:flex-row sm:items-center p-6 gap-4" :class="{ 'border-t border-surface-200 dark:border-surface-700': index !== 0 }">
<div class="flex flex-col md:flex-row justify-between md:items-center flex-1 gap-6">
<div class="flex flex-row md:flex-col justify-between items-start gap-2">
<div>
<div class="text-lg font-medium mt-2">{{ item.name }}</div>
<span class="font-medium text-surface-500 dark:text-surface-400 text-sm">{{ item.description }}</span>
</div>
<div class="flex flex-col sm:flex-row sm:items-center p-6 gap-4 bg-white dark:bg-gray-800 rounded-lg shadow-md"
:class="{ 'border-t border-gray-200 dark:border-gray-700': index !== 0 }">
<div class="flex flex-col flex-grow">
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ item.name }}</h3>
<p class="text-sm font-medium text-gray-500 dark:text-gray-400 mt-2">{{ item.description }}</p>
</div>
<div class="flex flex-col md:items-end gap-8">
<div class="flex flex-row-reverse md:flex-row gap-2">
<Button @click="executeScenario(item.id)" label="Load" class="flex-auto md:flex-initial whitespace-nowrap"></Button>
</div>
<div class="mt-auto flex justify-end">
<Button @click="executeScenario(item.id)" label="Load" class="flex-auto md:flex-initial text-white">
<ChevronRightIcon class="w-5 h-10 text-white transition-transform transform hover:translate-x-1"/>
</Button>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<template #grid="slotProps">
<div class="grid grid-cols-12 gap-4">
<div v-for="(item, index) in slotProps.items" :key="index" class="col-span-12 sm:col-span-6 md:col-span-4 xl:col-span-6 p-2">
<div class="p-6 border border-surface-200 dark:border-surface-700 bg-surface-0 dark:bg-surface-900 rounded flex flex-col">
<div class="text-lg font-medium mt-2">{{ item.name }}</div>
<span class="font-medium text-surface-500 dark:text-surface-400 text-sm">{{ item.description }}</span>
<div class="pt-6">
<div class="flex flex-col gap-6 mt-6">
<div class="flex gap-2">
<Button @click="executeScenario(item.id)" label="Load" class="flex-auto whitespace-nowrap"></Button>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4 mt-2">
<div v-for="(item, index) in slotProps.items" :key="index" class="p-2">
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md flex flex-col h-full">
<div class="p-4 flex flex-col flex-grow">
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">{{ item.name }}</h3>
<p class="text-sm font-medium text-gray-500 dark:text-gray-400 mt-2">{{ item.description }}</p>
</div>
<div class="p-2 border-t border-gray-200 dark:border-gray-700 flex justify-end">
<Button @click="executeScenario(item.id)" size="small" label="Load" class="flex-auto md:flex-initial text-white">
<ChevronRightIcon class="w-6 h-5 text-white transition-transform transform hover:translate-x-1"/>
</Button>
</div>
</div>
</div>
@@ -57,17 +59,19 @@
</template>
<script setup>
import { ChevronRightIcon } from '@heroicons/vue/24/solid';
import DataView from 'primevue/dataview';
import ProgressSpinner from 'primevue/progressspinner';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { ScenarioService } from '../../service/ScenarioService.js';
const router = useRouter()
const layout = ref('grid');
const options = ref(['list', 'grid']);
const scenarios = ref([])
const loading = ref(false)
const loading = ref(true)
onMounted(() => {
@@ -85,3 +89,5 @@ import { ScenarioService } from '../../service/ScenarioService.js';
router.push({ name: 'scenario-exec', params: { id: id } });
}
</script>
<style scoped></style>