@kumologica/sdk 3.2.1 → 3.2.2
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/cli/commands/export-commands/github-commands/aws.js +18 -4
- package/package.json +4 -4
- package/src/app/lib/aws/index.js +1 -0
- package/src/app/lib/github/index.js +7 -60
- package/src/app/lib/serverless/index.js +13 -8
- package/src/app/ui/editor-client/public/red/red.js +3 -830
- package/src/app/ui/editor-client/public/red/red.min.js +1 -1
- package/src/app/ui/editor-client/public/red/style.min.css +1 -1
- package/src/app/ui/editor-client/src/js/ui/palette-nodes.js +0 -1
- package/src/app/ui/editor-client/src/js/ui/sidebar.js +1 -1
- package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +1 -1
- package/src/app/ui/editor-client/src/sass/style.scss +0 -1
|
@@ -21191,7 +21191,7 @@ RED.view.tools = (function() {
|
|
|
21191
21191
|
RED.sidebar.info.init();
|
|
21192
21192
|
RED.sidebar.test.init();
|
|
21193
21193
|
RED.sidebar.git.init();
|
|
21194
|
-
RED.sidebar.kumohub.init();
|
|
21194
|
+
//RED.sidebar.kumohub.init();
|
|
21195
21195
|
RED.sidebar.azure.init();
|
|
21196
21196
|
RED.sidebar.awsDeploy.init();
|
|
21197
21197
|
|
|
@@ -22006,7 +22006,7 @@ RED.view.tools = (function() {
|
|
|
22006
22006
|
<span class="option-disabled">Generate script...</span>
|
|
22007
22007
|
<span id="exportCloudFormationBtn" class="option">AWS CloudFormation</span>
|
|
22008
22008
|
<span id="exportServerlessBtn" class="option">Serverless</span>
|
|
22009
|
-
<span id="exportGithubActionBtn" class="option">Github Action Workflow</span>
|
|
22009
|
+
<span id="exportGithubActionBtn" class="option">Github Action Workflow + Cloudformation</span>
|
|
22010
22010
|
</div>
|
|
22011
22011
|
</div>
|
|
22012
22012
|
</div>
|
|
@@ -25286,833 +25286,7 @@ RED.sidebar.nodeinfo = (function(){
|
|
|
25286
25286
|
refreshTab,
|
|
25287
25287
|
};
|
|
25288
25288
|
})();
|
|
25289
|
-
;RED.sidebar.
|
|
25290
|
-
marked.setOptions({
|
|
25291
|
-
renderer: new marked.Renderer(),
|
|
25292
|
-
gfm: true,
|
|
25293
|
-
tables: true,
|
|
25294
|
-
breaks: false,
|
|
25295
|
-
pedantic: false,
|
|
25296
|
-
sanitize: true,
|
|
25297
|
-
smartLists: true,
|
|
25298
|
-
smartypants: false,
|
|
25299
|
-
});
|
|
25300
|
-
|
|
25301
|
-
var content;
|
|
25302
|
-
var sections;
|
|
25303
|
-
var functionSection;
|
|
25304
|
-
var environmentSection;
|
|
25305
|
-
var initialised = false;
|
|
25306
|
-
var parameters;
|
|
25307
|
-
var SELECT_KUMOHUB_PROFILE = 'Select Kumohub profile...';
|
|
25308
|
-
var DEFINE_KUMOHUB_PROFILE = 'Define Kumohub profile';
|
|
25309
|
-
let workspaces; // workspaces from kumohub.io
|
|
25310
|
-
// store for workspace, storage, policy from profile before kumohub login
|
|
25311
|
-
let profileWorkspace;
|
|
25312
|
-
let profileStage;
|
|
25313
|
-
let profilePolicy;
|
|
25314
|
-
|
|
25315
|
-
const DEPLOYING = 'DEPLOYING';
|
|
25316
|
-
const NOTDEPLOYING = 'NOTDEPLOYING';
|
|
25317
|
-
let deployState = NOTDEPLOYING;
|
|
25318
|
-
|
|
25319
|
-
function initCss() {
|
|
25320
|
-
$('<style>')
|
|
25321
|
-
.text(
|
|
25322
|
-
`
|
|
25323
|
-
select {
|
|
25324
|
-
outline: 1.5px solid #ccc;
|
|
25325
|
-
}
|
|
25326
|
-
select:focus {
|
|
25327
|
-
outline: 1.5px solid #ccc;
|
|
25328
|
-
outline-offset: 0px;
|
|
25329
|
-
}
|
|
25330
|
-
.invalid {
|
|
25331
|
-
border: 1px solid red;
|
|
25332
|
-
}
|
|
25333
|
-
|
|
25334
|
-
.valid {
|
|
25335
|
-
border: 1px solid green;
|
|
25336
|
-
}
|
|
25337
|
-
datalist {
|
|
25338
|
-
max-height: 300px;
|
|
25339
|
-
overflow-y: auto !important;
|
|
25340
|
-
}
|
|
25341
|
-
.editor-button-xsmall {
|
|
25342
|
-
height: 16px;
|
|
25343
|
-
min-width: 16px;
|
|
25344
|
-
line-height: 14px;
|
|
25345
|
-
font-size: 10px;
|
|
25346
|
-
border-radius: 2px;
|
|
25347
|
-
padding: 0 2px;
|
|
25348
|
-
}
|
|
25349
|
-
`
|
|
25350
|
-
)
|
|
25351
|
-
.appendTo(document.head);
|
|
25352
|
-
}
|
|
25353
|
-
|
|
25354
|
-
function initHTML() {
|
|
25355
|
-
initCss();
|
|
25356
|
-
content = document.createElement('div');
|
|
25357
|
-
content.className = 'sidebar-kumohub';
|
|
25358
|
-
|
|
25359
|
-
RED.actions.add('core:show-kumohub-tab', show);
|
|
25360
|
-
|
|
25361
|
-
var stackContainer = $('<div>', {
|
|
25362
|
-
class: 'sidebar-node-info-stack',
|
|
25363
|
-
}).appendTo(content);
|
|
25364
|
-
|
|
25365
|
-
let headerContentHtml = `
|
|
25366
|
-
<div class="sidebar-title-wrapper">
|
|
25367
|
-
<span>Deploy: Kumohub</span>
|
|
25368
|
-
</div>
|
|
25369
|
-
<div id="kumohub-sidebar-header" class="sidebar-header">
|
|
25370
|
-
<div id="kumohub-instrumentation" class="node-info">
|
|
25371
|
-
<div id="kumohub-profiles-wrapper">
|
|
25372
|
-
<span style="padding-left: 3px">Profiles</span>
|
|
25373
|
-
<select id="kumohub-sidebar-profiles" class="palette-textinput" style="padding: 0px;">
|
|
25374
|
-
<option value="Select Kumohub profile..." style="color:#3988CB !important">Click to select one...</option>
|
|
25375
|
-
</select>
|
|
25376
|
-
</div>
|
|
25377
|
-
|
|
25378
|
-
<div id="kumohub-wrapper">
|
|
25379
|
-
<!-- connect btn -->
|
|
25380
|
-
<div>
|
|
25381
|
-
<a id="kumohub-sidebar-connect-btn" class="sidebar-header-button" href="#">
|
|
25382
|
-
<i id="kumohub-sidebar-connect-icon" class="fa fa-circle" style="color: red"></i>
|
|
25383
|
-
Connect
|
|
25384
|
-
</a>
|
|
25385
|
-
</div>
|
|
25386
|
-
|
|
25387
|
-
<!-- deploy btn -->
|
|
25388
|
-
<div style="margin-right: 4px;">
|
|
25389
|
-
<a id="kumohub-sidebar-deploy-btn" class="sidebar-header-button" href="#">
|
|
25390
|
-
<i id="kumohub-sidebar-deploy-icon" class="fa fa-cloud-upload"></i>
|
|
25391
|
-
Deploy
|
|
25392
|
-
</a>
|
|
25393
|
-
</div>
|
|
25394
|
-
|
|
25395
|
-
<!-- export btn -->
|
|
25396
|
-
<div id="kumohub-options-dropdown">
|
|
25397
|
-
<a id="kumohub-sidebar-export-btn" class="sidebar-header-button" href="#">
|
|
25398
|
-
<i class="fa fa-ellipsis-h"></i>
|
|
25399
|
-
</a>
|
|
25400
|
-
</div>
|
|
25401
|
-
<div id="kumohub-options-dropdown-content">
|
|
25402
|
-
<span id="kumohub-buildZipBtn" class="option">Export as Zip</span>
|
|
25403
|
-
<!--span id="kumohub-exportServerlessBtn" class="option">Serverless</span-->
|
|
25404
|
-
</div>
|
|
25405
|
-
</div>
|
|
25406
|
-
</div>
|
|
25407
|
-
<table hidden id="kumohub-sidebar-error" class="node-info" style="margin: 0px;">
|
|
25408
|
-
<tr>
|
|
25409
|
-
<td style="border: 0px solid white; padding: 3px; width: 100%;">
|
|
25410
|
-
<p style="font-size: 12px; margin: 0px; text-align: center; color:red;"><span>Kumohub profile has not been configured</span></p>
|
|
25411
|
-
</td>
|
|
25412
|
-
|
|
25413
|
-
<td style="border: 0px solid white; padding: 3px;">
|
|
25414
|
-
<a id="kumohub-sidebar-error-help-btn" class="editor-button editor-button-xsmall" href="https://docs.kumologica.com/docs/guide/GettingStarted.html#installation" target="_blank">
|
|
25415
|
-
<i class="fa fa-question"></i>
|
|
25416
|
-
</a>
|
|
25417
|
-
</td>
|
|
25418
|
-
|
|
25419
|
-
<td style="border: 0px solid white; padding: 3px 6px 3px 3px;">
|
|
25420
|
-
<a id="kumohub-sidebar-error-close-btn" class="editor-button editor-button-xsmall" href="#">
|
|
25421
|
-
<i class="fa fa-times"></i></a>
|
|
25422
|
-
</td>
|
|
25423
|
-
</tr>
|
|
25424
|
-
</table>
|
|
25425
|
-
</div>
|
|
25426
|
-
`;
|
|
25427
|
-
|
|
25428
|
-
$(headerContentHtml).appendTo(stackContainer);
|
|
25429
|
-
|
|
25430
|
-
let bodyContainer = $(`<div id="kumohub-sidebar-body" style="display:none"></div>`);
|
|
25431
|
-
bodyContainer.appendTo(stackContainer);
|
|
25432
|
-
|
|
25433
|
-
sections = RED.stack
|
|
25434
|
-
.create({
|
|
25435
|
-
container: bodyContainer,
|
|
25436
|
-
})
|
|
25437
|
-
.hide();
|
|
25438
|
-
|
|
25439
|
-
// function section
|
|
25440
|
-
functionSection = sections.add({
|
|
25441
|
-
title: 'function',
|
|
25442
|
-
collapsible: true,
|
|
25443
|
-
});
|
|
25444
|
-
functionSection.expand();
|
|
25445
|
-
|
|
25446
|
-
// environment section
|
|
25447
|
-
environmentSection = sections.add({
|
|
25448
|
-
title: 'environment',
|
|
25449
|
-
collapsible: true,
|
|
25450
|
-
});
|
|
25451
|
-
//environmentSection.expand();
|
|
25452
|
-
|
|
25453
|
-
RED.sidebar.addTab({
|
|
25454
|
-
id: 'kumohub',
|
|
25455
|
-
label: 'Kumohub',
|
|
25456
|
-
name: 'Kumohub Deployer',
|
|
25457
|
-
iconClass: 'fa fa-cloud',
|
|
25458
|
-
action: 'core:show-kumohub-tab',
|
|
25459
|
-
content: content,
|
|
25460
|
-
pinned: true,
|
|
25461
|
-
enableOnEdit: true,
|
|
25462
|
-
onchange: onchange,
|
|
25463
|
-
onsame: onsame
|
|
25464
|
-
});
|
|
25465
|
-
|
|
25466
|
-
// Function content init
|
|
25467
|
-
let functionSectionHtml = `
|
|
25468
|
-
<table class="node-info">
|
|
25469
|
-
<tr class="node-info-node-row">
|
|
25470
|
-
<td>Service Name</td>
|
|
25471
|
-
<td colspan="2" style="background: white"><input style="width:100%" id="kumohub-fn-name" class="palette-textinput" pattern="[a-zA-Z0-9-_]{1,64}" type="text"></td>
|
|
25472
|
-
</tr>
|
|
25473
|
-
<tr class="node-info-node-row">
|
|
25474
|
-
<td>Description</td>
|
|
25475
|
-
<td colspan="2" style="background: white"><input style="width:100%" id="kumohub-fn-description" class="palette-textinput" type="text"></td>
|
|
25476
|
-
</tr>
|
|
25477
|
-
<tr class="node-info-node-row">
|
|
25478
|
-
<td>Memory (MB)</td>
|
|
25479
|
-
<td colspan="2" style="background: white"><input id="kumohub-fn-memory" class="palette-textinput" type="number" min="128" max="1536"></td>
|
|
25480
|
-
</tr>
|
|
25481
|
-
<tr class="node-info-node-row">
|
|
25482
|
-
<td>Timeout (s)</td>
|
|
25483
|
-
<td colspan="2" style="background: white"><input id="kumohub-fn-timeout" class="palette-textinput" type="number" min="5" max="900"></td>
|
|
25484
|
-
</tr>
|
|
25485
|
-
<tr class="node-info-node-row">
|
|
25486
|
-
<td>Workspace</td>
|
|
25487
|
-
<td colspan="2" style="background: white">
|
|
25488
|
-
<select type="text" class="palette-textinput" id="kumohub-fn-workspace" style="float: left; width: 100%; padding: 0px; outline: 0px solid #ccc; ">
|
|
25489
|
-
<option value="UNDEFINED" selected="true">Undefined</option>
|
|
25490
|
-
</select>
|
|
25491
|
-
</td>
|
|
25492
|
-
</tr>
|
|
25493
|
-
|
|
25494
|
-
<tr class="node-info-node-row">
|
|
25495
|
-
<td>Stage</td>
|
|
25496
|
-
<td colspan="2" style="background: white">
|
|
25497
|
-
<select type="text" class="palette-textinput" id="kumohub-fn-stage" style="float: left; width: 100%; padding: 0px; outline: 0px solid #ccc; ">
|
|
25498
|
-
<option value="UNDEFINED" selected="true">Undefined</option>
|
|
25499
|
-
</select>
|
|
25500
|
-
</td>
|
|
25501
|
-
</tr>
|
|
25502
|
-
|
|
25503
|
-
<tr class="node-info-node-row">
|
|
25504
|
-
<td>Policy</td>
|
|
25505
|
-
<td colspan="2" style="background: white">
|
|
25506
|
-
<select type="text" class="palette-textinput" id="kumohub-fn-policy" style="float: left; width: 100%; padding: 0px; outline: 0px solid #ccc; ">
|
|
25507
|
-
<option value="Public" selected="true">Public</option>
|
|
25508
|
-
</select>
|
|
25509
|
-
</td>
|
|
25510
|
-
</tr>
|
|
25511
|
-
</table>
|
|
25512
|
-
`;
|
|
25513
|
-
$(functionSectionHtml).appendTo(functionSection.content);
|
|
25514
|
-
functionSection.container.show();
|
|
25515
|
-
|
|
25516
|
-
// Environment section init
|
|
25517
|
-
let environmentSectionHtml = `
|
|
25518
|
-
<div style="display:flex; flex-direction: column; justify-content: flex-start;">
|
|
25519
|
-
<div style="display:flex; justify-content: flex-end; padding:6px">
|
|
25520
|
-
<a id="kumohub-add-environment-variable" href="#" class="editor-button editor-button-small red-ui-editableList-addButton">
|
|
25521
|
-
<i class="fa fa-plus"></i> Add
|
|
25522
|
-
</a>
|
|
25523
|
-
</div>
|
|
25524
|
-
<div id="kumohub-fn-env" style="display:flex; flex-direction: column">
|
|
25525
|
-
<table id="kumohub-fn-env-table" class="node-info" style="table-layout: fixed">
|
|
25526
|
-
|
|
25527
|
-
</table>
|
|
25528
|
-
</div>
|
|
25529
|
-
</div>
|
|
25530
|
-
`;
|
|
25531
|
-
$(environmentSectionHtml).appendTo(environmentSection.content);
|
|
25532
|
-
environmentSection.container.show();
|
|
25533
|
-
|
|
25534
|
-
// Tooltips
|
|
25535
|
-
RED.popover.tooltip($('#kumohub-sidebar-deploy-btn'), 'Deploy to Kumohub');
|
|
25536
|
-
RED.popover.tooltip($('#kumohub-options-dropdown'), 'Other Kumohub Operations');
|
|
25537
|
-
RED.popover.tooltip($('#kumohub-sidebar-connect-btn'), 'Connect to Kumohub');
|
|
25538
|
-
}
|
|
25539
|
-
|
|
25540
|
-
function onchange(){
|
|
25541
|
-
RED.actions.invoke('core:show-sidebar');
|
|
25542
|
-
}
|
|
25543
|
-
|
|
25544
|
-
function onsame(){
|
|
25545
|
-
RED.actions.invoke('core:hide-sidebar');
|
|
25546
|
-
}
|
|
25547
|
-
|
|
25548
|
-
function sanitizeLambdaName(name) {
|
|
25549
|
-
return name
|
|
25550
|
-
.replace('.json', '')
|
|
25551
|
-
.trim()
|
|
25552
|
-
.replace(/^@/, '')
|
|
25553
|
-
.replace(/[^a-zA-Z0-9-_]/g, '_')
|
|
25554
|
-
.substr(0, 140);
|
|
25555
|
-
}
|
|
25556
|
-
|
|
25557
|
-
function setLambdaName(name) {
|
|
25558
|
-
$('#kumohub-fn-name').val(sanitizeLambdaName(name));
|
|
25559
|
-
}
|
|
25560
|
-
|
|
25561
|
-
function setValues(params) {
|
|
25562
|
-
// storing for setting it up after login to kumohub
|
|
25563
|
-
profileWorkspace = params.workspace || params.account;
|
|
25564
|
-
profileStage = params.stage;
|
|
25565
|
-
profilePolicy = params.policy;
|
|
25566
|
-
console.log(`profile stored: ${profileWorkspace} - ${profileStage} - ${profilePolicy}`);
|
|
25567
|
-
|
|
25568
|
-
if (!initialised) {
|
|
25569
|
-
parameters = params;
|
|
25570
|
-
return;
|
|
25571
|
-
}
|
|
25572
|
-
|
|
25573
|
-
if (params && (params.name || params.functionName)) {
|
|
25574
|
-
setLambdaName(params.name || params.functionName || params["service-name"]);
|
|
25575
|
-
} else {
|
|
25576
|
-
if (window.__kumologica.settings.projectFlowName) {
|
|
25577
|
-
setLambdaName(window.__kumologica.settings.projectFlowName);
|
|
25578
|
-
}
|
|
25579
|
-
}
|
|
25580
|
-
if (!params) {
|
|
25581
|
-
return;
|
|
25582
|
-
}
|
|
25583
|
-
if (params.profile) {
|
|
25584
|
-
setProfile(params.profile);
|
|
25585
|
-
}
|
|
25586
|
-
if (params.description) {
|
|
25587
|
-
$('#kumohub-fn-description').val(params.description);
|
|
25588
|
-
}
|
|
25589
|
-
if (params.memory) {
|
|
25590
|
-
$('#kumohub-fn-memory').val(params.memory);
|
|
25591
|
-
}
|
|
25592
|
-
if (params.timeout) {
|
|
25593
|
-
$('#kumohub-fn-timeout').val(params.timeout);
|
|
25594
|
-
}
|
|
25595
|
-
if (params.account) {
|
|
25596
|
-
$('#kumohub-fn-workspace').val(params.workspace || params.account);
|
|
25597
|
-
fillStages(params.workspace || params.account);
|
|
25598
|
-
}
|
|
25599
|
-
if (params.workspace) {
|
|
25600
|
-
$('#kumohub-fn-workspace').val(params.workspace);
|
|
25601
|
-
fillStages(params.workspace);
|
|
25602
|
-
}
|
|
25603
|
-
|
|
25604
|
-
if (params.stage) {
|
|
25605
|
-
$('#kumohub-fn-stage').val(params.stage);
|
|
25606
|
-
}
|
|
25607
|
-
if (params.policy) {
|
|
25608
|
-
$('#kumohub-fn-policy').val(params.policy);
|
|
25609
|
-
}
|
|
25610
|
-
|
|
25611
|
-
if (params.environment && params.environment.length > 0) {
|
|
25612
|
-
let environmentTable = $('#kumohub-fn-env-table');
|
|
25613
|
-
|
|
25614
|
-
params.environment.forEach(function (e, i) {
|
|
25615
|
-
$(`
|
|
25616
|
-
<tr class="node-info-node-row">
|
|
25617
|
-
<td style="background: white; width:46%"><input id="kumohub-fn-env-key" class="palette-textinput" type="text" placeholder="key" style="width:100%" value="${e.key}"></td>
|
|
25618
|
-
<td style="background: white; width:46%"><input id="kumohub-fn-env-val" class="palette-textinput" type="text" placeholder="value" style="width:100%" value="${e.value}"></td>
|
|
25619
|
-
<td id="kumohub-fn-env-row" style="text-align:center; width:8%" class="removeRow"><i class="fa fa-minus"></i></td>
|
|
25620
|
-
</tr>`).appendTo(environmentTable);
|
|
25621
|
-
});
|
|
25622
|
-
}
|
|
25623
|
-
}
|
|
25624
|
-
|
|
25625
|
-
function getValues() {
|
|
25626
|
-
// Basic information
|
|
25627
|
-
let fnProfile = getProfile();
|
|
25628
|
-
let fnName = $('#kumohub-fn-name').val();
|
|
25629
|
-
let fnDescription = $('#kumohub-fn-description').val();
|
|
25630
|
-
let fnMemory = $('#kumohub-fn-memory').val();
|
|
25631
|
-
let fnTimeout = $('#kumohub-fn-timeout').val();
|
|
25632
|
-
let fnStage = $('#kumohub-fn-stage').val();
|
|
25633
|
-
let fnAccount = $('#kumohub-fn-account').val();
|
|
25634
|
-
let fnWorkspace = $('#kumohub-fn-workspace').val();
|
|
25635
|
-
let fnPolicy = $('#kumohub-fn-policy').val();
|
|
25636
|
-
|
|
25637
|
-
// Environment variables
|
|
25638
|
-
let environment = [];
|
|
25639
|
-
let envvarRows = $('#kumohub-fn-env-table tr');
|
|
25640
|
-
|
|
25641
|
-
envvarRows.map((index, row) => {
|
|
25642
|
-
let envvar = $(row).find('td').find('input');
|
|
25643
|
-
let key = $(envvar[0]).val();
|
|
25644
|
-
let value = $(envvar[1]).val();
|
|
25645
|
-
environment.push({ key, value });
|
|
25646
|
-
});
|
|
25647
|
-
|
|
25648
|
-
return {
|
|
25649
|
-
profile: fnProfile,
|
|
25650
|
-
"service-name": fnName,
|
|
25651
|
-
description: fnDescription,
|
|
25652
|
-
memory: fnMemory,
|
|
25653
|
-
timeout: fnTimeout,
|
|
25654
|
-
workspace: fnWorkspace || fnAccount,
|
|
25655
|
-
stage: fnStage,
|
|
25656
|
-
environment: environment,
|
|
25657
|
-
policy: fnPolicy
|
|
25658
|
-
};
|
|
25659
|
-
}
|
|
25660
|
-
|
|
25661
|
-
function fillWorkspaces() {
|
|
25662
|
-
let dropdown = $('#kumohub-fn-workspace');
|
|
25663
|
-
|
|
25664
|
-
if (workspaces.length > 0) {
|
|
25665
|
-
dropdown.empty();
|
|
25666
|
-
}
|
|
25667
|
-
workspaces.forEach(function (w) {
|
|
25668
|
-
dropdown.append($('<option></option>').val(w.name).text(w.name));
|
|
25669
|
-
});
|
|
25670
|
-
|
|
25671
|
-
if (profileWorkspace) {
|
|
25672
|
-
$('#kumohub-fn-workspace').val(profileWorkspace);
|
|
25673
|
-
fillStages(profileWorkspace);
|
|
25674
|
-
}
|
|
25675
|
-
}
|
|
25676
|
-
|
|
25677
|
-
function fillStages(fnWorkspace) {
|
|
25678
|
-
|
|
25679
|
-
let dropdown = $('#kumohub-fn-stage');
|
|
25680
|
-
if (fnWorkspace == "UNDEFINED") {
|
|
25681
|
-
//dropdown.append($('<option></option>').val("UNDEFINED").text("Undefined"));
|
|
25682
|
-
return;
|
|
25683
|
-
}
|
|
25684
|
-
let ws;
|
|
25685
|
-
|
|
25686
|
-
if (workspaces) {
|
|
25687
|
-
ws = workspaces.find(w => w.name === fnWorkspace);
|
|
25688
|
-
}
|
|
25689
|
-
|
|
25690
|
-
if (ws) {
|
|
25691
|
-
dropdown.empty();
|
|
25692
|
-
if (ws.stages && ws.stages.length > 0) {
|
|
25693
|
-
ws.stages.forEach(function (s) {
|
|
25694
|
-
dropdown.append($('<option></option>').val(s.name).text(s.name));
|
|
25695
|
-
});
|
|
25696
|
-
if (profileStage) {
|
|
25697
|
-
$('#kumohub-fn-stage').val(profileStage);
|
|
25698
|
-
fillPolicies(fnWorkspace, profileStage);
|
|
25699
|
-
}
|
|
25700
|
-
} else {
|
|
25701
|
-
dropdown.append($('<option></option>').val("UNDEFINED").text("Undefined"));
|
|
25702
|
-
}
|
|
25703
|
-
|
|
25704
|
-
}
|
|
25705
|
-
}
|
|
25706
|
-
|
|
25707
|
-
function fillPolicies(workspace, stage) {
|
|
25708
|
-
|
|
25709
|
-
let dropdown = $('#kumohub-fn-policy');
|
|
25710
|
-
if (workspace == "UNDEFINED") {
|
|
25711
|
-
//dropdown.append($('<option></option>').val("UNDEFINED").text("Undefined"));
|
|
25712
|
-
return;
|
|
25713
|
-
}
|
|
25714
|
-
let ws;
|
|
25715
|
-
|
|
25716
|
-
if (workspaces) {
|
|
25717
|
-
ws = workspaces.find(w => w.name === workspace);
|
|
25718
|
-
}
|
|
25719
|
-
|
|
25720
|
-
if (ws) {
|
|
25721
|
-
let st = ws.stages.find(s => s.name === stage);
|
|
25722
|
-
if (st && st.policies) {
|
|
25723
|
-
dropdown.empty();
|
|
25724
|
-
|
|
25725
|
-
if (st.policies && st.policies.length > 0) {
|
|
25726
|
-
st.policies.forEach(function (p) {
|
|
25727
|
-
dropdown.append($('<option></option>').val(p.name).text(p.name));
|
|
25728
|
-
});
|
|
25729
|
-
if (profilePolicy) {
|
|
25730
|
-
$('#kumohub-fn-policy').val(profilePolicy);
|
|
25731
|
-
}
|
|
25732
|
-
} else {
|
|
25733
|
-
dropdown.append($('<option></option>').val("Public").text("Public"));
|
|
25734
|
-
}
|
|
25735
|
-
}
|
|
25736
|
-
}
|
|
25737
|
-
}
|
|
25738
|
-
|
|
25739
|
-
function fillProfiles() {
|
|
25740
|
-
try {
|
|
25741
|
-
const profiles = window.__kumologica.kumohub.listProfiles();
|
|
25742
|
-
let dropdown = $('#kumohub-sidebar-profiles');
|
|
25743
|
-
|
|
25744
|
-
if (profiles.length > 0) {
|
|
25745
|
-
dropdown.empty();
|
|
25746
|
-
dropdown.append($('<option disabled>Available Kumohub Profiles</option>'));
|
|
25747
|
-
}
|
|
25748
|
-
profiles.forEach(function (profile) {
|
|
25749
|
-
dropdown.append($('<option></option>').val(profile).text(profile));
|
|
25750
|
-
});
|
|
25751
|
-
|
|
25752
|
-
// in case kumohub-config.json was loaded already and
|
|
25753
|
-
// setValues could not select correct profile, doing it now
|
|
25754
|
-
if (window.__kumologica.kumohub.profile) {
|
|
25755
|
-
setProfile(window.__kumologica.kumohub.profile);
|
|
25756
|
-
}
|
|
25757
|
-
} catch (Error) {
|
|
25758
|
-
console.log(`error: ${Error}`);
|
|
25759
|
-
showProfileError();
|
|
25760
|
-
}
|
|
25761
|
-
}
|
|
25762
|
-
|
|
25763
|
-
function getProfile() {
|
|
25764
|
-
return $('#kumohub-sidebar-profiles').find(':selected').val();
|
|
25765
|
-
}
|
|
25766
|
-
|
|
25767
|
-
function setProfile(profile) {
|
|
25768
|
-
window.__kumologica.kumohub.profile = profile;
|
|
25769
|
-
|
|
25770
|
-
// Show the body if profile is set to existing profile
|
|
25771
|
-
if (profile != SELECT_KUMOHUB_PROFILE &&
|
|
25772
|
-
$('#kumohub-sidebar-profiles').find('option[value=' + profile + ']').length) {
|
|
25773
|
-
|
|
25774
|
-
$(`#kumohub-sidebar-profiles option[value='${SELECT_KUMOHUB_PROFILE}']`).remove();
|
|
25775
|
-
$('#kumohub-sidebar-profiles').val(profile);
|
|
25776
|
-
} else {
|
|
25777
|
-
$('#kumohub-sidebar-profiles').val(SELECT_KUMOHUB_PROFILE);
|
|
25778
|
-
}
|
|
25779
|
-
}
|
|
25780
|
-
|
|
25781
|
-
|
|
25782
|
-
function showProfileError() {
|
|
25783
|
-
$('#kumohub-sidebar-error').show();
|
|
25784
|
-
}
|
|
25785
|
-
|
|
25786
|
-
RED.events.on('settings:cloud-config-changed', function() {
|
|
25787
|
-
fillProfiles();
|
|
25788
|
-
});
|
|
25789
|
-
|
|
25790
|
-
// event triggered when kumohub-config.json file has been loaded
|
|
25791
|
-
RED.events.on('kumohub-config', function () {
|
|
25792
|
-
if (!$('#kumohub-fn-name').val() &&
|
|
25793
|
-
window.__kumologica.settings.projectFlowName
|
|
25794
|
-
) {
|
|
25795
|
-
setLambdaName(window.__kumologica.settings.projectFlowName);
|
|
25796
|
-
}
|
|
25797
|
-
|
|
25798
|
-
if (window.__kumologica.settings.kumohubConfig ) {
|
|
25799
|
-
const params = window.__kumologica.settings.kumohubConfig.getKumohubConfig();
|
|
25800
|
-
|
|
25801
|
-
setValues(params);
|
|
25802
|
-
|
|
25803
|
-
} else {
|
|
25804
|
-
console.log('kumologica.settings.kumohubConfig not present');
|
|
25805
|
-
}
|
|
25806
|
-
});
|
|
25807
|
-
|
|
25808
|
-
function initJs() {
|
|
25809
|
-
fillProfiles();
|
|
25810
|
-
|
|
25811
|
-
// Initialize fields with default values
|
|
25812
|
-
if (window.__kumologica.settings.projectFlowName) {
|
|
25813
|
-
setLambdaName(window.__kumologica.settings.projectFlowName);
|
|
25814
|
-
}
|
|
25815
|
-
|
|
25816
|
-
$('#kumohub-fn-description').val('kumologica flow');
|
|
25817
|
-
$('#kumohub-fn-memory').val('512');
|
|
25818
|
-
$('#kumohub-fn-timeout').val('20');
|
|
25819
|
-
|
|
25820
|
-
$('#kumohub-fn-timeout, #kumohub-fn-workspace, #kumohub-fn-stage, #kumohub-fn-policy, #kumohub-fn-memory, #kumohub-fn-description, #kumohub-fn-name').change(function () {
|
|
25821
|
-
saveSettings();
|
|
25822
|
-
});
|
|
25823
|
-
|
|
25824
|
-
$('#kumohub-fn-name').change(function () {
|
|
25825
|
-
this.value = sanitizeLambdaName(this.value);
|
|
25826
|
-
});
|
|
25827
|
-
|
|
25828
|
-
$('#kumohub-fn-workspace').on('change', function() {
|
|
25829
|
-
fillStages( this.value );
|
|
25830
|
-
});
|
|
25831
|
-
|
|
25832
|
-
$('#kumohub-fn-stage').on('change', function() {
|
|
25833
|
-
fillPolicies($('#kumohub-fn-workspace').val(), this.value);
|
|
25834
|
-
});
|
|
25835
|
-
|
|
25836
|
-
$('#kumohub-sidebar-profiles').change(function () {
|
|
25837
|
-
|
|
25838
|
-
if (this.value) {
|
|
25839
|
-
$('#kumohub-sidebar-body').show();
|
|
25840
|
-
}
|
|
25841
|
-
saveSettings();
|
|
25842
|
-
|
|
25843
|
-
if (this.value != SELECT_KUMOHUB_PROFILE) {
|
|
25844
|
-
$(`#kumohub-sidebar-profiles option[value='${SELECT_KUMOHUB_PROFILE}']`).remove();
|
|
25845
|
-
window.__kumologica.kumohub.profile = this.value;
|
|
25846
|
-
disconnectFromKumohub();
|
|
25847
|
-
}
|
|
25848
|
-
});
|
|
25849
|
-
|
|
25850
|
-
// Attach the environment variables
|
|
25851
|
-
$('#kumohub-add-environment-variable').click((e) => {
|
|
25852
|
-
let environmentTable = $('#kumohub-fn-env-table');
|
|
25853
|
-
let environmentRowHtml = `
|
|
25854
|
-
<tr class="node-info-node-row">
|
|
25855
|
-
<td style="background: white; width:46%"><input id="kumohub-fn-env-key" class="palette-textinput" type="text" placeholder="key" style="width:100%"></td>
|
|
25856
|
-
<td style="background: white; width:46%"><input id="kumohub-fn-env-val" class="palette-textinput" type="text" placeholder="value" style="width:100%"></td>
|
|
25857
|
-
<td id="kumohub-fn-env-row" style="text-align:center; width:8%" class="removeRow"><i class="fa fa-minus"></i></td>
|
|
25858
|
-
</tr>`;
|
|
25859
|
-
$(environmentRowHtml).appendTo(environmentTable);
|
|
25860
|
-
|
|
25861
|
-
$('#kumohub-fn-env-table')
|
|
25862
|
-
.find('input')
|
|
25863
|
-
.each(function () {
|
|
25864
|
-
$(this).change(function () {
|
|
25865
|
-
saveSettings();
|
|
25866
|
-
});
|
|
25867
|
-
});
|
|
25868
|
-
});
|
|
25869
|
-
|
|
25870
|
-
$('#kumohub-fn-env-table')
|
|
25871
|
-
.find('input')
|
|
25872
|
-
.each(function () {
|
|
25873
|
-
$(this).change(function () {
|
|
25874
|
-
saveSettings();
|
|
25875
|
-
});
|
|
25876
|
-
});
|
|
25877
|
-
|
|
25878
|
-
$('#kumohub-fn-env-table').on('click', '.removeRow', function () {
|
|
25879
|
-
$(this).parent().remove();
|
|
25880
|
-
saveSettings();
|
|
25881
|
-
});
|
|
25882
|
-
|
|
25883
|
-
// Close export menu when click in the window
|
|
25884
|
-
$('.sidebar-kumohub').click(function (e) {
|
|
25885
|
-
$('#kumohub-options-dropdown-content').hide();
|
|
25886
|
-
});
|
|
25887
|
-
|
|
25888
|
-
// Connect to AWS button
|
|
25889
|
-
$('#kumohub-sidebar-connect-btn').click((e) => {
|
|
25890
|
-
e.preventDefault();
|
|
25891
|
-
connectToKumohub();
|
|
25892
|
-
});
|
|
25893
|
-
|
|
25894
|
-
// Deploy to kumohub button
|
|
25895
|
-
$('#kumohub-sidebar-deploy-btn').click((e) => {
|
|
25896
|
-
e.preventDefault();
|
|
25897
|
-
deploy();
|
|
25898
|
-
});
|
|
25899
|
-
|
|
25900
|
-
$('#kumohub-buildZipBtn').click((e) => {
|
|
25901
|
-
e.preventDefault();
|
|
25902
|
-
hideMenu();
|
|
25903
|
-
buildZip();
|
|
25904
|
-
});
|
|
25905
|
-
|
|
25906
|
-
// Export cloudformation script
|
|
25907
|
-
$('#kumohub-exportCloudFormationBtn').click((e) => {
|
|
25908
|
-
e.preventDefault();
|
|
25909
|
-
hideMenu();
|
|
25910
|
-
exportScript(window.__kumologica.cloud.provider.aws);
|
|
25911
|
-
});
|
|
25912
|
-
|
|
25913
|
-
// Export serverless script
|
|
25914
|
-
$('#kumohub-exportServerlessBtn').click((e) => {
|
|
25915
|
-
e.preventDefault();
|
|
25916
|
-
hideMenu();
|
|
25917
|
-
exportScript(window.__kumologica.cloud.provider.serverless);
|
|
25918
|
-
});
|
|
25919
|
-
|
|
25920
|
-
$('#kumohub-options-dropdown').click((e) => {
|
|
25921
|
-
e.stopPropagation();
|
|
25922
|
-
|
|
25923
|
-
$('#kumohub-sidebar-export-btn').toggleClass('dropdown-selected');
|
|
25924
|
-
|
|
25925
|
-
$('#kumohub-options-dropdown-content').toggle();
|
|
25926
|
-
});
|
|
25927
|
-
|
|
25928
|
-
initialised = true;
|
|
25929
|
-
if (parameters) {
|
|
25930
|
-
setValues(parameters);
|
|
25931
|
-
}
|
|
25932
|
-
|
|
25933
|
-
connectUIDisconnected();
|
|
25934
|
-
}
|
|
25935
|
-
|
|
25936
|
-
function hideMenu() {
|
|
25937
|
-
$('#kumohub-sidebar-export-btn').removeClass('dropdown-selected');
|
|
25938
|
-
$('#kumohub-options-dropdown-content').hide();
|
|
25939
|
-
}
|
|
25940
|
-
|
|
25941
|
-
async function exportScript(provider) {
|
|
25942
|
-
|
|
25943
|
-
$('#workspace-terminal').show();
|
|
25944
|
-
try {
|
|
25945
|
-
await window.__kumologica.cloud.generateScript(
|
|
25946
|
-
provider,
|
|
25947
|
-
RED.header.getCurrentProjectInfo(),
|
|
25948
|
-
getValues()
|
|
25949
|
-
);
|
|
25950
|
-
} catch (Error) {
|
|
25951
|
-
handleError(Error);
|
|
25952
|
-
}
|
|
25953
|
-
}
|
|
25954
|
-
|
|
25955
|
-
async function buildZip(provider) {
|
|
25956
|
-
|
|
25957
|
-
$('#workspace-terminal').show();
|
|
25958
|
-
try {
|
|
25959
|
-
await window.__kumologica.kumohub.build(RED.header.getCurrentProjectInfo());
|
|
25960
|
-
/*await window.__kumologica.cloud.generateScript(
|
|
25961
|
-
provider,
|
|
25962
|
-
RED.header.getCurrentProjectInfo(),
|
|
25963
|
-
getValues()
|
|
25964
|
-
);*/
|
|
25965
|
-
} catch (Error) {
|
|
25966
|
-
handleError(Error);
|
|
25967
|
-
}
|
|
25968
|
-
}
|
|
25969
|
-
|
|
25970
|
-
async function connectToKumohub() {
|
|
25971
|
-
profile = getProfile();
|
|
25972
|
-
|
|
25973
|
-
if (!profile || profile == SELECT_KUMOHUB_PROFILE) {
|
|
25974
|
-
RED.notify(`<strong>Error</strong>: Please select Kumohub profile before connecting to Kumohub account.`, 'error');
|
|
25975
|
-
return;
|
|
25976
|
-
}
|
|
25977
|
-
|
|
25978
|
-
if (window.__kumologica.kumohub.isLoggedIn(profile)) {
|
|
25979
|
-
RED.notify(`<strong>Information</strong>: Already connected to ${profile} Kumohub account.`, 'info');
|
|
25980
|
-
return;
|
|
25981
|
-
}
|
|
25982
|
-
|
|
25983
|
-
connectUIConnecting();
|
|
25984
|
-
|
|
25985
|
-
try {
|
|
25986
|
-
await window.__kumologica.kumohub.login(profile);
|
|
25987
|
-
workspaces = await window.__kumologica.kumohub.getWorkspaces(profile);
|
|
25988
|
-
|
|
25989
|
-
fillWorkspaces(profileWorkspace);
|
|
25990
|
-
} catch (err) {
|
|
25991
|
-
connectUIDisconnected();
|
|
25992
|
-
|
|
25993
|
-
RED.notify(`<strong>Error</strong>: ${err.stderr? err.stderr: err}`, 'error');
|
|
25994
|
-
return;
|
|
25995
|
-
}
|
|
25996
|
-
connectUIConnected();
|
|
25997
|
-
}
|
|
25998
|
-
|
|
25999
|
-
function disconnectFromKumohub() {
|
|
26000
|
-
window.__kumologica.kumohub.logout();
|
|
26001
|
-
connectUIDisconnected();
|
|
26002
|
-
}
|
|
26003
|
-
|
|
26004
|
-
function connectUIDisconnected() {
|
|
26005
|
-
// show connect button
|
|
26006
|
-
$('#kumohub-sidebar-connect-btn').show();
|
|
26007
|
-
if ($('#kumohub-sidebar-connect-btn') && $('#kumohub-sidebar-connect-btn').html()) {
|
|
26008
|
-
$('#kumohub-sidebar-connect-btn').html($('#kumohub-sidebar-connect-btn').html().replace('Connecting', 'Connect'));
|
|
26009
|
-
}
|
|
26010
|
-
$('#kumohub-sidebar-connect-icon').attr({'class': 'fa fa-circle'});
|
|
26011
|
-
$('#kumohub-sidebar-connect-icon').css({'color': 'red'});
|
|
26012
|
-
// hide deploy and export buttons
|
|
26013
|
-
$('#kumohub-sidebar-deploy-btn').hide();
|
|
26014
|
-
$('#kumohub-sidebar-export-btn').hide();
|
|
26015
|
-
$('#kumohub-sidebar-body').hide();
|
|
26016
|
-
}
|
|
26017
|
-
|
|
26018
|
-
function connectUIConnecting() {
|
|
26019
|
-
$('#kumohub-sidebar-connect-icon').attr({'class': 'fa fa-spinner fa-spin'});
|
|
26020
|
-
$('#kumohub-sidebar-connect-icon').css({'color': 'black'});
|
|
26021
|
-
}
|
|
26022
|
-
|
|
26023
|
-
function connectUIConnected() {
|
|
26024
|
-
// hide connect button
|
|
26025
|
-
$('#kumohub-sidebar-connect-btn').hide();
|
|
26026
|
-
//$('#kumohub-sidebar-connect-btn').html($('#kumohub-sidebar-connect-btn').html().replace('Connect', 'Connected'));
|
|
26027
|
-
//$('#kumohub-sidebar-connect-icon').attr({'class': 'fa fa-circle'});
|
|
26028
|
-
//$('#kumohub-sidebar-connect-icon').css({'color': 'green'});
|
|
26029
|
-
|
|
26030
|
-
// show deploy and options buttons
|
|
26031
|
-
$('#kumohub-sidebar-deploy-btn').show();
|
|
26032
|
-
|
|
26033
|
-
// dont show until functionality implemented
|
|
26034
|
-
$('#kumohub-sidebar-export-btn').show();
|
|
26035
|
-
$('#kumohub-sidebar-body').show();
|
|
26036
|
-
}
|
|
26037
|
-
|
|
26038
|
-
function deployingUIDeploying() {
|
|
26039
|
-
$('#kumohub-sidebar-deploy-icon').attr({'class': 'fa fa-spinner fa-spin'});
|
|
26040
|
-
}
|
|
26041
|
-
function deployingUINotDeploying() {
|
|
26042
|
-
$('#kumohub-sidebar-deploy-icon').attr({'class': 'fa fa-cloud-upload'});
|
|
26043
|
-
}
|
|
26044
|
-
|
|
26045
|
-
async function deploy() {
|
|
26046
|
-
|
|
26047
|
-
const profile = getProfile();
|
|
26048
|
-
if (!profile || profile == SELECT_KUMOHUB_PROFILE) {
|
|
26049
|
-
RED.notify(`Please select kumohub profile before deploying flows.`, 'error');
|
|
26050
|
-
return;
|
|
26051
|
-
}
|
|
26052
|
-
|
|
26053
|
-
if (deployState == DEPLOYING) {
|
|
26054
|
-
RED.notify(`<strong>Information</strong>: Already deploying to Kumohub.`, 'info');
|
|
26055
|
-
return;
|
|
26056
|
-
}
|
|
26057
|
-
|
|
26058
|
-
RED.deploy.save();
|
|
26059
|
-
|
|
26060
|
-
deployingUIDeploying();
|
|
26061
|
-
deployState = DEPLOYING;
|
|
26062
|
-
|
|
26063
|
-
$('#workspace-terminal').show();
|
|
26064
|
-
|
|
26065
|
-
let params = getValues();
|
|
26066
|
-
|
|
26067
|
-
let envs = params.environment;
|
|
26068
|
-
|
|
26069
|
-
if (envs) {
|
|
26070
|
-
let variables = {Variables: {}};
|
|
26071
|
-
|
|
26072
|
-
envs.forEach(function(e) {
|
|
26073
|
-
variables.Variables[e.key] = e.value;
|
|
26074
|
-
});
|
|
26075
|
-
params.environment = {};
|
|
26076
|
-
params.environment = JSON.stringify(variables);
|
|
26077
|
-
};
|
|
26078
|
-
|
|
26079
|
-
try {
|
|
26080
|
-
await window.__kumologica.kumohub.deploy(
|
|
26081
|
-
RED.header.getCurrentProjectInfo(),
|
|
26082
|
-
params
|
|
26083
|
-
);
|
|
26084
|
-
|
|
26085
|
-
} catch (Error) {
|
|
26086
|
-
handleError(Error);
|
|
26087
|
-
}
|
|
26088
|
-
|
|
26089
|
-
deployState = NOTDEPLOYING;
|
|
26090
|
-
deployingUINotDeploying();
|
|
26091
|
-
}
|
|
26092
|
-
|
|
26093
|
-
function handleError(error) {
|
|
26094
|
-
let msg = error.toString();
|
|
26095
|
-
RED.notify(msg, 'error');
|
|
26096
|
-
}
|
|
26097
|
-
|
|
26098
|
-
function saveSettings() {
|
|
26099
|
-
window.__kumologica.settings.kumohubConfig.setKumohubConfig(getValues());
|
|
26100
|
-
}
|
|
26101
|
-
|
|
26102
|
-
function show() {
|
|
26103
|
-
RED.sidebar.show('kumohub');
|
|
26104
|
-
}
|
|
26105
|
-
|
|
26106
|
-
function init() {
|
|
26107
|
-
initHTML();
|
|
26108
|
-
initJs();
|
|
26109
|
-
}
|
|
26110
|
-
|
|
26111
|
-
return {
|
|
26112
|
-
init: init,
|
|
26113
|
-
show: show,
|
|
26114
|
-
};
|
|
26115
|
-
})();;RED.sidebar.git = (function(){
|
|
25289
|
+
;RED.sidebar.git = (function(){
|
|
26116
25290
|
|
|
26117
25291
|
let tabContent;
|
|
26118
25292
|
let sections;
|
|
@@ -27512,7 +26686,6 @@ RED.sidebar.azure = (function () {
|
|
|
27512
26686
|
'testing',
|
|
27513
26687
|
'logging',
|
|
27514
26688
|
'exception',
|
|
27515
|
-
'kumohub',
|
|
27516
26689
|
'aws',
|
|
27517
26690
|
'queue',
|
|
27518
26691
|
'storage',
|