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

@@ -36,7 +36,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
private $m_sMenu;
// private $m_currentOrganization;
private $m_aMessages;
private $m_sInitScript;
private $m_aInitScript = array();
protected $m_oTabs;
protected $bBreadCrumbEnabled;
protected $sBreadCrumbEntryId;
@@ -261,7 +261,7 @@ EOF;
EOF
);
$this->m_sInitScript =
$this->add_init_script(
<<< EOF
try
{
@@ -366,15 +366,14 @@ EOF
});
}
});
$('.resizable').filter(':visible').resizable();
}
catch(err)
{
// Do something with the error !
alert(err);
}
EOF;
EOF
);
$this->add_ready_script(
<<< EOF
@@ -858,7 +857,13 @@ EOF
if (!$this->IsPrintableVersion()) {
$this->add_script("var iPaneVisWatchDog = window.setTimeout('FixPaneVis()',5000);");
}
$this->add_script("\$(document).ready(function() {\n{$this->m_sInitScript};\nwindow.setTimeout('onDelayedReady()',10)\n});");
$sInitScripts = "";
if (count($this->m_aInitScript) > 0) {
foreach ($this->m_aInitScript as $m_sInitScript) {
$sInitScripts .= "$m_sInitScript\n";
}
}
$this->add_script("\$(document).ready(function() {\n{$sInitScripts};\nwindow.setTimeout('onDelayedReady()',10)\n});");
if ($this->IsPrintableVersion()) {
$this->add_ready_script(
<<<EOF
@@ -1376,4 +1381,11 @@ EOD
);
}
}
/**
* Adds a script to be executed when the DOM is ready (typical JQuery use), right before add_ready_script
* @return void
*/
public function add_init_script($sScript){
$this->m_aInitScript[] = $sScript;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3065,6 +3065,11 @@ span.search-button, span.refresh-button {
color:#fff;
border-radius: 4px;
}
///////////////////
// Datamodel Viewer
///////////////////
#img-lifecycle{
width:100%;
}
@@ -3074,7 +3079,7 @@ span.search-button, span.refresh-button {
}
#search-model{
width:98%;
width:90%;
}
.mfp-figure:after{
@@ -3110,9 +3115,7 @@ table.listResults .originColor{
#displaySelectorLabel, #changeDefaultDisplay{
display :inline-block;
}
///////////////////
// Datamodel Viewer
///////////////////
#dataModelSplitPane{
height:100%;
}
@@ -3144,19 +3147,24 @@ table.listResults .originColor{
#dataModelSplitPane .ui-layout-resizer {
background: #DDD;
}
width:10px !important;
margin-left: 15px !important;
}
#dataModelSplitPane .ui-layout-resizer :hover{
background: #E87C1E;
}
#dataModelSplitPane .ui-layout-resizer-west{
border-left : 1px solid #BBB;
border-right: 1px solid #BBB;
}
#dataModelSplitPane .ui-layout-resizer-east{
border-left : 1px solid #BBB;
border-right: 1px solid #BBB;
}
#dataModelSplitPane .ui-layout-toggler{
background: #AAA;
width:10px !important;
}
#dataModelSplitPane .ui-layout-toggler:hover{
background: #E87C1E;
@@ -3190,7 +3198,6 @@ table.listResults .originColor{
font-weight: bold;
border-bottom: 1px solid $grey-color;
padding: 3px;
}
.tooltipD3 i {
font-size: 14px;
@@ -3202,6 +3209,21 @@ table.listResults .originColor{
font-family: FontAwesome;
}
.data-model-viewer{
background-color: #FFF;
margin-top:7px !important;
margin-left: 15px !important;
}
#delDataModelSearch {
color: #E87C1E;
font-family: FontAwesome;
display:inline-block;
font-size:15px;
margin-left:1%;
}
#dataModelSplitPane .ui-layout-center{
margin-left :30px !important;
}
///////////////////

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}