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
Ophélie Gagnard
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
Changes
3
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
from
Products.ERP5Type.Document
import
newTempBase
import
json
return_list
=
[]
return_list
=
[]
try
:
try
:
...
@@ -9,6 +10,11 @@ except Exception:
...
@@ -9,6 +10,11 @@ except Exception:
if
connection_dict
is
None
:
if
connection_dict
is
None
:
return
return_list
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
()
portal
=
context
.
getPortalObject
()
if
relative_url
==
None
:
if
relative_url
==
None
:
relative_url
=
context
.
getRelativeUrl
()
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):
...
@@ -306,7 +306,6 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
class
TestSoftwareInstallation_getNewsDict
(
TestSlapOSHalJsonStyleMixin
):
class
TestSoftwareInstallation_getNewsDict
(
TestSlapOSHalJsonStyleMixin
):
def
test
(
self
):
def
test
(
self
):
...
@@ -1200,3 +1199,52 @@ class TestInstanceTree_edit(TestSlapOSHalJsonStyleMixin):
...
@@ -1200,3 +1199,52 @@ class TestInstanceTree_edit(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
new_parameter
,
self
.
assertEqual
(
new_parameter
,
self
.
instance_tree
.
getTextContent
())
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 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSHalJsonStyleSkins
</string>
</value>
<value>
<string>
testSlapOSHalJsonStyleSkins
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<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>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</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