Permalink
Browse files

purge finished, tests pass

  • Loading branch information...
1 parent 99cc5b1 commit 0f23b0b655ba9a20c8afa3017e56234291150709 Kevin Ngo committed Oct 22, 2012
View
11 cyder/settings/base.py
@@ -5,6 +5,7 @@
from cyder.settings.dns import *
ROOT_URLCONF = 'cyder.urls'
+APPEND_SLASH = True
MEDIA_ROOT = path('media')
MEDIA_URL = '/media/'
@@ -106,6 +107,11 @@
'django.contrib.admin',
]
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+)
# Because Jinja2 is the default template loader, add any non-Jinja templated
# apps here:
@@ -147,11 +153,6 @@
CORE_BASE_URL = "/core"
JINJA_CONFIG = {'autoescape': False}
BUILD_PATH = 'builds'
-MIDDLEWARE_CLASSES = (
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
-)
-
INTERNAL_IPS = ('127.0.0.1','10.22.74.139','10.250.2.54')
def custom_show_toolbar(request):
View
98 cyder/systems/fixtures/test_data.json
@@ -0,0 +1,98 @@
+[
+ {
+ "pk": 1,
+ "model": "systems.allocation",
+ "fields": {
+ "name": "testalloc"
+ }
+ },
+ {
+ "pk": 1,
+ "model": "systems.location",
+ "fields": {
+ "note": "",
+ "name": "Mountain View",
+ "address": ""
+ }
+ },
+ {
+ "pk": 1,
+ "model": "systems.operatingsystem",
+ "fields": {
+ "version": "2.33",
+ "name": "Test OS"
+ }
+ },
+ {
+ "pk": 1,
+ "model": "systems.servermodel",
+ "fields": {
+ "part_number": "",
+ "model": "Proliant",
+ "vendor": "HP",
+ "description": ""
+ }
+ },
+ {
+ "pk": 1,
+ "model": "systems.systemrack",
+ "fields": {
+ "name": "101.02",
+ "location": 1
+ }
+ },
+ {
+ "pk": 1,
+ "model": "systems.system",
+ "fields": {
+ "allocation": 1,
+ "operating_system": 1,
+ "rack_order": "1.00",
+ "oob_ip": "192.168.1.11",
+ "system_status": null,
+ "notes": "A bunch of notes.",
+ "hostname": "test system 1",
+ "oob_switch_port": "101.22",
+ "patch_panel_port": "101",
+ "server_model": 1,
+ "asset_tag": "",
+ "system_rack": 1,
+ "created_on": null,
+ "switch_ports": "101.02",
+ "change_password": "2011-02-03 00:00:00",
+ "licenses": "121-21-111-555-5555",
+ "updated_on": null,
+ "serial": "39993",
+ "purchase_price": "$101.2",
+ "ram": "",
+ "purchase_date": "2011-04-04"
+ }
+ },
+ {
+ "pk": 2,
+ "model": "systems.system",
+ "fields": {
+ "allocation": 1,
+ "operating_system": 1,
+ "rack_order": "1.00",
+ "oob_ip": "192.168.1.11",
+ "system_status": null,
+ "notes": "A bunch of notes.",
+ "hostname": "test system 2",
+ "oob_switch_port": "101.22",
+ "patch_panel_port": "101",
+ "server_model": 1,
+ "asset_tag": "",
+ "system_rack": 1,
+ "created_on": null,
+ "switch_ports": "101.02",
+ "change_password": "2011-02-03 00:00:00",
+ "licenses": "121-21-111-555-5555",
+ "updated_on": null,
+ "serial": "39993",
+ "purchase_price": "$101.2",
+ "ram": "",
+ "purchase_date": "2011-04-04"
+ }
+ }
+]
View
25 cyder/systems/urls.py
@@ -0,0 +1,25 @@
+from django.conf.urls.defaults import *
+
+from tastytools.api import Api
+
+from .system_api import (SystemResource, ServerModelResource,
+ OperatingSystemResource, KeyValueResource,
+ AllocationResource, LocationResource,
+ SystemRackResource, SystemStatusResource,
+ OperatingSystemData)
+
+system_api = Api(api_name='systems')
+system_api.register(SystemResource())
+system_api.register(ServerModelResource())
+system_api.register(OperatingSystemResource())
+system_api.register(KeyValueResource())
+system_api.register(AllocationResource())
+system_api.register(LocationResource())
+system_api.register(SystemRackResource())
+system_api.register(SystemStatusResource())
+system_api.register_testdata(OperatingSystemData)
+urlpatterns = patterns('',
+ (r'', include(system_api.urls)),
+ (r'^tastytools/', include('tastytools.urls'), {'api_name':
+ system_api.api_name}),
+)
View
0 cyder/templates/403.html
No changes.
View
0 cyder/templates/404.html
No changes.
View
0 cyder/templates/500.html
No changes.
View
99 cyder/templates/dhcp/edit.html
@@ -0,0 +1,99 @@
+{% extends "base.html" %}
+{% block subtitle %}: Edit DHCP Scope{% endblock %}
+{% block content %}
+<style type="text/css">
+ .error {
+ font: normal 11px Lucida Grande;
+ padding: 3px;
+ margin: 3px;
+ background-color: #ffc;
+ border: 1px solid #c00;
+ z-index: 500;
+ }
+ input[type=text].error {
+ font: normal 11px Lucida Grande;
+ background-color: #FFFFFF;
+ border: 1px solid #BBBBBB;
+ line-height: 14px;
+ padding: 1px 0 1px 0;
+ color: #000000;
+
+ }
+</style>
+
+<script type="text/javascript">
+ $(document).ready(function(){
+
+ $.validator.addMethod(
+ "ip_address",
+ function(value, element, regexp) {
+ var check = false;
+ return this.optional(element) || /\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/.test(value);
+ },
+ "Please Enter a Valid IP Address."
+ );
+
+ $.validator.addMethod(
+ "ip_address_or_blank",
+ function(value, element, regexp) {
+ var check = false;
+ return this.optional(element) || /^$|\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/.test(value);
+ },
+ "Please Enter a Valid IP Address, or blank for none."
+ );
+
+ $("#dhcp_edit_form").validate({
+ rules: {
+ domain_name: {
+ required: true
+ },
+ dns_server1: {
+ required: true,
+ ip_address: true
+ },
+ dns_server2: {
+ required: true,
+ ip_address: true
+ },
+ ntp_server1: {
+ required: true,
+ ip_address: true
+ },
+ ntp_server2: {
+ required: false,
+ ip_address_or_blank: true
+ },
+ pool_end: {
+ required: true,
+ ip_address: true
+ },
+ pool_start: {
+ required: true,
+ ip_address: true
+ },
+ scope_start: {
+ required: true,
+ ip_address: true
+ },
+ router: {
+ required: true,
+ ip_address: true
+ }
+ }
+ });
+
+ });
+</script>
+<h2>Edit DHCP Scope</h2>
+
+<br />
+{{ form.errors }}
+<a href='/dhcp/override/{{dhcp_scope}}/'>DHCP Scope Manual Entries</a>
+<form action='.' id="dhcp_edit_form" class='editform' method="post">
+<table style="min-width: 550px;">
+ {{ form.as_table() }}
+ <tr><td><input type="submit" value="Edit" id="submit"></td></tr>
+</table>
+</form>
+
+{% endblock %}
View
20 cyder/templates/dhcp/index.html
@@ -0,0 +1,20 @@
+{% extends "base.html" %}
+{% block subtitle %}: DHCP Scope list{% endblock %}
+{% block content %}
+<h2>Listing DHCP Scopes</h2>
+{% if not read_only %}<a href="{{ url('dhcp-new') }}">Create New</a>{% endif %}
+
+<br />
+<table class="span-24 listtable tablesorter">
+ <thead>
+ <tr>
+ <th colspan="2">Scope Name</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for scope in dhcp_scopes %}
+ <tr><td>{{scope}}</td><td><a href="/dhcp/edit/{{scope}}/">Edit</a>&nbsp;<a onclick="return confirm('Are you sure?');" href="/dhcp/delete/{{scope}}/">Delete</a>&nbsp;<a href="/dhcp/showfile/{{scope}}">Show File</a></td></tr>
+ {% endfor %}
+ </tbody>
+</table>
+{% endblock %}
View
19 cyder/templates/dhcp/new.html
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+{% block subtitle %}: Create DHCP Scope{% endblock %}
+{% block content %}
+<h2>Create DHCP Scope</h2>
+
+<br />
+{{ form.errors }}
+
+<form action='.' class='editform' method="post">
+<table style="width: 550px;">
+ {% if error_message %}
+ <tr><th><font color='red'>{{error_message}}</font></th></tr>
+ {% endif %}
+ {{ form.as_table() }}
+ <tr><td><input type="submit" value="Save" id="submit"></td></tr>
+</table>
+</form>
+
+{% endblock %}
View
19 cyder/templates/dhcp/override.html
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+{% block subtitle %}: Create DHCP Scope{% endblock %}
+{% block content %}
+<h2>Create DHCP Scope</h2>
+
+<br />
+{{ form.errors }}
+
+<form class='editform' method="post">
+<table style="width: 550px;">
+ {% if error_message %}
+ <tr><th><font color='red'>{{error_message}}</font></th></tr>
+ {% endif %}
+ {{ form.as_table() }}
+ <tr><td><input type="submit" value="Save" id="submit"></td></tr>
+</table>
+</form>
+
+{% endblock %}
View
5 cyder/templates/dhcp/showfile.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+{% block subtitle %}: DHCP Scope list{% endblock %}
+{% block content %}
+{{output|safe}}
+{% endblock %}
View
9 cyder/templates/generic_form.html
@@ -0,0 +1,9 @@
+{% extends "base.html" %}
+{% block content %}
+ <form method="post">
+ <table>
+ {{ form }}
+ </table>
+ <input type="submit" name="submit" value="Save" />
+ </form>
+{% endblock %}
View
21 cyder/templates/generic_listtable.html
@@ -0,0 +1,21 @@
+{% extends "base.html" %}
+{% block content %}
+<h2>Listing {% block list_name %}{% endblock %}</h2>
+
+<a href="{% block create_new_url %}{% endblock %}">Create New</a>
+
+<br />
+<table class="listtable tablesorter">
+ <thead>
+ {% block table_head %}{% endblock %}
+ </thead>
+ <tbody>
+ {% block table_body %}{% endblock %}
+ </tbody>
+</table>
+<script>
+ $().ready(function(){
+ add_tablesorter($('.listtable')[0]);
+ })
+</script>
+{% endblock %}
View
3 cyder/urls.py
@@ -14,10 +14,11 @@
urlpatterns = patterns('',
- url(r'^$', 'cyder.base.views.home', name='system-home'),
+ url(r'^$', direct_to_template, {'template': 'base/index.html'}, name='system-home'),
(r'^admin/', include(admin.site.urls)),
(r'^mozdns/', include('cyder.mozdns.urls')),
(r'^core/', include('cyder.core.urls')),
+ (r'^tasty/', include('cyder.systems.urls')),
)
if settings.DEBUG:

0 comments on commit 0f23b0b

Please sign in to comment.