File tree Expand file tree Collapse file tree
support/pipeline-visualiser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ FROM ruby:${RUBY_VERSION}-alpine${ALPINE_VERSION}@${DOCKER_IMAGE_DIGEST}
77# Install system-level dependnecies early on so they can be cached effectively for subsequent builds
88# build-base: needed to install be able to install BigDecimal extension requried by 'activesupport-duration-human_string' gem
99# libxml2-dev: needed to be able to install libxml-ruby gem required by 'activesupport-duration-human_string' gem
10- RUN apk add build-base libxml2-dev
10+ # tzdata: needed for setting the correct timezone in the container
11+ RUN apk add build-base libxml2-dev tzdata
1112
1213WORKDIR /app
1314ADD Gemfile /app/Gemfile
@@ -18,6 +19,8 @@ RUN bundle config set --local system true && \
1819 bundle config set --local without development && \
1920 bundle install
2021
22+ RUN ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
23+
2124EXPOSE 4567
2225
2326CMD ["ruby" , "index.rb" ]
Original file line number Diff line number Diff line change 88 AWS_SESSION_TOKEN="$$(echo "$${CREDS_JSON}" | jq -r '.Credentials.SessionToken' ) " \
99 ruby index.rb
1010
11+ run_in_docker :
12+ @docker build . -t forms-pipeline-visualiser:latest
13+
14+ CREDS_JSON="$$(aws sts assume-role --role-arn "arn:aws:iam::711966560482:role/deploy-pipeline-visualiser-ecs-task" --role-session-name "run-pipeline-visualiser")"; \
15+ AWS_ACCESS_KEY_ID="$$(echo "$${CREDS_JSON}" | jq -r '.Credentials.AccessKeyId')" \
16+ AWS_SECRET_ACCESS_KEY="$$(echo "$${CREDS_JSON}" | jq -r '.Credentials.SecretAccessKey')" \
17+ AWS_SESSION_TOKEN="$$(echo "$${CREDS_JSON}" | jq -r '.Credentials.SessionToken')" \
18+ \
19+ docker run \
20+ -p "4567:4567" \
21+ -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION \
22+ -v "$$(pwd):/app" \
23+ forms-pipeline-visualiser:latest
24+
1125.PHONY : dev
1226dev :
1327 PIPELINE_VISUALISER_DEV_MODE=true ruby index.rb
Original file line number Diff line number Diff line change 1313require_relative "lib/views/group"
1414
1515set :public_folder , "public"
16+ set :bind , "0.0.0.0"
17+
1618helpers do
1719 def slugify ( str )
1820 str . downcase
Original file line number Diff line number Diff line change 3030 </ td >
3131 < td class ="govuk-table__cell "> <%= pipeline . current_stage_name if pipeline . is_running? %> </ td >
3232 < td class ="govuk-table__cell ">
33- < time datetime ="<%= pipeline . last_started_at %> " title ="<%= pipeline . last_started_at %> ">
34- <% if pipeline . is_running? %>
35- <%= pipeline . running_duration . human_str %> ago
36- <% else %>
37- <%= pipeline . last_started_at . strftime ( "%H:%M, %A %d %b %Y " ) %>
38- <% end %>
33+ <%= erb :'partials/time' , :locals => {
34+ time : pipeline . last_started_at ,
35+ text : pipeline . is_running? ? pipeline . running_duration . human_str + " ago" : nil
36+ } %>
3937 </ time >
4038 </ td >
4139 </ tr >
Original file line number Diff line number Diff line change 1818 background-color : # F2F3F3 ;
1919 padding : 2px 5px ;
2020 }
21-
22- time {
23- text-decoration : underline;
24- text-decoration-style : dashed;
25- text-underline-offset : 8px ;
26- }
2721 </ style >
2822</ head >
2923
118112 < script type ="module ">
119113 import {
120114 initAll
121- } from '/javascript/govuk-frontend-5.3 .0.min.js'
115+ } from '/javascript/govuk-frontend-5.8 .0.min.js'
122116 initAll ( )
123117 </ script >
118+
119+ < script type ="module ">
120+ document . querySelectorAll ( "time:not([data-relative-time])" ) . forEach ( ( time ) => {
121+ if ( time . dateTime != null ) {
122+ let globalTime = new Date ( time . dateTime ) ;
123+ let localTime = globalTime . toLocaleString ( ) ;
124+ time . innerText = localTime ;
125+ }
126+ } ) ;
127+ </ script >
124128</ body >
125129
126130</ html >
Original file line number Diff line number Diff line change 1+ <% text = defined?(text) ? text : nil %>
2+ <% puts(text) %>
3+ <time datetime ="<%= time . utc . strftime ( '%Y-%m-%dT%H:%M:%S.%L%z' ) %> " title ="<%= time . utc . strftime ( '%Y-%m-%dT%H:%M:%S.%L%z' ) %> " <%= text . nil? ? '' : 'data-relative-time' %> >
4+ <% if text . nil? %>
5+ <%= time . strftime ( "%H:%M, %A %d %b %Y " ) %>
6+ <% else %>
7+ <%= text %>
8+ <% end %>
9+ </ time >
Original file line number Diff line number Diff line change 1111</ h1 >
1212
1313< p class ="govuk-body ">
14- < strong > Last execution time</ strong > <%= pipeline . last_started_at . strftime ( "%H:%M, %A %d %b %Y " ) %>
14+ < strong > Last execution time</ strong > <%= erb :'partials/time' , :locals => { time : pipeline . last_started_at } %>
1515</ p >
1616< p class ="govuk-body ">
1717 < strong > Execution id</ strong > <%= pipeline . execution_id %>
You can’t perform that action at this time.
0 commit comments