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
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
b9904d9f
Commit
b9904d9f
authored
Jun 06, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
slapos_jio: Accept _ to display the parameters a bit nicer
See merge request
nexedi/slapos.core!389
parents
7e61728e
9d093a5c
Pipeline
#22036
running with stage
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
26 deletions
+59
-26
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareInstance_getConnectionParameterList.py
...json_style/SoftwareInstance_getConnectionParameterList.py
+6
-0
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+50
-2
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.xml
...rtal_components/test.erp5.testSlapOSHalJsonStyleSkins.xml
+3
-24
No files found.
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/SoftwareInstance_getConnectionParameterList.py
View file @
b9904d9f
from
Products.ERP5Type.Document
import
newTempBase
import
json
return_list
=
[]
try
:
...
...
@@ -9,6 +10,11 @@ except Exception:
if
connection_dict
is
None
:
return
return_list
if
connection_dict
.
keys
()
==
[
"_"
]:
json_connection_dict
=
json
.
loads
(
connection_dict
[
"_"
])
if
isinstance
(
json_connection_dict
,
dict
):
connection_dict
=
json_connection_dict
portal
=
context
.
getPortalObject
()
if
relative_url
==
None
:
relative_url
=
context
.
getRelativeUrl
()
...
...
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
b9904d9f
...
...
@@ -306,7 +306,6 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
class
TestSoftwareInstallation_getNewsDict
(
TestSlapOSHalJsonStyleMixin
):
def
test
(
self
):
...
...
@@ -1200,3 +1199,52 @@ class TestInstanceTree_edit(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
new_parameter
,
self
.
instance_tree
.
getTextContent
())
class
TestSoftwareInstance_getConnectionParameterList
(
TestSlapOSHalJsonStyleMixin
):
def
testSoftwareInstance_getConnectionParameterList
(
self
):
instance
=
self
.
_makeInstance
()
xml_sample
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="p0">ABC</parameter>
<parameter id="p1">DEF</parameter>
</instance>"""
instance
.
edit
(
connection_xml
=
xml_sample
)
# Place instances on the project
self
.
logout
()
self
.
login
()
self
.
changeSkin
(
"Hal"
)
self
.
assertEqual
(
len
(
instance
.
SoftwareInstance_getConnectionParameterList
()),
2
)
self
.
assertEqual
(
instance
.
SoftwareInstance_getConnectionParameterList
(
raw
=
True
),
[{
"connection_key"
:
"p0"
,
"connection_value"
:
"ABC"
},
{
"connection_key"
:
"p1"
,
"connection_value"
:
"DEF"
}]
)
xml_sample
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="_">{"p0": "ABC", "p1": "DEF"}</parameter>
</instance>"""
instance
.
edit
(
connection_xml
=
xml_sample
)
# Place instances on the project
self
.
logout
()
self
.
login
()
self
.
changeSkin
(
"Hal"
)
self
.
assertEqual
(
len
(
instance
.
SoftwareInstance_getConnectionParameterList
()),
2
)
self
.
assertEqual
(
instance
.
SoftwareInstance_getConnectionParameterList
(
raw
=
True
),
[{
"connection_key"
:
"p0"
,
"connection_value"
:
"ABC"
},
{
"connection_key"
:
"p1"
,
"connection_value"
:
"DEF"
}]
)
\ No newline at end of file
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.xml
View file @
b9904d9f
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSHalJsonStyleSkins
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
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