Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
413b2f38
Commit
413b2f38
authored
Jan 20, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom handlers: add overview/new for computer and networks
parent
2ee97fbb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
166 additions
and
36 deletions
+166
-36
data/computer_new.json
data/computer_new.json
+7
-10
data/computer_overview.json
data/computer_overview.json
+1
-1
data/network_new.json
data/network_new.json
+1
-1
data/network_overview.json
data/network_overview.json
+1
-0
data/release_install.json
data/release_install.json
+1
-1
data/software_status.json
data/software_status.json
+1
-1
js/erp5_loader.js
js/erp5_loader.js
+151
-21
lang/en-EN/dict.json
lang/en-EN/dict.json
+3
-1
No files found.
data/computer_new.json
View file @
413b2f38
...
...
@@ -3,7 +3,7 @@
"portal_type_title"
:
"computer"
,
"portal_type_fields"
:
"computer_fieldlist"
,
"form"
:
true
,
"view"
:
"
FOO
"
,
"view"
:
"
web_view
"
,
"property_dict"
:
{
"dynamic_children"
:
[
0
],
"requires_authentication"
:
true
,
...
...
@@ -15,15 +15,12 @@
{
"position"
:
"left"
,
"fieldlist"
:
[
{
"field"
:
"title"
},
{
"field"
:
"reference_network"
}
]
},
{
"position"
:
"center"
,
"fieldlist"
:
[
{
"field"
:
"description"
},
{
"field"
:
"reference"
,
"overrides"
:
{
"widget"
:{
"hidden"
:
true
}}}
{
"type"
:
"input"
,
"direct"
:
{
"name"
:
"computer_title"
,
"id"
:
"computer_title"
,
"className"
:
"required"
},
"attributes"
:
{
"data-enhanced"
:
true
,
"type"
:
"text"
},
"logic"
:
{
"clear"
:
true
,
"label"
:
"Computer Title"
,
"setValue"
:
"computer_"
,
"label_i18n"
:
"portal_type_dict.computer_dict.text_dict.title"
,
"skip"
:
false
}}
]
},
{
"position"
:
"right"
,
"fieldlist"
:
[]
}
],
"children"
:
[{
...
...
@@ -45,7 +42,7 @@
},
"children"
:
[
{
"type"
:
"input"
,
"direct"
:
{
"value"
:
"Reset"
,
"className"
:
"translate"
},
"attributes"
:
{
"type"
:
"reset"
,
"data-i18n"
:
"[value]portal_type_dict.computer_dict.text_dict.cancel"
}},
{
"type"
:
"input"
,
"direct"
:
{
"value"
:
"Submit"
,
"className"
:
"action translate"
},
"attributes"
:
{
"type"
:
"submit"
,
"data-action"
:
"add"
,
"data-icon"
:
"save"
,
"data-i18n"
:
"[value]portal_type_dict.computer_dict.text_dict.submit"
,
"data-theme"
:
"slapos-black"
}}
{
"type"
:
"input"
,
"direct"
:
{
"value"
:
"Submit"
,
"className"
:
"action translate"
},
"attributes"
:
{
"type"
:
"submit"
,
"data-action"
:
"add
_server
"
,
"data-icon"
:
"save"
,
"data-i18n"
:
"[value]portal_type_dict.computer_dict.text_dict.submit"
,
"data-theme"
:
"slapos-black"
}}
]
}]
}
...
...
data/computer_overview.json
View file @
413b2f38
...
...
@@ -2,7 +2,7 @@
"portal_type_source"
:
"Computer"
,
"portal_type_title"
:
"computer"
,
"portal_type_fields"
:
"computer_fieldlist"
,
"portal_type_mapper"
:
"s
ubscription
s"
,
"portal_type_mapper"
:
"s
erver
s"
,
"initial_query"
:
{
"include_docs"
:
true
,
"limit"
:[
0
,
8
]},
"form"
:
true
,
"view"
:
"web_view"
,
...
...
data/network_new.json
View file @
413b2f38
...
...
@@ -15,7 +15,7 @@
{
"position"
:
"left"
,
"fieldlist"
:
[
{
"
field"
:
"title"
}
{
"
type"
:
"input"
,
"direct"
:
{
"name"
:
"network_title"
,
"id"
:
"network_title"
,
"className"
:
"required"
},
"attributes"
:
{
"data-enhanced"
:
true
,
"type"
:
"text"
},
"logic"
:
{
"clear"
:
true
,
"label"
:
"Computer Title"
,
"setValue"
:
"network_"
,
"label_i18n"
:
"portal_type_dict.network_dict.text_dict.title"
,
"skip"
:
false
}
}
]
},
{
...
...
data/network_overview.json
View file @
413b2f38
...
...
@@ -2,6 +2,7 @@
"portal_type_source"
:
"Computer Network"
,
"portal_type_title"
:
"network"
,
"portal_type_fields"
:
"network_fieldlist"
,
"portal_type_mapper"
:
"networks"
,
"initial_query"
:
{
"include_docs"
:
true
,
"limit"
:[
0
,
8
]},
"form"
:
true
,
"view"
:
"FOO"
,
...
...
data/release_install.json
View file @
413b2f38
...
...
@@ -25,7 +25,7 @@
"fieldlist"
:
[
{
"type"
:
"input"
,
"direct"
:
{
"id"
:
"software_release_show"
,
"className"
:
"required"
},
"attributes"
:
{
"data-enhanced"
:
"true"
,
"type"
:
"text"
,
"readonly"
:
"readonly"
},
"logic"
:
{
"setValue"
:
"_relative_url"
,
"label"
:
"Software Release"
,
"label_i18n"
:
"portal_type_dict.release_dict.text_dict.software_release"
,
"skip"
:
false
}},
{
"type"
:
"input"
,
"direct"
:
{
"name"
:
"software_release"
,
"id"
:
"software_release"
,
"className"
:
"required"
},
"attributes"
:
{
"data-enhanced"
:
"true"
,
"type"
:
"hidden"
},
"logic"
:
{
"setValue"
:
"_relative_url"
,
"skip"
:
false
}},
{
"type"
:
"input"
,
"direct"
:
{
"name"
:
"software_title"
,
"id"
:
"software_title"
,
"className"
:
"required"
},
"attributes"
:
{
"data-enhanced"
:
true
,
"type"
:
"text"
},
"logic"
:
{
"label"
:
"Instance Title"
,
"setValue"
:
"instance_"
,
"label_i18n"
:
"portal_type_dict.release_dict.text_dict.instance_title"
,
"skip"
:
false
}}
{
"type"
:
"input"
,
"direct"
:
{
"name"
:
"software_title"
,
"id"
:
"software_title"
,
"className"
:
"required"
},
"attributes"
:
{
"data-enhanced"
:
true
,
"type"
:
"text"
},
"logic"
:
{
"
clear"
:
true
,
"
label"
:
"Instance Title"
,
"setValue"
:
"instance_"
,
"label_i18n"
:
"portal_type_dict.release_dict.text_dict.instance_title"
,
"skip"
:
false
}}
]
},
{
...
...
data/software_status.json
View file @
413b2f38
...
...
@@ -4,7 +4,7 @@
"portal_type_fields"
:
"service_fieldlist"
,
"initial_query"
:
{
"include_docs"
:
true
,
"limit"
:[
0
,
1
]},
"form"
:
true
,
"view"
:
"
FOO
"
,
"view"
:
"
web_view
"
,
"property_dict"
:
{
"initial_query_url_identifier"
:
"reference_computer"
,
"dynamic_children"
:
[
0
],
...
...
js/erp5_loader.js
View file @
413b2f38
...
...
@@ -153,6 +153,106 @@
return
(
reply
);
},
/**
* @method subscriptions
* @param {object} reply Object received from previous chain element
* @param {object} response Object object passed on to next element
**/
"
servers
"
:
function
(
reply
)
{
var
config
,
property
,
query
,
href
,
i
,
reply
,
pass
=
reply
.
pass
;
if
(
storage
)
{
config
=
{
"
url
"
:
storage
.
items
.
dict
.
url
,
"
type
"
:
"
GET
"
,
"
data
"
:
JSON
.
stringify
({
"
_id
"
:
""
})
};
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
});
}).
then
(
function
(
answer
)
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_computer
"
)
{
query
=
reply
[
i
].
_query
;
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
if
(
reply
.
response
)
{
return
{
"
response
"
:
util
.
parse
(
reply
.
response
),
"
pass
"
:
pass
};
}
return
{
"
pass
"
:
pass
}
}).
fail
(
util
.
error
);
}
return
(
reply
);
},
/**
* @method subscriptions
* @param {object} reply Object received from previous chain element
* @param {object} response Object object passed on to next element
**/
"
networks
"
:
function
(
reply
)
{
var
config
,
property
,
query
,
href
,
i
,
reply
,
pass
=
reply
.
pass
;
if
(
storage
)
{
config
=
{
"
url
"
:
storage
.
items
.
dict
.
url
,
"
type
"
:
"
GET
"
,
"
data
"
:
JSON
.
stringify
({
"
_id
"
:
""
})
};
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
});
}).
then
(
function
(
answer
)
{
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_network
"
)
{
query
=
reply
[
i
].
_query
;
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
pass
.
config
.
initial_query
.
query
=
query
;
// pass hacked query back into chain
if
(
reply
.
response
)
{
return
{
"
response
"
:
util
.
parse
(
reply
.
response
),
"
pass
"
:
pass
};
}
return
{
"
pass
"
:
pass
}
}).
fail
(
util
.
error
);
}
return
(
reply
);
},
/**
* @method subscriptions
* @param {object} reply Object received from previous chain element
...
...
@@ -160,7 +260,7 @@
**/
// TODO: should be renamed to overview
"
subscriptions
"
:
function
(
reply
)
{
var
config
,
property
,
query
,
href
,
pass
=
reply
.
pass
;
var
config
,
property
,
query
,
href
,
i
,
reply
,
pass
=
reply
.
pass
;
if
(
storage
)
{
config
=
{
...
...
@@ -172,14 +272,19 @@
// access storage
return
jIO
.
util
.
ajax
(
config
)
.
then
(
function
(
response
)
{
console
.
log
(
util
.
parse
(
response
.
target
.
responseText
))
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
response
.
target
.
responseText
).
_links
.
me
.
href
});
}).
then
(
function
(
answer
)
{
console
.
log
(
util
.
parse
(
answer
.
target
.
responseText
))
query
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
.
_query
;
reply
=
util
.
parse
(
answer
.
target
.
responseText
).
_links
.
slapos_jump
;
for
(
i
=
0
;
i
<
reply
.
length
;
i
+=
1
)
{
if
(
reply
[
i
].
name
===
"
current_hosting_subscription
"
)
{
query
=
reply
[
i
].
_query
;
}
}
if
(
query
===
undefined
)
{
query
=
reply
.
href
;
}
if
(
pass
.
config
.
initial_query
===
undefined
)
{
pass
.
config
.
initial_query
=
{};
}
...
...
@@ -576,17 +681,6 @@
.
fail
(
util
.
error
);
},
/**
* Instantiate a software instance
* @method install
* @param {object} obj Action Object
**/
"
instantiate
"
:
function
(
obj
)
{
obj
.
gadget
.
state
.
create_new
=
true
;
obj
.
gadget
.
state
.
force_formdata
=
true
;
storage
.
add
(
obj
);
},
/**
* Create an installation = new service object
* @method install
...
...
@@ -596,7 +690,6 @@
// force new portal type and POST (create new record)
obj
.
gadget
.
state
.
force_type
=
"
Service
"
;
obj
.
gadget
.
state
.
create_new
=
true
;
storage
.
add
(
obj
);
},
...
...
@@ -617,7 +710,44 @@
"
add
"
:
function
(
obj
)
{
storage
.
add
(
obj
);
},
/**
* Add a user to the storage
* @method submit
* @param {object} obj Action Object
**/
"
add_server
"
:
function
(
obj
)
{
obj
.
gadget
.
state
.
create_new
=
true
;
obj
.
gadget
.
state
.
force_formdata
=
true
;
obj
.
gadget
.
state
.
url_pointer
=
"
request_computer
"
;
storage
.
add
(
obj
);
},
/**
* Instantiate a software instance
* @method install
* @param {object} obj Action Object
**/
"
instantiate
"
:
function
(
obj
)
{
obj
.
gadget
.
state
.
create_new
=
true
;
obj
.
gadget
.
state
.
force_formdata
=
true
;
obj
.
gadget
.
state
.
url_pointer
=
"
request
"
;
storage
.
add
(
obj
);
},
/**
* Instantiate a software instance
* @method install
* @param {object} obj Action Object
**/
"
add_network
"
:
function
(
obj
)
{
obj
.
gadget
.
state
.
create_new
=
true
;
obj
.
gadget
.
state
.
force_formdata
=
true
;
obj
.
gadget
.
state
.
url_pointer
=
"
request_network
"
;
storage
.
add
(
obj
);
},
/**
* Show jumps popup
* @method jump
...
...
@@ -4784,12 +4914,13 @@
app
.
store
({
"
response
"
:
[
obj
],
"
pass
"
:
{
"
form_data
"
:
formData
,
"
type
"
:
config
.
gadget
.
state
.
type
,
"
reply
"
:
true
,
"
validate_type
"
:
validate_portal_type_fields
,
// hacked view
"
view
"
:
config
.
gadget
.
state
.
view
"
view
"
:
config
.
gadget
.
state
.
view
,
"
form_data
"
:
formData
,
"
fetch
"
:
config
.
gadget
.
state
.
url_pointer
}
})
.
then
(
function
(
answer
)
{
...
...
@@ -6358,14 +6489,13 @@
})
.
then
(
function
(
answer
)
{
return
jIO
.
util
.
ajax
({
"
url
"
:
util
.
parse
(
answer
.
target
.
responseText
).
_actions
.
request
.
href
,
"
url
"
:
util
.
parse
(
answer
.
target
.
responseText
).
_actions
[
pass
.
fetch
]
.
href
,
"
type
"
:
"
POST
"
,
"
data
"
:
pass
.
form_data
});
})
.
then
(
function
(
erp5_response
)
{
header
=
erp5_response
.
target
.
getResponseHeader
(
"
Location
"
);
console
.
log
(
header
)
return
RSVP
.
resolve
({
"
status
"
:
200
,
"
foo
"
:
"
bar
"
,
...
...
lang/en-EN/dict.json
View file @
413b2f38
...
...
@@ -87,6 +87,7 @@
"portal_type_dict"
:
{
"network_dict"
:
{
"text_dict"
:
{
"title"
:
"Network Title"
,
"status"
:
"Status"
,
"networks"
:
"Networks"
,
"network_instance"
:
"Network Instance"
,
...
...
@@ -238,7 +239,8 @@
"delete"
:
"Delete"
,
"server_instance"
:
"Server Instance"
,
"instance_configuration"
:
"Instance Configuration"
,
"installed_services"
:
"Installed Services"
"installed_services"
:
"Installed Services"
,
"title"
:
"Computer Title"
},
"field_dict"
:
{
"network"
:
{
...
...
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