mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-02-17 12:06:47 +01:00
Add Angular filesize filter for Modify Website page
modifyWebsite.html uses | filesize for home directory available_space;
filter was missing, causing $injector/unpr FilesizeFilterProvider.
Register app.filter('filesize') with array annotation in all websiteFunctions.js copies.
This commit is contained in:
@@ -10742,6 +10742,19 @@ $("#websiteSuccessfullyModified").hide();
|
||||
$("#modifyWebsiteLoading").hide();
|
||||
$("#modifyWebsiteButton").hide();
|
||||
|
||||
/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */
|
||||
app.filter('filesize', [function () {
|
||||
return function (bytes) {
|
||||
if (bytes == null || isNaN(bytes)) return '-';
|
||||
var n = Number(bytes);
|
||||
if (n === 0) return '0 B';
|
||||
var k = 1024;
|
||||
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
var i = Math.floor(Math.log(n) / Math.log(k));
|
||||
return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)];
|
||||
};
|
||||
}]);
|
||||
|
||||
app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) {
|
||||
|
||||
// Initialize home directory variables
|
||||
|
||||
@@ -10176,6 +10176,19 @@ $("#websiteSuccessfullyModified").hide();
|
||||
$("#modifyWebsiteLoading").hide();
|
||||
$("#modifyWebsiteButton").hide();
|
||||
|
||||
/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */
|
||||
app.filter('filesize', [function () {
|
||||
return function (bytes) {
|
||||
if (bytes == null || isNaN(bytes)) return '-';
|
||||
var n = Number(bytes);
|
||||
if (n === 0) return '0 B';
|
||||
var k = 1024;
|
||||
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
var i = Math.floor(Math.log(n) / Math.log(k));
|
||||
return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)];
|
||||
};
|
||||
}]);
|
||||
|
||||
app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) {
|
||||
|
||||
$scope.fetchWebsites = function () {
|
||||
|
||||
@@ -10742,6 +10742,19 @@ $("#websiteSuccessfullyModified").hide();
|
||||
$("#modifyWebsiteLoading").hide();
|
||||
$("#modifyWebsiteButton").hide();
|
||||
|
||||
/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */
|
||||
app.filter('filesize', [function () {
|
||||
return function (bytes) {
|
||||
if (bytes == null || isNaN(bytes)) return '-';
|
||||
var n = Number(bytes);
|
||||
if (n === 0) return '0 B';
|
||||
var k = 1024;
|
||||
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
var i = Math.floor(Math.log(n) / Math.log(k));
|
||||
return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)];
|
||||
};
|
||||
}]);
|
||||
|
||||
app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) {
|
||||
|
||||
$scope.fetchWebsites = function () {
|
||||
|
||||
@@ -10176,6 +10176,19 @@ $("#websiteSuccessfullyModified").hide();
|
||||
$("#modifyWebsiteLoading").hide();
|
||||
$("#modifyWebsiteButton").hide();
|
||||
|
||||
/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */
|
||||
app.filter('filesize', [function () {
|
||||
return function (bytes) {
|
||||
if (bytes == null || isNaN(bytes)) return '-';
|
||||
var n = Number(bytes);
|
||||
if (n === 0) return '0 B';
|
||||
var k = 1024;
|
||||
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
var i = Math.floor(Math.log(n) / Math.log(k));
|
||||
return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)];
|
||||
};
|
||||
}]);
|
||||
|
||||
app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) {
|
||||
|
||||
$scope.fetchWebsites = function () {
|
||||
|
||||
@@ -10742,6 +10742,19 @@ $("#websiteSuccessfullyModified").hide();
|
||||
$("#modifyWebsiteLoading").hide();
|
||||
$("#modifyWebsiteButton").hide();
|
||||
|
||||
/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */
|
||||
app.filter('filesize', [function () {
|
||||
return function (bytes) {
|
||||
if (bytes == null || isNaN(bytes)) return '-';
|
||||
var n = Number(bytes);
|
||||
if (n === 0) return '0 B';
|
||||
var k = 1024;
|
||||
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
var i = Math.floor(Math.log(n) / Math.log(k));
|
||||
return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)];
|
||||
};
|
||||
}]);
|
||||
|
||||
app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) {
|
||||
|
||||
$scope.fetchWebsites = function () {
|
||||
|
||||
Reference in New Issue
Block a user