Revision 27738c43

b/snf-cyclades-app/conf/20-snf-cyclades-app-ui.conf
3 3
## UI settings
4 4
####################
5 5
#
6
## API URL
7
#COMPUTE_API_URL = '/api/v1.1'
8
#
9 6
## base url for ui static files
10 7
## if not set, defaults to MEDIA_URL + 'snf-<latest_ui_version>/'
11 8
#UI_MEDIA_URL = '/static/ui/static/snf/'
......
39 36
## consecutive API calls (aligning changes-since attribute).
40 37
#UI_CHANGES_SINCE_ALIGNMENT = 0
41 38
#
42
## URL to redirect not authenticated users
43
#UI_LOGIN_URL = "/im/login"
44
#
45
## URL to redirect user to when he logs out from the ui
46
#UI_LOGOUT_URL = "/im/logout"
47
#
48 39
## Cookie name to retrieve authentication data from
49 40
#UI_AUTH_COOKIE_NAME = '_pithos2_a'
50 41
#
......
187 178
## UI EXTENSIONS
188 179
################
189 180
#
190
## Glance images API endpoint
191
#UI_GLANCE_API_URL = '/plankton'
192
#
193 181
## Whether or not UI should display images from the Glance API
194
## set in UI_GLANCE_API_URL, if setting is set to False, ui will
195
## request images from Compute API
182
## If setting is set to False, ui will request images from Compute API
196 183
#UI_ENABLE_GLANCE = True
197 184
#
198 185
## a dict of image owner ids and their associate name
b/snf-cyclades-app/synnefo/app_settings/default/ui.py
43 43
# How often to check for user usage changes
44 44
UI_QUOTAS_UPDATE_INTERVAL = 10000
45 45

  
46
# URL to redirect not authenticated users
47
UI_LOGIN_URL = "/im/login"
48

  
49
# URL to redirect user to when he logs out from the ui
50
UI_LOGOUT_URL = "/im/logout"
51

  
52 46
# Cookie name to retrieve authentication data from
53 47
UI_AUTH_COOKIE_NAME = '_pithos2_a'
54 48

  
......
79 73

  
80 74
# A list of metadata keys to clone from image
81 75
# to the virtual machine on its creation.
82
VM_IMAGE_COMMON_METADATA = ["OS", "loginname", "logindomain", "users", "remote"]
76
VM_IMAGE_COMMON_METADATA = ["OS", "loginname", "logindomain", "users",
77
                            "remote"]
83 78

  
84 79
# A list of suggested vm roles to display to user on create wizard
85
VM_CREATE_SUGGESTED_ROLES = ["Database server", "File server", "Mail server", "Web server", "Proxy"]
80
VM_CREATE_SUGGESTED_ROLES = ["Database server", "File server", "Mail server",
81
                             "Web server", "Proxy"]
86 82

  
87 83
# Template to be used for suggesting the user a default name for newly created
88 84
# vms. {0} gets replaced by the image OS value
......
149 145

  
150 146
# OS/username map to identify default user name for the specified os
151 147
UI_OS_DEFAULT_USER_MAP = {
152
    'debian':'root', 'fedora': 'root', 'okeanos': 'root',
148
    'debian': 'root', 'fedora': 'root', 'okeanos': 'root',
153 149
    'ubuntu': 'root', 'kubuntu': 'root', 'centos': 'root',
154 150
    'windows': 'Administrator'
155 151
}
......
162 158
# If only one set, no select options will be displayed
163 159
UI_NETWORK_AVAILABLE_NETWORK_TYPES = {'MAC_FILTERED': 'mac-filtering'}
164 160

  
165
# Suggested private networks to let the user choose from when creating a private
166
# network with dhcp enabled
161
# Suggested private networks to let the user choose from when creating a
162
# private network with dhcp enabled
167 163
UI_NETWORK_AVAILABLE_SUBNETS = ['10.0.0.0/24', '192.168.0.0/24']
168 164

  
169 165
# UI will use this setting to find an available network subnet if user requests
......
189 185
# UI EXTENSIONS
190 186
###############
191 187

  
192
# Glance images API endpoint
193
#UI_GLANCE_API_URL = '/plankton'
194

  
195 188
# Whether or not UI should display images from the Glance API
196 189
# set in UI_GLANCE_API_URL, if setting is set to False, ui will
197 190
# request images from Compute API
b/snf-cyclades-app/synnefo/ui/settings.py
1
# Copyright 2013 GRNET S.A. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
#
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
#
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
#
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.
33
#
34

  
35
import synnefo.cyclades_settings as cyclades
36

  
37
from synnefo.lib import join_urls
38
from django.conf import settings
39

  
40

  
41
ASTAKOS_VIEWS_URL = join_urls(cyclades.ASTAKOS_BASE_URL,
42
                              cyclades.ASTAKOS_VIEWS_PREFIX)
