-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mount multiple streams #53
Draft
thekeele
wants to merge
6
commits into
master
Choose a base branch
from
feature/mount-multiple-streams
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3009d84
mount multiple streams
rcehemann b9b2139
render all mounted streams
rcehemann 448476b
expose stream in broadcast callback messages
thekeele 09fa767
update broadcast topic name, reorder message elements
thekeele 29e8c52
store stats as map, add phx-value-*
thekeele c076703
Display something when no streams are running
rcehemann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,172 +1,184 @@ | ||
|
||
<%= for {stream, %{"hourly" => hourly, "daily" => daily}} <- @streams do %> | ||
|
||
<section class="hero is-light"> | ||
<div class="hero-body"> | ||
<div class="container"> | ||
<h1 class="title is-1 is-spaced has-text-centered"> | ||
Hourly Stats | ||
</h1> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Stream</p> | ||
<p class="title"><%= String.upcase(stream) %></p> | ||
<%= if Enum.count(@streams) > 0 do %> | ||
|
||
<%= for {stream, %{"hourly" => hourly, "daily" => daily}} <- @streams do %> | ||
|
||
<section class="hero is-light"> | ||
<div class="hero-body"> | ||
<div class="container"> | ||
<h1 class="title is-1 is-spaced has-text-centered"> | ||
Hourly Stats | ||
</h1> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Stream</p> | ||
<p class="title"><%= String.upcase(stream) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Hour</p> | ||
<p class="title"><%= hourly.current %> UTC</p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Hour</p> | ||
<p class="title"><%= hourly.current %> UTC</p> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Tweets</p> | ||
<p class="title"><%= get_weight(hourly, :tweets, :count) %></p> | ||
</nav> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Tweets</p> | ||
<p class="title"><%= get_weight(hourly, :tweets, :count) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Average</p> | ||
<p class="title"><%= round_up(get_weight(hourly, :tweets, :average)) %>%</p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Average</p> | ||
<p class="title"><%= round_up(get_weight(hourly, :tweets, :average)) %>%</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Likes</p> | ||
<p class="title"><%= get_weight(hourly, :likes, :count) %></p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Likes</p> | ||
<p class="title"><%= get_weight(hourly, :likes, :count) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Retweets</p> | ||
<p class="title"><%= get_weight(hourly, :retweets, :count) %></p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Retweets</p> | ||
<p class="title"><%= get_weight(hourly, :retweets, :count) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</section> | ||
|
||
<div class="columns"> | ||
<div class="column is-two-thirds"> | ||
<%= hourly.svg %> | ||
</div> | ||
<div class="columns"> | ||
<div class="column is-two-thirds"> | ||
<%= hourly.svg %> | ||
</div> | ||
|
||
<div class="column"> | ||
<div class="box"> | ||
<h1 class="title has-text-centered">Tweet Type</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_text", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="text" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Text</button> | ||
<div class="column"> | ||
<div class="box"> | ||
<h1 class="title has-text-centered">Tweet Type</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_text", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="text" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Text</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_extended", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="extended" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Extended Tweet</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_extended", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="extended" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Extended Tweet</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_retweeted", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="retweeted" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Retweeted Status</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_retweeted", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="retweeted" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Retweeted Status</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_quoted", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="quoted" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Quoted Status</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_quoted", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="quoted" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="type">Quoted Status</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="box"> | ||
<h1 class="title has-text-centered">Weight By</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_tweets", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="tweets" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="weight">Tweets</button> | ||
<div class="box"> | ||
<h1 class="title has-text-centered">Weight By</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_tweets", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="tweets" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="weight">Tweets</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_likes", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="likes" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="weight">Likes</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_likes", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="likes" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="weight">Likes</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_retweets", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="retweets" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="weight">Retweets</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("hourly_retweets", hourly.filter["type"], hourly.filter["weight"]) %>" phx-click="retweets" phx-value-stream="<%= stream %>" phx-value-interval="hourly" phx-value-filter="weight">Retweets</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<section class="hero is-light"> | ||
<div class="hero-body"> | ||
<div class="container"> | ||
<h1 class="title is-1 is-spaced has-text-centered"> | ||
Daily Stats | ||
</h1> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Stream</p> | ||
<p class="title"><%= String.upcase(stream) %></p> | ||
<section class="hero is-light"> | ||
<div class="hero-body"> | ||
<div class="container"> | ||
<h1 class="title is-1 is-spaced has-text-centered"> | ||
Daily Stats | ||
</h1> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Stream</p> | ||
<p class="title"><%= String.upcase(stream) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Date</p> | ||
<p class="title"><%= Date.to_string(daily.current) %></p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Date</p> | ||
<p class="title"><%= Date.to_string(daily.current) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Tweets</p> | ||
<p class="title"><%= get_weight(daily, :tweets, :count) %></p> | ||
</nav> | ||
|
||
<nav class="level"> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Tweets</p> | ||
<p class="title"><%= get_weight(daily, :tweets, :count) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Average</p> | ||
<p class="title"><%= round_up(get_weight(daily, :tweets, :average)) %>%</p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Average</p> | ||
<p class="title"><%= round_up(get_weight(daily, :tweets, :average)) %>%</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Likes</p> | ||
<p class="title"><%= get_weight(daily, :likes, :count) %></p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Likes</p> | ||
<p class="title"><%= get_weight(daily, :likes, :count) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Retweets</p> | ||
<p class="title"><%= get_weight(daily, :retweets, :count) %></p> | ||
<div class="level-item has-text-centered"> | ||
<div> | ||
<p class="heading">Retweets</p> | ||
<p class="title"><%= get_weight(daily, :retweets, :count) %></p> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</section> | ||
|
||
<div class="columns"> | ||
<div class="column is-two-thirds"> | ||
<%= daily.svg %> | ||
</div> | ||
<div class="columns"> | ||
<div class="column is-two-thirds"> | ||
<%= daily.svg %> | ||
</div> | ||
|
||
<div class="column"> | ||
<div class="box"> | ||
<h1 class="title has-text-centered">Tweet Type</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_text", daily.filter["type"], daily.filter["weight"]) %>" phx-click="text" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Text</button><br /> | ||
<div class="column"> | ||
<div class="box"> | ||
<h1 class="title has-text-centered">Tweet Type</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_text", daily.filter["type"], daily.filter["weight"]) %>" phx-click="text" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Text</button><br /> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_extended", daily.filter["type"], daily.filter["weight"]) %>" phx-click="extended" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Extended Tweet</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_extended", daily.filter["type"], daily.filter["weight"]) %>" phx-click="extended" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Extended Tweet</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_retweeted", daily.filter["type"], daily.filter["weight"]) %>" phx-click="retweeted" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Retweeted Status</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_retweeted", daily.filter["type"], daily.filter["weight"]) %>" phx-click="retweeted" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Retweeted Status</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_quoted", daily.filter["type"], daily.filter["weight"]) %>" phx-click="quoted" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Quoted Status</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_quoted", daily.filter["type"], daily.filter["weight"]) %>" phx-click="quoted" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="type">Quoted Status</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="box"> | ||
<h1 class="title has-text-centered">Weight By</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_tweets", daily.filter["type"], daily.filter["weight"]) %>" phx-click="tweets" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="weight">Tweets</button> | ||
<div class="box"> | ||
<h1 class="title has-text-centered">Weight By</h1> | ||
<div class="buttons are-large"> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_tweets", daily.filter["type"], daily.filter["weight"]) %>" phx-click="tweets" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="weight">Tweets</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_likes", daily.filter["type"], daily.filter["weight"]) %>" phx-click="likes" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="weight">Likes</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_likes", daily.filter["type"], daily.filter["weight"]) %>" phx-click="likes" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="weight">Likes</button> | ||
|
||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_retweets", daily.filter["type"], daily.filter["weight"]) %>" phx-click="retweets" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="weight">Retweets</button> | ||
<button class="button is-light is-fullwidth is-outlined <%= is_selected("daily_retweets", daily.filter["type"], daily.filter["weight"]) %>" phx-click="retweets" phx-value-stream="<%= stream %>" phx-value-interval="daily" phx-value-filter="weight">Retweets</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<% end %> | ||
<% else %> | ||
<section class="hero is-warning"> | ||
<div class="hero body"> | ||
<div class="container"> | ||
<h1 class="title is-1 is-spaced has-text-centered"> | ||
😵 No streams running! 😵 | ||
</h1> | ||
</div> | ||
</div> | ||
</section> | ||
<% end %> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pattern match and avoid the count here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
match?/2
macro is an alternative to the above. Whatever reads better to you.