urls.py 11.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# CIRCLE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with CIRCLE.  If not, see <http://www.gnu.org/licenses/>.

18 19
from __future__ import absolute_import
from django.conf.urls import patterns, url, include
20

21
import autocomplete_light
22
from vm.models import Instance
23
from .views import (
24
    AclUpdateView, FavouriteView, GroupAclUpdateView, GroupDelete,
25
    GroupDetailView, GroupList, IndexView,
26 27
    InstanceActivityDetail, LeaseCreate, LeaseDelete, LeaseDetail,
    MyPreferencesView, NodeAddTraitView, NodeCreate, NodeDelete,
28
    NodeDetailView, NodeList, NodeActivityDetail,
29
    NotificationView, TemplateAclUpdateView, TemplateCreate,
30 31
    TemplateDelete, TemplateDetail, TemplateList,
    vm_activity, VmCreate, VmDetailView,
32
    VmDetailVncTokenView, VmList,
33
    DiskRemoveView, get_disk_download_status,
34
    GroupRemoveUserView,
35
    GroupRemoveFutureUserView,
36
    GroupCreate, GroupProfileUpdate,
37
    TemplateChoose,
38
    UserCreationView,
39
    get_vm_screenshot,
40
    ProfileView, toggle_use_gravatar, UnsubscribeFormView,
41
    UserKeyDelete, UserKeyDetail, UserKeyCreate,
42
    ConnectCommandDelete, ConnectCommandDetail, ConnectCommandCreate,
43
    StoreList, store_download, store_upload, store_get_upload_url, StoreRemove,
44
    store_new_directory, store_refresh_toplist,
45 46
    VmTraitsUpdate, VmRawDataUpdate,
    GroupPermissionsView,
47
    LeaseAclUpdateView,
48
    toggle_template_tutorial,
49
    ClientCheck, TokenLogin,
50
    VmGraphView, NodeGraphView, NodeListGraphView, TemplateGraphView,
51 52
    TransferInstanceOwnershipView, TransferInstanceOwnershipConfirmView,
    TransferTemplateOwnershipView, TransferTemplateOwnershipConfirmView,
53
    OpenSearchDescriptionView,
54
    NodeActivityView,
55
    UserList,
56
    StorageDetail, DiskDetail,
57
    MessageList, MessageDetail, MessageCreate, MessageDelete,
58
    EnableTwoFactorView, DisableTwoFactorView,
59
)
60 61
from .views.vm import vm_ops, vm_mass_ops
from .views.node import node_ops
62

63 64
autocomplete_light.autodiscover()

