Commit bcf92d4e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Remove WebMessage_stop call and don't set unnecessary values

The call to web_message stop was replaced by an interaction workflow entry along with the dummy sets with values hardcoded on the UI.

In general, UI should be cleaned up to contain its minimal necessary for API and all the deeper logic should be implemented exclusively on the backend.
parent 3848710a
......@@ -32,17 +32,10 @@
.push(function (doc) {
return gadget.jio_post(doc);
})
.push(function (key) {
return gadget.getSetting('hateoas_url')
.push(function (hateoas_url) {
return gadget.jio_putAttachment(key,
hateoas_url + key + "/WebMessage_stop", {});
})
.push(function () {
return gadget.redirect({"command": "change",
.push(function () {
return gadget.redirect({"command": "change",
"options": {"jio_key": gadget.state.jio_key,
"page": "slap_controller"}});
});
});
})
......@@ -77,28 +70,6 @@
"hidden": 1,
"type": "StringField"
},
"my_resource": {
"description": "Resource",
"title": "Title",
"default": result[2].resource,
"css_class": "",
"required": 1,
"editable": 1,
"key": "resource",
"hidden": 1,
"type": "StringField"
},
"my_destination": {
"description": "",
"title": "Source",
"default": result[2].source,
"css_class": "",
"required": 1,
"editable": 1,
"key": "destination",
"hidden": 1,
"type": "StringField"
},
"my_text_content": {
"description": "Include your message",
"title": "Your Message",
......@@ -121,17 +92,6 @@
"hidden": 1,
"type": "StringField"
},
"my_content_type": {
"description": "",
"title": "Content Type",
"default": "plain/text",
"css_class": "",
"required": 1,
"editable": 1,
"key": "content_type",
"hidden": 1,
"type": "StringField"
},
"my_follow_up": {
"description": "",
"title": "Follow up",
......@@ -164,17 +124,6 @@
"key": "parent_relative_url",
"hidden": 1,
"type": "StringField"
},
"my_start_date": {
"description": "",
"title": "Start Date",
"default": (new Date()).toISOString(),
"css_class": "",
"required": 1,
"editable": 1,
"key": "start_date",
"hidden": 1,
"type": "StringField"
}
}},
"_links": {
......@@ -189,9 +138,7 @@
"center",
[["my_title"], ["my_text_content"], ["my_follow_up"],
["my_portal_type"], ["my_parent_relative_url"],
["my_follow_up"], ["my_source"], ["my_resource"],
["my_content_type"], ["my_destination"],
["my_start_date"]]
["my_follow_up"], ["my_source"]]
]]
}
});
......
......@@ -284,7 +284,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.61017.55148.37802</string> </value>
<value> <string>972.37270.25301.10137</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -302,7 +302,7 @@
</tuple>
<state>
<tuple>
<float>1543420431.94</float>
<float>1545841502.46</float>
<string>UTC</string>
</tuple>
</state>
......
from zExceptions import Unauthorized
portal = context.getPortalObject()
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()
# XXX Proxy role is Manager so user to open ticket which is closed.
# We check permissions
if not person:
raise Unauthorized("You need to be logged in before modify this object!")
ticket = context.getFollowUpValue()
if ticket.getDestinationDecision() != person.getRelativeUrl():
raise Unauthorized
context.stop(comment="Submitted from the renderjs app")
if portal.portal_workflow.isTransitionPossible(ticket, "validate"):
ticket.validate(comment="See %s" % context.getRelativeUrl())
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>*args, **kwargs</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebMessage_stop</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment