Skip to content

Commit 047dd1b

Browse files
author
minjk-bl
committed
Fix Instance app's bug - not able to access subset button
1 parent 78fd1c9 commit 047dd1b

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

visualpython/html/m_apps/instance.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="vp-instance-body">
33
<div class="vp-instance-left-box vp-instance-base cm-s-ipython">
44
<div class="vp-instance-target-box vp-grid-col-110">
5-
<label for="vp_instanceTarget" class="vp-instance-label variable">Target variable</label>
5+
<label for="vp_instanceTarget" class="vp-instance-label variable vp-orange-text">Target variable</label>
66
<input type="text" id="vp_instanceTarget" placeholder="Select variable"/>
77
</div>
88
<div class="vp-instance-box variable">

visualpython/js/com/component/InstanceEditor.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,20 +523,23 @@ define([
523523
$(that.wrapSelector('.' + VP_INS_PARAMETER)).prop('disabled', true);
524524
}
525525
}
526+
527+
// callback
528+
if (callback) {
529+
callback(varObj);
530+
}
526531
}).catch(function(resultObj) {
527532
let { result } = resultObj;
528533
// show alert if this is visible
529534
if (that.pageThis.isHidden() == false && that.config.showAlert == true) {
530535
com_util.renderAlertModal(result.ename + ': ' + result.evalue);
531536
}
532-
}).finally(function() {
533537
// callback
534538
if (callback) {
535-
callback('');
539+
callback({});
536540
}
537541
});
538542

539-
540543
}
541544
show() {
542545
$(this.wrapSelector()).show();

visualpython/js/m_apps/Instance.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ define([
3333
super._init();
3434
/** Write codes executed before rendering */
3535
this.config.dataview = false;
36-
this.config.size = { width: 1064, height: 550 };
36+
this.config.sizeLevel = 4;
3737
this.config.checkModules = ['pd'];
3838

3939
this.state = {
@@ -197,11 +197,13 @@ define([
197197
allowModule: true,
198198
finish: function(value, dtype) {
199199
$(that.wrapSelector('#vp_instanceTarget')).trigger({type: 'change', value: value});
200+
that.updateValue(value);
201+
that.reloadInsEditor();
200202
},
201203
select: function(value, dtype) {
202204
$(that.wrapSelector('#vp_instanceTarget')).trigger({type: 'change', value: value});
203-
// that.updateValue(value);
204-
// that.reloadInsEditor();
205+
that.updateValue(value);
206+
that.reloadInsEditor();
205207
}
206208
});
207209
$(page).find('#vp_instanceTarget').replaceWith(targetSelector.toTagString());
@@ -211,7 +213,6 @@ define([
211213
});
212214
$(page).find('#vp_instanceAllocate').replaceWith(allocateSelector.toTagString());
213215

214-
215216
return page;
216217
}
217218

@@ -373,6 +374,7 @@ define([
373374
reloadInsEditor() {
374375
var that = this;
375376
var tempPointer = this.pointer;
377+
this.subsetEditor.disableButton();
376378
var callbackFunction = function (varObj) {
377379
var varType = varObj.type;
378380

@@ -382,8 +384,6 @@ define([
382384
let nowCode = (cmObj && cmObj.cm)?cmObj.cm.getValue():'';
383385
that.subsetEditor.state.pandasObject = nowCode;
384386
that.subsetEditor.enableButton();
385-
} else {
386-
that.subsetEditor.disableButton();
387387
}
388388
};
389389

0 commit comments

Comments
 (0)