Commit a0b568dd authored by Jérome Perrin's avatar Jérome Perrin

GUI: temporarilly revert back to the same feature set as before the new format

Pre input module and Expandable field will be handled later
parent 48a0c148
......@@ -29,11 +29,7 @@
/////////////////////////////////////////////////////////////////
.declareMethod("render", function () {
var gadget = this;
return gadget.aq_allDocs({
"include_docs": true,
"query": 'type:= "Dream"',
"select_list": ["title", "modified"]
})
return gadget.aq_allDocs({"select_list": ["title", "modified"]})
.push(function (document_list) {
var result_list = [],
doc,
......@@ -75,6 +71,7 @@
parameter_list.sort(function (a, b) {
return b.date - a.date;
});
// gadget.props.element.querySelector('a').href = document_list[0];
gadget.props.element.querySelector('.document_list').innerHTML =
......
......@@ -42,8 +42,7 @@
throw error;
})
.push(function (sim_json) {
var document = JSON.parse(sim_json),
document_list = [],
var document_list = JSON.parse(sim_json),
result_list = [],
i;
if (document.result) {
......
......@@ -18,9 +18,8 @@
<script id="panel-template" type="text/x-handlebars-template">
<ul data-role="listview">
<li><a class="pre_input_link ui-btn ui-icon-grid ui-btn-icon-left" data-icon="grid">Documents</a></li>
<!--li><a class="home_link ui-btn ui-icon-home ui-btn-icon-left" data-icon="home">Documents</a></li-->
<!--li><a class="fast_input_link ui-btn ui-icon-plus ui-btn-icon-left" data-icon="plus">New Document</a></li-->
<li><a class="home_link ui-btn ui-icon-home ui-btn-icon-left" data-icon="home">Documents</a></li>
<li><a class="fast_input_link ui-btn ui-icon-plus ui-btn-icon-left" data-icon="plus">New Document</a></li>
{{#navigationlist}}
<li><a href="{{link}}">{{title}}</a></li>
{{/navigationlist}}
......
This diff is collapsed.
/* ====================== listview checkbox ======================== */
/* allow checkbox and radio in split listview */
html body .ui-listview li.ui-li-has-checkbox {
padding-right: 2.25em;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
html body .ui-listview li.ui-li-has-checkbox label {
border-left-width: 0px;
-moz-box-sizing: border-box;
}
html .ui-listview li.ui-li-has-alt a.ui-btn.ui-icon-caret-right:after,
html .ui-listview li.ui-li-has-alt a.ui-btn.ui-icon-carat-r:after {
content: "";
}
html .ui-listview li div.ui-radio,
html .ui-listview li div.ui-checkbox {
height: 100%;
margin: 0;
padding: 0;
position: absolute;
right: 0;
top: 0;
width: 2.5em;
z-index: 2;
}
html body .ui-listview li div.ui-radio label.ui-btn,
html body .ui-listview li div.ui-checkbox label.ui-btn {
border-radius: .375em;
height: 100%;
min-height: 1em;
padding: 0;
width: auto;
}
html body .ui-listview li div.ui-radio,
html body .ui-listview li div.ui-radio label.ui-btn,
html body .ui-listview li div.ui-checkbox,
html body .ui-listview li div.ui-checkbox label.ui-btn {
box-shadow: 0;
-webkit-box-shadow: 0;
border-radius: 0;
-webkit-border-radius: 0;
}
html body .ui-listview li.ui-first-child div.ui-radio,
html body .ui-listview li.ui-first-child div.ui-radio label.ui-btn,
html body .ui-listview li.ui-first-child div.ui-checkbox,
html body .ui-listview li.ui-first-child div.ui-checkbox label.ui-btn {
border-top-right-radius: .375em;
-webkit-border-top-right-radius: .375em;
}
html body .ui-listview li.ui-last-child div.ui-radio,
html body .ui-listview li.ui-last-child div.ui-radio label,
html body .ui-listview li.ui-last-child div.ui-checkbox,
html body .ui-listview li.ui-last-child div.ui-checkbox label {
border-bottom-right-radius: .375em;
-webkit-border-bottom-right-radius: .375em;
border-bottom-width: 1px;
margin-bottom: -1px;
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Choose Instance</title>
<link rel="stylesheet" href="InputModule_viewAddInstanceDefinitionDialog.css" />
<script src="../lib/rsvp.min.js" type="text/javascript"></script>
<script src="../<%= copy.handlebars.relative_dest %>" type="text/javascript"></script>
<script src="../lib/renderjs.min.js" type="text/javascript"></script>
<script src="mixin_gadget.js" type="text/javascript"></script>
<script src="mixin_promise.js" type="text/javascript"></script>
<script src="InputModule_viewAddInstanceDefinitionDialog.js" type="text/javascript"></script>
<script id="table-template" type="text/x-handlebars-template">
<ul data-role="listview" data-inset="true" class="document-listview">
{{#documentlist}}
<li>
<div>
<!--div class="ui-btn ui-input-btn">{{title}} -->
<input type="submit" value="{{title}}" name= "{{name}}">
</div>
<div class="ui-checkbox">
<label class="ui-corner-all ui-btn-inherit ui-btn-icon-left ui-icon-checkbox-off ui-checkbox-off">
<!--label class="ui-corner-all ui-btn-inherit"-->
<input type="checkbox" value="" name="{{name}}">
</label>
</div>
</li>
{{/documentlist}}
</ul>
</script>
</head>
<body>
<div class="ui-grid-a ui-responsive">
<div class="ui-block-a">
<form class="new_form">
<button type="submit" class="ui-btn ui-btn ui-btn-inline ui-icon-plus ui-btn-icon-right">Default</button>
</form>
<form class="import_form">
<input id="dream_import" type="file" required=""
name="dream_import" class="ui-btn ui-btn-b ui-btn-inline">
<button type="submit" class="ui-btn ui-btn ui-btn-inline ui-icon-plus ui-btn-icon-right">Import</button>
</form>
</div>
<div class="ui-block-b">
<form method="post" action="#">
<input type="hidden" name="method" value="delete_status" ></input>
<section class="document_list"></section>
<!--ul data-role="listview" class="document-list" data-inset="true"></ul-->
<div class="ui-input-btn ui-btn ui-icon-delete ui-btn-inline ui-btn-icon-left">
Delete
<input type="submit" data-enhanced="true" value="Delete">
</div>
</form>
</div>
</div>
</body>
</html>
/*global rJS, RSVP, jQuery, Handlebars,
promiseEventListener, initGadgetMixin, console */
promiseEventListener, initGadgetMixin*/
/*jslint nomen: true */
(function (window, rJS, RSVP, Handlebars, initGadgetMixin) {
"use strict";
......@@ -23,20 +23,15 @@
var gadget = this,
queue;
console.log("FIELDSET RENDER 1");
console.log(options);
console.log(node_id);
gadget.props.key = options.key; // used for recursive fieldsets
gadget.props.field_gadget_list = [];
function addField(property_id, property_definition,
value) {
function addField(property_id, property_definition, value) {
var sub_gadget;
queue
.push(function () {
// XXX this is incorrect for recursive fieldsets.
// we should use nested fieldset with legend
console.log("insertingAdjacentHTML for:" + property_id);
gadget.props.element.insertAdjacentHTML(
'beforeend',
label_template({
......@@ -46,22 +41,6 @@
property_id )
})
);
console.log("....................");
console.log(property_id);
console.log(property_definition);
console.log(value);
// XXX maybe type should be used instead
if (property_definition.allOf) {
// if there is type property then remove it
if (property_definition.allOf[0].type) {
delete property_definition.allOf[0].type;
}
return gadget.declareGadget("../expandable_field/index.html");
}
if (property_definition.properties) {
// Create a recursive fieldset for this key.
return gadget.declareGadget("../fieldset/index.html");
}
if (property_definition.type === "object") {
// Create a recursive fieldset for this key.
return gadget.declareGadget("../fieldset/index.html");
......@@ -93,82 +72,27 @@
queue = new RSVP.Queue()
.push(function () {
var reserved_keys = [];
if (node_id) {
addField('id', {'type': 'string'}, node_id);
}
Object.keys(options.property_definition.properties)
.forEach(function (property_name) {
var property_definition =
options.property_definition.properties[property_name],
value,
i=0, property,
index;
if (property_definition) {
value = property_definition.default || {};
if (property_definition.allOf) {
if (property_definition.allOf[0].properties) {
for (property in property_definition
.allOf[0].properties) {
if (property_definition.allOf[0]
.properties.hasOwnProperty(property)) {
i += 1;
if (i > 1) {console.log("something is wrong!");}
value = property_definition.allOf[0]
.properties[property].default;
}
}
}
}
}
console.log("TRYING TO FIND A VALUE!!!!");
console.log(options);
console.log(options.value);
console.log(property_name);
// XXX if the field is complex then the value may be complex
// eg options.value > "time_to_failure":{},"time_to_repair":{}...
// while the property_names are abstract as allOf_1 corresponding
// to (for example) time_to_failure
if (options.property_definition
.properties[property_name].allOf) {
if ((options.value || {})[property_name] === undefined) {
if (typeof options.value === 'object') {
if (Object.keys(options.value).length > 0) {
for (index = 0;
index < Object.keys(options.value).length-1;
index += 1) {
if (!(reserved_keys
.indexOf(Object.keys(options.value)[index])
> -1)) {
reserved_keys.push(
Object.keys(options.value)[index]
);
value =
options.value[Object.keys(options.value)[index]];
break;
}
}
}
}
}
}
Object.keys(options.property_definition.properties
).forEach(function (property_name) {
var property_definition =
options.property_definition.properties[property_name],
value = (options.value || {})[property_name] === undefined
? value : options.value[property_name];
if (property_name !== 'coordinate'
&& property_name !== '_class'
&& property_name !== 'id') {
? property_definition._default : options.value[property_name];
// XXX some properties are not editable
// XXX should not be defined here
addField(property_name, property_definition, value);
}
});
if (property_name !== 'coordinate' && property_name !== '_class') {
addField(property_name, property_definition, value);
}
});
});
return queue;
return queue;
})
// getContent of all subfields
.declareMethod("getContent", function () {
console.log("GET CONTENT SIMPLE FIELDSET");
var i, promise_list = [], gadget = this;
for (i = 0; i < this.props.field_gadget_list.length; i += 1) {
promise_list.push(this.props.field_gadget_list[i].getContent());
......@@ -176,8 +100,6 @@
return RSVP.Queue()
.push(function () { return RSVP.all(promise_list); })
.push(function (result_list) {
console.log("(*)(/)(*)");
console.log(result_list);
var name, result = {}, content = result;
if (gadget.props.key) {
content = result[gadget.props.key] = {};
......@@ -189,23 +111,9 @@
}
}
}
console.log("GET CONTENT SIMPLE FIELDSET 2");
console.log(result);
return result;
});
})
.declareMethod('startService', function () {
console.log("startservice FIElDSET 1");
var gadget = this,
i,
promise_list = [];
for (i = 0; i < gadget.props.field_gadget_list.length; i += 1) {
if (gadget.props.field_gadget_list[i].startService) {
promise_list.push(gadget.props.field_gadget_list[i].startService());
}
}
console.log("there are " + promise_list.length + " subgadget promises");
return RSVP.all(promise_list);
});
}(window, rJS, RSVP, Handlebars, initGadgetMixin));
This diff is collapsed.
......@@ -40,21 +40,19 @@
*/
tools_container.className = 'tools-container';
Object.keys(data.class_definition).forEach(function (key) {
var _class_object = data.class_definition[key], tool;
var _class = data.class_definition[key], tool;
// XXX "expand" the json schema "allOF" etc
if (_class_object.allOf) {
if (_class_object.allOf[0].$ref === "#/node") {
tool = document.createElement('div');
// XXX maybe allow to configure the class name ?
tool.className = "tool " + key;
tool.textContent = _class_object.name || key;
tool.draggable = true;
tool.dataset.class_name = JSON.stringify(key);
Object.keys(_class_object.css || {}).forEach(function (k) {
tool.style[k] = _class_object.css[k];
});
tools_container.appendChild(tool);
}
if (_class._class === 'node') {
tool = document.createElement('div');
// XXX maybe allow to configure the class name ?
tool.className = "tool " + key;
tool.textContent = _class.name || key;
tool.draggable = true;
tool.dataset.class_name = JSON.stringify(key);
Object.keys(_class.css || {}).forEach(function (k) {
tool.style[k] = _class.css[k];
});
tools_container.appendChild(tool);
}
});
......
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