Skip to content

Commit b4d8fe0

Browse files
committed
add loading indicator for file UI
1 parent 2f0372a commit b4d8fe0

8 files changed

+85
-3
lines changed

css/file.css

+30
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,30 @@
7575
padding-top: 64px;
7676
}
7777

78+
#content-btn {
79+
position: relative;
80+
}
81+
82+
#content-loader-overlay {
83+
position: relative;
84+
top: 0%;
85+
left: 0%;
86+
width: 100%;
87+
height: 100%;
88+
transform: translateY(-100%);
89+
background:rgba(0,0,0,0.4);
90+
display: none;
91+
}
92+
93+
#content-loader-aspect {
94+
position: absolute;
95+
top: 50%;
96+
left: 50%;
97+
transform: translateY(-50%) translateX(-50%);
98+
width: 100px;
99+
height: 100px;
100+
}
101+
78102
#hierarchy-container {
79103
position: relative;
80104
height: 100%;
@@ -117,6 +141,12 @@
117141
transform: translate(-50%, -50%);
118142
}
119143

144+
/* no border on drop down to avoid horizonal scroll bars */
145+
.file-drop-menu {
146+
border: none;
147+
padding:; 1px;
148+
}
149+
120150
@media only screen and (max-width: 320px) {
121151
#hierarchy-container {
122152
width: 100%;

css/folders.css

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#folders-container {
1010
position: relative;
1111
overflow-y: scroll;
12+
height: 100%;
1213
}
1314

1415
.folder-row {
@@ -42,6 +43,13 @@
4243
.folder-selected {
4344
background-color: #C06306;
4445
transition: all 0.5s;
46+
animation: flicker 2s infinite;
47+
}
48+
49+
@keyframes flicker {
50+
0% { opacity: 1; }
51+
50% { opacity: 0.5; }
52+
100% { opacity: 1; }
4553
}
4654

4755
.folder-comment {

css/reports.css

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#reports-container {
1010
position: relative;
1111
overflow-y: scroll;
12+
height: 100%;
1213
}
1314

1415
.report-row {
@@ -42,6 +43,7 @@
4243
.report-selected {
4344
background-color: #763806;
4445
transition: all 0.5s;
46+
animation: flicker 2s infinite; /* defined in folders.css */
4547
}
4648

4749
.report-comment {

file.html

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ <h6 class="title-64">NAVFIT99</h6>
103103
<div class="container" id="detail-container">
104104
<div id="detail-background">Details</div>
105105
</div>
106+
107+
<div id="content-loader-overlay">
108+
<div id="content-loader-aspect"><div id="loader"></div></div>
109+
</div>
106110
</div>
107111
</div>
108112

js/alerts.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ function showSuccessAlertWithText(text) {
2727
function showWarnAlertWithTextWithLink(text, link) {
2828
$('#warn-alert').show();
2929
$('#warn-text').text(text);
30-
$('#warn-link').val(link);
30+
if (link != null) {
31+
$('#warn-link').show();
32+
$('#warn-link').val(link);
33+
} else {
34+
$('#warn-link').hide();
35+
}
36+
3137
}
3238

3339
function showTextAreaAlertWithTextWithData(text, data) {

js/constants.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
//js GET params
12
var fileUUIDKey = 'uuid';
3+
var authErrorKey = 'authError';
24

35
//auth parameter names for auth server
46
var urlEditorIDKey = 'user';

js/file.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function createFolderElement(folderMap) {
245245
actionsDropdownBtn.html('<span class="glyphicon glyphicon-option-horizontal" aria-hidden="false">&nbsp;<span class="caret"></span>');
246246

247247
var actionList = jQuery('<ul/>', {
248-
class: 'dropdown-menu'
248+
class: 'dropdown-menu file-drop-menu'
249249
});
250250

251251
//Add folder icon
@@ -508,6 +508,11 @@ function processFolders(data) {
508508

509509
console.log(data);
510510

511+
if (folders.length == 0) {
512+
showWarnAlertWithTextWithLink('No folders in NAVFIT database, click \'</>\' to see your NAVFIT database data. ', null);
513+
setTimeout(warnCloseButtonClicked, 5000);
514+
}
515+
511516
$('#folders-container').empty();
512517

513518
for (var i = 0; i < data.length; i++) {
@@ -529,6 +534,12 @@ function processReports(data) {
529534
var retrievedReports = data;
530535

531536
console.log(retrievedReports);
537+
538+
if (retrievedReports.length == 0) {
539+
showWarnAlertWithTextWithLink('No reports in folder.', null);
540+
setTimeout(warnCloseButtonClicked, 5000);
541+
}
542+
532543
for (var i = 0; i < retrievedReports.length; i++) {
533544
var reportMap = retrievedReports[i];
534545

@@ -573,11 +584,14 @@ function loadReportsForFolderFromServer(folderID, callback) {
573584
loadData(getUrlParameter(fileUUIDKey), 3, folderID, callback);
574585
}
575586

587+
/*
588+
* Request navift, folder, report data from backend
589+
*/
576590
function loadData(fileUUID, type, typeData, callback) {
577591
/*
578592
disableMainUI();
579-
$('#new-file-loader-aspect').show();
580593
*/
594+
$('#content-loader-overlay').show();
581595

582596
var editorID;
583597
var authToken;
@@ -631,6 +645,8 @@ function loadData(fileUUID, type, typeData, callback) {
631645
callback();
632646

633647
console.log(callback);
648+
649+
$('#content-loader-overlay').hide();
634650
}
635651
});
636652

js/main.js

+14
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ function setupLoginLogoutUI() {
2929
}
3030
}
3131

32+
function checkForAuthError() {
33+
var authError = getUrlParameter(authErrorKey);
34+
switch(parseInt(authError, 10)) {
35+
case 1:
36+
showErrorAlertWithText('No client certificate provided. Did you select a certificate? Restart browser to try again.');
37+
break;
38+
case 2:
39+
showErrorAlertWithText('Your certificate could not be verified. Select your DoD ID certificate. Restart browser to try again.');
40+
break;
41+
default:
42+
console.log('Unknown autherror ' + autherror);
43+
}
44+
}
45+
3246
$(document).ready(function() {
3347
checkAuthStruct(getAuthStruct(true), function(valid) {
3448
if (!valid) {

0 commit comments

Comments
 (0)