Skip to content

Commit e3c26b5

Browse files
author
minjk-bl
committed
Convert Data error box to Common style template, change class names for original usage of data error box, and Add error box to Seaborn, WordCloud apps
1 parent 3311da6 commit e3c26b5

File tree

17 files changed

+183
-232
lines changed

17 files changed

+183
-232
lines changed

css/component/popupComponent.css

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -363,28 +363,6 @@
363363
background-image: url('');
364364
}
365365

366-
/* error box */
367-
.vp-popup-data-error-box {
368-
margin: 7px;
369-
padding: 10px;
370-
background: #FFFFFF;
371-
border: 0.25px solid #E4E4E4;
372-
box-shadow: 1px 1px 2px rgb(0 0 0 / 10%);
373-
border-radius: 2px;
374-
}
375-
.vp-popup-data-error-box i.fa-exclamation-triangle {
376-
color: #F37704;
377-
}
378-
.vp-popup-data-error-box-title {
379-
color: #F37704;
380-
font-weight: bold;
381-
}
382-
.vp-popup-data-error-box pre {
383-
background: #eeeeee;
384-
margin: 0px;
385-
padding: 7px;
386-
}
387-
388366
/* inner popup */
389367
.vp-inner-popup-box {
390368
position: absolute;

css/m_apps/frame.css

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -208,26 +208,6 @@
208208
white-space: -o-pre-wrap; /* Opera 7 */
209209
word-wrap: break-all; /* Internet Explorer 5.5+ */
210210
}
211-
.vp-fe-info-error-box {
212-
margin: 7px;
213-
padding: 10px;
214-
background: #FFFFFF;
215-
border: 0.25px solid #C4C4C4;
216-
box-shadow: 1px 1px 2px rgb(0 0 0 / 10%);
217-
border-radius: 2px;
218-
}
219-
.vp-fe-info-error-box i.fa-exclamation-triangle {
220-
color: #F37704;
221-
}
222-
.vp-fe-info-error-box-title {
223-
color: #F37704;
224-
font-weight: bold;
225-
}
226-
.vp-fe-info-error-box pre {
227-
background: #eeeeee;
228-
margin: 0px;
229-
padding: 7px;
230-
}
231211
.vp-fe-preview-box {
232212
display: none;
233213
width: 100%;

css/m_apps/subset.css

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -270,24 +270,4 @@
270270
}
271271
.vp-ds-data-view-box table {
272272
height: 100%;
273-
}
274-
.vp-ds-data-error-box {
275-
margin: 7px;
276-
padding: 10px;
277-
background: #FFFFFF;
278-
border: 0.25px solid #E4E4E4;
279-
box-shadow: 1px 1px 2px rgb(0 0 0 / 10%);
280-
border-radius: 2px;
281-
}
282-
.vp-ds-data-error-box i.fa-exclamation-triangle {
283-
color: #F37704;
284-
}
285-
.vp-ds-data-error-box-title {
286-
color: #F37704;
287-
font-weight: bold;
288-
}
289-
.vp-ds-data-error-box pre {
290-
background: #eeeeee;
291-
margin: 0px;
292-
padding: 7px;
293273
}

