Skip to content

Commit 1004447

Browse files
author
minjk-bl
committed
Edit auto-update on JupyterLab and Fix default-state of open vp initially on Jupyter Notebook
1 parent aec2fb3 commit 1004447

File tree

1 file changed

+5
-34
lines changed

1 file changed

+5
-34
lines changed

visualpython/js/loadVisualpython.js

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -206,38 +206,6 @@ define([
206206
}
207207
}
208208

209-
var _checkVersion = function() {
210-
// check version timestamp
211-
let nowDate = new Date();
212-
vpConfig.getData('version_timestamp', 'vpcfg').then(function(data) {
213-
let doCheckVersion = false;
214-
if (data == undefined) {
215-
// no timestamp, check version
216-
doCheckVersion = true;
217-
} else if (data != '') {
218-
let lastCheck = new Date(parseInt(data));
219-
let diffCheck_now = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, nowDate.getDate());
220-
let diffCheck_last = new Date(lastCheck.getFullYear(), lastCheck.getMonth() + 1, lastCheck.getDate());
221-
222-
let diff = Math.abs(diffCheck_now.getTime() - diffCheck_last.getTime());
223-
diff = Math.ceil(diff / (1000 * 3600 * 24));
224-
225-
if (diff >= 1) {
226-
// if More than 1 day passed, check version
227-
doCheckVersion = true;
228-
}
229-
}
230-
231-
// check version and update version_timestamp
232-
if (doCheckVersion == true) {
233-
vpConfig.checkVpVersion(true);
234-
}
235-
236-
}).catch(function(err) {
237-
vpLog.display(VP_LOG_TYPE.ERROR, err);
238-
})
239-
}
240-
241209
//========================================================================
242210
// External call function
243211
//========================================================================
@@ -290,9 +258,10 @@ define([
290258
_addToolBarVpButton();
291259
}
292260
_loadVpResource(cfg);
293-
_checkVersion();
261+
vpConfig.checkVersionTimestamp();
294262

295-
if (cfg.vp_section_display && vpFrame) {
263+
if ((cfg.vp_section_display && vpFrame)
264+
|| vpConfig.extensionType === 'colab') { // CHROME: default to display vp
296265
vpFrame.openVp();
297266
}
298267

@@ -319,11 +288,13 @@ define([
319288
if (newValue.sessionContext.isReady) {
320289
vpLog.display(VP_LOG_TYPE.LOG, 'vp operations for kernel ready...');
321290
vpConfig.readKernelFunction();
291+
vpConfig.checkVersionTimestamp();
322292
}
323293
newValue.sessionContext._connectionStatusChanged.connect(function(s2, status) {
324294
if (status === 'connected') {
325295
vpLog.display(VP_LOG_TYPE.LOG, 'vp operations for kernel ready...');
326296
vpConfig.readKernelFunction();
297+
vpConfig.checkVersionTimestamp();
327298
}
328299
});
329300
} else {

0 commit comments

Comments
 (0)