Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Add session 1 tutorials #1185

Merged
merged 7 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 65 additions & 22 deletions cloud/Makefile.mk
Original file line number Diff line number Diff line change
@@ -1,29 +1,72 @@
# cloud/websites/Makefile.mk
#
# Cloud deployment makefile
#
# $ make cloud-deploy
#
# AWS - Update AWS S3 buckets *.gridlabd.us
#
# $ make aws-deploy
#
# The *-dev.gridlabd.us websites are updated for all
# branches except "master", which updates *.gridlabd.us
#
# Options:
#
# AWS_OPTIONS=--dryrun do not update websites
#
# GCP - No GCP resources are updated at this time
#
# $ make gcp-deploy
#
# AZ - No AZ resources are updated at this time
#
# $ make az-deploy
#

cloud-deploy: aws-deploy gcp-deploy azure-deploy
#
# Cloud deployment platforms
#

WEBSITES = code$(SUFFIX).gridlabd.us docs$(SUFFIX).gridlabd.us www$(SUFFIX).gridlabd.us
cloud-deploy: aws-deploy gcp-deploy az-deploy

#
# Get a list of files that have to be updated
#

WEBSITES=$(shell find cloud/websites/*.gridlabd.us -type d -prune)

#
# Target that forces updates
#

FORCE:

#
# AWS hosts the main websites to sync
#
aws-deploy: $(WEBSITES)

$(WEBSITES) :
if HAVE_AWSCLI
if SUFFIX
@echo "deploying $@ for SUFFIX='$(SUFFIX)'..."
else
@echo "cannot deploy $@ for SUFFIX='$(SUFFIX)'"
endif
endif
# if SUFFIX
# @echo "aws s3 cp cloud/websites/$@/index.html s3://$@/index.html"
# @echo "aws s3api put-object-acl --bucket $@ --key index.html --acl public-read"
# endif
#
# Target *-dev.gridlabd.us for all branches except "master"
#

AWS_TARGET=$(if $(subst master,,$(shell git rev-parse --abbrev-ref HEAD)),-dev,)

#
# Websites that should be sync'd
#

%.gridlabd.us: FORCE
@echo "syncing $(subst .gridlabd.us,$(AWS_TARGET).gridlabd.us,$(notdir $@)) with AWS_OPTIONS='$(AWS_OPTIONS)' ..."
@aws s3 sync $@ s3://$(subst .gridlabd.us,$(AWS_TARGET).gridlabd.us,$(notdir $@)) $(AWS_OPTIONS) --acl public-read

#
# GCP updates
#
gcp-deploy:
if HAVE_GCPCLI
@echo "WARNING: gcp-deploy is not implemented yet"
endif

azure-deploy:
if HAVE_AZCLI
@echo "WARNING: azure-deploy is not implemented yet"
endif

#
# Azure updates
#
az-deploy:
101 changes: 101 additions & 0 deletions cloud/websites/tutorials.gridlabd.us/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<HTML>

<HEAD>
<TITLE>HiPAS GridLAB-D Tutorials</TITLE>
<LINK REL="stylesheet" HREF="style.css" />
</HEAD>

<SCRIPT LANGUAGE="Javascript">

function play()
{
var file = document.getElementById("session").value;
document.getElementById('player').src = file;
}

function download()
{
var file = document.getElementById("session").value.replace(/\.mp4[^.]*$/,'.pdf');
window.open(file)
}

</SCRIPT>

<BODY>

<CENTER>
<H1>HiPAS GridLAB-D Training Video Library</H1>
<VIDEO ID="player" HEIGHT="600" WIDTH="900" CONTROLS AUTOPLAY>Your browser does not support embedded video playbacks</VIDEO>
<BR/>
Session playing:
<SELECT ID="session" ONCHANGE="play()">
</SELECT>
(View slides: <BUTTON ONCLICK="download()">&#x1F5A5;</BUTTON>)
</CENTER>

<SCRIPT TYPE="text/javascript">

var reader = new XMLHttpRequest()
reader.open("get","library.csv",false)
reader.send()
if ( reader.status != 200 )
{
alert("Library index is not available: ${reader.statusText} (code ${reader.status})")
}
library_csv = reader.response.trim().split(/\r\n|\n/);
first = true
group = false
select = ""
for ( record of library_csv )
{
record = record.trim()
// console.log("RECORD: '" + record + "'");
if ( record === '' )
{
continue;
}
info = record.split(/,/);
if ( info.length === 1 )
{
if ( group )
{
select += "\t</OPTGROUP>\n";
}
select += "\t<OPTGROUP LABEL=\"" + info[0] + "\">\n";
group = true;
}
else if ( info.length === 3 )
{
// console.log("SESSION: " + info);
select += "\t\t<OPTION VALUE=\"" + info[0] + ".mp4#t=" + info[2] + "\""
if ( first )
{
select += " SELECTED";
first = false;
}
select += ">" + info[1] + "</OPTION>\n"
}
else
{
console.log(info + " is invalid (len = " + info.length + ")");
}
}
if ( group )
{
select += "\t</OPTGROUP>\n";
}
console.log("OPTIONS:\n" + select);
document.getElementById("session").innerHTML = select;
play()

</SCRIPT>

<HR/>

<CITE ALIGN="center">
HiPAS GridLAB-D Version 4.3 Tutorials
<BR/>
Copyright &copy; 2022, Regents of the Leland Stanford Junior University
</CITE>

<HR/>
5 changes: 5 additions & 0 deletions cloud/websites/tutorials.gridlabd.us/library.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

User Tutorials

Developer Tutorials
developer/session1,Introduction,27
21 changes: 21 additions & 0 deletions cloud/websites/tutorials.gridlabd.us/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
body {
background: lightgrey;
}

h1 {
color: blue;
}

button {
color: white;
border-radius: 4px;
}

select
font-size: 18px Arial;
}

cite
{
font-size: 10;
}
4 changes: 4 additions & 0 deletions docs/Resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ This GitHub project contains libraries of GLM object that can be used in GridLAB
## [Examples](https://github.com/hipas/gridlabd-examples)

This GitHub project contains example GLM files that illustrate various ways of using GridLAB-D.

## [Tutorials](http://tutorials.gridlabd.us/index.html)

The user and develop tutorials are posted online in both MP4 and PDF format.