css/m_visualize/seaborn.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.vp-chart-setting {
22
float: right;
33
color: var(--gray-color);
4+
padding-top: 5px;
45
padding-right: 5px;
56
cursor: pointer;
67
}
@@ -59,9 +60,6 @@
5960
align-items: baseline;
6061
align-content: center;
6162
height: 100%;
62-
}
63-
.vp-chart-left-box {
64-
6563
}
6664
.vp-chart-left-box > label {
6765
margin-bottom: 0px;
@@ -82,6 +80,10 @@
8280
width: 100%;
8381
height: calc(100% - 30px);
8482
}
83+
.vp-chart-preview-content:empty::after {
84+
content: 'No preview image';
85+
color: var(--gray-color);
86+
}
8587
.vp-chart-preview-box img {
8688
width: 100%;
8789
height: 100%;

css/m_visualize/wordCloud.css

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
2-
/* temporary style for word cloud popup */
3-
.vp-popup-body-top-bar {
4-
position: absolute;
5-
left: calc(50% - 250px);
6-
}
7-
.vp-popup-codeview-box {
8-
height: 200px;
9-
}
101
/* word cloud styles */
112
.vp-wc-body {
123
display: grid;
@@ -72,6 +63,10 @@
7263
width: 100%;
7364
height: calc(100% - 30px);
7465
}
66+
.vp-wc-preview-content:empty::after {
67+
content: 'No preview image';
68+
color: var(--gray-color);
69+
}
7570
.vp-wc-preview-box img {
7671
width: 100%;
7772
height: 100%;

css/root.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,4 +492,25 @@ hr.vp-extra-menu-line {
492492
background: var(--light-gray-color);
493493
color: var(--font-highlight);
494494
cursor: pointer;
495+
}
496+
/* Data error box */
497+
.vp-data-error-box {
498+
margin: 7px;
499+
padding: 10px;
500+
background: #FFFFFF;
501+
border: 0.25px solid #E4E4E4;
502+
box-shadow: 1px 1px 2px rgb(0 0 0 / 10%);
503+
border-radius: 2px;
504+
}
505+
.vp-data-error-box i.fa-exclamation-triangle {
506+
color: #F37704;
507+
}
508+
.vp-data-error-box-title {
509+
color: #F37704;
510+
font-weight: bold;
511+
}
512+
.vp-data-error-box pre {
513+
background: #eeeeee;
514+
margin: 0px;
515+
padding: 7px;
495516
}

html/m_visualize/seaborn.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,8 @@
174174
</span>
175175
</div>
176176
<div class="vp-chart-preview-box vp-grid-border-box">
177-
<span></span>
178-
<div id="chartPreview" class="vp-center">
179-
180-
</div>
177+
<div id="chartPreview" class="vp-chart-preview-content vp-center"></div>
181178
</div>
182-
<!-- <div class="vp-chart-preview-size-box vp-grid-col-95 mt5">
183-
<label>Preview Size</label>
184-
<input type="range" id="previewSize" max="5" min="-5" value="0"/>
185-
</div> -->
186179
</div>
187180
</div>
188181

html/m_visualize/wordCloud.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@
5656
<span class="vp-wc-preview-title">Preview</span>
5757
</div>
5858
<div class="vp-wc-preview-box vp-grid-border-box">
59-
<span></span>
60-
<div id="vp_wcPreview" class="vp-center">
61-
62-
</div>
59+
<div id="vp_wcPreview" class="vp-wc-preview-content vp-center"></div>
6360
</div>
6461
</div>
6562
</div>

js/com/com_util.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,25 @@ define([
187187
});
188188
}
189189

190+
/**
191+
* Template for error box
192+
* @param {*} titleStr
193+
* @param {*} contentStr
194+
* @returns
195+
*/
196+
var templateForErrorBox = function(titleStr, contentStr='') {
197+
let errorContent = new com_String();
198+
errorContent.appendFormatLine('<div class="{0}">', 'vp-data-error-box');
199+
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
200+
errorContent.appendFormatLine('<label class="{0}">{1}</label>',
201+
'vp-data-error-box-title', titleStr);
202+
if (contentStr && contentStr != '') {
203+
errorContent.appendFormatLine('<pre>{0}</pre>', contentStr.split('\\n').join('<br/>'));
204+
}
205+
errorContent.appendLine('</div>');
206+
return errorContent.toString();
207+
}
208+
190209
/**
191210
* setIsAPIListRunCode
192211
*/
@@ -252,6 +271,8 @@ define([
252271
renderAlertModal: renderAlertModal,
253272
renderSuccessMessage: renderSuccessMessage,
254273

274+
templateForErrorBox: templateForErrorBox,
275+
255276
setIsAPIListRunCode: setIsAPIListRunCode,
256277
getIsAPIListRunCode: getIsAPIListRunCode,
257278
kernelExecute: kernelExecute,

js/m_apps/Bind.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
define([
1616
'text!vp_base/html/m_apps/bind.html!strip',
1717
'css!vp_base/css/m_apps/bind.css',
18+
'vp_base/js/com/com_util',
1819
'vp_base/js/com/com_String',
1920
'vp_base/js/com/component/PopupComponent',
2021
'vp_base/js/com/component/MultiSelector'
21-
], function(bindHtml, bindCss, com_String, PopupComponent, MultiSelector) {
22+
], function(bindHtml, bindCss, com_util, com_String, PopupComponent, MultiSelector) {
2223

2324
/**
2425
* Bind
@@ -347,35 +348,21 @@ define([
347348
that.renderDataPage('');
348349
}
349350
} else {
350-
var errorContent = new com_String();
351+
var errorContent = '';
351352
if (msg.content.ename) {
352-
errorContent.appendFormatLine('<div class="{0}">', 'vp-popup-data-error-box');
353-
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
354-
errorContent.appendFormatLine('<label class="{0}">{1}</label>',
355-
'vp-popup-data-error-box-title', msg.content.ename);
356-
if (msg.content.evalue) {
357-
// errorContent.appendLine('<br/>');
358-
errorContent.appendFormatLine('<pre>{0}</pre>', msg.content.evalue.split('\\n').join('<br/>'));
359-
}
360-
errorContent.appendLine('</div>');
353+
errorContent = com_util.templateForErrorBox(msg.content.ename, msg.content.evalue);
361354
}
362355
that.renderDataPage(errorContent);
356+
vpLog.display(VP_LOG_TYPE.ERROR, msg.content.ename, msg.content.evalue, msg.content);
363357
}
364358
}).catch(function(resultObj) {
365359
let { msg } = resultObj;
366-
var errorContent = new com_String();
360+
var errorContent = '';
367361
if (msg.content.ename) {
368-
errorContent.appendFormatLine('<div class="{0}">', 'vp-popup-data-error-box');
369-
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
370-
errorContent.appendFormatLine('<label class="{0}">{1}</label>',
371-
'vp-popup-data-error-box-title', msg.content.ename);
372-
if (msg.content.evalue) {
373-
// errorContent.appendLine('<br/>');
374-
errorContent.appendFormatLine('<pre>{0}</pre>', msg.content.evalue.split('\\n').join('<br/>'));
375-
}
376-
errorContent.appendLine('</div>');
362+
errorContent = com_util.templateForErrorBox(msg.content.ename, msg.content.evalue);
377363
}
378364
that.renderDataPage(errorContent);
365+
vpLog.display(VP_LOG_TYPE.ERROR, msg.content.ename, msg.content.evalue, msg.content);
379366
});
380367
}
381368

js/m_apps/Frame.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -996,18 +996,11 @@ define([
996996
});
997997
}
998998
} else {
999-
var errorContent = new com_String();
999+
var errorContent = '';
10001000
if (msg.content.ename) {
1001-
errorContent.appendFormatLine('<div class="{0}">', VP_FE_INFO_ERROR_BOX);
1002-
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
1003-
errorContent.appendFormatLine('<label class="{0}">{1}</label>'
1004-
, VP_FE_INFO_ERROR_BOX_TITLE, msg.content.ename);
1005-
if (msg.content.evalue) {
1006-
// errorContent.appendLine('<br/>');
1007-
errorContent.appendFormatLine('<pre>{0}</pre>', msg.content.evalue.split('\\n').join('<br/>'));
1008-
}
1009-
errorContent.appendLine('</div>');
1001+
errorContent = com_util.templateForErrorBox(msg.content.ename, msg.content.evalue);
10101002
}
1003+
vpLog.display(VP_LOG_TYPE.ERROR, msg.content.ename, msg.content.evalue, msg.content);
10111004
$(that.wrapSelector('.' + VP_FE_INFO_CONTENT)).replaceWith(function() {
10121005
return that.renderInfoPage(errorContent);
10131006
});
@@ -1363,9 +1356,6 @@ define([
13631356
const VP_FE_INFO = 'vp-fe-info';
13641357
const VP_FE_INFO_CONTENT = 'vp-fe-info-content';
13651358

1366-
const VP_FE_INFO_ERROR_BOX = 'vp-fe-info-error-box';
1367-
const VP_FE_INFO_ERROR_BOX_TITLE = 'vp-fe-info-error-box-title';
1368-
13691359
const VP_FE_PREVIEW_BOX = 'vp-fe-preview-box';
13701360
const VP_FE_BUTTON_PREVIEW = 'vp-fe-btn-preview';
13711361
const VP_FE_BUTTON_DATAVIEW = 'vp-fe-btn-dataview';

js/m_apps/Groupby.js

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -465,35 +465,21 @@ define([
465465
that.renderDataPage('');
466466
}
467467
} else {
468-
var errorContent = new com_String();
468+
var errorContent = '';
469469
if (msg.content.ename) {
470-
errorContent.appendFormatLine('<div class="{0}">', 'vp-popup-data-error-box');
471-
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
472-
errorContent.appendFormatLine('<label class="{0}">{1}</label>',
473-
'vp-popup-data-error-box-title', msg.content.ename);
474-
if (msg.content.evalue) {
475-
// errorContent.appendLine('<br/>');
476-
errorContent.appendFormatLine('<pre>{0}</pre>', msg.content.evalue.split('\\n').join('<br/>'));
477-
}
478-
errorContent.appendLine('</div>');
470+
errorContent = com_util.templateForErrorBox(msg.content.ename, msg.content.evalue);
479471
}
480472
that.renderDataPage(errorContent);
473+
vpLog.display(VP_LOG_TYPE.ERROR, msg.content.ename, msg.content.evalue, msg.content);
481474
}
482475
}).catch(function(resultObj) {
483476
let { msg } = resultObj;
484-
var errorContent = new com_String();
477+
var errorContent = '';
485478
if (msg.content.ename) {
486-
errorContent.appendFormatLine('<div class="{0}">', 'vp-popup-data-error-box');
487-
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
488-
errorContent.appendFormatLine('<label class="{0}">{1}</label>',
489-
'vp-popup-data-error-box-title', msg.content.ename);
490-
if (msg.content.evalue) {
491-
// errorContent.appendLine('<br/>');
492-
errorContent.appendFormatLine('<pre>{0}</pre>', msg.content.evalue.split('\\n').join('<br/>'));
493-
}
494-
errorContent.appendLine('</div>');
479+
errorContent = com_util.templateForErrorBox(msg.content.ename, msg.content.evalue);
495480
}
496481
that.renderDataPage(errorContent);
482+
vpLog.display(VP_LOG_TYPE.ERROR, msg.content.ename, msg.content.evalue, msg.content);
497483
});
498484
}
499485

js/m_apps/Reshape.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -256,33 +256,17 @@ define([
256256
that.renderDataPage('');
257257
}
258258
} else {
259-
var errorContent = new com_String();
259+
var errorContent = '';
260260
if (msg.content.ename) {
261-
errorContent.appendFormatLine('<div class="{0}">', 'vp-popup-data-error-box');
262-
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
263-
errorContent.appendFormatLine('<label class="{0}">{1}</label>',
264-
'vp-popup-data-error-box-title', msg.content.ename);
265-
if (msg.content.evalue) {
266-
// errorContent.appendLine('<br/>');
267-
errorContent.appendFormatLine('<pre>{0}</pre>', msg.content.evalue.split('\\n').join('<br/>'));
268-
}
269-
errorContent.appendLine('</div>');
261+
errorContent = com_util.templateForErrorBox(msg.content.ename, msg.content.evalue);
270262
}
271263
that.renderDataPage(errorContent);
272264
}
273265
}).catch(function(resultObj) {
274266
let { msg } = resultObj;
275-
var errorContent = new com_String();
267+
var errorContent = '';
276268
if (msg.content.ename) {
277-
errorContent.appendFormatLine('<div class="{0}">', 'vp-popup-data-error-box');
278-
errorContent.appendLine('<i class="fa fa-exclamation-triangle"></i>');
279-
errorContent.appendFormatLine('<label class="{0}">{1}</label>',
280-
'vp-popup-data-error-box-title', msg.content.ename);
281-
if (msg.content.evalue) {
282-
// errorContent.appendLine('<br/>');
283-
errorContent.appendFormatLine('<pre>{0}</pre>', msg.content.evalue.split('\\n').join('<br/>'));
284-
}
285-
errorContent.appendLine('</div>');
269+
errorContent = com_util.templateForErrorBox(msg.content.ename, msg.content.evalue);
286270
}
287271
that.renderDataPage(errorContent);
288272
});

0 commit comments

Comments
 (0)