Added base methods and classes for API

This commit is contained in:
Eddie Ramirez 2016-08-04 22:58:20 +00:00
parent 19b1a51ce8
commit a05a5e80e1
21 changed files with 238 additions and 18 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
dist
ChangeLog
AUTHORS
craton_ui.egg-info/*

View File

@ -1,6 +1,7 @@
CHANGES
=======
* Added base .gitignore
* Added regions panel
* Initial Structure
* Initial commit

3
MANIFEST.in Normal file
View File

@ -0,0 +1,3 @@
include setup.py
recursive-include craton_dashboard *.js *.html *.scss

View File

@ -0,0 +1 @@
from craton_dashboard.api import craton

View File

@ -11,3 +11,87 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from six.moves.urllib import request
from django.conf import settings
from horizon import exceptions
from openstack_dashboard.api import base
def cratonclient():
pass
def project_create(request, **kwargs):
pass
def project_delete(request, **kwargs):
pass
def project_list(request, **kwargs):
pass
def project_show(request, **kwargs):
pass
def project_update(request, **kwargs):
pass
def region_create(request, **kwargs):
pass
def region_delete(request, **kwargs):
pass
def region_list(request, **kwargs):
pass
def region_show(request, **kwargs):
pass
def region_update(request, **kwargs):
pass
def cell_create(request, **kwargs):
pass
def cell_delete(request, **kwargs):
pass
def cell_list(request, **kwargs):
pass
def cell_show(request, **kwargs):
pass
def cell_update(request, **kwargs):
pass
def device_create(request, **kwargs):
pass
def device_delete(request, **kwargs):
pass
def device_list(request, **kwargs):
pass
def device_show(request, **kwargs):
pass
def host_create(request, **kwargs):
pass
def host_delete(request, **kwargs):
pass
def host_list(request, **kwargs):
pass
def host_show(request, **kwargs):
pass
def host_update(request, **kwargs):
pass
def user_list(request, **kwargs):
pass

View File

@ -0,0 +1 @@
from craton_dashboard.api.rest import craton

View File

@ -0,0 +1,106 @@
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf import settings
from django.views import generic
from craton_dashboard.api import craton
from openstack_dashboard import api
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_utils
from six.moves.urllib import request
@urls.register
class Regions(generic.View):
"""API for craton"""
url_regex = r'craton/regions/$'
@rest_utils.ajax()
def get(self, request, **kwargs):
"""Gets all Regions"""
regions = craton.region_list(request)
return {'items': regions}
@rest_utils.ajax()
def post(self, request, **kwargs):
"""Creates a new Region"""
return craton.region_create(request)
@rest_utils.ajax()
def put(self, request, **kwargs):
"""Updates a Region"""
return craton.region_update(request)
@rest_utils.ajax()
def delete(self, request, **kwargs):
"""Deletes a Region"""
return craton.region_delete(request)
@urls.register
class Cells(generic.View):
"""API for craton"""
url_regex = r'craton/cells/$'
@rest_utils.ajax()
def get(self, request, **kwargs):
"""Gets all Cells"""
return craton.cell_list(request)
@rest_utils.ajax()
def post(self, request, **kwargs):
"""Creates a new Cell"""
return craton.cell_create(request)
@rest_utils.ajax()
def put(self, request, **kwargs):
"""Updates a Cell"""
return craton.cell_update(request)
@rest_utils.ajax()
def delete(self, request, **kwargs):
"""Deletes a Cell"""
return craton.cell_delete(request)
@urls.register
class Hosts(generic.View):
"""API for craton"""
url_regex = r'craton/hosts/$'
@rest_utils.ajax()
def get(self, request, **kwargs):
"""Gets all Hosts"""
return craton.host_list(request)
@rest_utils.ajax()
def post(self, request, **kwargs):
"""Creates a new Host"""
return craton.hosts_create(request)
@rest_utils.ajax()
def put(self, request, **kwargs):
"""Updates a Host"""
return craton.hosts_update(request)
@rest_utils.ajax()
def delete(self, request, **kwargs):
"""Deletes a Host"""
return craton.hosts_delete(request)

View File

@ -0,0 +1 @@
from craton_dashboard.api import rest

View File

@ -16,6 +16,6 @@ from django.utils.translation import ugettext_lazy as _
import horizon
class Taskflow(horizon.Panel):
class Taskflows(horizon.Panel):
name = _('Taskflows')
slug = 'taskflow'

View File

@ -1 +0,0 @@
<h2>Hello World!</h2>

View File

@ -1 +0,0 @@
<h1>Hello</h1>

View File

@ -16,17 +16,9 @@ from django.utils.translation import ugettext_lazy as _
from django.views import generic
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon import views
class IndexView(tables.DataTableView):
template_name = 'project/fleet/index.hml'
class IndexView(generic.TemplateView):
template_name = 'regions/index.html'
page_title = _('Regions')
def __init__(self, *args, **kwargs):
super(IndexView, self).__init__(*args, **kwargs)
self._more = None
def get_data(self):
return []

View File

@ -20,5 +20,4 @@ PANEL_DASHBOARD = 'project'
PANEL_GROUP = 'fleet_management'
ADD_PANEL = 'craton_dashboard.dashboards.project.fleeti.taksflows.panel.Taskflows'
ADD_PANEL = 'craton_dashboard.dashboards.project.fleet.taskflows.panel.Taskflows'

View File

View File

@ -0,0 +1,12 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Craton" %}{% endblock %}
{% block page_header %}{% endblock %}
{% block ng_route_base %}
<base href="{{ WEBROOT }}">
{% endblock %}
{% block main %}
<div ng-view></div>
{% endblock %}

View File

@ -0,0 +1,12 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Craton" %}{% endblock %}
{% block page_header %}{% endblock %}
{% block ng_route_base %}
<base href="{{ WEBROOT }}">
{% endblock %}
{% block main %}
<div ng-view></div>
{% endblock %}

View File

@ -1,6 +1,6 @@
Metadata-Version: 1.0
Name: craton-ui
Version: 0.0.1.dev2
Version: 0.0.1.dev3
Summary: The Craton UI for Horizon Dashboard
Home-page: http://www.openstack.org/
Author: OSIC

View File

@ -1,11 +1,15 @@
AUTHORS
ChangeLog
LICENSE
MANIFEST.in
README.rst
setup.cfg
setup.py
craton_dashboard/__init__.py
craton_dashboard/api/__init__.py
craton_dashboard/api/craton.py
craton_dashboard/api/rest/__init__.py
craton_dashboard/api/rest/craton.py
craton_dashboard/dashboards/__init__.py
craton_dashboard/dashboards/project/__init__.py
craton_dashboard/dashboards/project/fleet/__init__.py
@ -20,6 +24,11 @@ craton_dashboard/enabled/_1710_fleet_panel_group.py
craton_dashboard/enabled/_1720_fleet_regions_panel.py
craton_dashboard/enabled/_1730_fleet_taskflows_panel.py
craton_dashboard/enabled/__init__.py
craton_dashboard/templates/__init__.py
craton_dashboard/templates/regions/__init__.py
craton_dashboard/templates/regions/index.html
craton_dashboard/templates/workflows/__init__.py
craton_dashboard/templates/workflows/index.html
craton_ui.egg-info/PKG-INFO
craton_ui.egg-info/SOURCES.txt
craton_ui.egg-info/dependency_links.txt

View File

@ -1 +1 @@
{"is_release": false, "git_version": "e263577"}
{"is_release": false, "git_version": "19b1a51"}