Prepare UI for split
fixed paths to support new repo layout modified tox file Change-Id: Ibbe087cc4e0ae02b890824b4a559a9dd0c0a0a49
This commit is contained in:
parent
e6ee1e5b57
commit
f75bd1c7c7
@ -10,6 +10,5 @@ sys.path.append('/opt/stack/freezer')
|
||||
|
||||
# A list of applications to be added to INSTALLED_APPS.
|
||||
ADD_INSTALLED_APPS = [
|
||||
'horizon_web_ui.freezer_ui',
|
||||
'freezer_ui',
|
||||
]
|
||||
|
||||
|
@ -10,9 +10,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""Some helper functions to use the freezer_ui client functionality
|
||||
from horizon.
|
||||
"""
|
||||
# Some helper functions to use the freezer_ui client functionality
|
||||
# from horizon.
|
||||
|
||||
|
||||
import warnings
|
||||
|
||||
@ -23,20 +23,20 @@ from horizon.utils.memoized import memoized # noqa
|
||||
|
||||
|
||||
import freezer.apiclient.client
|
||||
from horizon_web_ui.freezer_ui.utils import Action
|
||||
from horizon_web_ui.freezer_ui.utils import ActionJob
|
||||
from horizon_web_ui.freezer_ui.utils import Backup
|
||||
from horizon_web_ui.freezer_ui.utils import Client
|
||||
from horizon_web_ui.freezer_ui.utils import Job
|
||||
from horizon_web_ui.freezer_ui.utils import JobList
|
||||
from horizon_web_ui.freezer_ui.utils import Session
|
||||
from horizon_web_ui.freezer_ui.utils import create_dict_action
|
||||
from horizon_web_ui.freezer_ui.utils import create_dummy_id
|
||||
from freezer_ui.utils import Action
|
||||
from freezer_ui.utils import ActionJob
|
||||
from freezer_ui.utils import Backup
|
||||
from freezer_ui.utils import Client
|
||||
from freezer_ui.utils import Job
|
||||
from freezer_ui.utils import JobList
|
||||
from freezer_ui.utils import Session
|
||||
from freezer_ui.utils import create_dict_action
|
||||
from freezer_ui.utils import create_dummy_id
|
||||
|
||||
|
||||
@memoized
|
||||
def get_service_url(request):
|
||||
""" Get Freezer API url from keystone catalog.
|
||||
"""Get Freezer API url from keystone catalog.
|
||||
if Freezer is not set in keystone, the fallback will be
|
||||
'FREEZER_API_URL' in local_settings.py
|
||||
"""
|
||||
@ -288,7 +288,8 @@ def client_get(request, client_id):
|
||||
|
||||
def add_job_to_session(request, session_id, job_id):
|
||||
"""This function will add a job to a session and the API will handle the
|
||||
copy of job information to the session """
|
||||
copy of job information to the session
|
||||
"""
|
||||
try:
|
||||
return _freezerclient(request).sessions.add_job(session_id, job_id)
|
||||
except Exception:
|
||||
@ -297,7 +298,8 @@ def add_job_to_session(request, session_id, job_id):
|
||||
|
||||
def remove_job_from_session(request, session_id, job_id):
|
||||
"""Remove a job from a session will delete the job information but not the
|
||||
job itself """
|
||||
job itself
|
||||
"""
|
||||
try:
|
||||
return _freezerclient(request).sessions.remove_job(session_id, job_id)
|
||||
except Exception:
|
||||
@ -366,7 +368,8 @@ def session_get(request, session_id):
|
||||
def backups_list(request, offset=0, time_after=None, time_before=None,
|
||||
text_match=None):
|
||||
"""List all backups and optionally you can provide filters and pagination
|
||||
values """
|
||||
values
|
||||
"""
|
||||
page_size = utils.get_page_size(request)
|
||||
|
||||
search = {}
|
||||
|
@ -19,7 +19,7 @@ from django.views import generic
|
||||
from openstack_dashboard.api.rest import utils as rest_utils
|
||||
from openstack_dashboard.api.rest.utils import JSONResponse
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
import freezer_ui.api.api as freezer_api
|
||||
|
||||
|
||||
# https://github.com/tornadoweb/tornado/issues/1009
|
||||
|
@ -14,7 +14,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
import horizon
|
||||
|
||||
import horizon_web_ui.freezer_ui.dashboard as dashboard
|
||||
import freezer_ui.dashboard as dashboard
|
||||
|
||||
|
||||
class BackupsPanel(horizon.Panel):
|
||||
|
@ -16,7 +16,7 @@ from django.utils import safestring
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon.utils import functions as utils
|
||||
from horizon import tables
|
||||
from horizon_web_ui.freezer_ui.utils import timestamp_to_string
|
||||
from freezer_ui.utils import timestamp_to_string
|
||||
|
||||
|
||||
class Restore(tables.LinkAction):
|
||||
|
@ -14,7 +14,7 @@
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from horizon_web_ui.freezer_ui.backups import views
|
||||
from freezer_ui.backups import views
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
|
@ -22,10 +22,9 @@ from horizon import exceptions
|
||||
from horizon import tables
|
||||
from horizon import workflows
|
||||
|
||||
|
||||
from horizon_web_ui.freezer_ui.backups import tables as freezer_tables
|
||||
from horizon_web_ui.freezer_ui.backups.workflows import restore as restore_workflow
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
from freezer_ui.backups import tables as freezer_tables
|
||||
from freezer_ui.backups.workflows import restore as restore_workflow
|
||||
import freezer_ui.api.api as freezer_api
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
@ -69,7 +68,8 @@ class RestoreView(workflows.WorkflowView):
|
||||
int(backup.data_dict[0]['backup_metadata']['time_stamp']))
|
||||
backup_date_str = django_date(backup_date, 'SHORT_DATETIME_FORMAT')
|
||||
return "Restore '{}' from {}".format(
|
||||
backup.data_dict[0]['backup_metadata']['backup_name'], backup_date_str)
|
||||
backup.data_dict[0]['backup_metadata']['backup_name'],
|
||||
backup_date_str)
|
||||
|
||||
def get_initial(self):
|
||||
return {"backup_id": self.kwargs['backup_id']}
|
||||
@ -79,4 +79,3 @@ class RestoreView(workflows.WorkflowView):
|
||||
workflow.name = self.get_workflow_name()
|
||||
|
||||
return workflow
|
||||
|
||||
|
@ -18,13 +18,13 @@ from horizon import forms
|
||||
from horizon import exceptions
|
||||
from horizon import workflows
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
import freezer_ui.api.api as freezer_api
|
||||
|
||||
|
||||
class DestinationAction(workflows.MembershipAction):
|
||||
path = forms.CharField(label=_("Destination Path"),
|
||||
help_text=_("The path in which the backup should be "
|
||||
"restored"),
|
||||
help_text=_("The path in which the backup should be"
|
||||
" restored"),
|
||||
required=True)
|
||||
backup_id = forms.CharField(widget=forms.HiddenInput())
|
||||
|
||||
|
@ -11,8 +11,10 @@
|
||||
# under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from freezer_ui.jobs import tables
|
||||
|
||||
from horizon import browsers
|
||||
from horizon_web_ui.freezer_ui.jobs import tables
|
||||
|
||||
|
||||
class ContainerBrowser(browsers.ResourceBrowser):
|
||||
|
@ -12,8 +12,9 @@
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from freezer_ui import dashboard
|
||||
|
||||
import horizon
|
||||
from horizon_web_ui.freezer_ui import dashboard
|
||||
|
||||
|
||||
class JobsPanel(horizon.Panel):
|
||||
|
@ -20,8 +20,8 @@ from horizon import messages
|
||||
from horizon import tables
|
||||
from horizon.utils.urlresolvers import reverse
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
from horizon_web_ui.freezer_ui.utils import timestamp_to_string
|
||||
import freezer_ui.api.api as freezer_api
|
||||
from freezer_ui.utils import timestamp_to_string
|
||||
|
||||
|
||||
def format_last_backup(last_backup):
|
||||
@ -212,7 +212,7 @@ class EditAction(tables.LinkAction):
|
||||
|
||||
def get_link_url(self, datum=None):
|
||||
# this is used to pass to values as an url
|
||||
# TODO: look for a way to improve this
|
||||
# TODO(m3m0): look for a way to improve this
|
||||
ids = '{0}==={1}'.format(datum.action_id, datum.job_id)
|
||||
return reverse("horizon:freezer_ui:jobs:create_action",
|
||||
kwargs={'job_id': ids})
|
||||
@ -232,7 +232,7 @@ class ActionsTable(tables.DataTable):
|
||||
|
||||
def get_object_id(self, container):
|
||||
# this is used to pass to values as an url
|
||||
# TODO: look for a way to improve this
|
||||
# TODO(m3m0): look for a way to improve this
|
||||
ids = '{0}==={1}'.format(container.action_id, container.job_id)
|
||||
return ids
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from horizon_web_ui.freezer_ui.jobs import views
|
||||
from freezer_ui.jobs import views
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
|
@ -19,14 +19,13 @@ from horizon import exceptions
|
||||
from horizon import messages
|
||||
from horizon import workflows
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
import horizon_web_ui.freezer_ui.jobs.browsers as project_browsers
|
||||
from horizon_web_ui.freezer_ui.utils import create_dict_action
|
||||
import freezer_ui.api.api as freezer_api
|
||||
import freezer_ui.jobs.browsers as project_browsers
|
||||
from freezer_ui.utils import create_dict_action
|
||||
import workflows.configure as configure_workflow
|
||||
import workflows.action as action_workflow
|
||||
|
||||
|
||||
|
||||
class JobWorkflowView(workflows.WorkflowView):
|
||||
workflow_class = configure_workflow.ConfigureJob
|
||||
|
||||
@ -98,7 +97,7 @@ class ActionWorkflowView(workflows.WorkflowView):
|
||||
try:
|
||||
action_id, job_id = ids.split('===')
|
||||
except ValueError:
|
||||
action_id = None
|
||||
# action_id = None
|
||||
job_id = self.kwargs['job_id']
|
||||
try:
|
||||
return freezer_api.job_get(self.request, job_id)
|
||||
@ -116,7 +115,7 @@ class ActionWorkflowView(workflows.WorkflowView):
|
||||
try:
|
||||
action_id, job_id = self.kwargs['job_id'].split('===')
|
||||
except ValueError:
|
||||
job_id = self.kwargs['job_id']
|
||||
# job_id = self.kwargs['job_id']
|
||||
action_id = None
|
||||
|
||||
if self.is_update():
|
||||
@ -133,9 +132,9 @@ class ActionWorkflowView(workflows.WorkflowView):
|
||||
initial.update(**rules)
|
||||
except KeyError:
|
||||
messages.warning(self.request, _("Cannot edit an action "
|
||||
"created by the scheduler"))
|
||||
"created by the"
|
||||
" scheduler"))
|
||||
exceptions.handle(self.request, "")
|
||||
|
||||
initial.update({'original_name': job.id})
|
||||
return initial
|
||||
|
||||
|
@ -14,7 +14,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import workflows
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
import freezer_ui.api.api as freezer_api
|
||||
|
||||
|
||||
class ActionConfigurationAction(workflows.Action):
|
||||
|
@ -18,8 +18,8 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import workflows
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
from horizon_web_ui.freezer_ui.utils import actions_in_job
|
||||
import freezer_ui.api.api as freezer_api
|
||||
from freezer_ui.utils import actions_in_job
|
||||
|
||||
|
||||
class ActionsConfigurationAction(workflows.Action):
|
||||
@ -31,6 +31,7 @@ class ActionsConfigurationAction(workflows.Action):
|
||||
help_text_template = "freezer_ui/jobs" \
|
||||
"/_actions.html"
|
||||
|
||||
|
||||
class ActionsConfiguration(workflows.Step):
|
||||
action_class = ActionsConfigurationAction
|
||||
contributes = ('actions',)
|
||||
|
@ -14,8 +14,10 @@
|
||||
# under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from freezer_ui.sessions import tables
|
||||
|
||||
from horizon import browsers
|
||||
from horizon_web_ui.freezer_ui.sessions import tables
|
||||
|
||||
|
||||
class SessionBrowser(browsers.ResourceBrowser):
|
||||
|
@ -11,9 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from freezer_ui import dashboard
|
||||
import horizon
|
||||
from horizon_web_ui.freezer_ui import dashboard
|
||||
|
||||
|
||||
class SessionsPanel(horizon.Panel):
|
||||
|
@ -17,7 +17,7 @@ from django.utils.translation import ungettext_lazy
|
||||
from horizon import tables
|
||||
from horizon.utils.urlresolvers import reverse
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
import freezer_ui.api.api as freezer_api
|
||||
|
||||
|
||||
def get_link(session):
|
||||
@ -115,7 +115,7 @@ class JobsTable(tables.DataTable):
|
||||
|
||||
def get_object_id(self, job):
|
||||
# this is used to pass to values as an url
|
||||
# TODO: look for a way to improve this
|
||||
# TODO(m3m0): look for a way to improve this
|
||||
ids = '{0}==={1}'.format(job.job_id, job.session_id)
|
||||
return ids
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from horizon_web_ui.freezer_ui.sessions import views
|
||||
from freezer_ui.sessions import views
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
|
@ -18,11 +18,11 @@ from horizon import browsers
|
||||
from horizon import exceptions
|
||||
from horizon import workflows
|
||||
|
||||
import horizon_web_ui.freezer_ui.sessions.browsers as project_browsers
|
||||
from horizon_web_ui.freezer_ui.sessions.workflows import attach
|
||||
from horizon_web_ui.freezer_ui.sessions.workflows import create_session
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
from horizon_web_ui.freezer_ui.utils import SessionJob
|
||||
import freezer_ui.sessions.browsers as project_browsers
|
||||
from freezer_ui.sessions.workflows import attach
|
||||
from freezer_ui.sessions.workflows import create_session
|
||||
import freezer_ui.api.api as freezer_api
|
||||
from freezer_ui.utils import SessionJob
|
||||
|
||||
|
||||
class AttachToSessionWorkflow(workflows.WorkflowView):
|
||||
|
@ -16,7 +16,7 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import workflows
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
import freezer_ui.api.api as freezer_api
|
||||
|
||||
|
||||
class SessionConfigurationAction(workflows.Action):
|
||||
|
@ -18,7 +18,7 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import workflows
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.api as freezer_api
|
||||
import freezer_ui.api.api as freezer_api
|
||||
|
||||
|
||||
class SessionConfigurationAction(workflows.Action):
|
||||
|
@ -24,7 +24,7 @@ from django.conf.urls import include
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
import horizon_web_ui.freezer_ui.api.rest.urls as rest_urls
|
||||
import freezer_ui.api.rest.urls as rest_urls
|
||||
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
|
@ -1,2 +1 @@
|
||||
parsedatetime>=1.4
|
||||
freezer
|
||||
parsedatetime>=1.4
|
@ -1,10 +1,21 @@
|
||||
-e git+https://github.com/openstack/horizon.git#egg=horizon
|
||||
django-nose>=1.2
|
||||
nose-exclude
|
||||
mock>=1.1,!=1.1.4;python_version!='2.6'
|
||||
mock==1.0.1;python_version=='2.6'
|
||||
python-openstackclient>=1.5.0
|
||||
mox>=0.5.3
|
||||
# Not in global-requirements
|
||||
parsedatetime
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
hacking<0.11,>=0.10.0
|
||||
|
||||
coverage>=3.6
|
||||
discover
|
||||
python-subunit>=0.0.18
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
oslosphinx<2.6.0,>=2.5.0 # Apache-2.0
|
||||
oslotest<1.6.0,>=1.5.1 # Apache-2.0
|
||||
testrepository>=0.0.18
|
||||
testscenarios>=0.4
|
||||
testtools!=1.2.0,>=0.9.36
|
||||
pbr>=1.6
|
||||
flake8
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-xdist
|
||||
pylint>=1.3.1
|
||||
testresources
|
42
tox.ini
42
tox.ini
@ -4,37 +4,27 @@ skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
deps =
|
||||
pytest
|
||||
flake8
|
||||
pytest-cov
|
||||
pytest-xdist
|
||||
pymysql
|
||||
python-openstackclient
|
||||
mock
|
||||
pylint>=1.3.1
|
||||
django-nose
|
||||
nose-exclude
|
||||
mox
|
||||
parsedatetime
|
||||
coverage>=3.6
|
||||
git+https://github.com/openstack/horizon.git#egg=horizon
|
||||
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
commands = coverage run --source='.' --omit='.tox/*' manage.py test . --settings=freezer_ui.tests.settings
|
||||
|
||||
[pytest]
|
||||
python_files = test_*.py
|
||||
norecursedirs = .tox .venv freezer_api freezer/binaries
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = py.test -v --cov-report term-missing --cov freezer_ui
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8 freezer_ui
|
||||
commands = flake8
|
||||
|
||||
[testenv:pylint]
|
||||
commands = pylint --rcfile .pylintrc freezer_ui
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
exclude = .venv,.tox,dist,doc,test,*egg,tests
|
||||
ignore = E123,E125,H405,H238,H306,H701
|
||||
builtins = _
|
||||
exclude=.venv,.tox,dist,doc,test,*egg,tests,runtests.py
|
||||
|
||||
[testenv:pylint]
|
||||
commands = pylint --rcfile .pylintrc freezer_ui
|
||||
|
Loading…
x
Reference in New Issue
Block a user