Kálmán Viktor committed
65 66
urlpatterns = patterns(
    '',
Kálmán Viktor committed
67
    url(r'^$', IndexView.as_view(), name="dashboard.index"),
68 69
    url(r"^profile/list/$", UserList.as_view(),
        name="dashboard.views.user-list"),
70 71 72
    url(r'^profile/create/$',
        UserCreationView.as_view(),
        name="dashboard.views.user-create"),
73 74
    url(r'^lease/(?P<pk>\d+)/$', LeaseDetail.as_view(),
        name="dashboard.views.lease-detail"),
75 76
    url(r'^lease/create/$', LeaseCreate.as_view(),
        name="dashboard.views.lease-create"),
77 78
    url(r'^lease/delete/(?P<pk>\d+)/$', LeaseDelete.as_view(),
        name="dashboard.views.lease-delete"),
79 80
    url(r'^lease/(?P<pk>\d+)/acl/$', LeaseAclUpdateView.as_view(),
        name="dashboard.views.lease-acl"),
81

82 83
    url(r'^template/create/$', TemplateCreate.as_view(),
        name="dashboard.views.template-create"),
84 85
    url(r'^template/choose/$', TemplateChoose.as_view(),
        name="dashboard.views.template-choose"),
86 87
    url(r'template/(?P<pk>\d+)/acl/$', TemplateAclUpdateView.as_view(),
        name='dashboard.views.template-acl'),
88 89
    url(r'^template/(?P<pk>\d+)/$', TemplateDetail.as_view(),
        name='dashboard.views.template-detail'),
90 91
    url(r"^template/list/$", TemplateList.as_view(),
        name="dashboard.views.template-list"),
92 93
    url(r"^template/delete/(?P<pk>\d+)/$", TemplateDelete.as_view(),
        name="dashboard.views.template-delete"),
94 95
    url(r'^template/(?P<pk>\d+)/tx/$', TransferTemplateOwnershipView.as_view(),
        name='dashboard.views.template-transfer-ownership'),
Kálmán Viktor committed
96 97
    url(r'^vm/(?P<pk>\d+)/$', VmDetailView.as_view(),
        name='dashboard.views.detail'),
98 99
    url(r'^vm/(?P<pk>\d+)/vnctoken/$', VmDetailVncTokenView.as_view(),
        name='dashboard.views.detail-vnc'),
100 101
    url(r'^vm/(?P<pk>\d+)/acl/$', AclUpdateView.as_view(model=Instance),
        name='dashboard.views.vm-acl'),
102
    url(r'^vm/(?P<pk>\d+)/tx/$', TransferInstanceOwnershipView.as_view(),
103
        name='dashboard.views.vm-transfer-ownership'),
Kálmán Viktor committed
104
    url(r'^vm/list/$', VmList.as_view(), name='dashboard.views.vm-list'),
105 106
    url(r'^vm/create/$', VmCreate.as_view(),
        name='dashboard.views.vm-create'),
107 108
    url(r'^vm/(?P<pk>\d+)/activity/$', vm_activity,
        name='dashboard.views.vm-activity-list'),
109 110
    url(r'^vm/activity/(?P<pk>\d+)/$', InstanceActivityDetail.as_view(),
        name='dashboard.views.vm-activity'),
111 112
    url(r'^vm/(?P<pk>\d+)/screenshot/$', get_vm_screenshot,
        name='dashboard.views.vm-get-screenshot'),
113 114 115 116
    url(r'^vm/(?P<pk>\d+)/traits/$', VmTraitsUpdate.as_view(),
        name='dashboard.views.vm-traits'),
    url(r'^vm/(?P<pk>\d+)/raw_data/$', VmRawDataUpdate.as_view(),
        name='dashboard.views.vm-raw-data'),
117 118
    url(r'^vm/(?P<pk>\d+)/toggle_tutorial/$', toggle_template_tutorial,
        name='dashboard.views.vm-toggle-tutorial'),
119

120 121 122
    url(r'^node/list/$', NodeList.as_view(), name='dashboard.views.node-list'),
    url(r'^node/(?P<pk>\d+)/$', NodeDetailView.as_view(),
        name='dashboard.views.node-detail'),
123 124
    url(r'^node/(?P<pk>\d+)/add-trait/$', NodeAddTraitView.as_view(),
        name='dashboard.views.node-addtrait'),
125 126
    url(r'^vm/tx/(?P<key>.*)/?$',
        TransferInstanceOwnershipConfirmView.as_view(),
127
        name='dashboard.views.vm-transfer-ownership-confirm'),
128 129 130
    url(r'^template/tx/(?P<key>.*)/?$',
        TransferTemplateOwnershipConfirmView.as_view(),
        name='dashboard.views.template-transfer-ownership-confirm'),
131 132
    url(r'^node/delete/(?P<pk>\d+)/$', NodeDelete.as_view(),
        name="dashboard.views.delete-node"),
133 134
    url(r'^node/(?P<pk>\d+)/activity/$', NodeActivityView.as_view(),
        name='dashboard.views.node-activity-list'),
135 136
    url(r'^node/create/$', NodeCreate.as_view(),
        name='dashboard.views.node-create'),
137 138
    url(r'^node/activity/(?P<pk>\d+)/$', NodeActivityDetail.as_view(),
        name='dashboard.views.node-activity'),
139

140 141
    url(r'^favourite/$', FavouriteView.as_view(),
        name='dashboard.views.favourite'),
142 143
    url(r'^group/delete/(?P<pk>\d+)/$', GroupDelete.as_view(),
        name="dashboard.views.delete-group"),
144 145
    url(r'^group/list/$', GroupList.as_view(),
        name='dashboard.views.group-list'),
146
    url((r'^vm/(?P<pk>\d+)/graph/(?P<metric>[a-z]+)/'
147
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
148 149
        VmGraphView.as_view(),
        name='dashboard.views.vm-graph'),
150
    url((r'^node/(?P<pk>\d+)/graph/(?P<metric>[a-z]+)/'
151 152 153
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
        NodeGraphView.as_view(),
        name='dashboard.views.node-graph'),
154 155 156 157
    url((r'^node/graph/(?P<metric>[a-z]+)/'
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
        NodeListGraphView.as_view(),
        name='dashboard.views.node-list-graph'),
158 159 160 161
    url((r'^template/(?P<pk>\d+)/graph/(?P<metric>[a-z]+)/'
         r'(?P<time>[0-9]{1,2}[hdwy])$'),
        TemplateGraphView.as_view(),
        name='dashboard.views.template-graph'),
162 163
    url(r'^group/(?P<pk>\d+)/$', GroupDetailView.as_view(),
        name='dashboard.views.group-detail'),
164 165
    url(r'^group/(?P<pk>\d+)/update/$', GroupProfileUpdate.as_view(),
        name='dashboard.views.group-update'),
166 167
    url(r'^group/(?P<pk>\d+)/acl/$', GroupAclUpdateView.as_view(),
        name='dashboard.views.group-acl'),
168 169
    url(r'^notifications/$', NotificationView.as_view(),
        name="dashboard.views.notifications"),
170

171 172
    url(r'^disk/(?P<pk>\d+)/remove/$', DiskRemoveView.as_view(),
        name="dashboard.views.disk-remove"),
173 174 175
    url(r'^disk/(?P<pk>\d+)/status/$', get_disk_download_status,
        name="dashboard.views.disk-status"),

176
    url(r'^profile/$', MyPreferencesView.as_view(),
177
        name="dashboard.views.profile-preferences"),
178 179
    url(r'^subscribe/(?P<token>.*)/$', UnsubscribeFormView.as_view(),
        name="dashboard.views.unsubscribe"),
180
    url(r'^profile/(?P<username>[^/]+)/$', ProfileView.as_view(),
181
        name="dashboard.views.profile"),
182
    url(r'^profile/(?P<username>[^/]+)/use_gravatar/$', toggle_use_gravatar),
183 184 185 186
    url(r'^profile/two-factor/enable/$', EnableTwoFactorView.as_view(),
        name="dashboard.views.profile-enable-two-factor"),
    url(r'^profile/two-factor/disable/$', DisableTwoFactorView.as_view(),
        name="dashboard.views.profile-disable-two-factor"),
187

188
    url(r'^group/(?P<group_pk>\d+)/remove/user/(?P<member_pk>\d+)/$',
189 190
        GroupRemoveUserView.as_view(),
        name="dashboard.views.remove-user"),
191 192 193
    url(r'^group/(?P<group_pk>\d+)/remove/futureuser/(?P<member_org_id>.+)/$',
        GroupRemoveFutureUserView.as_view(),
        name="dashboard.views.remove-future-user"),
194 195
    url(r'^group/create/$', GroupCreate.as_view(),
        name='dashboard.views.group-create'),
196 197 198
    url(r'^group/(?P<group_pk>\d+)/permissions/$',
        GroupPermissionsView.as_view(),
        name="dashboard.views.group-permissions"),
199 200 201 202 203 204 205 206 207 208

    url(r'^sshkey/delete/(?P<pk>\d+)/$',
        UserKeyDelete.as_view(),
        name="dashboard.views.userkey-delete"),
    url(r'^sshkey/(?P<pk>\d+)/$',
        UserKeyDetail.as_view(),
        name="dashboard.views.userkey-detail"),
    url(r'^sshkey/create/$',
        UserKeyCreate.as_view(),
        name="dashboard.views.userkey-create"),
Kálmán Viktor committed
209

210 211
    url(r'^conncmd/delete/(?P<pk>\d+)/$',
        ConnectCommandDelete.as_view(),
212
        name="dashboard.views.connect-command-delete"),
213 214
    url(r'^conncmd/(?P<pk>\d+)/$',
        ConnectCommandDetail.as_view(),
215
        name="dashboard.views.connect-command-detail"),
216 217
    url(r'^conncmd/create/$',
        ConnectCommandCreate.as_view(),
218
        name="dashboard.views.connect-command-create"),
219

220
    url(r'^autocomplete/', include('autocomplete_light.urls')),
221

Kálmán Viktor committed
222
    url(r"^store/list/$", StoreList.as_view(),
223 224 225
        name="dashboard.views.store-list"),
    url(r"^store/download/$", store_download,
        name="dashboard.views.store-download"),
226 227
    url(r"^store/upload/url$", store_get_upload_url,
        name="dashboard.views.store-upload-url"),
228 229
    url(r"^store/upload/$", store_upload,
        name="dashboard.views.store-upload"),
230 231
    url(r"^store/remove/$", StoreRemove.as_view(),
        name="dashboard.views.store-remove"),
232 233
    url(r"^store/new_directory/$", store_new_directory,
        name="dashboard.views.store-new-directory"),
Kálmán Viktor committed
234 235
    url(r"^store/refresh_toplist$", store_refresh_toplist,
        name="dashboard.views.store-refresh-toplist"),
236 237
    url(r"^client/check$", ClientCheck.as_view(),
        name="dashboard.views.client-check"),
238 239
    url(r'^token-login/(?P<token>.*)/$', TokenLogin.as_view(),
        name="dashboard.views.token-login"),
240 241
    url(r'^vm/opensearch.xml$', OpenSearchDescriptionView.as_view(),
        name="dashboard.views.vm-opensearch"),
242

243 244
    url(r'^storage/$', StorageDetail.as_view(),
        name="dashboard.views.storage"),
245 246
    url(r'^disk/(?P<pk>\d+)/$', DiskDetail.as_view(),
        name="dashboard.views.disk-detail"),
247 248 249 250 251 252 253 254 255

    url(r'^message/list/$', MessageList.as_view(),
        name="dashboard.views.message-list"),
    url(r'^message/(?P<pk>\d+)/$', MessageDetail.as_view(),
        name="dashboard.views.message-detail"),
    url(r'^message/create/$', MessageCreate.as_view(),
        name="dashboard.views.message-create"),
    url(r'^message/delete/(?P<pk>\d+)/$', MessageDelete.as_view(),
        name="dashboard.views.message-delete"),
Kálmán Viktor committed
256
)
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274

urlpatterns += patterns(
    '',
    *(url(r'^vm/(?P<pk>\d+)/op/%s/$' % op, v.as_view(), name=v.get_urlname())
        for op, v in vm_ops.iteritems())
)

urlpatterns += patterns(
    '',
    *(url(r'^vm/mass_op/%s/$' % op, v.as_view(), name=v.get_urlname())
        for op, v in vm_mass_ops.iteritems())
)

urlpatterns += patterns(
    '',
    *(url(r'^node/(?P<pk>\d+)/op/%s/$' % op, v.as_view(), name=v.get_urlname())
        for op, v in node_ops.iteritems())
)