3.0.1.8 Control repository status check on update

This commit is contained in:
Andy Howard
2025-10-26 14:51:00 +00:00
parent a841bd8b4b
commit d414910e96
47 changed files with 727 additions and 404 deletions
@@ -67,7 +67,7 @@
.sbc-panel-data .sbc-panel-filter .sbc-label
{
padding: 2px 8px 0 0;
padding: 4px 8px 0 0;
}
/* Data panel - Content */
@@ -167,8 +167,10 @@
.sbc-form .sbc-input, .sbc-form .sbc-textarea, .sbc-form .sbc-select
{
padding: 3px 8px 4px 8px;
box-sizing: border-box;
padding: 3px 8px 3px 8px;
width: 100%;
min-height: 1rem;
font-size: 1rem;
line-height: 1.25;
background-color: #fff;
@@ -232,6 +232,35 @@ a:focus
font-weight: bold;
}
/* Icons */
.sbc-icon
{
display: inline-block;
min-width: 24px;
height: 20px;
padding: 2px;
text-align: center;
background-size: contain;
background-repeat: no-repeat;
vertical-align: middle;
border: solid 1px #e0e0e0;
border-radius: 4px;
cursor: pointer;
}
.sbc-icon:active {
background-color: #d4af37;
box-shadow: inset 2px 2px 6px #aaa;
border-color: #b0b0b0;
transform: translateY(1px);
}
.sbc-icon:hover
{
border-color:#17a2b8;
}
/* Buttons */
.sbc-button-cta, .sbc-button-action
@@ -75,7 +75,7 @@
sbc.refreshControlValues(response.controlValues);
if (!response.success) return;
env.$dlg.init.dialog('close');
if (env.cfg.fnSuccess) env.cfg.fnSuccess();
if (env.cfg.fnSuccess) env.cfg.fnSuccess(response.repository);
delete env.cfg;
}
@@ -45,9 +45,11 @@
let items = response.repositories || [];
if (!items.length)
return $pnl.msgs.append($('<div class="sbc-message">' + sbc.msg.dataNoneFound + '</div>')).fadeIn(500);
for (let itemIdx = 0; itemIdx < items.length; itemIdx++)
$table.append(ir.populateItem(ir.getItemRowTemplate(), items[itemIdx]));
ir.refreshRepoInfo(items[0].id, 500);
for (const item of items)
{
$table.append(ir.populateItem(ir.getItemRowTemplate(), item));
ir.addRepoForInfo(item);
}
}
ir.populateItem = function ($item, item)
{
@@ -79,6 +81,29 @@
}
//--------------------------------------------------------------
const reposForInfo = [];
ir.addRepoForInfo = (item) =>
{
if (reposForInfo.some(repo => repo.id == item.id)) return;
ir.clearRepoInfo(item);
reposForInfo.push(item);
if (reposForInfo.length == 1) ir.refreshNextRepoInfo();
}
ir.clearRepoInfo = (item) =>
{
$pnl.table.find('#' + ir.getItemId(item)).find('.RepositoryInitialised').empty();
}
ir.resetRefreshRepoInfo = () =>
{
reposForInfo.length = 0;
sbc.cancelAjaxRequest(ir.ajax.repoInit);
}
ir.refreshNextRepoInfo = () =>
{
if (ir.ajax.repoInit?.timeout) return;
let repo = reposForInfo.shift();
if (repo?.id) ir.refreshRepoInfo(repo.id, 200);
}
ir.refreshRepoInfo = function (id, delay)
{
$frm.itemId.find('.RepositoryId').val(id);
@@ -103,13 +128,11 @@
}
else $repoInit.append($('<div>').append($('<img style="width:16px">').prop('src', '/img/icon/tick-24.png')));
$bgr.toggle(!!$('.sbc-dropdown-item', $mnu).length);
let $next = $item.next();
if ($next.length) ir.refreshRepoInfo($next.prop('id').replace(/[^0-9]/g, ''), 200);
ir.refreshNextRepoInfo();
}
ir.onInitRepo = function (id)
ir.onInitRepo = function (item)
{
//sbc.debug('onInitRepo', id);
ir.refreshResults(50);
ir.addRepoForInfo(item);
}
//--------------------------------------------------------------
@@ -237,6 +260,7 @@
$('table tbody', $pnl.table).prepend($item).show();
}
ir.populateItem($item, item);
ir.addRepoForInfo(item);
}
//--------------------------------------------------------------
@@ -136,6 +136,19 @@
var sel = $(':selected', $sel).length;
($info || $('.sbc-info', $sel.closest('.sbc-form-control'))).text(sel == 0 ? sbc.lbl.noneSelected : sbc.lbl.numberSelected.replace(/\{0\}/g, sel));
}
sbc.offsetSelectedOption = ($sel, offset) =>
{
var currentIndex = $sel.prop('selectedIndex');
var optionsCount = $sel.find('option').length;
if (optionsCount === 0) return;
var newIndex = currentIndex + offset;
if (newIndex < 0) newIndex = 0;
if (newIndex >= optionsCount) newIndex = optionsCount - 1;
if (newIndex != currentIndex)
$sel.prop('selectedIndex', newIndex).trigger('change');
}
sbc.initCalendars = function (sel, opt)
{
return $(sel).datepicker(opt || {});
@@ -148,6 +161,7 @@
$(this).datepicker('setDate', null).datepicker('hide').trigger('change');
});
}
sbc.refreshPaging = function (response, context, refreshFn)
{
if (sbc.resultsPaging.fn.refreshPaging)
@@ -341,15 +355,20 @@
//--------------------------------------------------------------
// Ajax.
sbc.doAjaxRequest = function (ajax, delay)
sbc.doAjaxRequest = (ajax, delay) =>
{
win.clearTimeout(ajax.timeout);
if (!ajax.noWaitIcon) sbc.doPleaseWait();
ajax.timeout = setTimeout(function () { sbc.execAjaxRequest(ajax); }, Math.max(50, parseInt(delay || 0, 10)));
}
sbc.execAjaxRequest = function (ajax)
sbc.cancelAjaxRequest = (ajax) =>
{
win.clearTimeout(ajax?.timeout);
}
sbc.execAjaxRequest = (ajax) =>
{
win.clearTimeout(ajax.timeout);
delete ajax.timeout;
if (ajax.request) ajax.request.abort();
var cfgAjax =
{
@@ -275,6 +275,10 @@
$ctrl.cbFolders = $frm.filter.find('#cbFilterLogFolder').on('change', function () { sl.refreshYears(250); });
$ctrl.cbYears = $frm.filter.find('#cbFilterLogYear').on('change', function () { sl.refreshMonths(250); });
$ctrl.cbMonths = $frm.filter.find('#cbFilterLogMonth').on('change', function () { sl.refreshFiles(250); });
$('.icon-year-prev').on('click', () => { sbc.offsetSelectedOption($ctrl.cbYears, -1) });
$('.icon-year-next').on('click', () => { sbc.offsetSelectedOption($ctrl.cbYears, 1) });
$('.icon-month-prev').on('click', () => { sbc.offsetSelectedOption($ctrl.cbMonths, -1) });
$('.icon-month-next').on('click', () => { sbc.offsetSelectedOption($ctrl.cbMonths, 1) });
var opt = sbc.dlgOpts();
opt.buttons[sbc.lbl.close] = function () { $(this).dialog('close'); sl.setFileData(); };