datagrok-tools 4.1.20 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -84
- package/bin/_deprecated/migrate.js +83 -83
- package/bin/_deprecated/upload.js +161 -161
- package/bin/commands/create.js +2 -0
- package/bin/commands/publish.js +31 -25
- package/bin/grok.js +26 -26
- package/bin/utils/utils.js +1 -7
- package/config-template.yaml +11 -11
- package/entity-template/app.js +6 -6
- package/entity-template/connection.json +17 -17
- package/entity-template/function.js +9 -9
- package/entity-template/function.ts +9 -9
- package/entity-template/init.js +4 -4
- package/entity-template/panel.js +11 -11
- package/entity-template/panel.ts +11 -11
- package/entity-template/queries.sql +7 -7
- package/entity-template/sem-type-detector.js +11 -11
- package/entity-template/view-class.js +60 -60
- package/entity-template/view-class.ts +64 -64
- package/entity-template/view.js +10 -10
- package/entity-template/viewer-class.js +23 -23
- package/entity-template/viewer-class.ts +23 -23
- package/entity-template/viewer.js +8 -8
- package/package-template/.eslintrc.json +37 -35
- package/package-template/.vscode/launch.json +15 -15
- package/package-template/.vscode/tasks.json +9 -9
- package/package-template/README.md +2 -2
- package/package-template/detectors.js +9 -9
- package/package-template/gitignore +29 -29
- package/package-template/package.json +23 -22
- package/package-template/src/package-test.js +13 -0
- package/package-template/src/package-test.ts +13 -0
- package/package-template/src/package.js +2 -2
- package/package-template/ts.webpack.config.js +3 -1
- package/package-template/webpack.config.js +27 -26
- package/package.json +51 -51
- package/script-template/javascript.js +6 -6
- package/script-template/julia.jl +8 -8
- package/script-template/node.js +8 -8
- package/script-template/octave.m +8 -8
- package/script-template/python.py +8 -8
- package/script-template/r.R +8 -8
- package/tsconfig.json +71 -71
package/bin/commands/publish.js
CHANGED
|
@@ -56,7 +56,7 @@ function processPackage(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
|
56
56
|
|
|
57
57
|
function _processPackage() {
|
|
58
58
|
_processPackage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(debug, rebuild, host, devKey, packageName, suffix) {
|
|
59
|
-
var timestamps, url, zip, localTimestamps, files, distFiles, contentValidationLog, uploadPromise, log;
|
|
59
|
+
var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, uploadPromise, log;
|
|
60
60
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
61
61
|
while (1) {
|
|
62
62
|
switch (_context3.prev = _context3.next) {
|
|
@@ -108,25 +108,26 @@ function _processPackage() {
|
|
|
108
108
|
_context3.next = 22;
|
|
109
109
|
return (0, _ignoreWalk["default"])({
|
|
110
110
|
path: '.',
|
|
111
|
-
ignoreFiles: ['.npmignore', '.gitignore'],
|
|
111
|
+
ignoreFiles: ['.npmignore', '.gitignore', '.grokignore'],
|
|
112
112
|
includeEmpty: false,
|
|
113
113
|
follow: true
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
case 22:
|
|
117
117
|
files = _context3.sent;
|
|
118
|
+
isWebpack = _fs["default"].existsSync('webpack.config.js');
|
|
118
119
|
|
|
119
|
-
if (!(!rebuild &&
|
|
120
|
-
_context3.next =
|
|
120
|
+
if (!(!rebuild && isWebpack)) {
|
|
121
|
+
_context3.next = 36;
|
|
121
122
|
break;
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
if (!_fs["default"].existsSync('dist/package.js')) {
|
|
125
|
-
_context3.next =
|
|
126
|
+
_context3.next = 32;
|
|
126
127
|
break;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
_context3.next =
|
|
130
|
+
_context3.next = 28;
|
|
130
131
|
return (0, _ignoreWalk["default"])({
|
|
131
132
|
path: './dist',
|
|
132
133
|
ignoreFiles: [],
|
|
@@ -134,21 +135,21 @@ function _processPackage() {
|
|
|
134
135
|
follow: true
|
|
135
136
|
});
|
|
136
137
|
|
|
137
|
-
case
|
|
138
|
+
case 28:
|
|
138
139
|
distFiles = _context3.sent;
|
|
139
140
|
distFiles.forEach(function (df) {
|
|
140
141
|
files.push("dist/".concat(df));
|
|
141
142
|
});
|
|
142
|
-
_context3.next =
|
|
143
|
+
_context3.next = 36;
|
|
143
144
|
break;
|
|
144
145
|
|
|
145
|
-
case
|
|
146
|
+
case 32:
|
|
146
147
|
console.log("File 'dist/package.js' not found. Building the package on the server side...");
|
|
147
148
|
console.log("Next time, please build your package locally with Webpack beforehand");
|
|
148
149
|
console.log("or run `grok publish` with the `--rebuild` option");
|
|
149
150
|
rebuild = true;
|
|
150
151
|
|
|
151
|
-
case
|
|
152
|
+
case 36:
|
|
152
153
|
contentValidationLog = '';
|
|
153
154
|
files.forEach(function (file) {
|
|
154
155
|
var fullPath = file;
|
|
@@ -160,6 +161,11 @@ function _processPackage() {
|
|
|
160
161
|
if (canonicalRelativePath.startsWith('.')) return;
|
|
161
162
|
if (relativePath.startsWith('node_modules')) return;
|
|
162
163
|
if (relativePath.startsWith('dist') && rebuild) return;
|
|
164
|
+
|
|
165
|
+
if (relativePath.startsWith('src') && !rebuild && isWebpack) {
|
|
166
|
+
if (!relativePath.startsWith('src/package')) return;
|
|
167
|
+
}
|
|
168
|
+
|
|
163
169
|
if (relativePath.startsWith('upload.keys.json')) return;
|
|
164
170
|
if (relativePath === 'zip') return;
|
|
165
171
|
|
|
@@ -230,21 +236,21 @@ function _processPackage() {
|
|
|
230
236
|
})["catch"](function (error) {
|
|
231
237
|
console.error(error);
|
|
232
238
|
});
|
|
233
|
-
_context3.next =
|
|
239
|
+
_context3.next = 44;
|
|
234
240
|
return zip.finalize();
|
|
235
241
|
|
|
236
|
-
case
|
|
237
|
-
_context3.prev =
|
|
238
|
-
_context3.next =
|
|
242
|
+
case 44:
|
|
243
|
+
_context3.prev = 44;
|
|
244
|
+
_context3.next = 47;
|
|
239
245
|
return uploadPromise;
|
|
240
246
|
|
|
241
|
-
case
|
|
247
|
+
case 47:
|
|
242
248
|
log = _context3.sent;
|
|
243
249
|
|
|
244
250
|
_fs["default"].unlinkSync('zip');
|
|
245
251
|
|
|
246
252
|
if (!(log['#type'] === 'ApiError')) {
|
|
247
|
-
_context3.next =
|
|
253
|
+
_context3.next = 55;
|
|
248
254
|
break;
|
|
249
255
|
}
|
|
250
256
|
|
|
@@ -252,29 +258,29 @@ function _processPackage() {
|
|
|
252
258
|
console.log(log['innerMessage']);
|
|
253
259
|
return _context3.abrupt("return", 1);
|
|
254
260
|
|
|
255
|
-
case
|
|
261
|
+
case 55:
|
|
256
262
|
console.log(log);
|
|
257
263
|
console.log(contentValidationLog);
|
|
258
264
|
|
|
259
|
-
case
|
|
260
|
-
_context3.next =
|
|
265
|
+
case 57:
|
|
266
|
+
_context3.next = 63;
|
|
261
267
|
break;
|
|
262
268
|
|
|
263
|
-
case
|
|
264
|
-
_context3.prev =
|
|
265
|
-
_context3.t1 = _context3["catch"](
|
|
269
|
+
case 59:
|
|
270
|
+
_context3.prev = 59;
|
|
271
|
+
_context3.t1 = _context3["catch"](44);
|
|
266
272
|
console.error(_context3.t1);
|
|
267
273
|
return _context3.abrupt("return", 1);
|
|
268
274
|
|
|
269
|
-
case
|
|
275
|
+
case 63:
|
|
270
276
|
return _context3.abrupt("return", 0);
|
|
271
277
|
|
|
272
|
-
case
|
|
278
|
+
case 64:
|
|
273
279
|
case "end":
|
|
274
280
|
return _context3.stop();
|
|
275
281
|
}
|
|
276
282
|
}
|
|
277
|
-
}, _callee3, null, [[3, 14], [
|
|
283
|
+
}, _callee3, null, [[3, 14], [44, 59]]);
|
|
278
284
|
}));
|
|
279
285
|
return _processPackage.apply(this, arguments);
|
|
280
286
|
}
|
package/bin/grok.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const argv = require('minimist')(process.argv.slice(2), {alias: {k: 'key'}});
|
|
3
|
-
const help = require('./commands/help').help;
|
|
4
|
-
|
|
5
|
-
const commands = {
|
|
6
|
-
add: require('./commands/add').add,
|
|
7
|
-
api: require('./commands/api').api,
|
|
8
|
-
config: require('./commands/config').config,
|
|
9
|
-
create: require('./commands/create').create,
|
|
10
|
-
publish: require('./commands/publish').publish,
|
|
11
|
-
migrate: require('./_deprecated/migrate').migrate
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const command = argv['_'][0];
|
|
15
|
-
if (command in commands) {
|
|
16
|
-
try {
|
|
17
|
-
if (!commands[command](argv)) {
|
|
18
|
-
console.log(help[command]);
|
|
19
|
-
}
|
|
20
|
-
} catch (err) {
|
|
21
|
-
console.error(err);
|
|
22
|
-
console.log(help[command]);
|
|
23
|
-
}
|
|
24
|
-
} else {
|
|
25
|
-
console.log(help.help);
|
|
26
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const argv = require('minimist')(process.argv.slice(2), {alias: {k: 'key'}});
|
|
3
|
+
const help = require('./commands/help').help;
|
|
4
|
+
|
|
5
|
+
const commands = {
|
|
6
|
+
add: require('./commands/add').add,
|
|
7
|
+
api: require('./commands/api').api,
|
|
8
|
+
config: require('./commands/config').config,
|
|
9
|
+
create: require('./commands/create').create,
|
|
10
|
+
publish: require('./commands/publish').publish,
|
|
11
|
+
migrate: require('./_deprecated/migrate').migrate
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const command = argv['_'][0];
|
|
15
|
+
if (command in commands) {
|
|
16
|
+
try {
|
|
17
|
+
if (!commands[command](argv)) {
|
|
18
|
+
console.log(help[command]);
|
|
19
|
+
}
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.error(err);
|
|
22
|
+
console.log(help[command]);
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
console.log(help.help);
|
|
26
|
+
}
|
package/bin/utils/utils.js
CHANGED
|
@@ -261,13 +261,7 @@ var dgToTsTypeMap = {
|
|
|
261
261
|
dataframe: 'DG.DataFrame',
|
|
262
262
|
column: 'DG.Column',
|
|
263
263
|
column_list: 'string[]',
|
|
264
|
-
file: 'DG.FileInfo'
|
|
265
|
-
// datetime: '',
|
|
266
|
-
// blob: '',
|
|
267
|
-
// map: '',
|
|
268
|
-
// list: '',
|
|
269
|
-
//'list<T>'
|
|
270
|
-
|
|
264
|
+
file: 'DG.FileInfo'
|
|
271
265
|
};
|
|
272
266
|
exports.dgToTsTypeMap = dgToTsTypeMap;
|
|
273
267
|
|
package/config-template.yaml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
servers:
|
|
2
|
-
dev:
|
|
3
|
-
url: 'https://dev.datagrok.ai/api'
|
|
4
|
-
key: ''
|
|
5
|
-
public:
|
|
6
|
-
url: 'https://public.datagrok.ai/api'
|
|
7
|
-
key: ''
|
|
8
|
-
local:
|
|
9
|
-
url: 'http://127.0.0.1:8080/api'
|
|
10
|
-
key: ''
|
|
11
|
-
default: 'public'
|
|
1
|
+
servers:
|
|
2
|
+
dev:
|
|
3
|
+
url: 'https://dev.datagrok.ai/api'
|
|
4
|
+
key: ''
|
|
5
|
+
public:
|
|
6
|
+
url: 'https://public.datagrok.ai/api'
|
|
7
|
+
key: ''
|
|
8
|
+
local:
|
|
9
|
+
url: 'http://127.0.0.1:8080/api'
|
|
10
|
+
key: ''
|
|
11
|
+
default: 'public'
|
package/entity-template/app.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
//name: #{NAME}
|
|
3
|
-
//tags: app
|
|
4
|
-
export function #{NAME}() {
|
|
5
|
-
grok.shell.info('Hello!');
|
|
6
|
-
}
|
|
1
|
+
|
|
2
|
+
//name: #{NAME}
|
|
3
|
+
//tags: app
|
|
4
|
+
export function #{NAME}() {
|
|
5
|
+
grok.shell.info('Hello!');
|
|
6
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "#{NAME}",
|
|
3
|
-
"#type": "DataConnection",
|
|
4
|
-
"parameters": {
|
|
5
|
-
"server": "#{GROK_DB_SERVER}",
|
|
6
|
-
"db": "#{DB_NAME}"
|
|
7
|
-
},
|
|
8
|
-
"credentials" : {
|
|
9
|
-
"parameters": {
|
|
10
|
-
"login": "#{LOGIN}",
|
|
11
|
-
"password": "#{PASSWORD}"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"dataSource": "PostgreSQL",
|
|
15
|
-
"description": "#{DB_NAME} db",
|
|
16
|
-
"tags": ["demo"]
|
|
17
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "#{NAME}",
|
|
3
|
+
"#type": "DataConnection",
|
|
4
|
+
"parameters": {
|
|
5
|
+
"server": "#{GROK_DB_SERVER}",
|
|
6
|
+
"db": "#{DB_NAME}"
|
|
7
|
+
},
|
|
8
|
+
"credentials" : {
|
|
9
|
+
"parameters": {
|
|
10
|
+
"login": "#{LOGIN}",
|
|
11
|
+
"password": "#{PASSWORD}"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dataSource": "PostgreSQL",
|
|
15
|
+
"description": "#{DB_NAME} db",
|
|
16
|
+
"tags": ["demo"]
|
|
17
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
//name: #{NAME}
|
|
3
|
-
//input: string name
|
|
4
|
-
//output: string greeting
|
|
5
|
-
export function #{NAME}(name) {
|
|
6
|
-
let greeting = 'Hello, ' + name;
|
|
7
|
-
grok.shell.info(greeting);
|
|
8
|
-
return greeting;
|
|
9
|
-
}
|
|
1
|
+
|
|
2
|
+
//name: #{NAME}
|
|
3
|
+
//input: string name
|
|
4
|
+
//output: string greeting
|
|
5
|
+
export function #{NAME}(name) {
|
|
6
|
+
let greeting = 'Hello, ' + name;
|
|
7
|
+
grok.shell.info(greeting);
|
|
8
|
+
return greeting;
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
//name: #{NAME}
|
|
3
|
-
//input: string name
|
|
4
|
-
//output: string greeting
|
|
5
|
-
export function #{NAME}(name: string) {
|
|
6
|
-
let greeting = 'Hello, ' + name;
|
|
7
|
-
grok.shell.info(greeting);
|
|
8
|
-
return greeting;
|
|
9
|
-
}
|
|
1
|
+
|
|
2
|
+
//name: #{NAME}
|
|
3
|
+
//input: string name
|
|
4
|
+
//output: string greeting
|
|
5
|
+
export function #{NAME}(name: string) {
|
|
6
|
+
let greeting = 'Hello, ' + name;
|
|
7
|
+
grok.shell.info(greeting);
|
|
8
|
+
return greeting;
|
|
9
|
+
}
|
package/entity-template/init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
//tags: init
|
|
3
|
-
export async function #{NAME}() {
|
|
4
|
-
}
|
|
1
|
+
|
|
2
|
+
//tags: init
|
|
3
|
+
export async function #{NAME}() {
|
|
4
|
+
}
|
package/entity-template/panel.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
//name: #{NAME}
|
|
3
|
-
//description: Creates an info panel
|
|
4
|
-
//tags: panel
|
|
5
|
-
//input: string smiles {semType: Molecule}
|
|
6
|
-
//output: widget result
|
|
7
|
-
//condition: true
|
|
8
|
-
export function #{NAME}(smiles) {
|
|
9
|
-
let mol = ui.div(grok.chem.svgMol(smiles));
|
|
10
|
-
return DG.Widget.fromRoot(mol);
|
|
11
|
-
}
|
|
1
|
+
|
|
2
|
+
//name: #{NAME}
|
|
3
|
+
//description: Creates an info panel
|
|
4
|
+
//tags: panel
|
|
5
|
+
//input: string smiles {semType: Molecule}
|
|
6
|
+
//output: widget result
|
|
7
|
+
//condition: true
|
|
8
|
+
export function #{NAME}(smiles) {
|
|
9
|
+
let mol = ui.div(grok.chem.svgMol(smiles));
|
|
10
|
+
return DG.Widget.fromRoot(mol);
|
|
11
|
+
}
|
package/entity-template/panel.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
//name: #{NAME}
|
|
3
|
-
//description: Creates an info panel
|
|
4
|
-
//tags: panel
|
|
5
|
-
//input: string smiles {semType: Molecule}
|
|
6
|
-
//output: widget result
|
|
7
|
-
//condition: true
|
|
8
|
-
export function #{NAME}(smiles: string) {
|
|
9
|
-
let mol = ui.div(grok.chem.svgMol(smiles));
|
|
10
|
-
return DG.Widget.fromRoot(mol);
|
|
11
|
-
}
|
|
1
|
+
|
|
2
|
+
//name: #{NAME}
|
|
3
|
+
//description: Creates an info panel
|
|
4
|
+
//tags: panel
|
|
5
|
+
//input: string smiles {semType: Molecule}
|
|
6
|
+
//output: widget result
|
|
7
|
+
//condition: true
|
|
8
|
+
export function #{NAME}(smiles: string) {
|
|
9
|
+
let mol = ui.div(grok.chem.svgMol(smiles));
|
|
10
|
+
return DG.Widget.fromRoot(mol);
|
|
11
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
--name: #{NAME}
|
|
3
|
-
--connection: #{CONNECTION}
|
|
4
|
-
--input: int id
|
|
5
|
-
--output: dataframe result
|
|
6
|
-
select * from country where id = @id
|
|
7
|
-
--end
|
|
1
|
+
|
|
2
|
+
--name: #{NAME}
|
|
3
|
+
--connection: #{CONNECTION}
|
|
4
|
+
--input: int id
|
|
5
|
+
--output: dataframe result
|
|
6
|
+
select * from country where id = @id
|
|
7
|
+
--end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
//tags: semTypeDetector
|
|
3
|
-
//input: column col
|
|
4
|
-
//output: string semType
|
|
5
|
-
detect#{PACKAGE_DETECTORS_NAME}(col) {
|
|
6
|
-
if (col.name.startsWith('#{NAME_PREFIX}')) {
|
|
7
|
-
col.semType = '#{NAME}';
|
|
8
|
-
return col.semType;
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
1
|
+
|
|
2
|
+
//tags: semTypeDetector
|
|
3
|
+
//input: column col
|
|
4
|
+
//output: string semType
|
|
5
|
+
detect#{PACKAGE_DETECTORS_NAME}(col) {
|
|
6
|
+
if (col.name.startsWith('#{NAME_PREFIX}')) {
|
|
7
|
+
col.semType = '#{NAME}';
|
|
8
|
+
return col.semType;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import * as grok from 'datagrok-api/grok';
|
|
2
|
-
import * as ui from 'datagrok-api/ui';
|
|
3
|
-
import * as DG from 'datagrok-api/dg';
|
|
4
|
-
|
|
5
|
-
// A sample class from the Notebooks package:
|
|
6
|
-
// https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
|
|
7
|
-
// This class defines a new view for Jupyter Notebooks.
|
|
8
|
-
export class #{NAME} extends DG.ViewBase {
|
|
9
|
-
constructor(params, path) {
|
|
10
|
-
super(params, path);
|
|
11
|
-
this.TYPE = 'Notebook';
|
|
12
|
-
this.PATH = '/notebook';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Override basic methods
|
|
16
|
-
get type() {
|
|
17
|
-
return this.TYPE;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
get helpUrl() {
|
|
21
|
-
return '/help/develop/jupyter-notebook.md';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get name() {
|
|
25
|
-
return 'Notebook';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get path() {
|
|
29
|
-
return `${this.PATH}/${this.notebookId}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Icon
|
|
33
|
-
getIcon() {
|
|
34
|
-
let img = document.createElement('img');
|
|
35
|
-
img.src = '/images/entities/jupyter.png';
|
|
36
|
-
img.height = 18;
|
|
37
|
-
img.width = 18;
|
|
38
|
-
return img;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// View state serialization/deserialization
|
|
42
|
-
saveStateMap() {
|
|
43
|
-
return {'notebookId': this.notebookId};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
loadStateMap(stateMap) {
|
|
47
|
-
open(stateMap['notebookId']);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// URL path handler
|
|
51
|
-
handlePath(path) {
|
|
52
|
-
let id = path.replace(`${this.PATH}/`, '');
|
|
53
|
-
open(id);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// URL path checker
|
|
57
|
-
acceptsPath(path) {
|
|
58
|
-
return path.startsWith(this.PATH);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
|
+
import * as ui from 'datagrok-api/ui';
|
|
3
|
+
import * as DG from 'datagrok-api/dg';
|
|
4
|
+
|
|
5
|
+
// A sample class from the Notebooks package:
|
|
6
|
+
// https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
|
|
7
|
+
// This class defines a new view for Jupyter Notebooks.
|
|
8
|
+
export class #{NAME} extends DG.ViewBase {
|
|
9
|
+
constructor(params, path) {
|
|
10
|
+
super(params, path);
|
|
11
|
+
this.TYPE = 'Notebook';
|
|
12
|
+
this.PATH = '/notebook';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Override basic methods
|
|
16
|
+
get type() {
|
|
17
|
+
return this.TYPE;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get helpUrl() {
|
|
21
|
+
return '/help/develop/jupyter-notebook.md';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get name() {
|
|
25
|
+
return 'Notebook';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get path() {
|
|
29
|
+
return `${this.PATH}/${this.notebookId}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Icon
|
|
33
|
+
getIcon() {
|
|
34
|
+
let img = document.createElement('img');
|
|
35
|
+
img.src = '/images/entities/jupyter.png';
|
|
36
|
+
img.height = 18;
|
|
37
|
+
img.width = 18;
|
|
38
|
+
return img;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// View state serialization/deserialization
|
|
42
|
+
saveStateMap() {
|
|
43
|
+
return {'notebookId': this.notebookId};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
loadStateMap(stateMap) {
|
|
47
|
+
open(stateMap['notebookId']);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// URL path handler
|
|
51
|
+
handlePath(path) {
|
|
52
|
+
let id = path.replace(`${this.PATH}/`, '');
|
|
53
|
+
open(id);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// URL path checker
|
|
57
|
+
acceptsPath(path) {
|
|
58
|
+
return path.startsWith(this.PATH);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import * as grok from 'datagrok-api/grok';
|
|
2
|
-
import * as ui from 'datagrok-api/ui';
|
|
3
|
-
import * as DG from 'datagrok-api/dg';
|
|
4
|
-
|
|
5
|
-
// A sample class from the Notebooks package:
|
|
6
|
-
// https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
|
|
7
|
-
// This class defines a new view for Jupyter Notebooks.
|
|
8
|
-
export class #{NAME} extends DG.ViewBase {
|
|
9
|
-
TYPE: string;
|
|
10
|
-
PATH: string;
|
|
11
|
-
notebookId: any;
|
|
12
|
-
|
|
13
|
-
constructor(params: object | null, path: string) {
|
|
14
|
-
super(params, path);
|
|
15
|
-
this.TYPE = 'Notebook';
|
|
16
|
-
this.PATH = '/notebook';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Override basic methods
|
|
20
|
-
get type() {
|
|
21
|
-
return this.TYPE;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
get helpUrl() {
|
|
25
|
-
return '/help/compute/jupyter-notebook.md';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get name() {
|
|
29
|
-
return 'Notebook';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get path() {
|
|
33
|
-
return `${this.PATH}/${this.notebookId}`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Icon
|
|
37
|
-
getIcon() {
|
|
38
|
-
let img = document.createElement('img');
|
|
39
|
-
img.src = '/images/entities/jupyter.png';
|
|
40
|
-
img.height = 18;
|
|
41
|
-
img.width = 18;
|
|
42
|
-
return img;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// View state serialization/deserialization
|
|
46
|
-
saveStateMap() {
|
|
47
|
-
return {'notebookId': this.notebookId};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
loadStateMap(stateMap: { [x: string]: string }) {
|
|
51
|
-
open(stateMap['notebookId']);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// URL path handler
|
|
55
|
-
handlePath(path: string) {
|
|
56
|
-
let id = path.replace(`${this.PATH}/`, '');
|
|
57
|
-
open(id);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// URL path checker
|
|
61
|
-
acceptsPath(path: string) {
|
|
62
|
-
return path.startsWith(this.PATH);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
import * as grok from 'datagrok-api/grok';
|
|
2
|
+
import * as ui from 'datagrok-api/ui';
|
|
3
|
+
import * as DG from 'datagrok-api/dg';
|
|
4
|
+
|
|
5
|
+
// A sample class from the Notebooks package:
|
|
6
|
+
// https://github.com/datagrok-ai/public/tree/master/packages/Notebooks
|
|
7
|
+
// This class defines a new view for Jupyter Notebooks.
|
|
8
|
+
export class #{NAME} extends DG.ViewBase {
|
|
9
|
+
TYPE: string;
|
|
10
|
+
PATH: string;
|
|
11
|
+
notebookId: any;
|
|
12
|
+
|
|
13
|
+
constructor(params: object | null, path: string) {
|
|
14
|
+
super(params, path);
|
|
15
|
+
this.TYPE = 'Notebook';
|
|
16
|
+
this.PATH = '/notebook';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Override basic methods
|
|
20
|
+
get type() {
|
|
21
|
+
return this.TYPE;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get helpUrl() {
|
|
25
|
+
return '/help/compute/jupyter-notebook.md';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get name() {
|
|
29
|
+
return 'Notebook';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get path() {
|
|
33
|
+
return `${this.PATH}/${this.notebookId}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Icon
|
|
37
|
+
getIcon() {
|
|
38
|
+
let img = document.createElement('img');
|
|
39
|
+
img.src = '/images/entities/jupyter.png';
|
|
40
|
+
img.height = 18;
|
|
41
|
+
img.width = 18;
|
|
42
|
+
return img;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// View state serialization/deserialization
|
|
46
|
+
saveStateMap() {
|
|
47
|
+
return {'notebookId': this.notebookId};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
loadStateMap(stateMap: { [x: string]: string }) {
|
|
51
|
+
open(stateMap['notebookId']);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// URL path handler
|
|
55
|
+
handlePath(path: string) {
|
|
56
|
+
let id = path.replace(`${this.PATH}/`, '');
|
|
57
|
+
open(id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// URL path checker
|
|
61
|
+
acceptsPath(path: string) {
|
|
62
|
+
return path.startsWith(this.PATH);
|
|
63
|
+
}
|
|
64
|
+
}
|