Skip to content

Commit 7a7eb9a

Browse files
authored
+ options + notes
adding more details about each options + more db + note dark mode
1 parent 29dbef7 commit 7a7eb9a

1 file changed

Lines changed: 109 additions & 8 deletions

File tree

tool/web-app/script.js

Lines changed: 109 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,17 @@ document.querySelectorAll('.info-icon').forEach(icon => {
6060
const themeToggle = document.getElementById('theme-toggle');
6161
themeToggle.addEventListener('click', () => {
6262
document.body.classList.toggle('dark-mode');
63-
themeToggle.textContent = document.body.classList.contains('dark-mode') ? '☀️' : '🌙';
63+
const isDark = document.body.classList.contains('dark-mode');
64+
themeToggle.textContent = isDark ? '☀️' : '🌙';
65+
// Add a note indicating which mode is being switched to
66+
let note = document.getElementById('theme-note');
67+
if (!note) {
68+
note = document.createElement('div');
69+
note.id = 'theme-note';
70+
note.style.marginTop = '8px';
71+
themeToggle.parentNode.appendChild(note);
72+
}
73+
note.textContent = isDark ? 'Switched to dark mode. Click to change to light mode.' : 'Switched to light mode. Click to change to dark mode.';
6474
});
6575

6676
// --- Preset use case autofill ---
@@ -127,22 +137,113 @@ document.getElementById('advisor-form').addEventListener('submit', async (event)
127137
// Simulate backend call (replace with real fetch in production)
128138
// const response = await fetch('http://your-backend-url/recommend', { ... });
129139
// const result = await response.json();
130-
// For demo, use hardcoded logic:
140+
// Expanded logic for more Azure database options with richer justifications:
131141
let recommendation = 'Azure SQL Database';
132-
let justification = 'Recommended for structured data, strong consistency, and moderate query complexity.';
142+
let justification = 'If you are building modern cloud applications that require high availability, scalability, and minimal maintenance, Azure SQL Database (PaaS) is a strong choice. It’s fully managed and ideal for apps needing relational data with features like automatic tuning and built-in AI.';
133143
let confidence = 85;
144+
134145
if (data.data_type === 'semi-structured' || data.data_type === 'unstructured') {
135-
recommendation = 'Azure Cosmos DB';
136-
justification = 'Cosmos DB supports semi-structured/unstructured data, global scaling, and low-latency.';
137-
confidence = 92;
146+
if (data.use_case === 'AI/ML') {
147+
recommendation = 'Azure Databricks or Cosmos DB';
148+
justification = 'Azure Databricks is ideal for scalable AI/ML workloads and big data processing. Cosmos DB supports semi-structured/unstructured data, global scaling, and low-latency, making it suitable for IoT, gaming, and retail apps.';
149+
confidence = 85;
150+
} else if (data.use_case === 'OLAP') {
151+
recommendation = 'Azure Synapse Analytics or Cosmos DB';
152+
justification = 'Azure Synapse Analytics is best for analytical workloads and complex queries on large datasets. Cosmos DB is suitable for globally distributed, low-latency NoSQL workloads, supporting multiple APIs and millisecond response times.';
153+
confidence = 88;
154+
} else if (data.data_type === 'semi-structured') {
155+
recommendation = 'Azure Cosmos DB';
156+
justification = 'Cosmos DB supports semi-structured data (JSON, etc.), offers global distribution, multi-model support, and low-latency access. It is unmatched for globally distributed, low-latency NoSQL workloads.';
157+
confidence = 92;
158+
} else {
159+
recommendation = 'Azure Data Lake or Cosmos DB';
160+
justification = 'For unstructured data, Azure Data Lake provides scalable storage and analytics, while Cosmos DB supports unstructured data with global distribution and elastic scaling.';
161+
confidence = 80;
162+
}
138163
} else if (data.use_case === 'OLAP') {
139164
recommendation = 'Azure Synapse Analytics';
140-
justification = 'Best for analytical workloads and complex queries on large datasets.';
165+
justification = 'Best for analytical workloads, data warehousing, and complex queries on large, structured datasets. It integrates with other Azure services for advanced analytics and big data.';
141166
confidence = 90;
142167
} else if (data.use_case === 'AI/ML') {
143168
recommendation = 'Azure Databricks or Cosmos DB';
144-
justification = 'Supports AI/ML workloads and scalable data processing.';
169+
justification = 'Azure Databricks is optimized for AI/ML and big data analytics, supporting collaborative data science and advanced analytics. Cosmos DB can be used for storing and serving large, diverse datasets with global distribution.';
145170
confidence = 80;
171+
} else if (data.use_case === 'cache' || (data.query_complexity === 'simple' && data.latency === '<10ms')) {
172+
recommendation = 'Azure Cache for Redis';
173+
justification = 'Azure Cache for Redis is perfect for caching, session storage, and real-time analytics, boosting performance for high-throughput applications with sub-millisecond latency.';
174+
confidence = 90;
175+
} else if (data.data_type === 'structured') {
176+
if (data.consistency === 'strong' && data.scalability === 'global') {
177+
recommendation = 'Azure Cosmos DB';
178+
justification = 'Cosmos DB offers strong consistency, global distribution, and is suitable for mission-critical applications needing millisecond response times and elastic scaling.';
179+
confidence = 88;
180+
} else if (data.use_case === 'OLTP' && data.budget && data.budget.includes('100-500')) {
181+
recommendation = 'Azure SQL Database';
182+
justification = 'Azure SQL Database is a fully managed PaaS for modern cloud apps needing high availability, scalability, and security for relational data. Features include automatic tuning and built-in AI.';
183+
confidence = 87;
184+
} else if (data.use_case === 'OLTP' && data.integration_needs === 'yes' && data.backup_recovery === 'yes') {
185+
recommendation = 'Azure SQL Managed Instance';
186+
justification = 'Managed Instance is ideal for organizations migrating from on-prem SQL Server with minimal changes, offering near 100% compatibility and built-in backup, integration, and security features.';
187+
confidence = 85;
188+
} else if (data.use_case === 'OLTP' && data.security === 'compliance') {
189+
recommendation = 'Azure Database for PostgreSQL';
190+
justification = 'Azure Database for PostgreSQL (PaaS) is excellent for AI-ready, mission-critical apps with support for vector search, PostgreSQL extensions, and advanced analytics.';
191+
confidence = 83;
192+
} else if (data.use_case === 'OLTP' && data.security === 'encryption') {
193+
recommendation = 'Azure Database for MySQL';
194+
justification = 'Azure Database for MySQL (PaaS) is ideal for web apps like WordPress or Magento, offering high availability, seamless scaling, and built-in encryption.';
195+
confidence = 83;
196+
} else if (data.use_case === 'OLTP' && data.data_retention === 'long-term') {
197+
recommendation = 'SQL Server on Azure Virtual Machines';
198+
justification = 'SQL Server on Azure VMs (IaaS) is best for legacy apps and custom configurations, providing full control over the OS and SQL Server features.';
199+
confidence = 80;
200+
} else if (data.use_case === 'OLTP' && data.security === 'rbac') {
201+
recommendation = 'Azure SQL Managed Instance';
202+
justification = 'Managed Instance supports advanced security features including RBAC, and is suitable for enterprise workloads needing high compatibility and managed operations.';
203+
confidence = 82;
204+
} else if (data.use_case === 'OLTP' && data.data_retention === 'short-term') {
205+
recommendation = 'Azure SQL Database';
206+
justification = 'Azure SQL Database is cost-effective for short-term, high-availability OLTP workloads, with minimal maintenance and built-in intelligence.';
207+
confidence = 80;
208+
} else if (data.use_case === 'OLTP' && data.budget && data.budget.includes('>500')) {
209+
recommendation = 'SQL Server 2022 (IaaS)';
210+
justification = 'SQL Server 2022 on Azure VMs is the most Azure-integrated version yet, offering data virtualization, enhanced security, and hybrid cloud support for enterprises needing advanced analytics and cloud connectivity.';
211+
confidence = 80;
212+
} else if (data.use_case === 'OLTP' && data.security === 'compliance' && data.integration_needs === 'yes') {
213+
recommendation = 'Oracle Database on Azure (IaaS)';
214+
justification = 'Oracle Database on Azure provides a familiar environment for Oracle workloads, with low-latency access and integration with Azure services.';
215+
confidence = 78;
216+
} else {
217+
recommendation = 'Azure SQL Database';
218+
justification = 'Azure SQL Database is a general-purpose, fully managed relational database for most structured OLTP workloads, with high availability and built-in AI.';
219+
confidence = 85;
220+
}
221+
} else if (data.data_type === 'nosql' || data.use_case === 'NoSQL') {
222+
if (data.consistency === 'eventual' && data.scalability === 'global') {
223+
recommendation = 'Azure Cosmos DB';
224+
justification = 'Cosmos DB is a globally distributed, multi-model NoSQL database with tunable consistency, high throughput, and millisecond response times.';
225+
confidence = 90;
226+
} else if (data.use_case === 'OLTP' && data.integration_needs === 'yes') {
227+
recommendation = 'Azure Managed Instance for Apache Cassandra';
228+
justification = 'Azure Managed Instance for Apache Cassandra (PaaS) simplifies operations for Cassandra workloads with automated scaling and hybrid deployment support.';
229+
confidence = 85;
230+
} else if (data.use_case === 'OLTP' && data.data_type === 'semi-structured') {
231+
recommendation = 'Azure Cosmos DB for MongoDB';
232+
justification = 'Cosmos DB for MongoDB provides MongoDB API compatibility, global distribution, and managed service, adding elastic scaling and low-latency.';
233+
confidence = 85;
234+
} else if (data.use_case === 'OLTP' && data.data_type === 'semi-structured' && data.budget && data.budget.includes('>500')) {
235+
recommendation = 'MongoDB Atlas on Azure (SaaS)';
236+
justification = 'MongoDB Atlas on Azure is a fully managed SaaS offering with advanced features and integrations, providing a familiar MongoDB experience and multi-cloud flexibility.';
237+
confidence = 80;
238+
} else {
239+
recommendation = 'Azure Cosmos DB';
240+
justification = 'Cosmos DB is a flexible, fully managed NoSQL database for a wide range of NoSQL workloads, supporting multiple APIs and global distribution.';
241+
confidence = 85;
242+
}
243+
} else if (data.use_case === 'cache') {
244+
recommendation = 'Azure Cache for Redis';
245+
justification = 'Azure Cache for Redis is perfect for caching, session storage, and real-time analytics, boosting performance for high-throughput applications.';
246+
confidence = 90;
146247
}
147248
// Show result
148249
document.getElementById('recommendation-result').innerHTML = `

0 commit comments

Comments
 (0)