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
Xavier Thompson
slapos.core
Commits
724f3ab3
Commit
724f3ab3
authored
May 09, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
slapos_jio: Improve intent gadget to be handle Error better
See merge request
!523
parents
0d691d7f
25ec1d12
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
142 additions
and
89 deletions
+142
-89
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
...Item/portal_components/test.erp5.testSlapOSCodingStyle.py
+0
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.html
...eb_page_module/rjs_gadget_erp5_page_slap_intent_html.html
+4
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.xml
...web_page_module/rjs_gadget_erp5_page_slap_intent_html.xml
+2
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.js
...em/web_page_module/rjs_gadget_erp5_page_slap_intent_js.js
+63
-76
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.xml
...m/web_page_module/rjs_gadget_erp5_page_slap_intent_js.xml
+2
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.py
...json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.py
+10
-5
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+61
-1
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSCodingStyle.py
View file @
724f3ab3
...
@@ -259,7 +259,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
...
@@ -259,7 +259,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_hal_json_style/SaleInvoiceTransaction_getRelatedPaymentTransactionIntegrationId'
,
'slapos_hal_json_style/SaleInvoiceTransaction_getRelatedPaymentTransactionIntegrationId'
,
'slapos_hal_json_style/SoftwareInstallation_getSoftwareReleaseInformation'
,
'slapos_hal_json_style/SoftwareInstallation_getSoftwareReleaseInformation'
,
'slapos_hal_json_style/SoftwareInstance_getReportedState'
,
'slapos_hal_json_style/SoftwareInstance_getReportedState'
,
'slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas'
,
'slapos_hal_json_style/SoftwareRelease_requestInstanceTree'
,
'slapos_hal_json_style/SoftwareRelease_requestInstanceTree'
,
'slapos_hal_json_style/SoftwareRelease_requestSoftwareInstallation'
,
'slapos_hal_json_style/SoftwareRelease_requestSoftwareInstallation'
,
'slapos_hal_json_style/SupportRequest_close'
,
'slapos_hal_json_style/SupportRequest_close'
,
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.html
View file @
724f3ab3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<head>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Site List
</title>
<title>
Intent page
</title>
<!-- renderjs -->
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
...
@@ -19,7 +19,9 @@
...
@@ -19,7 +19,9 @@
</head>
</head>
<body>
<body>
<div
class=
"message"
>
<p>
Wait, you are going to be redirected automatically.
</p>
<p>
Wait, you are going to be redirected automatically.
</p>
</div>
<form
class=
"save_form ui-body-c"
novalidate
>
<form
class=
"save_form ui-body-c"
novalidate
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"
></button>
ui-icon-edit ui-btn-icon-right ui-screen-hidden"
></button>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_html.xml
View file @
724f3ab3
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
982.16656.9604.44475
</string>
</value>
<value>
<string>
1008.12324.34619.3993
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1
583501586.1
7
</float>
<float>
1
683223974.8
7
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.js
View file @
724f3ab3
...
@@ -27,32 +27,6 @@
...
@@ -27,32 +27,6 @@
return
this
.
triggerSubmit
();
return
this
.
triggerSubmit
();
})
})
.
onEvent
(
'
submit
'
,
function
()
{
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
})
.
push
(
function
(
doc
)
{
return
gadget
.
getSetting
(
"
hateoas_url
"
)
.
push
(
function
(
url
)
{
return
gadget
.
jio_putAttachment
(
doc
.
relative_url
,
url
+
doc
.
relative_url
+
"
/SoftwareRelease_requestInstanceTree
"
,
doc
);
});
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
message
:
gadget
.
message_tranlation
,
status
:
'
success
'
})
.
push
(
function
()
{
// Workaround, find a way to open document without break gadget.
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
"
options
"
:
{
"
jio_key
"
:
"
/
"
,
"
page
"
:
"
slap_service_list
"
}});
});
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
return
this
.
element
.
querySelector
(
'
button[type="submit"]
'
).
click
();
return
this
.
element
.
querySelector
(
'
button[type="submit"]
'
).
click
();
})
})
...
@@ -90,7 +64,7 @@
...
@@ -90,7 +64,7 @@
});
});
})
})
.
onStateChange
(
function
(
options
)
{
.
onStateChange
(
function
(
options
)
{
this
.
deferRender
(
options
);
return
this
.
deferRender
(
options
);
})
})
.
declareJob
(
"
deferRender
"
,
function
(
options
)
{
.
declareJob
(
"
deferRender
"
,
function
(
options
)
{
var
gadget
=
this
;
var
gadget
=
this
;
...
@@ -99,8 +73,12 @@
...
@@ -99,8 +73,12 @@
}
}
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
getUrlFor
({
command
:
'
history_previous
'
})
.
push
(
function
(
selection_url
)
{
return
gadget
.
updateHeader
({
return
gadget
.
updateHeader
({
page_title
:
gadget
.
page_title_translation
page_title
:
gadget
.
page_title_translation
,
selection_url
:
selection_url
});
});
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -114,6 +92,12 @@
...
@@ -114,6 +92,12 @@
});
});
})
})
.
push
(
function
(
jio_key
)
{
.
push
(
function
(
jio_key
)
{
var
div
;
if
((
jio_key
===
undefined
)
||
(
jio_key
===
""
))
{
div
=
gadget
.
element
.
querySelector
(
"
div.message
"
);
div
.
textContent
=
gadget
.
error_translation
+
"
: could not find software release
"
;
return
div
;
}
if
(
options
.
auto
===
undefined
)
{
if
(
options
.
auto
===
undefined
)
{
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
return
gadget
.
redirect
({
"
command
"
:
"
change
"
,
"
options
"
:
{
"
jio_key
"
:
jio_key
,
"
page
"
:
"
slap_add_instance_tree
"
,
"
options
"
:
{
"
jio_key
"
:
jio_key
,
"
page
"
:
"
slap_add_instance_tree
"
,
...
@@ -121,6 +105,8 @@
...
@@ -121,6 +105,8 @@
}
}
// The auto is set, so we move foward to auto request the SR
// The auto is set, so we move foward to auto request the SR
options
.
jio_key
=
jio_key
;
options
.
jio_key
=
jio_key
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_view
'
),
gadget
.
getDeclaredGadget
(
'
form_view
'
),
gadget
.
jio_get
(
jio_key
),
gadget
.
jio_get
(
jio_key
),
...
@@ -177,4 +163,5 @@
...
@@ -177,4 +163,5 @@
});
});
});
});
});
});
});
}(
window
,
rJS
,
RSVP
));
}(
window
,
rJS
,
RSVP
));
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_intent_js.xml
View file @
724f3ab3
...
@@ -283,7 +283,7 @@
...
@@ -283,7 +283,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
986.45437.22132.61764
</string>
</value>
<value>
<string>
1008.12332.26729.18090
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -303,7 +303,7 @@
...
@@ -303,7 +303,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
16
02259520.17
</float>
<float>
16
83224657.13
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareProduct_getSoftwareReleaseAsHateoas.py
View file @
724f3ab3
import
json
import
json
software_release_relative_url
=
""
kw
=
{
"software_release_url"
:
software_release
,
"strict"
:
strict
}
if
software_release
.
startswith
(
"product."
):
if
software_release
.
startswith
(
"product."
):
software_release_list
=
context
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_product_reference
=
software_release
[
8
:])
kw
=
{
"software_product_reference"
:
software_release
[
8
:]}
else
:
software_release_list
=
context
.
SoftwareProduct_getSortedSoftwareReleaseList
(
software_release_url
=
software_release
,
strict
=
strict
)
software_release_list
=
context
.
SoftwareProduct_getSortedSoftwareReleaseList
(
**
kw
)
if
len
(
software_release_list
):
if
len
(
software_release_list
):
software_release_
document
=
software_release_list
[
0
]
software_release_
relative_url
=
software_release_list
[
0
].
getRelativeUrl
()
return
json
.
dumps
(
software_release_
document
.
getRelativeUrl
()
)
return
json
.
dumps
(
software_release_
relative_url
)
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
724f3ab3
...
@@ -1740,3 +1740,63 @@ class TestInstanceTree_getFastInputDict(TestSlapOSHalJsonStyleMixin):
...
@@ -1740,3 +1740,63 @@ class TestInstanceTree_getFastInputDict(TestSlapOSHalJsonStyleMixin):
'enabled'
:
True
,
'enabled'
:
True
,
'sla_xml'
:
'<parameter id="instance_guid">%s</parameter>'
%
software_instance
.
getReference
()
'sla_xml'
:
'<parameter id="instance_guid">%s</parameter>'
%
software_instance
.
getReference
()
},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
},
self
.
instance_tree
.
InstanceTree_getFastInputDict
())
class
TestSoftwareProduct_getSoftwareReleaseAsHateoas
(
TestSlapOSHalJsonStyleMixin
):
@
simulate
(
'SoftwareProduct_getSortedSoftwareReleaseList'
,
'software_product_reference=None, software_release_url=None, strict=None'
,
"""
assert software_product_reference == 'fake'
assert software_release_url is None
assert strict is None
return context.REQUEST['test_software_release_list']"""
)
def
test_product_reference
(
self
):
sr
=
self
.
_makeSoftwareRelease
()
self
.
changeSkin
(
'RJS'
)
self
.
portal
.
REQUEST
[
'test_software_release_list'
]
=
[
sr
]
self
.
assertEqual
(
sr
.
getRelativeUrl
(),
json
.
loads
(
self
.
portal
.
SoftwareProduct_getSoftwareReleaseAsHateoas
(
"product.fake"
))
)
@
simulate
(
'SoftwareProduct_getSortedSoftwareReleaseList'
,
'software_product_reference=None, software_release_url=None, strict=None'
,
"""
assert software_product_reference is None
assert software_release_url == 'fake'
assert strict is False
return context.REQUEST['test_software_release_list']"""
)
def
test_software_release
(
self
):
sr
=
self
.
_makeSoftwareRelease
()
self
.
changeSkin
(
'RJS'
)
self
.
portal
.
REQUEST
[
'test_software_release_list'
]
=
[
sr
]
self
.
assertEqual
(
sr
.
getRelativeUrl
(),
json
.
loads
(
self
.
portal
.
SoftwareProduct_getSoftwareReleaseAsHateoas
(
"fake"
))
)
@
simulate
(
'SoftwareProduct_getSortedSoftwareReleaseList'
,
'software_product_reference=None, software_release_url=None, strict=None'
,
"""
assert software_product_reference is None
assert software_release_url == 'fake'
assert strict is True
return []"""
)
def
test_software_release_not_found
(
self
):
self
.
changeSkin
(
'RJS'
)
self
.
assertEqual
(
''
,
json
.
loads
(
self
.
portal
.
SoftwareProduct_getSoftwareReleaseAsHateoas
(
"fake"
,
True
))
)
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