43

  
44
ASTAKOS_ACCOUNTS_URL = join_urls(cyclades.ASTAKOS_BASE_URL,
45
                                 cyclades.ASTAKOS_ACCOUNTS_PREFIX)
46
if cyclades.PROXY_USER_SERVICES:
47
    ASTAKOS_ACCOUNTS_URL = join_urls(cyclades.BASE_ASTAKOS_PROXY_PATH,
48
                                     cyclades.ASTAKOS_ACCOUNTS_PREFIX)
49

  
50

  
51
ACCOUNTS_URL = getattr(settings, 'CYCLADES_UI_ACCOUNTS_URL',
52
                       join_urls(ASTAKOS_ACCOUNTS_URL))
53
USER_CATALOG_URL = getattr(settings, 'CYCLADES_UI_USER_CATALOG_URL',
54
                           join_urls(ACCOUNTS_URL, 'user_catalogs'))
55
FEEDBACK_URL = getattr(settings, 'CYCLADES_UI_FEEDBACK_URL',
56
                       join_urls(ACCOUNTS_URL, 'feedback'))
57
COMPUTE_URL = getattr(settings, 'CYCLADES_UI_COMPUTE_URL',
58
                      join_urls(cyclades.BASE_PATH,
59
                                cyclades.COMPUTE_PREFIX,
60
                                'v1.1'))
61
GLANCE_URL = getattr(settings, 'CYCLADES_UI_GLANCE_URL',
62
                     join_urls(cyclades.BASE_PATH, cyclades.PLANKTON_PREFIX))
63
USERDATA_URL = getattr(settings, 'CYCLADES_UI_USERDATA_URL',
64
                       join_urls(cyclades.BASE_PATH, cyclades.USERDATA_PREFIX))
65
LOGIN_URL = getattr(settings, 'CYCLADES_UI_LOGIN_URL',
66
                    join_urls(cyclades.ASTAKOS_BASE_URL,
67
                              cyclades.ASTAKOS_VIEWS_PREFIX, 'login'))
68
LOGOUT_REDIRECT = getattr(settings, 'CYCLADES_UI_LOGOUT_REDIRECT', LOGIN_URL)
b/snf-cyclades-app/synnefo/ui/templates/home.html
84 84
    <script>
85 85
        tmp_auth_client = new synnefo.auth.AstakosClient({
86 86
            cookie_name: '{{ auth_cookie_name }}',
87
            login_url: '{{ login_redirect }}'
87
            login_url: {{ login_redirect|safe }}
88 88
        });
89 89
        if (!tmp_auth_client.get_token()) { tmp_auth_client.redirect_to_login(); }
90 90
    </script>
......
637 637
            synnefo.config.os_created_users = {{ os_created_users|safe }};
638 638
            synnefo.config.feedback_post_url = {{ feedback_post_url|safe }};
639 639
            
640
            synnefo.config.logout_redirect = '{{ logout_redirect }}';
641
            synnefo.config.login_redirect = '{{ login_redirect }}';
640
            synnefo.config.logout_redirect = {{ logout_redirect|safe }};
