Skip to content

Commit 05d65ff

Browse files
authored
Merge pull request #200 from minjk-bl/devops
Devops for v2.3.3
2 parents 0df73e9 + 724cf44 commit 05d65ff

File tree

15 files changed

+179
-121
lines changed

15 files changed

+179
-121
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dist/
22
jupyterlab/lib/visualpython
3-
test/
3+
test/

visualpython/css/component/dataSelector.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@
5555
}
5656
.vp-ds-data-box {
5757
width: 100%;
58-
height: 160px;
58+
height: 150px;
5959
align-content: baseline;
6060
align-items: center;
6161
}
6262
.vp-ds-type-box,
6363
.vp-ds-variable-box {
6464
border: 0.25px solid var(--border-gray-color);
65-
height: 160px;
65+
height: 150px;
6666
grid-row-gap: 0px;
6767
align-content: baseline;
6868
}
@@ -90,7 +90,7 @@
9090
margin-top: 10px;
9191
}
9292
.vp-ds-option-inner-box {
93-
height: calc(100% - 30px);
93+
height: calc(100% - 35px);
9494
}
9595
.vp-ds-df-option-box {
9696
height: 100%;

visualpython/css/component/multiSelector.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,10 @@
7979
left: calc(100% - 25px);
8080
bottom: 23px;
8181
cursor: pointer;
82+
}
83+
.vp-cs-del-item {
84+
position: relative;
85+
float: right;
86+
top: 4px;
87+
cursor: pointer;
8288
}

