Here's a beautifully designed Vue app that replicates your PowerShell script's functionality with modern styling, input validation, and real-time feedback. The UI is clean, responsive, and user-friendly, using only Vue and plain CSS (no external libraries).
✅ Features:
- Dynamic URL encoding (like PowerShell)
- Form validation
- Loading animation
- JSON result preview
- Error handling with detailed messages
- Responsive layout
- Modern card-style design
📁 Project Structure:
/vue-descriptive-app/
├── index.html
├── main.js
├── App.vue
🔧 index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Descriptive Analytics</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
<style>
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
</style>
</head>
<body>
<div id="app"></div>
</body>
</html>
🧩 main.js
import Vue from 'vue'
import App from './App.vue'
new Vue({
render: h => h(App)
}).$mount('#app')
🎨 App.vue
<template>
<div class="container">
<div class="card">
<h2>📊 Descriptive Analytics</h2>
<!-- Form Inputs -->
<form @submit.prevent="submitForm" class="form">
<label>
Dataset Path
<input type="text" v-model="datasetPath" placeholder="e.g. G:\data\products.csv" required />
</label>
<label>
Column
<input type="text" v-model="column" placeholder="e.g. Price" required />
</label>
<button type="submit" :disabled="loading" class="btn">
<span v-if="!loading">Submit</span>
<span v-else class="spinner">Loading...</span>
</button>
</form>
<!-- Query Preview -->
<div v-if="fullUrl" class="url-preview">
🌐 Querying: <code>{{ fullUrl }}</code>
</div>
<!-- Loading State -->
<div v-if="loading" class="loading">⏳ Fetching data...</div>
<!-- Error Message -->
<div v-if="error" class="error">
❌ {{ error }}
</div>
<!-- JSON Response -->
<div v-if="response" class="response">
<h3>✅ Result Preview:</h3>
<pre>{{ formattedResponse }}</pre>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
datasetPath: 'G:\\projects\\uv_rup99\\handyscripts\\products-100.csv',
column: 'Price',
apiBase: 'http://localhost:8080/descriptive',
loading: false,
error: null,
response: null
}
},
computed: {
fullUrl() {
return `${this.apiBase}?datasetPath=${encodeURIComponent(this.datasetPath)}&column=${encodeURIComponent(this.column)}`
},
formattedResponse() {
return JSON.stringify(this.response, null, 2)
}
},
methods: {
async submitForm() {
this.loading = true
this.error = null
this.response = null
try {
const res = await fetch(this.fullUrl)
if (!res.ok) throw new Error(`HTTP error! Status: ${res.status}`)
this.response = await res.json()
} catch (err) {
this.error = `Request failed: ${err.message}`
if (err.response?.data) {
this.error += `\n${err.response.data}`
}
} finally {
this.loading = false
}
}
}
}
</script>
<style scoped>
.container {
display: flex;
justify-content: center;
padding: 2rem;
}
.card {
background: white;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
padding: 2rem;
max-width: 600px;
width: 100%;
}
.form {
display: flex;
flex-direction: column;
gap: 1rem;
margin-bottom: 1.5rem;
}
label {
font-weight: 600;
}
input {
padding: 0.75rem;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 1rem;
}
.btn {
padding: 0.75rem;
background: #42b983;
color: white;
font-weight: 600;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background 0.3s;
}
.btn:hover:not(:disabled) {
background: #369f6e;
}
.btn:disabled {
background: #aaa;
cursor: not-allowed;
}
.spinner::after {
content: "🌀";
margin-left: 8px;
}
.url-preview {
font-size: 0.9rem;
margin-bottom: 1rem;
color: #555;
}
.loading {
color: #42b983;
margin-bottom: 1rem;
}
.error {
color: #e74c3c;
white-space: pre-wrap;
}
.response {
background: #f8f8f8;
padding: 1rem;
border-radius: 8px;
overflow-x: auto;
}
pre {
margin: 0;
font-size: 0.9rem;
}
</style>