Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit ecf77b4

Browse files
author
Nicolas Moutschen
committed
Add field to change the Kinesis Data Stream name
1 parent a5f6f77 commit ecf77b4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

DataProcessing/guide/site/dashboard.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ <h6 class='modal-title'>Configure Dashboard</h6>
2323
<label for='cognitoIdentityPoolId'>Cognito Identity Pool ID</label>
2424
<input autocomplete='off' class='form-control' id='cognitoIdentityPoolId' spellcheck='false' type='text'>
2525
</div>
26+
<div class='form-group'>
27+
<label for='kinesisStreamName'>Kinesis Data Stream Name</label>
28+
<input autocomplete='off' class='form-control' id='kinesisStreamName' spellcheck='false' type='text' value='wildrydes'>
29+
</div>
2630
</div>
2731
<div class='modal-footer'>
2832
<button class='btn btn-primary' id='start'>Start</button>

DataProcessing/guide/site/js/dashboard.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@
115115
}
116116
}
117117

118-
Dashboard.Poller = function(kinesis, map, console) {
119-
const streamName = 'wildrydes';
118+
Dashboard.Poller = function(kinesis, streamName, map, console) {
120119
const shardIteratorType = 'LATEST';
121120
const pollFrequency = 1000;
122121

@@ -189,16 +188,18 @@
189188
$(window).on('load', function() {
190189
const map = Dashboard.Map(L).init('map').render();
191190

192-
if (Cookies.get('cognitoIdentityPoolId') !== undefined) {
191+
if (Cookies.get('cognitoIdentityPoolId') !== undefined || Cookies.get('kinesisStreamName') !== undefined) {
193192
$('#cognitoIdentityPoolId').val(Cookies.get('cognitoIdentityPoolId'));
193+
$('#kinesisStreamName').val(Cookies.get('kinesisStreamName'));
194194
$('#modal').on('shown.bs.modal', () => $('button').focus());
195195
}
196196

197197
$('form').on('submit', function(e) {
198198
e.preventDefault();
199199

200200
const cognitoIdentityPoolId = $('#cognitoIdentityPoolId').val();
201-
const region = cognitoIdentityPoolId.substring(0, cognitoIdentityPoolId.indexOf(":"))
201+
const kinesisStreamName = $('$kinesisStreamName').val();
202+
const region = cognitoIdentityPoolId.substring(0, cognitoIdentityPoolId.indexOf(":"));
202203

203204
AWS.config.region = region;
204205
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
@@ -209,7 +210,7 @@
209210

210211
kinesis.listStreams().promise()
211212
.then(() => Cookies.set("cognitoIdentityPoolId", cognitoIdentityPoolId))
212-
.then(() => Dashboard.Poller(kinesis, map, console).poll())
213+
.then(() => Dashboard.Poller(kinesis, kinesisStreamName, map, console).poll())
213214
.then(() => $('#modal').modal('hide'))
214215
.catch((err) => $('#modal .notice').text(err).show());
215216
});

0 commit comments

Comments
 (0)