visualpython/css/m_ml/modelInfo.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.vp-model-select-box {
2+
grid-column-gap: 5px;
3+
align-items: start;
4+
}
15
.vp-ins-select-title {
26
font-weight: bold;
37
color: var(--font-highlight);

visualpython/html/component/dataSelector.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="vp-inner-popup-close" title="Close data selector"></div>
99
</div>
1010
<div class="vp-inner-popup-body vp-scrollbar">
11-
<div class="vp-grid-col-p50">
11+
<div class="vp-grid-col-p50 mb5">
1212
<label class="vp-bold">Type</label>
1313
<label class="vp-bold">Data</label>
1414
</div>
@@ -22,7 +22,7 @@
2222
</div>
2323
<div class="vp-ds-option-box">
2424
<label class="vp-bold">Option Page</label>
25-
<div class="vp-ds-option-inner-box">
25+
<div class="vp-ds-option-inner-box mt5">
2626

2727
</div>
2828
</div>

visualpython/html/m_apps/file.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
</td>
7575
</tr>
7676
<tr>
77-
<td><label for="vp_sampleReturn" class="vp-orange-text">Allocate to</label></td>
77+
<td><label for="vp_sampleReturn">Allocate to</label></td>
7878
<td><input type="text" class="vp-input input-single" id="vp_sampleReturn" placeholder="" value="" title=""></td>
7979
</tr>
8080
</tbody>

visualpython/js/MainFrame.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,10 @@ define([
478478
let parentBlock = null;
479479
let prevBlock = null;
480480
loadStateList.forEach(obj => {
481-
let { blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj;
481+
let { file, blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj;
482482
// get OptionComponent Object
483483
// LAB: relative path needed
484-
let OptionComponent = require('./' + menuConfig.file);
484+
let OptionComponent = require('./' + file);
485485
if (OptionComponent) {
486486
let taskState = menuState.taskState;
487487
let blockState = menuState.blockState;

visualpython/js/com/com_Config.js

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ define([
208208
vp_config_version: '1.0.0',
209209
vp_signature: 'VisualPython',
210210
vp_position: {},
211-
// CHROME: default to display vp
212-
vp_section_display: true,
211+
vp_section_display: false,
213212
vp_note_display: false,
214213
vp_menu_width: Config.MENU_MIN_WIDTH,
215214
vp_note_width: Config.BOARD_MIN_WIDTH
@@ -485,15 +484,15 @@ define([
485484
that._checkMounted().then(function() {
486485
that._readFromColab(configKey).then(function(result) {
487486
let data = result;
488-
if (data == undefined || data == {}) {
487+
if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) {
489488
resolve(data);
490489
return;
491490
}
492491
if (dataKey == '') {
493492
resolve(data);
494493
return;
495494
}
496-
if (Object.keys(data).length > 0) {
495+
if (data instanceof Object && Object.keys(data).length > 0) {
497496
resolve(data[dataKey]);
498497
return;
499498
}
@@ -509,15 +508,15 @@ define([
509508
// LAB: use local .visualpython files
510509
that._readFromLab(configKey).then(function(result) {
511510
let data = result;
512-
if (data == undefined || data == {}) {
511+
if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) {
513512
resolve(data);
514513
return;
515514
}
516515
if (dataKey == '') {
517516
resolve(data);
518517
return;
519518
}
520-
if (Object.keys(data).length > 0) {
519+
if (data instanceof Object && Object.keys(data).length > 0) {
521520
resolve(data[dataKey]);
522521
return;
523522
}
@@ -779,6 +778,40 @@ define([
779778
return Config.version;
780779
}
781780

781+
checkVersionTimestamp = function() {
782+
let that = this;
783+
// check version timestamp
784+
let nowDate = new Date();
785+
this.getData('version_timestamp', 'vpcfg').then(function(data) {
786+
let doCheckVersion = false;
787+
vpLog.display(VP_LOG_TYPE.DEVELOP, 'Checking its version timestamp... : ' + data);
788+
if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) {
789+
// no timestamp, check version
790+
doCheckVersion = true;
791+
} else if (data != '') {
792+
let lastCheck = new Date(parseInt(data));
793+
let diffCheck_now = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, nowDate.getDate());
794+
let diffCheck_last = new Date(lastCheck.getFullYear(), lastCheck.getMonth() + 1, lastCheck.getDate());
795+
796+
let diff = Math.abs(diffCheck_now.getTime() - diffCheck_last.getTime());
797+
diff = Math.ceil(diff / (1000 * 3600 * 24));
798+
799+
if (diff >= 1) {
800+
// if More than 1 day passed, check version
801+
doCheckVersion = true;
802+
}
803+
}
804+
805+
// check version and update version_timestamp
806+
if (doCheckVersion == true) {
807+
that.checkVpVersion(true);
808+
}
809+
810+
}).catch(function(err) {
811+
vpLog.display(VP_LOG_TYPE.ERROR, err);
812+
})
813+
}
814+
782815
checkVpVersion(background=false) {
783816
let that = this;
784817
let nowVersion = this.getVpInstalledVersion();
@@ -818,6 +851,8 @@ define([
818851
switch (clickedBtnIdx) {
819852
case 0:
820853
// cancel
854+
// update version_timestamp
855+
that.setData({ 'version_timestamp': new Date().getTime() }, 'vpcfg');
821856
break;
822857
case 1:
823858
// update

visualpython/js/com/com_generatorV2.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,17 @@ define([
134134
package.options && package.options.forEach(function(o, i) {
135135
var obj = JSON.parse(JSON.stringify(o));
136136
let newTag = vp_createTag(pageThis, obj, state);
137-
if (obj.required) {
137+
if (obj.required === true || obj.output === true) {
138138
tblInput.append(newTag);
139139
} else {
140140
tblOption.append(newTag);
141141
}
142142
});
143143

144144
// TODO: userOption
145+
if (package.code.includes('${etc}')) {
146+
147+
}
145148

146149
bindAutoComponentEvent(pageThis);
147150
}
@@ -163,7 +166,7 @@ define([
163166
let value = state[name];
164167

165168
var requiredFontStyle = required == true? 'vp-orange-text' : '';
166-
var lblTag = $(`<label>${label}</label>`).attr({
169+
var lblTag = $(`<label class="vp-bold">${label}</label>`).attr({
167170
'for': name,
168171
'class': requiredFontStyle,
169172
'title': '(' + name + ')'

visualpython/js/com/component/MultiSelector.js

Lines changed: 73 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ define([
305305
// select - right
306306
tag.appendFormatLine('<div class="{0}">', APP_SELECT_RIGHT);
307307
var selectedList = this.dataList.filter(data => that.selectedList.includes(data.code));
308-
tag.appendLine(this.renderSelectedBox(selectedList));
308+
tag.appendLine(this.renderSelectedBox(this.selectedList));
309309
if (this.allowAdd) {
310310
// add item
311311
tag.appendLine('<input type="text" class="vp-cs-add-item-name vp-input wp100" placeholder="New item to add" value="">');
@@ -380,62 +380,6 @@ define([
380380
that.bindDraggable();
381381
});
382382

383-
// item indexing
384-
$(this.wrapSelector('.' + APP_SELECT_ITEM)).on('click', function(event) {
385-
var dataIdx = $(this).attr('data-idx');
386-
var idx = $(this).index();
387-
var added = $(this).hasClass('added'); // right side added item?
388-
var selector = '';
389-
390-
// remove selection for select box on the other side
391-
if (added) {
392-
// remove selection for left side
393-
$(that.wrapSelector('.' + APP_SELECT_ITEM + ':not(.added)')).removeClass('selected');
394-
// set selector
395-
selector = '.added';
396-
} else {
397-
// remove selection for right(added) side
398-
$(that.wrapSelector('.' + APP_SELECT_ITEM + '.added')).removeClass('selected');
399-
// set selector
400-
selector = ':not(.added)';
401-
}
402-
403-
if (vpEvent.keyManager.keyCheck.ctrlKey) {
404-
// multi-select
405-
that.pointer = { start: idx, end: -1 };
406-
$(this).toggleClass('selected');
407-
} else if (vpEvent.keyManager.keyCheck.shiftKey) {
408-
// slicing
409-
var startIdx = that.pointer.start;
410-
411-
if (startIdx == -1) {
412-
// no selection
413-
that.pointer = { start: idx, end: -1 };
414-
} else if (startIdx > idx) {
415-
// add selection from idx to startIdx
416-
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
417-
for (var i = idx; i <= startIdx; i++) {
418-
$(tags[i]).addClass('selected');
419-
}
420-
that.pointer = { start: startIdx, end: idx };
421-
} else if (startIdx <= idx) {
422-
// add selection from startIdx to idx
423-
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
424-
for (var i = startIdx; i <= idx; i++) {
425-
$(tags[i]).addClass('selected');
426-
}
427-
that.pointer = { start: startIdx, end: idx };
428-
}
429-
} else {
430-
// single-select
431-
that.pointer = { start: idx, end: -1 };
432-
// un-select others
433-
$(that.wrapSelector('.' + APP_SELECT_ITEM + selector)).removeClass('selected');
434-
// select this
435-
$(this).addClass('selected');
436-
}
437-
});
438-
439383
// item indexing - add all
440384
$(this.wrapSelector('.' + APP_SELECT_ADD_ALL_BTN)).on('click', function(event) {
441385
$(that.wrapSelector('.' + APP_SELECT_BOX + '.left .' + APP_SELECT_ITEM)).appendTo(
@@ -510,6 +454,75 @@ define([
510454
that._addNewItem(newItemName);
511455
}
512456
});
457+
458+
this._bindItemClickEvent();
459+
}
460+
461+
_bindItemClickEvent() {
462+
let that = this;
463+
// item indexing
464+
$(this.wrapSelector('.' + APP_SELECT_ITEM)).off('click');
465+
$(this.wrapSelector('.' + APP_SELECT_ITEM)).on('click', function(event) {
466+
var dataIdx = $(this).attr('data-idx');
467+
var idx = $(this).index();
468+
var added = $(this).hasClass('added'); // right side added item?
469+
var selector = '';
470+
471+
// remove selection for select box on the other side
472+
if (added) {
473+
// remove selection for left side
474+
$(that.wrapSelector('.' + APP_SELECT_ITEM + ':not(.added)')).removeClass('selected');
475+
// set selector
476+
selector = '.added';
477+
} else {
478+
// remove selection for right(added) side
479+
$(that.wrapSelector('.' + APP_SELECT_ITEM + '.added')).removeClass('selected');
480+
// set selector
481+
selector = ':not(.added)';
482+
}
483+
484+
if (vpEvent.keyManager.keyCheck.ctrlKey) {
485+
// multi-select
486+
that.pointer = { start: idx, end: -1 };
487+
$(this).toggleClass('selected');
488+
} else if (vpEvent.keyManager.keyCheck.shiftKey) {
489+
// slicing
490+
var startIdx = that.pointer.start;
491+
492+
if (startIdx == -1) {
493+
// no selection
494+
that.pointer = { start: idx, end: -1 };
495+
} else if (startIdx > idx) {
496+
// add selection from idx to startIdx
497+
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
498+
for (var i = idx; i <= startIdx; i++) {
499+
$(tags[i]).addClass('selected');
500+
}
501+
that.pointer = { start: startIdx, end: idx };
502+
} else if (startIdx <= idx) {
503+
// add selection from startIdx to idx
504+
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
505+
for (var i = startIdx; i <= idx; i++) {
506+
$(tags[i]).addClass('selected');
507+
}
508+
that.pointer = { start: startIdx, end: idx };
509+
}
510+
} else {
511+
// single-select
512+
that.pointer = { start: idx, end: -1 };
513+
// un-select others
514+
$(that.wrapSelector('.' + APP_SELECT_ITEM + selector)).removeClass('selected');
515+
// select this
516+
$(this).addClass('selected');
517+
}
518+
});
519+
520+
// item deleting (manually added item only)
521+
$(this.wrapSelector('.vp-cs-del-item')).off('click');
522+
$(this.wrapSelector('.vp-cs-del-item')).on('click', function(event) {
523+
$(this).closest('.' + APP_SELECT_ITEM).remove();
524+
that.pointer = { start: -1, end: -1 };
525+
});
513526
}
514527

515528
_addNewItem(newItemName) {
@@ -551,6 +564,7 @@ define([
551564
let newItemIndex = this.dataList.length;
552565
var targetTag = $(`<div class="${APP_SELECT_ITEM} ${APP_DRAGGABLE} added selected" data-idx="${newItemIndex}" data-name="${newItemName}" data-type="object" data-code="'${newItemName}'" title="${newItemName}: Added manually">
553566
<span>${newItemName}</span>
567+
<div class="vp-cs-del-item vp-icon-close-small" title="Delete this manually added item"></div>
554568
</div>`);
555569
$(targetTag).appendTo(
556570
$(this.wrapSelector('.' + APP_SELECT_BOX + '.right'))
@@ -560,6 +574,8 @@ define([
560574
$(this.wrapSelector('.' + APP_SELECT_ITEM)).removeClass('selected');
561575
// clear item input
562576
$(this.wrapSelector('.vp-cs-add-item-name')).val('');
577+
// bind click event
578+
this._bindItemClickEvent();
563579
// bind draggable
564580
this.bindDraggable();
565581
}

visualpython/js/com/component/PopupComponent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ define([
9292
this.id = this.state.config.id;
9393
this.name = this.state.config.name;
9494
this.path = this.state.config.path;
95+
this.category = this.state.config.category;
9596

9697

9798
this.config = {
@@ -530,7 +531,8 @@ define([
530531
template() {
531532
this.$pageDom = $(popupComponentHtml.replaceAll('${vp_base}', com_Const.BASE_PATH));
532533
// set title
533-
this.$pageDom.find('.vp-popup-title').text(this.name);
534+
// this.$pageDom.find('.vp-popup-title').text(this.category + ' > ' + this.name);
535+
this.$pageDom.find('.vp-popup-title').html(`<span style="color: var(--gray-color);font-size: 12px;">${this.category} > </span><span>${this.name}</span>`);
534536
// set body
535537
let bodyTemplate = this.templateForBody();
536538
// CHROME: check url keyword and replace it

0 commit comments

Comments
 (0)