Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

621 lines (600 sloc) 22.555 kB
<!DOCTYPE html>
<html>
<head>
<script src="jquery-datalink/jquery.js"></script>
<script src="jquery-datalink/jquery.datalink.js"></script>
<script src="jquery-tmpl/jquery.tmpl.js"></script>
<script src="jquery-tmpl/jquery.tmplPlus.js"></script>
<script src="jquery.json.js"></script>
<script src="linode-javascript/linode.api.js"></script>
<script src="linode-javascript/linode.cache.js"></script>
<script src="linode-javascript/linode.datalink.js"></script>
<link rel="stylesheet" href="jquery-ui/themes/base/jquery.ui.all.css">
<script src="jquery-ui/ui/jquery.ui.core.js"></script>
<script src="jquery-ui/ui/jquery.ui.widget.js"></script>
<script src="jquery-ui/ui/jquery.ui.mouse.js"></script>
<script src="jquery-ui/ui/jquery.ui.accordion.js"></script>
<script src="jquery-ui/ui/jquery.ui.autocomplete.js"></script>
<script src="jquery-ui/ui/jquery.ui.button.js"></script>
<script src="jquery-ui/ui/jquery.ui.datepicker.js"></script>
<script src="jquery-ui/ui/jquery.ui.dialog.js"></script>
<script src="jquery-ui/ui/jquery.ui.draggable.js"></script>
<script src="jquery-ui/ui/jquery.ui.droppable.js"></script>
<script src="jquery-ui/ui/jquery.ui.position.js"></script>
<script src="jquery-ui/ui/jquery.ui.progressbar.js"></script>
<script src="jquery-ui/ui/jquery.ui.resizable.js"></script>
<script src="jquery-ui/ui/jquery.ui.selectable.js"></script>
<script src="jquery-ui/ui/jquery.ui.slider.js"></script>
<script src="jquery-ui/ui/jquery.ui.sortable.js"></script>
<script src="jquery-ui/ui/jquery.ui.tabs.js"></script>
<script src="jquery-ui/ui/jquery.effects.core.js"></script>
<script src="jquery-ui/ui/jquery.effects.blind.js"></script>
<script src="jquery-ui/ui/jquery.effects.bounce.js"></script>
<script src="jquery-ui/ui/jquery.effects.clip.js"></script>
<script src="jquery-ui/ui/jquery.effects.drop.js"></script>
<script src="jquery-ui/ui/jquery.effects.explode.js"></script>
<script src="jquery-ui/ui/jquery.effects.fold.js"></script>
<script src="jquery-ui/ui/jquery.effects.highlight.js"></script>
<script src="jquery-ui/ui/jquery.effects.pulsate.js"></script>
<script src="jquery-ui/ui/jquery.effects.scale.js"></script>
<script src="jquery-ui/ui/jquery.effects.shake.js"></script>
<script src="jquery-ui/ui/jquery.effects.slide.js"></script>
<script src="jquery-ui/ui/jquery.effects.transfer.js"></script>
<script src="ui.tabs.closable/ui.tabs.closable.js"></script>
<style>
.horizontal_lists li {
display: inline;
list-style-type: none;
padding-right: 20px;
}
table {
width: 100%;
}
</style>
<script type="text/x-jquery-tmpl" id="tmpl_linode_edit">
<div id="linode-container-${LINODEID}" class="dynamic_tab">
<form id="linode-${LINODEID}">
<input type="hidden" name="LINODEID" value="${LINODEID}" />
<ul>
<li>Label <input type="text" name="LABEL" value="${LABEL}" size=25 /></li>
<li>Display Group <input type="text" name="LPM_DISPLAYGROUP" value="${LPM_DISPLAYGROUP}" /></li>
<li>Status <input type="text" name="STATUS" value="${STATUS}" disabled="disabled" size=10 /></li>
<li>Ram <input type="text" name="TOTALRAM" value="${TOTALRAM}" disabled="disabled" size=5 /></li>
<li>HD <input type="text" name="TOTALHD" value="${TOTALHD}" disabled="disabled" size=5 /></li>
<li>BW <input type="text" name="TOTALXFER" value="${TOTALXFER}" disabled="disabled" size=5 /></li>
<li>Datacenter <input type="text" name="DATACENTERID" value="${DATACENTERID}" disabled="disabled" /></li>
<li>Backups <input type="checkbox" name="BACKUPSENABLED" {{if BACKUPSENABLED}}checked="true"{{/if}} disabled="disabled" /></li>
<li>Lassie <input type="checkbox" name="WATCHDOG" {{if WATCHDOG}}checked="true"{{/if}} disabled="disabled" /></li>
<li>Alerts
<ul>
<li>Disk <input type="checkbox" name="ALERT_DISKIO_ENABLED" /> Threshold <input type="text" name="ALERT_DISKIO_THRESHOLD" size=10 /></li>
<li>CPU <input type="checkbox" name="ALERT_CPU_ENABLED" /> Threshold <input type="text" name="ALERT_CPU_THRESHOLD" size=10 /></li>
<li>Bandwidth In <input type="checkbox" name="ALERT_BWIN_ENABLED" /> Threshold <input type="text" name="ALERT_BWIN_THRESHOLD" size=10 /></li>
<li>Bandwidth Out <input type="checkbox" name="ALERT_BWOUT_ENABLED" /> Threshold <input type="text" name="ALERT_BWOUT_THRESHOLD" size=10 /></li>
<li>Bandwidth Quota <input type="checkbox" name="ALERT_BWQUOTA_ENABLED" /> Threshold <input type="text" name="ALERT_BWQUOTA_THRESHOLD" size=10 /></li>
</ul>
</li>
<li><a href="#" class="linode_save">Save</a></li>
</ul>
</form>
<div class="linode_options">
<ul>
<li><a href="#linode-configs-${LINODEID}">Config Profiles</a></li>
<li><a href="#linode-disks-${LINODEID}">Disk Images</a></li>
</ul>
<table id="linode-configs-${LINODEID}">
</table>
<table id="linode-disks-${LINODEID}">
</table>
</div>
</div>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_configs">
<tr>
<td>${LABEL}</td>
<td>
<a href="#" onClick="objEdit('CONFIGID', 'config', ${CONFIGID});">Edit</a>
|
<a href="#">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_disks">
<tr>
<td>${LABEL}</td>
<td>
<a href="#" onClick="objEdit('DISKID', 'disk', ${DISKID});">Edit</a>
|
<a href="#">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_config_edit">
<ul>
<form id="config-${CONFIGID}">
<input type="hidden" name="LINODEID" value="${LINODEID.LINODEID}" />
<input type="hidden" name="CONFIGID" value="${CONFIGID}" />
<li>Label <input type="text" name="LABEL" value="${LABEL}" /></li>
<li>Notes <input type="text" name="COMMENTS" value="${COMMENTS}" /></li>
<li>Kernel
<select name="KERNELID">
{{each $item.cache.getAll("KERNELID")}}
<option value="${$value.KERNELID}">${$value.LABEL}</option>
{{/each}}
</select>
</li>
<li>Run Level <input type="text" name="RUNLEVEL" value="${RUNLEVEL}" /></li>
<li>RAM Limit <input type="text" name="RAMLIMIT" value="${RAMLIMIT}" /></li>
{{each DISKLIST.split(",")}}
<li>/dev/xvd${String.fromCharCode(97+$index)}
<select>
<option value=""></option>
{{each(d, disk) cache.getAll("DISKID", matchKey(LINODEID))}}
<option value="${disk.DISKID}" {{if disk.DISKID == $value}}selected="selected"{{/if}}>
${disk.LABEL}
</option>
{{/each}}
</select>
</li>
{{/each}}
<li>Root Device Custom <input type="text" name="ROOTDEVICECUSTOM" value="${ROOTDEVICECUSTOM}" /></li>
<li>Root Device
<select name="ROOTDEVICENUM">
{{each DISKLIST.split(",")}}
<option value="${$index+1}">/dev/xvd${String.fromCharCode(97+$index)}</option>
{{/each}}
</select>
Read Only <input type="checkbox" name="ROOTDEVICERO" />
</li>
<li>Rescue <input type="checkbox" name="ISRESCUE" /></li>
<ul>Helpers
<li>Xenify Distro <input type="checkbox" name="HELPER_XEN" /></li>
<li>Disable updatedb <input type="checkbox" name="HELPER_DISABLEUPDATEDB" /></li>
<li>modules.dep Helper <input type="checkbox" name="HELPER_DEPMOD" /></li>
<li>Automount devtmpfs <input type="checkbox" name="DEVTMPFS_AUTOMOUNT" /></li>
</ul>
</form>
</ul>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_disk_edit">
<ul>
<form id="disk-${DISKID}">
<input type="hidden" name="LINODEID" value="${LINODEID.LINODEID}" />
<input type="hidden" name="DISKID" value="${DISKID}" />
<li>Label <input type="text" name="LABEL" value="${LABEL}" /></li>
<li>Type
<select name="TYPE">
<option value="ext3">Ext3</option>
<option value="swap">Swap</option>
<option value="raw">Raw</option>
<option value="initrd">initrd</option>
</select>
</li>
<li>Size <input type="text" name="SIZE" value="${SIZE}" /></li>
<li>Read Only <input type="checkbox" name="ISREADONLY" /></li>
<li>Status <input type="text" name="STATUS" value="${STATUS}" /></li>
<li>Created <input type="text" name="CREATE_DT" value="${CREATE_DT}" disabled="disabled" /></li>
<li>Updated <input type="text" name="UPDATE_DT" value="${UPDATE_DT}" disabled="disabled" /></li>
</form>
</ul>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_ttl_option">
<option value="0">Default</option>
<option value="300">300</option>
<option value="3600">3600</option>
<option value="7200">7200</option>
<option value="14400">14400</option>
<option value="28800">28800</option>
<option value="57600">57600</option>
<option value="86400">86400</option>
<option value="172800">172800</option>
<option value="345600">345600</option>
<option value="604800">604800</option>
<option value="1209600">1209600</option>
<option value="2419200">2419200</option>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_resource_edit">
<ul>
<form id="resource-${RESOURCEID}">
<input type="hidden" name="DOMAINID" value="${DOMAINID.DOMAINID}" />
<input type="hidden" name="RESOURCEID" value="${RESOURCEID}" />
<li>Protocol
<select name="PROTOCOL">
<option value=""></option>
<option value="tcp">TCP</option>
<option value="udp">UDP</option>
</select>
</li>
<li>Name <input type="text" name="NAME" value="${NAME}" /></li>
<li>Weight <input type="text" name="WEIGHT" value="${WEIGHT}" /></li>
<li>Priority <input type="text" name="PRIORITY" value="${PRIORITY}" /></li>
<li>TTL
<select name="TTL_SEC">
{{tmpl "#tmpl_ttl_option"}}
</select>
</li>
<li>TYPE
<select name="TYPE">
<option value=""></option>
<option value="ns">MX</option>
<option value="mx">MX</option>
<option value="a">A</option>
<option value="cname">CNAME</option>
<option value="txt">TXT</option>
<option value="srv">SRV</option>
</select>
</li>
<li>TARGET <input type="text" name="TARGET" value="${TARGET}" /></li>
</form>
</ul>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_resource_a">
<tr>
<td>${NAME}</td>
<td>${TARGET}</td>
<td>${TTL_SEC}</td>
<td>
<a href="#" onClick="objEdit('RESOURCEID', 'resource', ${RESOURCEID});">Edit</a>
|
<a href="#" id="" class="resource-delete">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_resource_mx">
<tr>
<td>${TARGET}</td>
<td>${PRIORITY}</td>
<td>${TTL_SEC}</td>
<td>
<a href="#" onClick="objEdit('RESOURCEID', 'resource', ${RESOURCEID});">Edit</a>
|
<a href="#" id="" class="resource-delete">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_resource_cname">
<tr>
<td>${NAME}</td>
<td>${TARGET}</td>
<td>${TTL_SEC}</td>
<td>
<a href="#" onClick="objEdit('RESOURCEID', 'resource', ${RESOURCEID});">Edit</a>
|
<a href="#" id="" class="resource-delete">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_resource_txt">
<tr>
<td>${NAME}</td>
<td>${TARGET}</td>
<td>${TTL_SEC}</td>
<td>
<a href="#" onClick="objEdit('RESOURCEID', 'resource', ${RESOURCEID});">Edit</a>
|
<a href="#" id="" class="resource-delete">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_resource_srv">
<tr>
<td>${NAME}</td>
<td>${PRIORITY}</td>
<td>${WEIGHT}</td>
<td>${PROTOCOL}</td>
<td>${PORT}</td>
<td>${TARGET}</td>
<td>${TTL_SEC}</td>
<td>
<a href="#" onClick="objEdit('RESOURCEID', 'resource', ${RESOURCEID});">Edit</a>
|
<a href="#" id="" class="resource-delete">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_resource_ns">
<tr>
<td>${NAME}</td>
<td>${TARGET}</td>
<td>${TTL_SEC}</td>
<td>
<a href="#" onClick="objEdit('RESOURCEID', 'resource', ${RESOURCEID});">Edit</a>
|
<a href="#" id="" class="resource-delete">Delete</a>
</td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_domain_edit">
<div id="domain-container-${DOMAINID}" class="dynamic_tab">
<form id="domain-${DOMAINID}">
<input type="hidden" name="DOMAINID" value="${DOMAINID}" />
<ul>
<li>${DOMAIN}</li>
<li>Description <input type="text" name="DESCRIPTION" value="${DESCRIPTION}" /></li>
<li>Type
<select disabled="disabled" name="TYPE">
<option value="master">Master</option>
<option value="slave">Slave</option>
</select>
</li>
<li>SOA Email <input type="text" name="SOA_EMAIL" value="${SOA_EMAIL}" /></li>
<li>Status
<select name="STATUS">
<option value="1">Active</option>
<option value="2">Edit</option>
<option value="3">Inactive</option>
</select>
</li>
<li>TTL
<select name="TTL_SEC">
{{tmpl "#tmpl_ttl_option"}}
</select>
</li>
<li>Refresh
<select name="REFRESH_SEC">
{{tmpl "#tmpl_ttl_option"}}
</select>
</li>
<li>Expire
<select name="EXPIRE_SEC">
{{tmpl "#tmpl_ttl_option"}}
</select>
</li>
<li><a href="#">Save</a></li>
</ul>
</form>
<div class="resources_tabs">
<ul>
<li><a href="#resources-ns-${DOMAINID}">NS Records</a></li>
<li><a href="#resources-mx-${DOMAINID}">MX Records</a></li>
<li><a href="#resources-a-${DOMAINID}">A Records</a></li>
<li><a href="#resources-cname-${DOMAINID}">CNAME Records</a></li>
<li><a href="#resources-srv-${DOMAINID}">SRV Records</a></li>
<li><a href="#resources-txt-${DOMAINID}">TXT Records</a></li>
</ul>
<div id="resources-ns-${DOMAINID}">
<table id="domain-resource-ns-${DOMAINID}" class="resource_list">
<tr>
<td>Name Server</td>
<td>Subdomain</td>
<td>TTL</td>
<td>Action</td>
</tr>
</table>
</div>
<div id="resources-mx-${DOMAINID}">
<table id="domain-resource-mx-${DOMAINID}" class="resource_list">
<tr>
<td>Mail Server</td>
<td>Preference</td>
<td>TTL</td>
<td>Action</td>
</tr>
</table>
</div>
<div id="resources-a-${DOMAINID}">
<table id="domain-resource-a-${DOMAINID}" class="resource_list">
<tr>
<td>Hostname</td>
<td>IP</td>
<td>TTL</td>
<td>Action</td>
</tr>
</table>
</div>
<div id="resources-cname-${DOMAINID}">
<table id="domain-resource-cname-${DOMAINID}" class="resource_list">
<tr>
<td>Hostname</td>
<td>Alias To</td>
<td>TTL</td>
<td>Action</td>
</tr>
</table>
</div>
<div id="resources-srv-${DOMAINID}">
<table id="domain-resource-srv-${DOMAINID}" class="resource_list">
<tr>
<td>Service</td>
<td>Priority</td>
<td>Weight</td>
<td>Port</td>
<td>Target</td>
<td>TTL</td>
<td>Action</td>
</tr>
</table>
</div>
<div id="resources-txt-${DOMAINID}">
<table id="domain-resource-txt-${DOMAINID}" class="resource_list">
<tr>
<td>Name</td>
<td>Target</td>
<td>TTL</td>
<td>Action</td>
</tr>
</table>
</div>
</div>
</div>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_linode_list">
<tr>
<td>${LABEL}</td>
<td>${$item.statusMap(STATUS)}</td>
<td>{{if DATACENTERID }}${DATACENTERID.LOCATION}{{/if}}</td>
<td><a href="#" id="linode-edit-${LINODEID}" class="linode_edit">edit</a></td>
</tr>
</script>
<script type="text/x-jquery-tmpl" id="tmpl_domain_list">
<tr>
<td>${DOMAIN}</td>
<td>${TYPE}</td>
<td>${$item.statusMap(STATUS)}</td>
<td><a href="#" id="domain-edit-${DOMAINID}" class="domain_edit">edit</a></td>
</tr>
</script>
<script type="text/javascript">
var cache = chrome.extension.getBackgroundPage().cache;
function link_item(elm, item) {
$(elm).link(item, LINODE_OBJ_CONVERSION[item.key])
for(k in item) {
$(item).data(k, item[k])
}
}
function iter_objs(shortname, objs) {
$.each(objs, function(i, obj) {
var elm = $('#'+shortname+'-'+obj[obj.key])
link_item(elm, obj)
})
}
function matchKey(obj) {
return function(o) {
return (o[obj.key] && o[obj.key][obj.key] == obj[obj.key])
}
}
function objEdit(key, short, rid) {
var resource = cache.get(key, rid)
$('#edit_dialog').html('')
$('#tmpl_'+short+'_edit').tmpl([resource], {'cache': cache}).appendTo('#edit_dialog')
link_item($('#'+short+'-'+rid), resource)
$('#edit_dialog').dialog({
modal: true,
minWidth: 400,
minHeight: 500,
title: 'Edit Resource',
buttons: {
cancel: function() { $(this).dialog('close'); },
save: function() { $(this).dialog('close'); }
},
})
}
$(function()
{
function find_tab(label) {
var pos = -1
$('#outer_tabs > div.dynamic_tab').each(function(i, e) {
if(e.id == label) {
pos = i + 2
}
})
return pos
}
function start()
{
var linodes = cache.getAll('LINODEID');
var domains = cache.getAll('DOMAINID')
$('#tmpl_linode_list').tmpl(linodes, {
'statusMap': function(s) {
return cache.status_map[s.toString()]
}
}).appendTo('#linodes')
$('#tmpl_domain_list').tmpl(domains, {
'statusMap': function(s) {
return cache.domain_status[s.toString()]
}
}).appendTo('#domains')
$('.linode_edit').each(function(i, e){
$(e).click(function(){
var id = e.id.replace('linode-edit-', '')
var linode = cache.get('LINODEID', parseInt(id))
var pos = find_tab('linode-container-'+linode.LINODEID)
if(pos > -1)
{
$('#outer_tabs').tabs('select', pos)
}
else
{
$('#tmpl_linode_edit').tmpl([linode]).appendTo('#outer_tabs')
$('#outer_tabs').tabs('add', '#linode-container-'+id, linode.LABEL)
$('#outer_tabs').tabs('select', $('#outer_tabs').tabs('length')-1)
link_item($('#linode-'+id), linode)
$('.linode_options').tabs()
$('#tmpl_configs').tmpl(
cache.getAll('CONFIGID', matchKey(linode))
).appendTo('#linode-configs-'+id)
$('#tmpl_disks').tmpl(
cache.getAll('DISKID', matchKey(linode))
).appendTo('#linode-disks-'+id)
}
})
})
$('.domain_edit').each(function(i, e) {
$(e).click(function(){
var id = e.id.replace('domain-edit-', '')
var domain = cache.get('DOMAINID', parseInt(id))
var pos = find_tab('domain-container-'+domain.DOMAINID)
if(pos > -1)
{
$('#outer_tabs').tabs('select', pos)
}
else
{
var resources = cache.getAll('RESOURCEID', matchKey(domain))
var recs = {
'ns': [],
'a': [],
'mx': [],
'cname': [],
'srv': [],
'txt': [],
}
$.each(resources, function(i, r) {
var t = r.TYPE.toLowerCase()
recs[t].push(r)
})
$('#tmpl_domain_edit').tmpl([domain]).appendTo('#outer_tabs')
for (k in recs) {
$('#tmpl_resource_'+k).tmpl(recs[k]).appendTo('#domain-resource-'+k+'-'+id)
}
$('#outer_tabs').tabs('add', '#domain-container-'+id, domain.DOMAIN)
$('#outer_tabs').tabs('select', $('#outer_tabs').tabs('length')-1)
link_item($('#domain-'+id), domain)
$('.resources_tabs').tabs()
}
})
})
}
$('#outer_tabs').tabs({
closable: true,
closableClick: function(event, ui) {
return !$(ui.panel).hasClass('unclosable')
},
})
$('#refresh_cache').click(function() {
$('#linodes').html('')
$('#domains').html('')
var length = $('#outer_tabs').tabs('length')
if(length > 2) {
length -= 1
while(length > 1) {
$('#outer_tabs').tabs('remove', length)
length -= 1
}
}
cache.cache = {}
cache.fill(start)
})
start()
});
</script>
</head>
<body>
<a href="#" id="refresh_cache">Refresh Cache</a>
<div id="edit_dialog"></div>
<div id="outer_tabs">
<ul>
<li><a href="#linodes_container">Linodes</a></li>
<li><a href="#domains_container">Domains</a></li>
</ul>
<div id="linodes_container" class="horizontal_lists unclosable">
<table id="linodes">
</table>
</div>
<div id="domains_container" class="horizontal_lists unclosable">
<table id="domains">
</table>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.