641
            synnefo.config.login_redirect = {{ login_redirect|safe }};
642 642
            synnefo.config.auth_cookie_name = '{{ auth_cookie_name }}';
643 643

  
644 644
            synnefo.config.translate_uuids = {{ translate_uuids|safe }};
b/snf-cyclades-app/synnefo/ui/views.py
52 52

  
53 53
from snf_django.lib.astakos import get_user
54 54
from synnefo import cyclades_settings
55
from synnefo.ui import settings as uisettings
55 56

  
56 57
SYNNEFO_JS_LIB_VERSION = get_component_version('app')
57
PROXY_USER_SERVICES = getattr(settings, 'CYCLADES_PROXY_USER_SERVICES', True)
58

  
59

  
60
# resolve astakos base url to be used by ui
61
UI_ASTAKOS_BASE_HREF = cyclades_settings.ASTAKOS_BASE_URL
62
if PROXY_USER_SERVICES:
63
    UI_ASTAKOS_BASE_HREF = \
64
        '/' + cyclades_settings.BASE_ASTAKOS_PROXY_PATH.lstrip('/')
65

  
66
UI_ASTAKOS_ACCOUNTS_HREF = join_urls(UI_ASTAKOS_BASE_HREF,
67
                                     cyclades_settings.ASTAKOS_ACCOUNTS_PREFIX)
68

  
69
UI_ASTAKOS_VIEWS_HREF = join_urls(UI_ASTAKOS_BASE_HREF,
70
                                  cyclades_settings.ASTAKOS_VIEWS_PREFIX)
71

  
72
UI_ASTAKOS_KEYSTONE_HREF = join_urls(UI_ASTAKOS_BASE_HREF,
73
                                     cyclades_settings.ASTAKOS_KEYSTONE_PREFIX)
74

  
75
# api configuration
76
api_path = join_urls(cyclades_settings.COMPUTE_PREFIX, 'v1.1').lstrip('/')
77
api_path = '/' + join_urls(cyclades_settings.BASE_PATH, api_path).lstrip('/')
78
COMPUTE_API_HREF = getattr(settings, 'COMPUTE_API_URL', api_path)
79 58

  
80 59
# UI preferences settings
81 60
TIMEOUT = getattr(settings, "TIMEOUT", 10000)
......
108 87
OS_CREATED_USERS = getattr(settings, "UI_OS_DEFAULT_USER_MAP")
109 88
UNKNOWN_OS = getattr(settings, "UI_UNKNOWN_OS", "unknown")
110 89

  
111
LOGOUT_PATH = join_urls(cyclades_settings.ASTAKOS_ACCOUNTS_PREFIX,
112
                        getattr(settings, "UI_LOGOUT_PATH", 'authenticate'))
113
LOGOUT_URL = join_urls(cyclades_settings.ASTAKOS_BASE_URL, LOGOUT_PATH)
114

  
115
LOGIN_PATH = join_urls(cyclades_settings.ASTAKOS_VIEWS_PREFIX,
116
                       getattr(settings, "UI_LOGIN_PATH", 'login'))
117
LOGIN_URL = join_urls(cyclades_settings.ASTAKOS_BASE_URL, LOGIN_PATH)
118

  
119 90
AUTH_COOKIE_NAME = getattr(settings, "UI_AUTH_COOKIE_NAME", 'synnefo_user')
120 91

  
121 92
# UI behaviour settings
......
160 131

  
161 132
# extensions
162 133
ENABLE_GLANCE = getattr(settings, 'UI_ENABLE_GLANCE', True)
163
glance_path = join_urls(cyclades_settings.BASE_PATH,
164
                        cyclades_settings.PLANKTON_PREFIX)
165
glance_path = '/' + glance_path.lstrip('/')
166
GLANCE_API_HREF = getattr(settings, 'UI_GLANCE_API_URL', glance_path)
167 134

  
168 135
DIAGNOSTICS_UPDATE_INTERVAL = \
169 136
    getattr(settings, 'UI_DIAGNOSTICS_UPDATE_INTERVAL', 2000)
