Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
slapos.core
Commits
54601f5c
Commit
54601f5c
authored
Mar 03, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Implement error handling for request Hosting Subscription
parent
7c72b6fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
8 deletions
+24
-8
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_hosting_subscription_js.js
.../rjs_gadget_erp5_page_slap_add_hosting_subscription_js.js
+9
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_hosting_subscription_js.xml
...rjs_gadget_erp5_page_slap_add_hosting_subscription_js.xml
+2
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareRelease_requestHostingSubscription.py
..._json_style/SoftwareRelease_requestHostingSubscription.py
+12
-4
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareRelease_requestHostingSubscription.xml
...json_style/SoftwareRelease_requestHostingSubscription.xml
+1
-1
No files found.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_hosting_subscription_js.js
View file @
54601f5c
...
@@ -55,6 +55,14 @@
...
@@ -55,6 +55,14 @@
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
"
options
"
:
{
"
jio_key
"
:
"
/
"
,
"
page
"
:
"
slap_service_list
"
}});
"
options
"
:
{
"
jio_key
"
:
"
/
"
,
"
page
"
:
"
slap_service_list
"
}});
});
});
},
function
(
error
)
{
if
(
error
.
target
.
status
===
409
)
{
return
gadget
.
notifySubmitted
({
message
:
'
A service with this title already exists.
'
,
status
:
'
error
'
});
}
if
(
error
.
target
.
status
===
400
)
{
return
gadget
.
notifySubmitted
({
message
:
'
Service Title is mandatory.
'
,
status
:
'
error
'
});
}
});
});
});
});
})
})
...
@@ -65,7 +73,7 @@
...
@@ -65,7 +73,7 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
var
gadget
=
this
;
return
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_view
'
),
gadget
.
getDeclaredGadget
(
'
form_view
'
),
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_add_hosting_subscription_js.xml
View file @
54601f5c
...
@@ -274,7 +274,7 @@
...
@@ -274,7 +274,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
98
1.35383.15103.35259
</string>
</value>
<value>
<string>
98
2.17545.17272.64904
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -292,7 +292,7 @@
...
@@ -292,7 +292,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
158
0513887.37
</float>
<float>
158
3203969.98
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareRelease_requestHostingSubscription.py
View file @
54601f5c
from
zExceptions
import
Unauthorized
if
REQUEST
is
None
:
raise
Unauthorized
import
json
import
json
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
response
=
REQUEST
.
RESPONSE
if
shared
in
[
"true"
,
"1"
,
1
]:
if
shared
in
[
"true"
,
"1"
,
1
]:
shared
=
True
shared
=
True
...
@@ -8,7 +15,8 @@ if shared in ["false", "", 0, "0", None]:
...
@@ -8,7 +15,8 @@ if shared in ["false", "", 0, "0", None]:
shared
=
False
shared
=
False
if
not
title
:
if
not
title
:
raise
ValueError
(
"Service Title is mandatory!"
)
response
.
setStatus
(
400
)
return
"Service Title is mandatory!"
if
"{uid}"
in
title
:
if
"{uid}"
in
title
:
uid_
=
portal
.
portal_ids
.
generateNewId
(
id_group
=
(
"vifib"
,
"kvm"
),
default
=
1
)
uid_
=
portal
.
portal_ids
.
generateNewId
(
id_group
=
(
"vifib"
,
"kvm"
),
default
=
1
)
...
@@ -21,7 +29,8 @@ hosting_subscription = portal.portal_catalog.getResultValue(
...
@@ -21,7 +29,8 @@ hosting_subscription = portal.portal_catalog.getResultValue(
)
)
if
hosting_subscription
is
not
None
:
if
hosting_subscription
is
not
None
:
raise
ValueError
(
"Instance with this name already exists"
)
response
.
setStatus
(
409
)
return
"Instance with this name already exists"
# The URL should come from the URL Probably
# The URL should come from the URL Probably
url
=
context
.
getUrlString
()
url
=
context
.
getUrlString
()
...
@@ -29,7 +38,7 @@ url = context.getUrlString()
...
@@ -29,7 +38,7 @@ url = context.getUrlString()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
if
person
is
None
:
if
person
is
None
:
raise
ValueError
(
"You cannot request without been logged in as a user."
)
raise
Unauthorized
(
"You cannot request without been logged in as a user."
)
if
software_type
in
[
None
,
""
]:
if
software_type
in
[
None
,
""
]:
software_type
=
"RootSoftwareInstance"
software_type
=
"RootSoftwareInstance"
...
@@ -63,5 +72,4 @@ if sla_xml:
...
@@ -63,5 +72,4 @@ if sla_xml:
</instance>"""
%
sla_xml
</instance>"""
%
sla_xml
person
.
requestSoftwareInstance
(
**
request_kw
)
person
.
requestSoftwareInstance
(
**
request_kw
)
return
json
.
dumps
(
context
.
REQUEST
.
get
(
'request_hosting_subscription'
).
getRelativeUrl
())
return
json
.
dumps
(
context
.
REQUEST
.
get
(
'request_hosting_subscription'
).
getRelativeUrl
())
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareRelease_requestHostingSubscription.xml
View file @
54601f5c
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, text_content="", software_type=None, shared=False, computer_guid=None, sla_xml=""
</string>
</value>
<value>
<string>
title, text_content="", software_type=None, shared=False, computer_guid=None, sla_xml=""
, REQUEST=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment