Skip to content

Commit

Permalink
move debug to saved costs tips
Browse files Browse the repository at this point in the history
  • Loading branch information
timkoopmans committed Feb 3, 2025
1 parent fa32df0 commit 6b136ca
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 24 deletions.
1 change: 0 additions & 1 deletion dist/assets/index-C4_nV1QP.css

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/index-UnL-7Xdd.js

This file was deleted.

14 changes: 9 additions & 5 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-dragdata@latest/dist/chartjs-plugin-dragdata.min.js"></script>
<script type="module" crossorigin src="/assets/index-UnL-7Xdd.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-C4_nV1QP.css">
<script type="module" crossorigin src="/assets/index-CTLm646y.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B9xDjrZ1.css">
</head>
<body>
<div class="container">
Expand All @@ -19,7 +19,11 @@
<span id="costDiff">$0</span>
<span id="costDiffMo">/mo</span>
</p>
<p id="costDiffSaved">saved using ScyllaDB</p>
<p id="costSaved">saved using ScyllaDB
<span class="info-icon">i
<span class="tooltip-text" id="costSavedTip"></span>
</span>
</p>
</div>

<div class="radio-container">
Expand Down Expand Up @@ -121,8 +125,8 @@
<option value="infrequentAccess">Infrequent Access</option>
</select>
<span class="info-icon">i
<span class="tooltip-text">Select the table class for your workload.</span>
</span>
<span class="tooltip-text">Select the table class for your workload.</span>
</span>
</label>
</div>

Expand Down
10 changes: 7 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
<span id="costDiff">$0</span>
<span id="costDiffMo">/mo</span>
</p>
<p id="costDiffSaved">saved using ScyllaDB</p>
<p id="costSaved">saved using ScyllaDB
<span class="info-icon">i
<span class="tooltip-text" id="costSavedTip"></span>
</span>
</p>
</div>

<div class="radio-container">
Expand Down Expand Up @@ -121,8 +125,8 @@
<option value="infrequentAccess">Infrequent Access</option>
</select>
<span class="info-icon">i
<span class="tooltip-text">Select the table class for your workload.</span>
</span>
<span class="tooltip-text">Select the table class for your workload.</span>
</span>
</label>
</div>

Expand Down
1 change: 0 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ document.querySelector('input[name="pricingModel"][value="provisioned"]').addEve

document.getElementById('tableClass').addEventListener('change', (event) => {
cfg.tableClass = event.target.value;
console.log(cfg.tableClass);
updateChart();
});

Expand Down
5 changes: 3 additions & 2 deletions src/calculator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {cfg} from './config.js';
import {chart} from "./chart.js";
import {formatNumber, updateDebugPanel} from "./utils.js";
import {formatNumber, updateSavedCosts} from "./utils.js";

const scyllaPrices = [{
family: "i4i", instance: "i4i.xlarge", baseline: 78000, peak: 120000, storage: 937, price: 3.325
Expand Down Expand Up @@ -232,7 +232,8 @@ function logCosts(scyllaResult, costRatio) {
`nodeCount: ${scyllaResult.nodeCount}`,
`family: ${scyllaResult.family}`]);

updateDebugPanel(logs);
console.log(cfg);
updateSavedCosts(logs);
}

export function updateOps() {
Expand Down
16 changes: 10 additions & 6 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ h3 {
vertical-align: middle;
}

#costDiffSaved {
#costSaved {
font-size: 1.5em;
margin-bottom: 1.0rem;
}
Expand Down Expand Up @@ -182,6 +182,7 @@ input[type="radio"]:checked::after {
text-align: center;
line-height: 12px;
font-size: 12px;
vertical-align: middle;
}

.tooltip-text {
Expand Down Expand Up @@ -242,8 +243,8 @@ select:focus {
box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

.debug-panel {
background-color: #f9f9f9;
.cost-panel {
background-color: #333;
border: 1px solid #ccc;
padding: 10px;
margin-top: 20px;
Expand All @@ -255,16 +256,19 @@ select:focus {
white-space: pre-wrap;
}

.debug-entry {
.cost-entry {
color: #fff;
display: flex;
justify-content: space-between;
padding-right: 20px;
}

.debug-key {
.cost-key {
color: #fff;
text-align: left;
}

.debug-value {
.cost-value {
color: #fff;
text-align: right;
}
11 changes: 6 additions & 5 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ function getQueryParams() {

export const queryParams = getQueryParams();

export function updateDebugPanel(logs) {
const debugPanel = document.getElementById('debugPanel');
debugPanel.innerHTML = logs.map(log => {
export function updateSavedCosts(logs) {
const costDiffPanel = document.getElementById('costSavedTip');
costDiffPanel.style.display = 'block';
costDiffPanel.innerHTML = logs.map(log => {
const [key, value] = log.split(': ');
return `<div class="debug-entry"><span class="debug-key">${key}:</span><span class="debug-value">${value}</span></div>`;
return `<div class="cost-entry"><span class="cost-key">${key}:</span><span class="cost-value">${value}</span></div>`;
}).join('');
}
}

0 comments on commit 6b136ca

Please sign in to comment.