Skip to content
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

Ui for baracoda cog uk id #87

Merged
merged 4 commits into from
Feb 4, 2021
Merged
Changes from 1 commit
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
112 changes: 112 additions & 0 deletions baracoda/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<html>

pjvv marked this conversation as resolved.
Show resolved Hide resolved
<body>
<script>
function clickButton() {
var prefix = (document.getElementById("prefix").value);
var count = (document.getElementById("count").value);
sendBaracoda(prefix, count);
}
function sendBaracoda(prefix, count) {
var url = "http://uat.baracoda.psd.sanger.ac.uk/barcodes_group/" + prefix + "/new?count=" + count;


var xhr = new XMLHttpRequest();
// we defined the xhr

xhr.onreadystatechange = function () {
if (this.readyState != 4) return;

if (this.status == 201) {
var data = JSON.parse(this.responseText);
var barcodes = data.barcodes_group.barcodes;

var barcodesDiv = document.getElementById('barcodes');
barcodesDiv.innerHTML = '';
for (var i = 0; i < barcodes.length; i++) {
var div = document.createElement('div');
div.innerHTML = barcodes[i];
barcodesDiv.appendChild(div);
}

// we get the returned data
}

// end of state change: it can be after some time (async)
};

xhr.open('POST', url, true);
xhr.send();
}

var prefixes = [{ "prefix": "PHEC", "sequence_name": "heron", "convert": true },
{ "prefix": "PHWC", "sequence_name": "heron", "convert": true },
{ "prefix": "GCVR", "sequence_name": "heron", "convert": true },
{ "prefix": "SANG", "sequence_name": "heron", "convert": true },
{ "prefix": "BIRM", "sequence_name": "heron", "convert": true },
{ "prefix": "CAMB", "sequence_name": "heron", "convert": true },
{ "prefix": "EDIN", "sequence_name": "heron", "convert": true },
{ "prefix": "LIVE", "sequence_name": "heron", "convert": true },
{ "prefix": "OXON", "sequence_name": "heron", "convert": true },
{ "prefix": "SHEF", "sequence_name": "heron", "convert": true },
{ "prefix": "LOND", "sequence_name": "heron", "convert": true },
{ "prefix": "NORW", "sequence_name": "heron", "convert": true },
{ "prefix": "NIRE", "sequence_name": "heron", "convert": true },
{ "prefix": "BRIS", "sequence_name": "heron", "convert": true },
{ "prefix": "NOTT", "sequence_name": "heron", "convert": true },
{ "prefix": "EXET", "sequence_name": "heron", "convert": true },
{ "prefix": "NORT", "sequence_name": "heron", "convert": true },
{ "prefix": "LEED", "sequence_name": "heron", "convert": true },
{ "prefix": "PORT", "sequence_name": "heron", "convert": true },
{ "prefix": "MILK", "sequence_name": "heron", "convert": true },
{ "prefix": "BRIG", "sequence_name": "heron", "convert": true },
{ "prefix": "ALDP", "sequence_name": "heron", "convert": true },
{ "prefix": "TBSD", "sequence_name": "heron", "convert": true },
{ "prefix": "BHRT", "sequence_name": "heron", "convert": true },
{ "prefix": "LCST", "sequence_name": "heron", "convert": true },
{ "prefix": "CWAR", "sequence_name": "heron", "convert": true },
{ "prefix": "GLOU", "sequence_name": "heron", "convert": true },
{ "prefix": "PRIN", "sequence_name": "heron", "convert": true },
{ "prefix": "MTUN", "sequence_name": "heron", "convert": true },
{ "prefix": "HECH", "sequence_name": "heron", "convert": true },
{ "prefix": "WSFT", "sequence_name": "heron", "convert": true },
{ "prefix": "NWGH", "sequence_name": "heron", "convert": true },
{ "prefix": "EKHU", "sequence_name": "heron", "convert": true },
{ "prefix": "RSCH", "sequence_name": "heron", "convert": true },
{ "prefix": "GSTT", "sequence_name": "heron", "convert": true },
{ "prefix": "KGHT", "sequence_name": "heron", "convert": true },
{ "prefix": "WAHH", "sequence_name": "heron", "convert": true },
{ "prefix": "PAHT", "sequence_name": "heron", "convert": true },
{ "prefix": "TFCI", "sequence_name": "heron", "convert": true },
{ "prefix": "CAMC", "sequence_name": "heron", "convert": true },
{ "prefix": "QEUH", "sequence_name": "heron", "convert": true },
{ "prefix": "RAND", "sequence_name": "heron", "convert": true },
{ "prefix": "HT", "sequence_name": "ht", "convert": false }
]

function buildPrefixSelector() {
var prefixSelector = document.getElementById('prefix');
for (var i = 0; i < prefixes.length; i++) {
var option = document.createElement('option');
option.value = prefixes[i].prefix;
option.innerHTML = prefixes[i].prefix;

prefixSelector.appendChild(option);
}
}
</script>
<h1>Baracoda COG UK id retriever</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call it "COG-UK barcode creator"

<form>
<label for="prefix">Prefix
<select id="prefix"></select>
</label>
<label for="count">Count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call it "Number" for "number of barcodes".

<input type="text" name="count" id="count" value="" autocomplete="off" /></label>
<input type="button" name="but" onclick="clickButton()" value="Retrieve" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say "Create".

</form>

<div id="barcodes"></div>
<script>buildPrefixSelector();</script>
</body>

</html>