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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
66211d9a
Commit
66211d9a
authored
Oct 31, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_panel: prefill all Software Product info from JS
parent
e2d5020e
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
876 additions
and
186 deletions
+876
-186
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_html.html
..._page_module/slapos_master_panel_import_product_html.html
+16
-0
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_html.xml
...b_page_module/slapos_master_panel_import_product_html.xml
+334
-0
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_js.js
.../web_page_module/slapos_master_panel_import_product_js.js
+128
-0
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_js.xml
...web_page_module/slapos_master_panel_import_product_js.xml
+336
-0
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_addSlapOSSoftwareProduct.py
...al_skins/slapos_panel/Project_addSlapOSSoftwareProduct.py
+5
-4
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_addSlapOSSoftwareProduct.xml
...l_skins/slapos_panel/Project_addSlapOSSoftwareProduct.xml
+1
-1
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog.xml
...anel/Project_viewSlapOSSoftwareProductFastInputDialog.xml
+1
-3
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog/your_product_import_json.xml
...ftwareProductFastInputDialog/your_product_import_json.xml
+55
-5
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog/your_software_type.xml
...apOSSoftwareProductFastInputDialog/your_software_type.xml
+0
-89
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog/your_title.xml
...t_viewSlapOSSoftwareProductFastInputDialog/your_title.xml
+0
-84
No files found.
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_html.html
0 → 100644
View file @
66211d9a
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
SlapOS product import gadget
</title>
<link
rel=
"http://www.renderjs.org/rel/interface"
href=
"interface_erp5_form_content_provider.html"
>
<link
rel=
"stylesheet"
href=
"gadget_editor.css"
>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"jiodev.js"
></script>
<script
src=
"slapos_master_panel_import_product.js"
></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_html.xml
0 → 100644
View file @
66211d9a
This diff is collapsed.
Click to expand it.
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_js.js
0 → 100644
View file @
66211d9a
/*global window, rJS, RSVP, domsugar, jIO, console */
/*jslint nomen: true, maxlen:80, indent:2*/
(
function
(
window
,
rJS
,
RSVP
,
domsugar
,
jIO
,
console
)
{
"
use strict
"
;
var
DISPLAY_URL
=
'
display_url
'
,
FIELD_SCOPE
=
'
url_input
'
;
function
renderSoftwareReleaseURLView
(
gadget
)
{
return
gadget
.
declareGadget
(
'
gadget_html5_input.html
'
,
{
scope
:
FIELD_SCOPE
})
.
push
(
function
(
sub_gadget
)
{
return
sub_gadget
.
render
({
value
:
gadget
.
state
.
value
,
editable
:
gadget
.
state
.
editable
,
required
:
gadget
.
state
.
required
,
id
:
gadget
.
state
.
key
,
name
:
gadget
.
state
.
key
,
type
:
'
url
'
})
.
push
(
function
()
{
domsugar
(
gadget
.
element
,
[
sub_gadget
.
element
]);
});
});
}
function
getContentFromSoftwareReleaseURLView
(
gadget
)
{
var
software_url
;
return
gadget
.
getDeclaredGadget
(
FIELD_SCOPE
)
.
push
(
function
(
sub_gadget
)
{
return
sub_gadget
.
getContent
();
})
.
push
(
function
(
result
)
{
software_url
=
result
[
gadget
.
state
.
key
];
return
jIO
.
util
.
ajax
({
url
:
software_url
+
'
.json
'
,
dataType
:
'
json
'
});
})
.
push
(
function
(
evt
)
{
var
software_json
=
evt
.
target
.
response
,
software_type_array
=
[],
software_type
,
result
=
{};
console
.
log
(
software_json
);
for
(
software_type
in
software_json
[
'
software-type
'
])
{
if
(
software_json
[
'
software-type
'
].
hasOwnProperty
(
software_type
))
{
software_type_array
.
push
(
software_type
);
}
}
result
[
gadget
.
state
.
title_key
]
=
software_json
.
name
;
result
[
gadget
.
state
.
description_key
]
=
software_json
.
description
||
""
;
result
[
gadget
.
state
.
software_release_key
]
=
software_url
;
result
[
gadget
.
state
.
software_type_key
]
=
software_type_array
;
console
.
log
(
result
);
return
result
;
});
}
rJS
(
window
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
console
.
log
(
options
);
return
this
.
changeState
({
display_step
:
DISPLAY_URL
,
value
:
options
.
value
,
editable
:
options
.
editable
,
// required is not a gadget field parameter. TOFIX
required
:
true
,
//options.required,
key
:
options
.
key
,
title_key
:
options
.
title_key
,
description_key
:
options
.
description_key
,
software_release_key
:
options
.
software_release_key
,
software_type_key
:
options
.
software_type_key
});
})
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
;
if
(
modification_dict
.
display_step
===
DISPLAY_URL
)
{
return
renderSoftwareReleaseURLView
(
gadget
);
}
if
(
modification_dict
.
hasOwnProperty
(
'
display_step
'
))
{
throw
new
Error
(
'
Unhandled display step:
'
+
gadget
.
state
.
display_step
);
}
})
//////////////////////////////////////////////////
// Used when submitting the form
//////////////////////////////////////////////////
.
declareMethod
(
'
getContent
'
,
function
()
{
console
.
log
(
'
getContent
'
);
var
gadget
=
this
,
display_step
=
gadget
.
state
.
display_step
,
queue
;
if
(
gadget
.
state
.
display_step
===
DISPLAY_URL
)
{
queue
=
new
RSVP
.
Queue
(
getContentFromSoftwareReleaseURLView
(
gadget
));
}
else
{
throw
new
Error
(
'
getContent form not handled:
'
+
display_step
);
}
return
queue
;
},
{
mutex
:
'
changestate
'
})
.
declareAcquiredMethod
(
"
notifyValid
"
,
"
notifyValid
"
)
.
declareAcquiredMethod
(
"
notifyInvalid
"
,
"
notifyInvalid
"
)
.
declareMethod
(
'
checkValidity
'
,
function
()
{
var
gadget
=
this
,
result
;
// XXX Cache getContent result (to prevent doing 2 ajax queries)
return
new
RSVP
.
Queue
(
getContentFromSoftwareReleaseURLView
(
gadget
))
.
push
(
function
()
{
result
=
true
;
return
gadget
.
notifyValid
();
},
function
(
error
)
{
result
=
false
;
console
.
warn
(
error
);
return
gadget
.
notifyInvalid
(
'
Can not extract software release json
'
);
})
.
push
(
function
()
{
return
result
;
});
},
{
mutex
:
'
changestate
'
});
}(
window
,
rJS
,
RSVP
,
domsugar
,
jIO
,
console
));
\ No newline at end of file
master/bt5/slapos_panel/PathTemplateItem/web_page_module/slapos_master_panel_import_product_js.xml
0 → 100644
View file @
66211d9a
This diff is collapsed.
Click to expand it.
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_addSlapOSSoftwareProduct.py
View file @
66211d9a
...
...
@@ -11,10 +11,11 @@ software_product.newContent(
title
=
software_release
,
url_string
=
software_release
)
software_product
.
newContent
(
portal_type
=
"Software Product Type Variation"
,
title
=
software_type
)
for
software_type
in
software_type_list
:
software_product
.
newContent
(
portal_type
=
"Software Product Type Variation"
,
title
=
software_type
)
software_product
.
validate
()
return
software_product
.
Base_redirect
(
...
...
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_addSlapOSSoftwareProduct.xml
View file @
66211d9a
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, software_release, software_type, **kw
</string>
</value>
<value>
<string>
title, software_release, software_type
_list, description=""
, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog.xml
View file @
66211d9a
...
...
@@ -90,9 +90,7 @@
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
your_title
</string>
<string>
your_software_release
</string>
<string>
your_software_type
</string>
<string>
your_product_import_json
</string>
</list>
</value>
</item>
...
...
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog/your_
software_release
.xml
→
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog/your_
product_import_json
.xml
View file @
66211d9a
...
...
@@ -10,14 +10,17 @@
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
required
</string>
<string>
gadget_url
</string>
<string>
renderjs_extra
</string>
<string>
title
</string>
<string>
validator_field_id
</string>
<string>
validator_form_id
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_
software_release
</string>
</value>
<value>
<string>
your_
product_import_json
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
...
...
@@ -57,6 +60,22 @@
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
gadget_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
validator_field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
validator_form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
@@ -66,20 +85,51 @@
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_
string
_field
</string>
</value>
<value>
<string>
my_
gadget
_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<int>
1
</int>
</value>
<key>
<string>
gadget_url
</string>
</key>
<value>
<string>
slapos_master_panel_import_product.html
</string>
</value>
</item>
<item>
<key>
<string>
renderjs_extra
</string>
</key>
<value>
<list>
<tuple>
<string>
title_key
</string>
<string>
title
</string>
</tuple>
<tuple>
<string>
description_key
</string>
<string>
description
</string>
</tuple>
<tuple>
<string>
software_release_key
</string>
<string>
software_release
</string>
</tuple>
<tuple>
<string>
software_type_key
</string>
<string>
software_type_list
</string>
</tuple>
</list>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Software Release
</string>
</value>
</item>
<item>
<key>
<string>
validator_field_id
</string>
</key>
<value>
<string>
my_core_mode_text_content_validator
</string>
</value>
</item>
<item>
<key>
<string>
validator_form_id
</string>
</key>
<value>
<string>
erp5_core/Base_viewFieldLibrary
</string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog/your_software_type.xml
deleted
100644 → 0
View file @
e2d5020e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
required
</string>
<string>
title
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_software_type
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_string_field
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Software Type
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Project_viewSlapOSSoftwareProductFastInputDialog/your_title.xml
deleted
100644 → 0
View file @
e2d5020e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ProxyField"
module=
"Products.ERP5Form.ProxyField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
delegated_list
</string>
</key>
<value>
<list>
<string>
required
</string>
</list>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
your_title
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
field_id
</string>
</key>
<value>
<string>
my_view_mode_title
</string>
</value>
</item>
<item>
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
required
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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