--- a/js/app.js Wed Apr 13 17:35:50 2016 -0500
+++ b/js/app.js Thu Apr 14 13:35:34 2016 -0500
@@ -1,5 +1,80 @@
+function get_registry_url() { + var url = "http://" + settings.registry; + for(registry in settings.registries) { + if(registry.hostname === settings.registry) { + console.log("found registry"); + url = registry.scheme + "://" + registry.hostname; +function tag_display() { + var container = $("#tags"); + var url = get_registry_url() + "/v1/repositories/" + settings.repository + "/tags"; + /* the docker registry returns a list of objects like + * [{"layer", "deadb33f", "name": "latest"}] + * and the private registry returns a dictionary of tag + * names to images. Like: + * {"latest", "deadb33f"} + * This function will normalize them into a sorted list like + * Image IDs are thrown away because we don't care about them. + if(data.constructor === Array) { + // create dtags which is a dictionary of layers with a value that + $.each(data, function(idx, tag) { + dtags[tag.layer] = dtags[tag.layer] || []; + dtags[tag.layer].push(tag.name); + $.each(dtags, function(layer, layer_tags) { + $.each(data, function(tag, layer) { + dtags[layer] = dtags[layer] || []; + dtags[layer].push(tag); + $.each(dtags, function(idx, layer_tags) { + $.each(tags, function(idx, layer_tags) { + var html = "<div class=\"ui card\"><div class=\"content\">"; + html += "<div class=\"meta\">"; + html += "<span class=\"category\">" + layer_tags.length + " tags</span>"; + html += "</div><div class=\"description\">"; + $.each(layer_tags, function(idx, tag) { + html += "<div class=\"ui label\">" + tag + "</div>"; + html += "</div></div></div>"; + container.append(html); function repository_selected(result, response) {
$("#repository-header").text(result.name || "Unknown");
$("#repository-description").text(result.description || "(no description)");
@@ -15,42 +90,36 @@
storage.set({"repository": result.name});
function repository_results(response) {
- // shove the repositories into a dictionary and clean it up
+ var library_prefix = "library/"; $.each(response.results, function(idx, repo) {
- var library_prefix = "library/";
if(repo.name.indexOf(library_prefix) === 0) {
repo.name = repo.name.substring(library_prefix.length, repo.name.length);
- repos[repo.name] = repo;
+ if(!(repo.description)) + repo.description = "(no description)";
function repository_config() {
- var url = "http://" + settings.registry;
- for(registry in settings.registries) {
- if(registry.hostname === settings.registry) {
- url = registry.scheme + "://" + registry.hostname;
+ var url = get_registry_url(); - url: url + "/v1/search?q={query}"
+ url: url + "/v1/search?q={query}", + onResponse: repository_results - onResults: repository_results,
onSelect: repository_selected,
@@ -86,25 +155,25 @@
-function registry_initialize() {
$("#repository").val(settings.repository);
- $("registry").val(settings.registry);
+ $("#registry").val(settings.registry); // add our handler for settings changes
chrome.storage.onChanged.addListener(function(changes, namespace) {
+ // update our copy of the settings + settings[key] = changes[key].newValue; } else if(key === 'repository') {