Skip to content

Commit f185377

Browse files
author
minjk-bl
committed
Apps > Subset bug fix & change event naming to apps_run
1 parent 04ee638 commit f185377

File tree

6 files changed

+24
-21
lines changed

6 files changed

+24
-21
lines changed

src/api_block/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ define([
377377
});
378378

379379
/** Apps Menu Apply event */
380-
$(document).on('subset_run frame_run pdf_run', '#vp_appsCode', function(evt) {
380+
$(document).on('apps_run', '#vp_appsCode', function(evt) {
381381
var code = evt.code;
382382
var title = evt.title;
383383
var state = evt.state;

src/common/kernelApi.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ define([
6969
});
7070
}
7171

72+
var getRowList = function(dataframe, callback) {
73+
executePython(
74+
vpCommon.formatString('_vp_print(_vp_get_rows_list({0}))', dataframe)
75+
, function(result) {
76+
callback(result);
77+
});
78+
}
79+
7280
var getProfilingList = function(callback) {
7381
executePython('_vp_print(_vp_get_profiling_list())', function(result) {
7482
callback(result);
@@ -79,6 +87,7 @@ define([
7987
executePython: executePython,
8088
searchVarList: searchVarList,
8189
getColumnList: getColumnList,
90+
getRowList: getRowList,
8291
getProfilingList: getProfilingList
8392
}
8493
});

src/common/vpFrameEditor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ define([
11981198
if (this.pageThis) {
11991199
$(this.pageThis.wrapSelector('#' + this.targetId)).val(code);
12001200
$(this.pageThis.wrapSelector('#' + this.targetId)).trigger({
1201-
type: 'frame_run',
1201+
type: 'apps_run',
12021202
title: 'Frame',
12031203
code: code,
12041204
state: this.state,
@@ -1208,7 +1208,7 @@ define([
12081208
} else {
12091209
$(vpCommon.wrapSelector('#' + this.targetId)).val(code);
12101210
$(vpCommon.wrapSelector('#' + this.targetId)).trigger({
1211-
type: 'frame_run',
1211+
type: 'apps_run',
12121212
title: 'Frame',
12131213
code: code,
12141214
state: this.state,

src/common/vpPDF.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ define([
396396
if (this.pageThis) {
397397
$(this.pageThis.wrapSelector('#' + this.targetId)).val(code);
398398
$(this.pageThis.wrapSelector('#' + this.targetId)).trigger({
399-
type: 'pdf_run',
399+
type: 'apps_run',
400400
title: 'PDF',
401401
code: code,
402402
state: this.state,
@@ -406,7 +406,7 @@ define([
406406
} else {
407407
$(vpCommon.wrapSelector('#' + this.targetId)).val(code);
408408
$(vpCommon.wrapSelector('#' + this.targetId)).trigger({
409-
type: 'pdf_run',
409+
type: 'apps_run',
410410
title: 'PDF',
411411
code: code,
412412
state: this.state,

src/common/vpSubsetEditor.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ define([
170170

171171
useCopy: false,
172172
toFrame: false,
173-
subsetType: 'subset', // subset / loc / iloc
173+
subsetType: 'loc', // subset / loc / iloc
174174

175175
tabPage: 'subset', // subset / data
176176

@@ -633,8 +633,11 @@ define([
633633
tag.appendFormatLine('<div class="{0} {1} {2} {3}">', VP_DS_SELECT_BOX, 'left', VP_DS_DROPPABLE, 'no-selection');
634634
// get col data and make draggable items
635635
colList.forEach((col, idx) => {
636+
// col.array parsing
637+
var colInfo = vpCommon.safeString(col.array);
638+
// render column box
636639
tag.appendFormatLine('<div class="{0} {1} {2}" data-idx="{3}" data-colname="{4}" data-dtype="{5}" data-code="{6}" title="{7}"><span>{8}</span></div>'
637-
, VP_DS_SELECT_ITEM, 'select-col', VP_DS_DRAGGABLE, col.location, col.value, col.dtype, col.code, col.label + ': \n' + col.array, col.label);
640+
, VP_DS_SELECT_ITEM, 'select-col', VP_DS_DRAGGABLE, col.location, col.value, col.dtype, col.code, col.label + ': \n' + colInfo, col.label);
638641
});
639642
tag.appendLine('</div>'); // VP_DS_SELECT_BOX
640643
return tag.toString();
@@ -1093,7 +1096,7 @@ define([
10931096
if (this.pageThis) {
10941097
$(this.pageThis.wrapSelector('#' + this.targetId)).val(code);
10951098
$(this.pageThis.wrapSelector('#' + this.targetId)).trigger({
1096-
type: 'subset_run',
1099+
type: 'apps_run',
10971100
title: 'Subset',
10981101
code: code,
10991102
state: this.state,
@@ -1103,7 +1106,7 @@ define([
11031106
} else {
11041107
$(vpCommon.wrapSelector('#' + this.targetId)).val(code);
11051108
$(vpCommon.wrapSelector('#' + this.targetId)).trigger({
1106-
type: 'subset_run',
1109+
type: 'apps_run',
11071110
title: 'Subset',
11081111
code: code,
11091112
state: this.state,
@@ -1394,9 +1397,8 @@ define([
13941397
// that.loadSubsetType(that.state.dataType);
13951398

13961399
if (that.state.dataType == 'DataFrame') {
1397-
var colCode = vpCommon.formatString('_vp_print(_vp_get_columns_list({0}))', varName);
13981400
// get result and load column list
1399-
kernelApi.executePython(colCode, function(result) {
1401+
kernelApi.getColumnList(varName, function(result) {
14001402
var colList = JSON.parse(result);
14011403
colList = colList.map(function(x) {
14021404
return {
@@ -1410,9 +1412,8 @@ define([
14101412
that.generateCode();
14111413
});
14121414

1413-
var rowCode = vpCommon.formatString('_vp_print(_vp_get_rows_list({0}))', varName);
14141415
// get result and load column list
1415-
kernelApi.executePython(rowCode, function(result) {
1416+
kernelApi.getRowList(varName, function(result) {
14161417
var rowList = JSON.parse(result);
14171418
rowList = rowList.map(function(x) {
14181419
return {

src/file_io/instance.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,12 @@ define([
257257
});
258258

259259
// subset applied - variable
260-
$(document).on('change subset_run subset_apply', this.wrapSelector('#vp_instanceVariable'), function(event) {
260+
$(document).on('change apps_run', this.wrapSelector('#vp_instanceVariable'), function(event) {
261261
var val = $(this).val();
262262
that.addStack();
263263
that.updateValue('variable', val);
264264
});
265265

266-
// subset applied - allocate
267-
$(document).on('change subset_run subset_apply', this.wrapSelector('#vp_instanceAllocate'), function(event) {
268-
var val = $(this).val();
269-
that.addStack();
270-
that.updateValue('allocate', val);
271-
});
272-
273266
// codemirror clicked
274267
$(document).on('click', this.wrapSelector('.CodeMirror'), function(event) {
275268
$(that.wrapSelector('.CodeMirror')).removeClass('selected');

0 commit comments

Comments
 (0)