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

Commit 91f8cdc

Browse files
authored
Merge pull request #214 from nmoutschen/add-stream-name
Add a field to customize the Kinesis stream name
2 parents 4c9c3b5 + e7f4160 commit 91f8cdc

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
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>
23.1 KB
Loading

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
});

DataProcessing/guide/site/streaming-data.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ <h4 id="view-unicorn-status-on-the-dashboard">6. View unicorn status on the dash
131131
<p><strong>✅ Step-by-step directions</strong></p>
132132
<ol type="1">
133133
<li><p>Open the <a href="https://dataprocessing.wildrydes.com/dashboard.html">Unicorn Dashboard</a>.</p></li>
134-
<li><p>Enter the <strong>Cognito Identity Pool ID</strong> you noted in step 4 and click <strong>Start</strong>.</p>
134+
<li><p>Enter the <strong>Cognito Identity Pool ID</strong> you noted in step 4 and the <strong>Kinesis Data Stream name</strong> and click <strong>Start</strong>.</p>
135135
<p><img src="./images/streaming-data-dashboard-configure.png" /></p></li>
136136
<li><p>Validate that you can see the unicorn on the map.</p>
137137
<p><img src="./images/streaming-data-map.png" /></p></li>

0 commit comments

Comments
 (0)