Skip to content

Commit 8020d16

Browse files
committed
Added database creation indicator #87
* Added indicator to show database is being created when initially loading a JSON file Signed-off-by: Jillian Daguil <[email protected]>
1 parent 07bad30 commit 8020d16

File tree

3 files changed

+62
-6
lines changed

3 files changed

+62
-6
lines changed

assets/css/main.css

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,14 @@ div.node-content {
145145

146146
#leftCol{
147147
padding-top: 10px;
148-
margin-left: -50px; /* For sidebar space */
148+
/* For sidebar space */
149+
margin-left: -50px;
149150
}
150151

151152
/*////// Sidebar //////*/
152153
.btn-sidebar {
153-
color: grey;
154-
background-color: #000;
154+
color: grey;
155+
background-color: #000;
155156
/*border-color: #ccc;*/
156157
padding: 0;
157158
width: 50px;
@@ -183,11 +184,13 @@ margin-left: -50px; /* For sidebar space */
183184

184185
/*////// DataTables custom //////*/
185186

186-
div.dataTables_scrollHead table { /*For rounded table border*/
187+
/*For rounded table border*/
188+
div.dataTables_scrollHead table {
187189
border-top-left-radius: 4px;
188190
}
189191

190-
div.dataTables_scrollHead th:first-child { /*For rounded table border*/
192+
/*For rounded table border*/
193+
div.dataTables_scrollHead th:first-child {
191194
border-top-left-radius: 4px;
192195
}
193196

@@ -202,3 +205,37 @@ div.dataTables_scrollHead th:first-child { /*For rounded table border*/
202205
/*////// Components view //////*/
203206

204207
#tabbar.col-md-11 {margin-left: -15px;}
208+
209+
/*////// Progress Indicator //////*/
210+
211+
/* Center the progress indicator */
212+
#db-indicator{
213+
position: absolute;
214+
left: 50%;
215+
top: 50%;
216+
z-index: 1;
217+
width: 150px;
218+
height: 150px;
219+
margin: -75px 0 0 -75px;
220+
border: 6px solid #B4DDF8;
221+
border-radius: 50%;
222+
border-top: 6px solid #3498db;
223+
width: 50px;
224+
height: 50px;
225+
animation: spin 1s linear infinite;
226+
display: none;
227+
}
228+
229+
@keyframes spin {
230+
0% { transform: rotate(0deg); }
231+
100% { transform: rotate(360deg); }
232+
}
233+
234+
#indicator-text {
235+
position: absolute;
236+
left: 50%;
237+
top: 50%;
238+
z-index: 1;
239+
margin: -120px 0 0 -125px;
240+
display: none;
241+
}

assets/js/renderer.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ $(document).ready(function () {
525525
dbName: "demo_schema",
526526
dbStorage: fileName,
527527
});
528-
528+
showProgressIndicator();
529529
// The flattened data is used by the clue table and jstree
530530
aboutCodeDB.addFlattenedRows(json)
531531
.then(() => aboutCodeDB.addScanData(json))
@@ -543,6 +543,7 @@ $(document).ready(function () {
543543
// loading data into jstree
544544
jstree.jstree(true).refresh(true);
545545
})
546+
.then(() => hideProgressIndicator())
546547
.catch(function (reason) {
547548
throw reason;
548549
});
@@ -551,6 +552,22 @@ $(document).ready(function () {
551552
});
552553
});
553554

555+
// Show database creation indicator and hide table view
556+
function showProgressIndicator() {
557+
$("#db-indicator").show();
558+
$("#indicator-text").show();
559+
$("#tabbar").hide();
560+
$("#leftCol").hide();
561+
}
562+
563+
// Hide database creation indicator and show table view
564+
function hideProgressIndicator() {
565+
$("#tabbar").show();
566+
$("#leftCol").show();
567+
$("#db-indicator").hide();
568+
$("#indicator-text").hide();
569+
}
570+
554571
// Export JSON file with components that have been created
555572
ipcRenderer.on('export-JSON', function () {
556573
dialog.showSaveDialog({

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
</ul>
8181
</div>
8282
</div>
83+
<div id="indicator-text"><h4>Creating Database ...</h4></div>
84+
<div id="db-indicator"></div>
8385
<div class="col-md-2" id="leftCol">
8486
<div id="jstree"></div>
8587
</div>

0 commit comments

Comments
 (0)