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
Klaus Wölfel
slapos.core
Commits
7fe6b1f1
Commit
7fe6b1f1
authored
Apr 22, 2016
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_web: Allow user view raw parameters to edit.
parent
3cf3352a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
12 deletions
+117
-12
master/bt5/slapos_web/PathTemplateItem/web_page_module/rjs_slapos_parameter_form_js.js
...plateItem/web_page_module/rjs_slapos_parameter_form_js.js
+114
-9
master/bt5/slapos_web/PathTemplateItem/web_page_module/rjs_slapos_parameter_form_js.xml
...lateItem/web_page_module/rjs_slapos_parameter_form_js.xml
+3
-3
No files found.
master/bt5/slapos_web/PathTemplateItem/web_page_module/rjs_slapos_parameter_form_js.js
View file @
7fe6b1f1
...
...
@@ -467,7 +467,17 @@
span_error
=
document
.
createElement
(
"
span
"
),
textarea
=
document
.
createElement
(
"
textarea
"
),
fieldset
=
document
.
createElement
(
"
fieldset
"
),
fieldset_list
=
g
.
props
.
element
.
querySelectorAll
(
'
fieldset
'
);
fieldset_list
=
g
.
props
.
element
.
querySelectorAll
(
'
fieldset
'
),
button0
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-raw-parameter
"
),
button1
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-form
"
);
if
(
button0
!==
null
)
{
$
(
button0
).
addClass
(
"
hidden-button
"
);
}
if
(
button1
!==
null
)
{
$
(
button1
).
addClass
(
"
hidden-button
"
);
}
div
.
setAttribute
(
"
class
"
,
"
field
"
);
textarea
.
setAttribute
(
"
rows
"
,
"
10
"
);
...
...
@@ -494,22 +504,47 @@
return
fieldset
;
})
.
declareMethod
(
'
renderRawParameterTextArea
'
,
function
(
content
)
{
var
g
=
this
,
div
=
document
.
createElement
(
"
div
"
),
div_error
=
document
.
createElement
(
"
div
"
),
textarea
=
document
.
createElement
(
"
textarea
"
),
fieldset
=
document
.
createElement
(
"
fieldset
"
),
fieldset_list
=
g
.
props
.
element
.
querySelectorAll
(
'
fieldset
'
);
div
.
setAttribute
(
"
class
"
,
"
field
"
);
textarea
.
setAttribute
(
"
rows
"
,
"
10
"
);
textarea
.
setAttribute
(
"
cols
"
,
"
80
"
);
textarea
.
setAttribute
(
"
name
"
,
"
field_your_instance_xml
"
);
textarea
.
textContent
=
content
;
div
.
appendChild
(
textarea
);
div
.
appendChild
(
textarea
);
fieldset
.
appendChild
(
div
);
fieldset
.
appendChild
(
div_error
);
$
(
fieldset_list
[
1
]).
replaceWith
(
fieldset
);
fieldset_list
[
2
].
innerHTML
=
''
;
return
fieldset
;
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
if
(
options
.
json_url
===
undefined
)
{
throw
new
Error
(
"
undefined json_url
"
);
}
var
g
=
this
,
softwaretype
,
softwaretype
index
;
to_hide
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-raw-parameter
"
)
,
softwaretype
;
this
.
options
=
options
;
function
updateParameterForm
(
evt
)
{
options
.
parameter
.
softwaretype
=
evt
.
srcElement
.
value
;
options
.
parameter
.
softwaretypeindex
=
evt
.
srcElement
.
selectedOptions
[
0
][
"
data-id
"
];
return
g
.
render
(
options
);
if
(
to_hide
!==
null
)
{
$
(
to_hide
).
addClass
(
"
hidden-button
"
);
}
this
.
options
=
options
;
return
g
.
loadSoftwareJSON
(
g
.
options
.
json_url
).
push
(
function
(
json
)
{
var
option_index
,
option
,
...
...
@@ -517,6 +552,10 @@
input
=
g
.
props
.
element
.
querySelector
(
'
select.slapos-software-type
'
),
s_input
=
g
.
props
.
element
.
querySelector
(
'
input.slapos-serialisation-type
'
);
if
(
options
.
parameter
.
softwaretypeindex
===
undefined
)
{
option_selected
=
options
.
parameter
.
softwaretype
;
}
if
(
input
.
children
.
length
===
0
)
{
for
(
option_index
in
json
[
'
software-type
'
])
{
if
(
json
[
'
software-type
'
].
hasOwnProperty
(
option_index
))
{
...
...
@@ -656,6 +695,72 @@
updateParameterForm
.
bind
(
g
)
);
})
.
declareService
(
function
()
{
var
g
=
this
,
element
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-raw-parameter
"
);
if
(
element
===
undefined
)
{
return
true
;
}
function
showRawParameter
(
evt
)
{
var
e
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-raw-parameter
"
),
to_show
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-form
"
),
parameter_xml
;
if
(
g
.
options
.
parameter
.
parameter_hash
!==
undefined
)
{
parameter_xml
=
atob
(
g
.
options
.
parameter
.
parameter_hash
);
}
$
(
e
).
addClass
(
"
hidden-button
"
);
$
(
to_show
).
removeClass
(
"
hidden-button
"
);
return
g
.
renderRawParameterTextArea
(
parameter_xml
)
.
push
(
function
()
{
return
loadEventList
(
g
);
});
}
return
loopEventListener
(
element
,
'
click
'
,
false
,
showRawParameter
.
bind
(
g
)
);
})
.
declareService
(
function
()
{
var
g
=
this
,
element
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-form
"
);
function
showParameterForm
(
evt
)
{
var
e
=
g
.
props
.
element
.
getElementsByTagName
(
'
select
'
)[
0
],
to_hide
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-form
"
),
to_show
=
g
.
props
.
element
.
querySelector
(
"
button.slapos-show-raw-parameter
"
);
if
(
e
===
undefined
)
{
throw
new
Error
(
"
Select not found.
"
);
}
$
(
to_hide
).
addClass
(
"
hidden-button
"
);
$
(
to_show
).
removeClass
(
"
hidden-button
"
);
g
.
options
.
parameter
.
softwaretype
=
e
.
value
;
g
.
options
.
parameter
.
softwaretypeindex
=
e
.
selectedOptions
[
0
][
"
data-id
"
];
return
g
.
render
(
g
.
options
)
.
push
(
function
()
{
return
loadEventList
(
g
);
});
}
return
loopEventListener
(
element
,
'
click
'
,
false
,
showParameterForm
.
bind
(
g
)
);
})
.
declareService
(
function
()
{
return
loadEventList
(
this
);
})
...
...
master/bt5/slapos_web/PathTemplateItem/web_page_module/rjs_slapos_parameter_form_js.xml
View file @
7fe6b1f1
...
...
@@ -222,7 +222,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
slapos-admin
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
950.
20387.46343.5749
7
</string>
</value>
<value>
<string>
950.
44873.5010.286
7
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
14
59876241.06
</float>
<float>
14
61346067.07
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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