Datamodel viewer: autocomplete validation goes to selected class, autofocus on autocomplete field, delete input text button, add_init_script for itopwebpage class, fixed cases where default value and default null value were array instead of strings, visual tweaks

SVN:trunk[5722]
This commit is contained in:
Stephen Abello
2018-04-23 14:25:28 +00:00
parent e82a16146e
commit 9d6b5d347c
4 changed files with 1712 additions and 1804 deletions

View File

@@ -232,12 +232,35 @@ function DisplayClassesList($oPage, $sContext)
{
$oPage->add("<h1>".Dict::S('UI:Schema:Title')."</h1>\n");
$oPage->add("<label for='search-model'>" . Dict::S('UI:Schema:ClassFilter') ."</label><input id='search-model'/> ");
$oPage->add("<label for='search-model'>" . Dict::S('UI:Schema:ClassFilter') ."</label><br/><input type=\"text\" id=\"search-model\" autofocus=\"autofocus\"/>");
$oPage->add("<div id=\"delDataModelSearch\"> <i class=\"far fa-times-circle\"></i></div>");
$oPage->add("<ul id=\"ClassesList\" class=\"treeview fileview\">\n");
$oPage->add_ready_script(
<<<EOF
$("#search-model").result(function(){
$(this).trigger(jQuery.Event('input'));
$("#search-model").result(function(e,f,g,h){
//$(this).trigger(jQuery.Event('input'));
var preUrl = "?operation=details_class&class=";
var sufUrl = "&c[menu]=DataModelMenu";
var code = '';
switch($("#displaySelector").val()){
case 'labelandcode':
var id = autocompleteClassLabelAndCode.indexOf(g);
if(id != undefined)
code = autocompleteClassCode[id];
break;
case 'label':
var id = autocompleteClassLabel.indexOf(g);
if(id != undefined)
code = autocompleteClassCode[id];
break;
case 'code':
var id = autocompleteClassCode.indexOf(g);
if(id != undefined)
code = autocompleteClassCode[id];
break;
}
if(code != '')
window.location = preUrl + code + sufUrl;
});
$("#search-model").on('input', function() {
var search_result = [];
@@ -255,6 +278,10 @@ function DisplayClassesList($oPage, $sContext)
e.parents().show();
});
});
$("#delDataModelSearch").on ('click', function(){
$("#search-model").val("");
$("#search-model").trigger('input');
});
EOF
);
@@ -823,7 +850,12 @@ function DisplayClassDetails($oPage, $sClass, $sContext)
if($oAttDef->IsNullAllowed())
{
$aMoreInfo[] = Dict::S('UI:Schema:NullAllowed');
$sDefaultNullValue = ($oAttDef->GetNullValue() !== null ? Dict::Format('UI:Schema:DefaultNullValue', $oAttDef->GetNullValue()) : "" );
$sDefaultNullValue = ($oAttDef->GetNullValue() !== null ? $oAttDef->GetNullValue() : "" );
if(!is_string($sDefaultNullValue))
{
$sDefaultNullValue = json_encode($sDefaultNullValue);
}
$sDefaultNullValue = (!empty($sDefaultNullValue) ? Dict::Format('UI:Schema:DefaultNullValue', $sDefaultNullValue) : "" );
}
else
{
@@ -831,7 +863,12 @@ function DisplayClassDetails($oPage, $sClass, $sContext)
}
if($oAttDef->GetDefaultValue())
{
$aMoreInfo[] = Dict::Format("UI:Schema:Default_Description", $oAttDef->GetDefaultValue());
$sDefaultValue = $oAttDef->GetDefaultValue();
if(!is_string($sDefaultValue))
{
$sDefaultValue = json_encode($sDefaultValue);
}
$aMoreInfo[] = Dict::Format("UI:Schema:Default_Description", $sDefaultValue);
}
$sMoreInfo .= implode(', ', $aMoreInfo);
}
@@ -915,14 +952,12 @@ EOF
var aColors = d3.scale.linear().domain([1,aOrigins.length])
.interpolate(d3.interpolateHcl)
.range([d3.rgb("#007AFF"), d3.rgb('#FFF500')]);
for(var origin of aOrigins)
{
$.each(aOrigins,function(idx, origin){
$('.originColor'+origin).parent().css('background-color',aColors(aOrigins.indexOf(origin)));
}
Array.prototype.forEach.call($(".listResults").find('td:nth-child(1),th:nth-child(1)'), e =>{
});
Array.prototype.forEach.call($(".listResults").find('td:nth-child(1),th:nth-child(1)'), function(e){
$(e).removeClass("header").addClass("originColor");
}
);
});
EOF
);
@@ -1060,6 +1095,7 @@ switch($operation)
<<<EOF
$('#search-model').val('$sClass');
$('#search-model').trigger("input");
EOF
);
DisplayClassDetails($oPage, $sClass, $sContext);
@@ -1070,9 +1106,8 @@ EOF
}
$oPage->add("</div>");
$oPage->add("</div>");
//split the page in 2 panels
$oPage->add_ready_script(
$oPage->add_init_script(
<<<EOF
$('#dataModelSplitPane').layout({
west : {size: "20%", minSize : 200,paneSize : 600}