Fix Timelapse Frames counting in AddStorage++

fix-timelapse-in-addstorage
Moe 2023-01-16 18:33:43 -08:00
parent e5bd7e61ff
commit 6766a5afc6
3 changed files with 22 additions and 8 deletions

View File

@ -204,8 +204,8 @@ module.exports = (s,config,lang) => {
} }
var storageIndex = theGroup.addStorageUse[storageId] var storageIndex = theGroup.addStorageUse[storageId]
//run purge command //run purge command
const maxSize = (storageIndex.usedSpaceVideos * (theGroup.sizeLimitVideoPercent / 100) * config.cron.deleteOverMaxOffset); const maxSize = (storageIndex.sizeLimit * (theGroup.sizeLimitVideoPercent / 100) * config.cron.deleteOverMaxOffset);
if(storageIndex.usedSpace > maxSize){ if(storageIndex.usedSpaceVideos > maxSize){
s.knexQuery({ s.knexQuery({
action: "select", action: "select",
columns: "*", columns: "*",

View File

@ -911,9 +911,13 @@ function drawIndicatorBar(item){
</div> </div>
</div> </div>
<div> <div>
<div class="progress"> ${!item.multiple ? `<div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" style="width: 0%;"></div> <div class="progress-bar progress-bar-warning" role="progressbar" style="width: 0%;"></div>
</div> </div>` : `<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" style="width: 0%;"></div>
<div class="progress-bar progress-bar-danger" role="progressbar" style="width: 0%;"></div>
<div class="progress-bar progress-bar-warning" role="progressbar" style="width: 0%;"></div>
</div>`}
</div> </div>
</div> </div>
</div>` </div>`

View File

@ -91,6 +91,7 @@ function loadBoxWrappers() {
function drawAddStorageIndicators(){ function drawAddStorageIndicators(){
$.each(addStorage,function(n,storage){ $.each(addStorage,function(n,storage){
drawIndicatorBar({ drawIndicatorBar({
multiple: true,
icon: 'hdd-o', icon: 'hdd-o',
name: storage.name, name: storage.name,
label: `<span style="text-transform:capitalize">${storage.name}</span> : <span class="value"></span>`, label: `<span style="text-transform:capitalize">${storage.name}</span> : <span class="value"></span>`,
@ -199,16 +200,25 @@ onWebSocketEvent(function (d){
diskIndicatorBar[2].title = `${lang['FileBin Share']} : ${fileBinPercent}` diskIndicatorBar[2].title = `${lang['FileBin Share']} : ${fileBinPercent}`
if(d.addStorage){ if(d.addStorage){
$.each(d.addStorage,function(n,storage){ $.each(d.addStorage,function(n,storage){
var percent = parseInt((storage.usedSpace/storage.sizeLimit)*100)+'%' var diskIndicator = loadedIndicators[storage.name]
var diskIndicatorBars = diskIndicator.progressBar
var diskLimit = storage.sizeLimit
var percent = parseDiskUsePercent(storage.usedSpace,diskLimit);
var videosPercent = parseDiskUsePercent(storage.usedSpaceVideos,diskLimit);
var timelapsePercent = parseDiskUsePercent(storage.usedSpaceTimelapseFrames,diskLimit);
//
var humanValue = parseFloat(storage.usedSpace) var humanValue = parseFloat(storage.usedSpace)
if(humanValue > 1000){ if(humanValue > 1000){
humanValue = (humanValue/1000).toFixed(2)+' GB' humanValue = (humanValue/1000).toFixed(2)+' GB'
}else{ }else{
humanValue = humanValue.toFixed(2)+' MB' humanValue = humanValue.toFixed(2)+' MB'
} }
loadedIndicators[storage.name].value.html(humanValue) diskIndicator.value.html(humanValue)
loadedIndicators[storage.name].percent.html(percent) diskIndicator.percent.html(percent)
loadedIndicators[storage.name].progressBar.css('width',percent) diskIndicatorBars[0].style.width = videosPercent
diskIndicatorBars[0].title = `${lang['Video Share']} : ${videosPercent}`
diskIndicatorBars[1].style.width = timelapsePercent
diskIndicatorBars[1].title = `${lang['Timelapse Frames Share']} : ${timelapsePercent}`
}) })
} }
break; break;