3.0.0.4 Portal Commodity Sales properties. Control Index population.
This commit is contained in:
@@ -225,6 +225,11 @@ td.action
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.width15pc
|
||||
{
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.width20pc
|
||||
{
|
||||
width: 20%;
|
||||
@@ -235,6 +240,16 @@ td.action
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.width30pc
|
||||
{
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.width40pc
|
||||
{
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.halfwidth, .width50pc
|
||||
{
|
||||
width: 50%;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
env.$pnl.bgr.invisible();
|
||||
env.$pnl.mnu.empty();
|
||||
env.$pnl.mnu.append(cd.getFilterMenuOption(env, sbc.lbl.refresh, function () { cd.refreshItems(env); }, 'sbc-refresh'));
|
||||
env.$pnl.mnu.append(cd.getFilterMenuOption(env, sbc.lbl.popIndices, function () { cd.populateIndices(env); }, 'sbc-config'));
|
||||
sbc.debug(!!$('.sbc-dropdown-item', env.$pnl.mnu).length);
|
||||
env.$pnl.bgr.toggleVisibility(!!$('.sbc-dropdown-item', env.$pnl.mnu).length);
|
||||
}
|
||||
|
||||
@@ -97,7 +99,7 @@
|
||||
|
||||
env.$pnl.items = $('.sbc-panel.Tables');
|
||||
env.$pnl.header = env.$pnl.items.find('.sbc-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbc-burger');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbc-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbc-dropdown-menu');
|
||||
env.$pnl.table = env.$pnl.items.find('.sbc-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.table.find('.sbc-panel-messages');
|
||||
|
||||
@@ -5,47 +5,48 @@
|
||||
(function (win, doc, undef)
|
||||
{
|
||||
"use strict";
|
||||
let ds = sbc.mdl.repDbSchema = { env: {}, data: {} };
|
||||
let $pnl = ds.$pnl = {}, $frm = ds.$frm = {}, $dlg = ds.$dlg = {};
|
||||
let rs = sbc.mdl.repoSchema = { env: {} };
|
||||
|
||||
//--------------------------------------------------------------
|
||||
ds.refreshDbSchema = function (delay)
|
||||
rs.refreshDbSchema = function (env, delay)
|
||||
{
|
||||
if (sbc.awaitingLogin) return;
|
||||
if (!$frm.filter.find('.FilterContext').val()) return;
|
||||
if (!ds.awaitingSchemaResponse)
|
||||
if (!env.$frm.filter.find('.FilterContext').val()) return;
|
||||
if (!rs.awaitingSchemaResponse)
|
||||
{
|
||||
$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
env.$pnl.bgr.invisible();
|
||||
rs.clearItems(env);
|
||||
env.$pnl.msgs.hide().empty().append($('<div class="sbc-message">' + sbc.msg.dataQuerying + '</div>')).fadeIn(200);
|
||||
}
|
||||
ds.clearItems();
|
||||
sbc.ajax.dbSchema = sbc.ajax.dbSchema || { url: sbc.url.base + 'System/Ajax/ValidateDatabaseSchema', formSel: $frm.filter, callbackFn: ds.handleDbSchemaResponse, noWaitIcon: true };
|
||||
sbc.doAjaxRequest(sbc.ajax.dbSchema, delay || 50);
|
||||
ds.awaitingSchemaResponse = true;
|
||||
env.ajax.dbSchema = env.ajax.dbSchema || { url: sbc.url.base + 'System/Ajax/ValidateDatabaseSchema', formSel: env.$frm.filter, callbackFn: function (response) { rs.handleDbSchemaResponse(env, response); }, noWaitIcon: true };
|
||||
sbc.doAjaxRequest(env.ajax.dbSchema, delay || 50);
|
||||
rs.awaitingSchemaResponse = true;
|
||||
}
|
||||
ds.handleDbSchemaResponse = function (response)
|
||||
rs.handleDbSchemaResponse = function (env, response)
|
||||
{
|
||||
//sbc.debug('handleDbSchemaResponse', response);
|
||||
delete ds.awaitingSchemaResponse;
|
||||
$pnl.msgs.hide().empty();
|
||||
var $table = $pnl.table.find('table.sbc-item-list');
|
||||
ds.clearItems();
|
||||
delete rs.awaitingSchemaResponse;
|
||||
env.$pnl.msgs.hide().empty();
|
||||
var $table = env.$pnl.table.find('table.sbc-item-list');
|
||||
rs.clearItems(env);
|
||||
if (!response.success) return;
|
||||
// Menu.
|
||||
if (env.$pnl.bgr.length)
|
||||
{
|
||||
env.$pnl.mnu.empty();
|
||||
env.$pnl.mnu.append(rs.getFilterMenuOption(env, sbc.lbl.refresh, function () { rs.refreshDbSchema(env); }, 'sbc-refresh'));
|
||||
env.$pnl.mnu.append(rs.getFilterMenuOption(env, sbc.lbl.popIndices, function () { rs.populateIndices(env); }, 'sbc-process'));
|
||||
sbc.debug(env.$pnl.mnu);
|
||||
env.$pnl.bgr.toggleVisibility(!!env.$pnl.mnu.find('.sbc-dropdown-item').length);
|
||||
}
|
||||
// Items.
|
||||
var items = response.items;
|
||||
if (!items.length)
|
||||
return $pnl.msgs.append($('<div class="sbc-message">' + sbc.msg.dbSchemaValid + '</div>')).fadeIn(500);
|
||||
return env.$pnl.msgs.append($('<div class="sbc-message">' + sbc.msg.dbSchemaValid + '</div>')).fadeIn(500);
|
||||
for (const item of items)
|
||||
$table.append(ds.populateDbSchemaItem(ds.getDbSchemaRowTemplate(), item));
|
||||
$table.append(rs.populateDbSchemaItem(env, rs.getItemTemplate(env), item));
|
||||
}
|
||||
ds.getDbSchemaTableTemplate = function ()
|
||||
{
|
||||
return $pnl.tmpl.find('.sbc-panel-item-table.Schema').clone().hide();
|
||||
}
|
||||
ds.getDbSchemaRowTemplate = function ()
|
||||
{
|
||||
return $pnl.tmpl.find('.sbc-row-item.SchemaItem').clone();
|
||||
}
|
||||
ds.populateDbSchemaItem = function ($item, item)
|
||||
rs.populateDbSchemaItem = function (env, $item, item)
|
||||
{
|
||||
if (!item) return;
|
||||
$item.prop('id', sbc.itemIdPrefix + item.id);
|
||||
@@ -54,25 +55,72 @@
|
||||
$('.IndexName', $item).text(item.indexName);
|
||||
$('.ColumnName', $item).text(item.columnName);
|
||||
$('.Comment', $item).text(item.comment);
|
||||
let $bgr = $item.find('.sbc-burger').invisible();
|
||||
return $item;
|
||||
}
|
||||
ds.clearItems = function ()
|
||||
rs.clearItems = function (env)
|
||||
{
|
||||
$pnl.table.find('table.sbc-item-list').find('tbody tr').remove();
|
||||
env.$pnl.table.find('table.sbc-item-list').find('tbody tr').remove();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
rs.getFilterDropdownTemplate = function (env)
|
||||
{
|
||||
return env.$pnl.tmpl.find('.sbc-dropdown-menu.SchemaFilter li.sbc-dropdown-item').clone();
|
||||
}
|
||||
rs.getItemTemplate = function (env)
|
||||
{
|
||||
return env.$pnl.tmpl.find('.sbc-row-item.SchemaItem').clone();
|
||||
}
|
||||
rs.getItemDropdownTemplate = function (env)
|
||||
{
|
||||
return env.$pnl.tmpl.find('.sbc-dropdown-menu.SchemaItem li.sbc-dropdown-item').clone();
|
||||
}
|
||||
rs.getFilterMenuOption = function (env, lbl, fn, cls)
|
||||
{
|
||||
return rs.getMenuOption(rs.getFilterDropdownTemplate(env), lbl, fn, cls);
|
||||
}
|
||||
rs.getItemMenuOption = function (env, lbl, fn, cls)
|
||||
{
|
||||
return rs.getMenuOption(rs.getItemDropdownTemplate(env), lbl, fn, cls);
|
||||
}
|
||||
rs.getMenuOption = function ($opt, lbl, fn, cls)
|
||||
{
|
||||
return $opt.find('div.sbc-label').text(lbl).end().on('click', fn).addClass(cls);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
rs.populateIndices = function (env, delay)
|
||||
{
|
||||
env.ajax.popIndices = env.ajax.popIndices || { url: sbc.url.base + 'Instance/Repository/Ajax/PopulateIndices', formSel: env.$frm.filter, callbackFn: function (response) { rs.onPopulateIndices(env, response); }, noWaitIcon: true };
|
||||
sbc.doAjaxRequest(env.ajax.popIndices, delay || 50);
|
||||
}
|
||||
rs.onPopulateIndices = function (env, response)
|
||||
{
|
||||
//sbc.debug('onPopulateIndices', response);
|
||||
rs.refreshDbSchema(env);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
$(function ()
|
||||
{
|
||||
$pnl.items = $('.sbc-panel.Schema');
|
||||
$frm.filter = $pnl.items.find('#frmSchemaFilter');
|
||||
$frm.filter.on('change', '.FilterContext', ds.refreshDbSchema);
|
||||
$frm.filter.on('input', '.FilterSearch', ds.refreshDbSchema);
|
||||
$frm.filter.find('.FilterInstance').val('BusMgr');
|
||||
$pnl.table = $pnl.items.find('.sbc-panel-item-table');
|
||||
$pnl.msgs = $pnl.items.find('.sbc-panel-messages');
|
||||
$pnl.tmpl = $pnl.items.find('.sbc-panel-item-template');
|
||||
setTimeout(function () { ds.refreshDbSchema(); }, 500);
|
||||
let env = { data: {}, ajax: {}, $pnl: {}, $frm: {}, $ctrl: {}, $dlg: {} };
|
||||
|
||||
env.$pnl.items = $('.sbc-panel.Schema');
|
||||
env.$pnl.header = env.$pnl.items.find('.sbc-panel-header');
|
||||
env.$pnl.bgr = env.$pnl.header.find('.sbc-burger').invisible();
|
||||
env.$pnl.mnu = env.$pnl.bgr.find('ul.sbc-dropdown-menu');
|
||||
env.$frm.filter = env.$pnl.items.find('#frmSchemaFilter');
|
||||
env.$frm.filter.on('change', '.FilterContext', function () { rs.refreshDbSchema(env); });
|
||||
env.$frm.filter.on('input', '.FilterSearch', function () { rs.refreshDbSchema(env); });
|
||||
env.$frm.filter.find('.FilterInstance').val('BusMgr');
|
||||
env.$pnl.table = env.$pnl.items.find('.sbc-panel-item-table');
|
||||
env.$pnl.msgs = env.$pnl.items.find('.sbc-panel-messages');
|
||||
env.$pnl.tmpl = env.$pnl.items.find('.sbc-panel-item-template');
|
||||
|
||||
rs.env.schema = env;
|
||||
if (rs.env.schema.$pnl.table.length)
|
||||
setTimeout(function () { rs.refreshDbSchema(env); }, 500);
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user