......
195 162
GROUPED_PUBLIC_NETWORK_NAME = \
196 163
    getattr(settings, 'UI_GROUPED_PUBLIC_NETWORK_NAME', 'Internet')
197 164

  
198
USER_CATALOG_PATH = getattr(settings, 'UI_USER_CATALOG_PATH', 'user_catalogs')
199
USER_CATALOG_HREF = join_urls(UI_ASTAKOS_ACCOUNTS_HREF, USER_CATALOG_PATH)
200

  
201
FEEDBACK_POST_PATH = getattr(settings, 'UI_FEEDBACK_POST_PATH', 'feedback')
202
FEEDBACK_POST_HREF = join_urls(UI_ASTAKOS_ACCOUNTS_HREF, FEEDBACK_POST_PATH)
203

  
204

  
205
ACCOUNTS_API_VERSION = getattr(settings, 'UI_ACCOUNTS_API_VERSION', '')
206
ACCOUNTS_API_HREF = join_urls(UI_ASTAKOS_ACCOUNTS_HREF, ACCOUNTS_API_VERSION)
207

  
208
TRANSLATE_UUIDS = not getattr(settings, 'TRANSLATE_UUIDS', False)
209

  
210 165

  
211 166
def template(name, request, context):
212 167
    template_path = os.path.join(os.path.dirname(__file__), "templates/")
......
231 186
               'project': '+nefo',
232 187
               'request': request,
233 188
               'current_lang': get_language() or 'en',
234
               'compute_api_url': json.dumps(COMPUTE_API_HREF),
235
               'user_catalog_url': json.dumps(USER_CATALOG_HREF),
236
               'feedback_post_url': json.dumps(FEEDBACK_POST_HREF),
237
               'accounts_api_url': json.dumps(ACCOUNTS_API_HREF),
238
               'translate_uuids': json.dumps(TRANSLATE_UUIDS),
189
               'compute_api_url': json.dumps(uisettings.COMPUTE_URL),
190
               'user_catalog_url': json.dumps(uisettings.USER_CATALOG_URL),
191
               'feedback_post_url': json.dumps(uisettings.FEEDBACK_URL),
192
               'accounts_api_url': json.dumps(uisettings.ACCOUNTS_URL),
193
               'logout_redirect': json.dumps(uisettings.LOGOUT_REDIRECT),
194
               'login_redirect': json.dumps(uisettings.LOGIN_URL),
195
               'glance_api_url': json.dumps(uisettings.GLANCE_URL),
196
               'translate_uuids': json.dumps(True),
239 197
               # update interval settings
240 198
               'update_interval': UPDATE_INTERVAL,
241 199
               'update_interval_increase': UPDATE_INTERVAL_INCREASE,
......
245 203
               'update_interval_max': UPDATE_INTERVAL_MAX,
246 204
               'changes_since_alignment': CHANGES_SINCE_ALIGNMENT,
247 205
               'image_icons': IMAGE_ICONS,
248
               'logout_redirect': LOGOUT_URL,
249
               'login_redirect': LOGIN_URL,
250 206
               'auth_cookie_name': AUTH_COOKIE_NAME,
251 207
               'suggested_flavors': json.dumps(SUGGESTED_FLAVORS),
252 208
               'suggested_roles': json.dumps(SUGGESTED_ROLES),
......
264 220
               'os_created_users': json.dumps(OS_CREATED_USERS),
265 221
               'userdata_keys_limit': json.dumps(MAX_SSH_KEYS_PER_USER),
266 222
               'use_glance': json.dumps(ENABLE_GLANCE),
267
               'glance_api_url': json.dumps(GLANCE_API_HREF),
268 223
               'system_images_owners': json.dumps(SYSTEM_IMAGES_OWNERS),
269 224
               'custom_image_help_url': CUSTOM_IMAGE_HELP_URL,
270 225
               'image_deleted_title': json.dumps(IMAGE_DELETED_TITLE),

Also available in: Unified diff