diff --git a/apps/Core/Components/Devtools/Modules/ModulesComponent.php b/apps/Core/Components/Devtools/Modules/ModulesComponent.php
index 15a1228bf..4373ef18d 100644
--- a/apps/Core/Components/Devtools/Modules/ModulesComponent.php
+++ b/apps/Core/Components/Devtools/Modules/ModulesComponent.php
@@ -192,7 +192,7 @@ public function viewAction()
foreach ($modulesTypeArr['childs'] as $childKey => &$child) {
$child = $this->modulesPackage->validateFilesHash($child);
- if ($child['repoExists'] && !$child['isModified']) {
+ if ($child['repoExists'] && !$child['isModified'] && $child['latestRelease']) {
unset($modules[$moduleType]['childs'][$childKey]);
}
}
diff --git a/apps/Core/Packages/Devtools/Modules/DevtoolsModules.php b/apps/Core/Packages/Devtools/Modules/DevtoolsModules.php
index 024acaa05..f71fc4d5e 100644
--- a/apps/Core/Packages/Devtools/Modules/DevtoolsModules.php
+++ b/apps/Core/Packages/Devtools/Modules/DevtoolsModules.php
@@ -39,27 +39,7 @@ class DevtoolsModules extends BasePackage
public function addModule($data)
{
- if ($data['api_id'] != '0' &&
- ($data['repo'] === 'https://.../' || $data['repo'] === '')
- ) {
- $this->addResponse('Repository is not local, please provide correct module repo url.', 1);
-
- return false;
- }
-
- if (!isset($data['module_type']) ||
- (isset($data['module_type']) &&
- ($data['module_type'] === 'components' || $data['module_type'] === 'apps_types')
- )
- ) {
- $ignoreChars = [' '];
- } else {
- $ignoreChars = [''];
- }
-
- if (!checkCtype($data['name'], 'alpha', $ignoreChars)) {
- $this->addResponse('Name cannot have special chars or numbers.', 1);
-
+ if (!$this->precheck($data)) {
return false;
}
@@ -111,19 +91,8 @@ public function addModule($data)
return false;
}
- if ($data['module_type'] === 'components') {
- $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndRepoAndRoute';
- $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['repo'], $data['route']);
- } else if ($data['module_type'] === 'packages' || $data['module_type'] === 'middlewares') {
- $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndRepoAndClass';
- $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['repo'], $data['class']);
- } else if ($data['module_type'] === 'views') {
- $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndRepoAndName';
- $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['repo'], $data['name']);
- }
-
- if ($module) {
- $this->addResponse('Module already exists!', 1);
+ if ($this->searchModule($data)) {
+ $this->addResponse('Module already exists! Check name & class', 1);
return false;
}
@@ -218,27 +187,7 @@ public function addModule($data)
public function updateModule($data)
{
- if ($data['api_id'] != '0' &&
- ($data['repo'] === 'https://.../' || $data['repo'] === '')
- ) {
- $this->addResponse('Repository is not local, please provide correct module repo url.', 1);
-
- return false;
- }
-
- if (!isset($data['module_type']) ||
- (isset($data['module_type']) &&
- ($data['module_type'] === 'components' || $data['module_type'] === 'apps_types')
- )
- ) {
- $ignoreChars = [' '];
- } else {
- $ignoreChars = [''];
- }
-
- if (!checkCtype($data['name'], 'alpha', $ignoreChars)) {
- $this->addResponse('Name cannot have special chars or numbers.', 1);
-
+ if (!$this->precheck($data)) {
return false;
}
@@ -290,6 +239,14 @@ public function updateModule($data)
} else {
$module = $this->modules->{$data['module_type']}->getById($data['id']);
+ if ($searchModule = $this->searchModule($data)) {
+ if ($searchModule['id'] !== $module['id']) {
+ $this->addResponse('Module already exists! Check name & class', 1);
+
+ return false;
+ }
+ }
+
$module = array_merge($module, $data);
$viewPublic = true;
@@ -397,6 +354,83 @@ public function updateModule($data)
$this->addResponse('Error updating Module', 1);
}
+ protected function precheck($data)
+ {
+ if ($data['api_id'] != '0' &&
+ ($data['repo'] === 'https://.../' || $data['repo'] === '')
+ ) {
+ $this->addResponse('Repository is not local, please provide correct module repo url.', 1);
+
+ return false;
+ }
+
+ if (!isset($data['module_type']) ||
+ (isset($data['module_type']) &&
+ ($data['module_type'] === 'components' || $data['module_type'] === 'apps_types')
+ )
+ ) {
+ $ignoreChars = [' '];
+ } else {
+ $ignoreChars = [''];
+ }
+
+ if (!checkCtype($data['name'], 'alpha', $ignoreChars)) {
+ $this->addResponse('Name cannot have special chars or numbers.', 1);
+
+ return false;
+ }
+
+ if ($data['module_type'] === 'components') {
+ $data = $this->checkAppType($data);
+ $data = $this->checkModuleTypeAndCategory($data);
+ $data['class'] = str_replace('Apps\\' . ucfirst($data['app_type']) . '\\' . ucfirst($data['module_type']) . '\\', '', $data['class']);
+ $data['class'] = str_replace('Component', '', $data['class']);
+ $classArr = explode('\\', $data['class']);
+ array_pop($classArr);
+
+ $routeArr = explode('/', trim($data['route'], '/'));
+ array_walk($routeArr, function(&$route) {
+ $route = ucfirst($route);
+ });
+
+ $compare = array_diff($classArr, $routeArr);
+
+ if (count($compare) > 0) {
+ $this->addResponse('Route and class do not match!', 1);
+
+ return false;
+ }
+ } else if ($data['module_type'] === 'packages' || $data['module_type'] === 'middlewares') {
+ $classArr = explode('\\', $data['class']);
+
+ if (strtolower($this->helper->last($classArr)) !== strtolower($data['name'])) {
+ $this->addResponse('Name and class do not match!', 1);
+
+ return false;
+ }
+ } else if ($data['module_type'] === 'views') {
+ //
+ }
+
+ return true;
+ }
+
+ protected function searchModule($data)
+ {
+ if ($data['module_type'] === 'components') {
+ $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndRoute';
+ $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['route']);
+ } else if ($data['module_type'] === 'packages' || $data['module_type'] === 'middlewares') {
+ $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndClass';
+ $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['class']);
+ } else if ($data['module_type'] === 'views') {
+ $moduleMethod = 'get' . ucfirst(substr($data['module_type'], 0, -1)) . 'ByAppTypeAndName';
+ $module = $this->modules->{$data['module_type']}->{$moduleMethod}($data['app_type'], $data['name']);
+ }
+
+ return $module;
+ }
+
public function removeModule($data)
{
try {
@@ -524,48 +558,55 @@ public function reCalculateFilesHash($module, $remove = false, $viaGenerateRelea
$filesHash['module_id'] = $module['id'];
}
- $moduleLocation = $this->getModuleFilesLocation($module);
-
- $moduleLocationFiles = $this->basepackages->utils->scanDir($moduleLocation, true, ['.git/', '.fileHashes']);
-
- //In case you have .gitignore file, it can get complicated to sort which files to hash.
- //So, the files you want to hash, just add them in .fileHashes in the same folder as .gitignore
- //The file should have a list of all files to hash (1 filename per line)
- //Example:
- //.gitignore
- // README.md
- // view.html
- // view.json
- $filesToHash = [];
- if ($this->localContent->fileExists($moduleLocation . '.fileHashes')) {
- $filesToHash = $this->localContent->read($moduleLocation . '.fileHashes');
+ $moduleLocationFiles['files'] = [];
- if ($filesToHash && $filesToHash !== '') {
- $filesToHash = str_replace("'", '', $filesToHash);
- $filesToHash = explode(PHP_EOL, $filesToHash);
- }
+ if ($module['module_type'] === 'views' && $module['is_subview'] == false) {
+ $moduleLocations = [$this->getModuleFilesLocation($module), $this->getModuleFilesLocation($module, true)];
+ } else {
+ $moduleLocations = [$this->getModuleFilesLocation($module)];
}
- if ($module['module_type'] === 'views' && $module['is_subview'] == false) {
- $moduleLocation = $this->getModuleFilesLocation($module, true);
+ foreach ($moduleLocations as $moduleLocation) {
+ if ($this->localContent->fileExists($moduleLocation . '.fileHashes')) {
+ $filesToHash = $this->localContent->read($moduleLocation . '.fileHashes');
- $viewFiles = $this->basepackages->utils->scanDir($moduleLocation, true, ['.git/', '.fileHashes']);
+ if ($filesToHash && $filesToHash !== '') {
+ $filesToHash = str_replace("'", '', $filesToHash);
+ $filesToHash = explode(PHP_EOL, $filesToHash);
- if ($viewFiles && count($viewFiles['files']) > 0) {
- $moduleLocationFiles['files'] = array_merge($moduleLocationFiles['files'], $viewFiles['files']);
- }
+ if (count($filesToHash) > 0) {
+ $hashFiles = [];
- if ($this->localContent->fileExists($moduleLocation . '.fileHashes')) {
- $viewFilesToHash = $this->localContent->read($moduleLocation . '.fileHashes');
+ foreach ($filesToHash as $fileToHash) {
+ if (str_ends_with($fileToHash, '/')) {
+ $fileToHashDirList = $this->basepackages->utils->scanDir($moduleLocation . $fileToHash, true);
- if ($viewFilesToHash && $viewFilesToHash !== '') {
- $viewFilesToHash = str_replace("'", '', $viewFilesToHash);
- $viewFilesToHash = explode(PHP_EOL, $viewFilesToHash);
+ if ($fileToHashDirList && count($fileToHashDirList['files']) > 0) {
+ $hashFiles = array_merge($hashFiles, $fileToHashDirList['files']);
+ }
+ } else {
+ array_push($hashFiles, $moduleLocation . $fileToHash);
+ }
+ }
- if (count($viewFilesToHash) > 0) {
- $filesToHash = array_merge($filesToHash, $viewFilesToHash);
+ if (count($hashFiles) > 0) {
+ $moduleLocationFiles['files'] = array_merge($moduleLocationFiles['files'], $hashFiles);
+ }
}
}
+ } else {
+ $files = $this->basepackages->utils->scanDir(
+ $moduleLocation,
+ true,
+ [
+ '.git/',
+ 'linter-backup/'
+ ]
+ );
+
+ if ($files && count($files['files']) > 0) {
+ $moduleLocationFiles['files'] = array_merge($moduleLocationFiles['files'], $files['files']);
+ }
}
}
@@ -577,12 +618,6 @@ public function reCalculateFilesHash($module, $remove = false, $viaGenerateRelea
$file = str_replace($moduleLocation, '', $file);
- if (count($filesToHash) > 0) {
- if (!in_array($file, $filesToHash)) {
- continue;
- }
- }
-
$hash = hash_file('md5', base_path($filePath));
$filesHash['files_hash'][$file] = $hash;
@@ -605,18 +640,30 @@ public function validateFilesHash($module)
$moduleLocation = $this->getNewFilesLocation($module);
$module['repoExists'] = false;
+ $module['latestRelease'] = false;
if ($this->localContent->directoryExists($moduleLocation . '.git')) {
- $module['repoExists'] = true;
-
- if (!isset($module['repo_details'])) {
- $this->modules->manager->getModuleInfo(
+ if ((!isset($module['repo_details']) ||
+ !isset($module['repo_details']['latestRelease'])) ||
+ (isset($module['repo_details']['latestRelease']['name']) &&
+ $module['repo_details']['latestRelease']['name'] !== $module['version'])
+ ) {
+ $module = $this->modules->manager->getModuleInfo(
[
- 'module_type' => $module['module_type'],
- 'module_id' => $module['id'],
- 'sync' => true
+ 'module_type' => $module['module_type'],
+ 'module_id' => $module['id'],
+ 'sync' => true,
+ 'getLatestRelease' => true
]
);
}
+
+ $module['repoExists'] = true;
+
+ if (isset($module['repo_details']['latestRelease']['name'])) {
+ $module['latestRelease'] = $module['repo_details']['latestRelease']['name'];
+ } else {
+ $module['latestRelease'] = false;
+ }
}
$filesHash = $this->getFilesHash($module);
@@ -628,61 +675,64 @@ public function validateFilesHash($module)
return $module;
}
- $moduleFiles = $this->basepackages->utils->scanDir($moduleLocation, true, ['.git/', '.fileHashes']);
+ $moduleLocationFiles['files'] = [];
- //In case you have .gitignore file, it can get complicated to sort which files to hash.
- //So, the files you want to hash, just add them in .fileHashes in the same folder as .gitignore
- //The file should have a list of all files to hash (1 filename per line)
- //Example:
- //.gitignore
- // README.md
- // view.html
- // view.json
- $filesToHash = [];
- if ($this->localContent->fileExists($moduleLocation . '.fileHashes')) {
- $filesToHash = $this->localContent->read($moduleLocation . '.fileHashes');
-
- if ($filesToHash && $filesToHash !== '') {
- $filesToHash = str_replace("'", '', $filesToHash);
- $filesToHash = explode(PHP_EOL, $filesToHash);
- }
+ if ($module['module_type'] === 'views' && $module['is_subview'] == false) {
+ $moduleLocations = [$this->getModuleFilesLocation($module), $this->getModuleFilesLocation($module, true)];
+ } else {
+ $moduleLocations = [$this->getModuleFilesLocation($module)];
}
- if ($module['module_type'] === 'views' && $module['is_subview'] == false) {
- $moduleLocation = $this->getModuleFilesLocation($module, true);
+ foreach ($moduleLocations as $moduleLocation) {
+ if ($this->localContent->fileExists($moduleLocation . '.fileHashes')) {
+ $filesToHash = $this->localContent->read($moduleLocation . '.fileHashes');
- $viewFiles = $this->basepackages->utils->scanDir($moduleLocation, true, ['.git/', '.fileHashes']);
+ if ($filesToHash && $filesToHash !== '') {
+ $filesToHash = str_replace("'", '', $filesToHash);
+ $filesToHash = explode(PHP_EOL, $filesToHash);
- if ($viewFiles && count($viewFiles['files']) > 0) {
- $moduleFiles['files'] = array_merge($moduleFiles['files'], $viewFiles['files']);
- }
+ if (count($filesToHash) > 0) {
+ $hashFiles = [];
- if ($this->localContent->fileExists($moduleLocation . '.fileHashes')) {
- $viewFilesToHash = $this->localContent->read($moduleLocation . '.fileHashes');
+ foreach ($filesToHash as $fileToHash) {
+ if (str_ends_with($fileToHash, '/')) {
+ $fileToHashDirList = $this->basepackages->utils->scanDir($moduleLocation . $fileToHash, true);
- if ($viewFilesToHash && $viewFilesToHash !== '') {
- $viewFilesToHash = str_replace("'", '', $viewFilesToHash);
- $viewFilesToHash = explode(PHP_EOL, $viewFilesToHash);
+ if ($fileToHashDirList && count($fileToHashDirList['files']) > 0) {
+ $hashFiles = array_merge($hashFiles, $fileToHashDirList['files']);
+ }
+ } else {
+ array_push($hashFiles, $moduleLocation . $fileToHash);
+ }
+ }
- if (count($viewFilesToHash) > 0) {
- $filesToHash = array_merge($filesToHash, $viewFilesToHash);
+ if (count($hashFiles) > 0) {
+ $moduleLocationFiles['files'] = array_merge($moduleLocationFiles['files'], $hashFiles);
+ }
}
}
+ } else {
+ $files = $this->basepackages->utils->scanDir(
+ $moduleLocation,
+ true,
+ [
+ '.git/',
+ 'linter-backup/'
+ ]
+ );
+
+ if ($files && count($files['files']) > 0) {
+ $moduleLocationFiles['files'] = array_merge($moduleLocationFiles['files'], $files['files']);
+ }
}
}
- if ($moduleFiles && count($moduleFiles['files']) > 0) {
- foreach ($moduleFiles['files'] as $file) {
+ if ($moduleLocationFiles && count($moduleLocationFiles['files']) > 0) {
+ foreach ($moduleLocationFiles['files'] as $file) {
$filePath = $file;
$file = str_replace($moduleLocation, '', $file);
- if (count($filesToHash) > 0) {
- if (!in_array($file, $filesToHash)) {
- continue;
- }
- }
-
$hash = hash_file('md5', base_path($filePath));
if (!isset($filesHash['files_hash'][$file]) ||
@@ -691,7 +741,7 @@ public function validateFilesHash($module)
) {
$module['isModified'] = true;
- return $module;
+ break;
}
}
}
@@ -927,35 +977,6 @@ protected function checkAppType($data)
}
$data['app_type'] = $data['app_type']['data'][0];
- } else if (isset($data['app_type']['newTags'][0])) {
- if (!checkCtype($data['app_type']['newTags'][0], 'alpha', [''])) {
- $this->addResponse('AppType cannot have special chars or numbers.', 1);
-
- return false;
- }
-
- $appType = $this->apps->types->getFirst('app_type', strtolower($data['app_type']['newTags'][0]));
-
- if (!$appType) {
- $appType =
- [
- 'name' => $data['app_type']['newTags'][0],
- 'app_type' => strtolower($data['app_type']['newTags'][0]),
- 'dashboards' => $data['dashboards'],
- 'description' => 'Added via devtools module add.',
- 'version' => $data['version'],
- 'api_id' => $data['api_id'],
- 'repo' => $data['repo'],
- 'updated_by' => '0',
- 'installed' => $data['installed']
- ];
-
- $this->apps->types->add($appType);
-
- $this->addUpdateAppTypeFiles($appType);
- }
-
- $data['app_type'] = strtolower($data['app_type']['newTags'][0]);
}
} else if (isset($data['app_type']) &&
!isset($data['module_type'])
@@ -3499,6 +3520,7 @@ public function generateModuleRepoUrl($data)
$this->validation->init()->add('api_id', PresenceOf::class, ["message" => "Please provide api id."]);
$this->validation->add('app_type', PresenceOf::class, ["message" => "Please provide app type."]);
$this->validation->add('module_type', PresenceOf::class, ["message" => "Please provide module type."]);
+ $this->validation->add('category', PresenceOf::class, ["message" => "Please provide module category."]);
if (!$this->validateData($data)) {
return false;
@@ -3809,7 +3831,17 @@ public function getRemoteModules($id)
}
try {
- $modulesArr = $this->apiClient->useMethod($collection, $method, $args)->getResponse(true);
+ $page = 1;
+ $getRemoteModules = [];
+ $modulesArr = [];
+ while ($getRemoteModules !== false) {
+ $args['page'] = $page;
+ $getRemoteModules = $this->apiClient->useMethod($collection, $method, $args)->getResponse(true);
+ if ($getRemoteModules) {
+ $modulesArr = array_merge($modulesArr, $getRemoteModules);
+ }
+ $page++;
+ }
} catch (\throwable | ClientException $e) {
$this->addResponse($e->getMessage(), 1);
diff --git a/apps/Core/Views/Default/html/devtools/modules/changes/view.html b/apps/Core/Views/Default/html/devtools/modules/changes/view.html
index 11f70edb4..59c89dddb 100644
--- a/apps/Core/Views/Default/html/devtools/modules/changes/view.html
+++ b/apps/Core/Views/Default/html/devtools/modules/changes/view.html
@@ -1,4 +1,4 @@
-
+
{% set changesHtml = '' %}
{% if modules|length > 0 %}
{% for moduleType, modulesArr in modules %}
@@ -11,8 +11,14 @@
''
%}
{% set moduleUrl = '-' %}
- {% if moduleArr['repoExists'] != false and moduleArr['repo_details']['details']['html_url'] is defined %}
- {% set moduleUrl = '' ~ moduleArr['repo_details']['details']['html_url'] %}
+ {% set moduleVersion = '-' %}
+ {% if moduleArr['repoExists'] != false %}
+ {% if moduleArr['repo_details']['details']['html_url'] is defined %}
+ {% set moduleUrl = '' ~ moduleArr['repo_details']['details']['html_url'] %}
+ {% endif %}
+ {% if moduleArr['repo_details']['latestRelease'] is defined %}
+ {% set moduleVersion = moduleArr['repo_details']['latestRelease']['name'] %}
+ {% endif %}
{% endif %}
{% set moduleModified = '-' %}
{% if moduleArr['isModified'] != false %}
@@ -22,6 +28,7 @@
'
' ~ moduleArr['name'] ~ ' | ' ~
' ' ~ moduleArr['module_type'] ~ ' | ' ~
' ' ~ moduleUrl ~ ' | ' ~
+ ' ' ~ moduleVersion ~ ' | ' ~
' ' ~ moduleModified ~ ' | ' ~
' ' ~ moduleEdit ~ ' | ' ~
' ' %}
@@ -61,6 +68,7 @@
Name |
Module Type |
Repository |
+ Latest Version |
Modified |
Edit |
@@ -111,6 +119,7 @@
null,
null,
null,
+ null,
{ orderable: false }
],
lengthMenu: [
@@ -199,3 +208,4 @@
dataCollectionSectionForm['funcs']['init']();
});
+
\ No newline at end of file
diff --git a/apps/Core/Views/Default/html/devtools/modules/module.html b/apps/Core/Views/Default/html/devtools/modules/module.html
index 44de2b47b..542fcbbac 100644
--- a/apps/Core/Views/Default/html/devtools/modules/module.html
+++ b/apps/Core/Views/Default/html/devtools/modules/module.html
@@ -1542,7 +1542,7 @@
'{{componentId}}-{{sectionId}}-id' : { },
'{{componentId}}-{{sectionId}}-type' : { },
'{{componentId}}-{{sectionId}}-app_type' : {
- 'placeholder' : 'SELECT APP TYPE OR CREATE NEW'
+ 'placeholder' : 'SELECT APP TYPE'
},
'{{componentId}}-{{sectionId}}-module_type' : {
'placeholder' : 'SELECT MODULE TYPE'
diff --git a/apps/Core/Views/Default/html/devtools/modules/module/info.html b/apps/Core/Views/Default/html/devtools/modules/module/info.html
index bde5b1ffc..a9ea4757e 100644
--- a/apps/Core/Views/Default/html/devtools/modules/module/info.html
+++ b/apps/Core/Views/Default/html/devtools/modules/module/info.html
@@ -159,7 +159,6 @@
'fieldBazPostOnCreate' : true,
'fieldBazPostOnUpdate' : true,
'fieldBazScan' : true,
- 'fieldDataSelect2Create' : true,
'fieldDataSelect2OptionsArray' : true,
'fieldDataSelect2Options' : appTypes,
'fieldDataSelect2OptionsKey' : 'id',
diff --git a/apps/Core/Views/Default/html/modules/queue/analyse.html b/apps/Core/Views/Default/html/modules/queue/analyse.html
index 1546467df..d82d44a83 100644
--- a/apps/Core/Views/Default/html/modules/queue/analyse.html
+++ b/apps/Core/Views/Default/html/modules/queue/analyse.html
@@ -250,7 +250,7 @@
dataCollectionSectionForm['vars']['queue'] = JSON.parse('{{queue}}');
dataCollectionSectionForm['funcs'] = { };
dataCollectionSectionForm['funcs']['init'] = function() {
- BazProgress.buildProgressBar($('#installer-progress'), false, true, true);
+ BazProgress.buildProgressBar($('#installer-progress'), false, true, true, false);
if ($.fn.DataTable && !$.fn.DataTable.isDataTable('#{{componentId}}-{{sectionId}}-queue-table')) {
$('#{{componentId}}-{{sectionId}}-queue-table').DataTable({
diff --git a/public/core/default/js/footer/core/Baz/BazContentSectionWithListing.js b/public/core/default/js/footer/core/Baz/BazContentSectionWithListing.js
index 2ede05e53..bead534ca 100644
--- a/public/core/default/js/footer/core/Baz/BazContentSectionWithListing.js
+++ b/public/core/default/js/footer/core/Baz/BazContentSectionWithListing.js
@@ -1266,10 +1266,11 @@
// Control Column
if (datatableOptions.rowControls) {
listColumns[thisOptions.listOptions.tableName].push({
- data : '__control',
- title : 'ACTIONS',
- orderable : false,
- className : classes
+ data : '__control',
+ title : 'ACTIONS',
+ orderable : false,
+ className : classes,
+ responsivePriority : -1
});
}
diff --git a/public/core/default/js/footer/core/Baz/BazHelpers.js b/public/core/default/js/footer/core/Baz/BazHelpers.js
index 5174effa9..0622f37e1 100644
--- a/public/core/default/js/footer/core/Baz/BazHelpers.js
+++ b/public/core/default/js/footer/core/Baz/BazHelpers.js
@@ -108,7 +108,37 @@ var BazHelpers = function() {
output += bazCreateHtmlList(obj[k]);
output += '';
} else {
- output += '' + k + ' : ' + obj[k] + '';
+ if (typeof obj[k] === 'string') {
+ if (obj[k].startsWith('{')) {
+ var regex = /{.*}/g;
+
+ var found = obj[k].match(regex);
+
+ if (found) {
+ //eslint-disable-next-line
+ var data = found[0].replaceAll('\"', '"');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\', '\\\\\\\\');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\\\\\u0022', '"');
+ var objObject = JSON.parse(data);
+
+ if (objObject) {
+ output += '' + k + ' : ';
+ output += bazCreateHtmlList(objObject);
+ output += '';
+ } else {
+ output += '' + k + ' : ' + obj[k] + '';
+ }
+ } else {
+ output += '' + k + ' : ' + obj[k] + '';
+ }
+ } else {
+ output += '' + k + ' : ' + obj[k] + '';
+ }
+ } else {
+ output += '' + k + ' : ' + obj[k] + '';
+ }
}
});
output += '';
diff --git a/public/core/default/js/footer/core/Baz/BazProgress.js b/public/core/default/js/footer/core/Baz/BazProgress.js
index 0aefea7e0..646a13da1 100644
--- a/public/core/default/js/footer/core/Baz/BazProgress.js
+++ b/public/core/default/js/footer/core/Baz/BazProgress.js
@@ -18,7 +18,7 @@ var BazProgress = function() {
var initialized = false;
var progressCounter = 0;
var online = false;
- var element, manualShowHide, hasChild, hasSubProcess, hasCancelButton;
+ var element, manualShowHide, hasChild, hasSubProcess, hasCancelButton, hasDetails;
var callableFunc = null;
var url
var postData = { };
@@ -68,12 +68,13 @@ var BazProgress = function() {
console.log('Progress service offline');
}
- function buildProgressBar(el, mSH = false, hC = false, hSP = false, hCB = true) {
+ function buildProgressBar(el, mSH = false, hC = false, hSP = false, hCB = true, hD = true) {
element = el;
manualShowHide = mSH;
hasChild = hC;
hasSubProcess = hSP;
hasCancelButton = hCB;
+ hasDetails = hD;
$(element).html(
'' +
@@ -115,17 +116,37 @@ var BazProgress = function() {
);
}
+ var buttons = '
';
+
if (hasCancelButton) {
- $(element).append(
- '
' +
- '' +
- '
'
- );
+ buttons +=
+ '
' +
+ '
' +
+ '' +
+ '
' +
+ '
';
+ }
+
+ if (hasDetails) {
+ buttons +=
+ '
' +
+ '
' +
+ '' +
+ '
' +
+ '
';
+ }
- $('#' + $(element)[0].id + '-cancel').off();
- $('#' + $(element)[0].id + '-cancel').click(function() {
+ buttons += '
';
+
+ $(element).append(buttons);
+
+ if (hasCancelButton) {
+ $('#' + $(element)[0].id + '-cancel-button').off();
+ $('#' + $(element)[0].id + '-cancel-button').click(function() {
if (pid > 0) {
Swal.fire({
title : '
Cancel current process?',
@@ -165,6 +186,8 @@ var BazProgress = function() {
'title' : response.responseMessage
});
+ $('body').trigger('bazProgressCancelled');
+
resetProgressCounter();
} else {
paginatedPNotify('error', {
@@ -177,6 +200,32 @@ var BazProgress = function() {
}
});
}
+
+ if (hasDetails) {
+ $('#' + $(element)[0].id + '-details-button').off();
+ $('#' + $(element)[0].id + '-details-button').click(function() {
+ var text = $('#' + $(element)[0].id + '-details-button').text().toLowerCase();
+
+ if (text === 'show details') {
+ $('#' + $(element)[0].id + '-details-button').text('Hide details');
+ $('#details-div').attr('hidden', false);
+ } else if (text === 'hide details') {
+ $('#' + $(element)[0].id + '-details-button').text('Show details');
+ $('#details-div').attr('hidden', true);
+ }
+ });
+
+ $(element).append(
+ '
'
+ );
+ }
}
function getProgress(options) {
@@ -185,6 +234,7 @@ var BazProgress = function() {
if (callableFunc && callableFunc['beforeStart']) {
if (callableFunc['beforeStart']() === false) {
resetProgressCounter();
+
return;
}
}
@@ -217,6 +267,7 @@ var BazProgress = function() {
if (callableFunc && callableFunc['beforeProcess']) {
if (callableFunc['beforeProcess'](response) === false) {
resetProgressCounter();
+
return;
}
}
@@ -235,6 +286,8 @@ var BazProgress = function() {
if (responseData['pid']) {
$('#' + $(element)[0].id + '-cancel').attr('hidden', false);
pid = responseData['pid'];
+
+ $('#details-data').html('PID running : Progress is running with process ID: ' + pid + '
');
}
if (responseData['progressFile']) {
@@ -242,13 +295,57 @@ var BazProgress = function() {
}
if (responseData['preCheckComplete'] == false ||
- (responseData['callResult'] && responseData['callResult'] === 'reset')
+ (responseData['callResult'] && responseData['callResult'] === 'reset') ||
+ (responseData['callResult'] && responseData['callResult'] === 'pid_running')
) {
- resetProgressCounter();
+ if (responseData['errors']) {
+ $('#details-div').attr('hidden', false);
+ var html = responseData['errors'];
+ var regex = /{.*}/g;
+ var found = html.match(regex);
+
+ if (found) {
+ //eslint-disable-next-line
+ var data = found[0].replaceAll('\"', '"');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\', '\\\\\\\\');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\\\\\u0022', '"');
+ var obj = JSON.parse(data);
+
+ if (obj) {
+ $('#details-data').html(
+ '
' +
+ BazHelpers.createHtmlList({'obj': obj}));
+ '
'
+ }
+ } else {
+ $('#details-data').html(html);
+ }
+
+ $('#details-data').scrollTop($('#details-data')[0].scrollHeight);
+ }
+
+ if (responseData['callResult'] === 'pid_running') {
+ $('#' + $(element)[0].id).attr('hidden', false);
+ $('#' + $(element)[0].id + '-cancel').attr('hidden', false);
+ $('#' + $(element)[0].id + '-cancel-button').text('Cancel Process: ' + responseData['pid']);
+ }
+
+ if (responseData['callResult'] && responseData['callResult'] === 'reset') {
+ if (!responseData['errors']) {
+ resetProgressCounter();
+ }
+ }
return false;
}
+ if (responseData['details']) {
+ var pidHtml = $('#details-data').html();
+ $('#details-data').html(pidHtml + BazHelpers.createHtmlList({'obj': responseData['details']}));
+ }
+
if (responseData['total'] !== 'undefined' && responseData['completed'] !== 'undefined') {
if (responseData['total'] !== responseData['completed']) {
if (responseData['runners'] && responseData['runners']['running'] !== false) {
@@ -446,12 +543,16 @@ var BazProgress = function() {
responseData['runners']['running']['remoteWebCounters']['downloadTotal'] > 0
) {
isDownload = true;
+ isUpload = false;
+ isSteps = false;
downloadTotal = responseData['runners']['running']['remoteWebCounters']['downloadTotal'];
downloadedBytes = responseData['runners']['running']['remoteWebCounters']['downloadedBytes'];
} else if (responseData['runners']['running']['remoteWebCounters']['uploadTotal'] &&
responseData['runners']['running']['remoteWebCounters']['uploadTotal'] > 0
) {
isUpload = true;
+ isDownload = false;
+ isSteps = false;
uploadTotal = responseData['runners']['running']['remoteWebCounters']['uploadTotal'];
uploadedBytes = responseData['runners']['running']['remoteWebCounters']['uploadedBytes'];
}
@@ -460,6 +561,8 @@ var BazProgress = function() {
responseData['runners']['running']['stepsCounters']['stepsTotal'] > 0
) {
isSteps = true;
+ isDownload = false;
+ isUpload = false;
stepsTotal = responseData['runners']['running']['stepsCounters']['stepsTotal'];
stepsCurrent = responseData['runners']['running']['stepsCounters']['stepsCurrent'];
}
@@ -478,7 +581,7 @@ var BazProgress = function() {
return text;
}
- function resetProgressCounter() {
+ function resetProgressCounter(hideDiv = true) {
if (progressCounter !== 60) {
progressCounter ++;
@@ -490,10 +593,14 @@ var BazProgress = function() {
}
}
- $('#' + $(element)[0].id).attr('hidden', true);
+ if (hideDiv) {
+ $('#' + $(element)[0].id).attr('hidden', true);
+ $('#details-div').attr('hidden', true);
+ }
$('.' + $(element)[0].id + '-bar').css('width', '0%');
$('.' + $(element)[0].id + '-bar').attr('aria-valuenow', 0);
switchProgressBarColor('.' + $(element)[0].id + '-bar', 'info');
+ $('#' + $(element)[0].id + '-cancel-button').text('Cancel');
downloadTotal = 0;
downloadedBytes = 0;
uploadTotal = 0;
@@ -543,8 +650,8 @@ var BazProgress = function() {
getProgress(options);
}
}
- BazProgress.buildProgressBar = function(el, mSH = false, child = false, hasSubProcess = false, hasCancelButton = true) {
- buildProgressBar(el, mSH, child, hasSubProcess, hasCancelButton);
+ BazProgress.buildProgressBar = function(el, mSH = false, child = false, hasSubProcess = false, hasCancelButton = true, hasDetails = true) {
+ buildProgressBar(el, mSH, child, hasSubProcess, hasCancelButton, hasDetails);
}
BazProgress.switchProgressBarColor = function(el, color) {
switchProgressBarColor(el, color);
diff --git a/public/core/default/js/footer/core/Baz/BazTunnels.js b/public/core/default/js/footer/core/Baz/BazTunnels.js
index 673ccb537..c0a66edbd 100644
--- a/public/core/default/js/footer/core/Baz/BazTunnels.js
+++ b/public/core/default/js/footer/core/Baz/BazTunnels.js
@@ -1,5 +1,5 @@
/* exported BazTunnels */
-/* globals BazNotifications BazMessenger BazAnnouncements BazProgress ab BazHelpers */
+/* globals BazNotifications BazMessenger BazProgress ab BazHelpers */
/*
* @title : BazTunnels
* @description : Baz Tunnels Lib for wstunnels
@@ -104,17 +104,17 @@ var BazTunnels = function() {
});
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- dataCollection.env.wsTunnels.pusher.subscribe('messengerNotifications', function(topic, data) {
- BazMessenger.onMessage(data);
- });
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // dataCollection.env.wsTunnels.pusher.subscribe('messengerNotifications', function(topic, data) {
+ // BazMessenger.onMessage(data);
+ // });
+ // }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- dataCollection.env.wsTunnels.pusher.subscribe('systemAnnouncements', function(topic, data) {
- BazAnnouncements.onMessage('systemAnnouncements', data);
- });
- }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // dataCollection.env.wsTunnels.pusher.subscribe('systemAnnouncements', function(topic, data) {
+ // BazAnnouncements.onMessage('systemAnnouncements', data);
+ // });
+ // }
if (tunnelsToInit.includes('progress')) {
dataCollection.env.wsTunnels.pusher.subscribe('progress', function(topic, data) {
@@ -128,12 +128,12 @@ var BazTunnels = function() {
if (tunnelsToInit.includes('systemNotifications')) {
BazNotifications.serviceOnline();
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- BazMessenger.serviceOnline();
- }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- BazAnnouncements.serviceOnline();
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // BazMessenger.serviceOnline();
+ // }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // BazAnnouncements.serviceOnline();
+ // }
if (tunnelsToInit.includes('progress')) {
BazProgress.serviceOnline();
}
@@ -141,12 +141,12 @@ var BazTunnels = function() {
if (tunnelsToInit.includes('systemNotifications')) {
BazNotifications.init();
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- BazMessenger.init();
- }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- BazAnnouncements.init();
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // BazMessenger.init();
+ // }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // BazAnnouncements.init();
+ // }
if (tunnelsToInit.includes('progress')) {
BazProgress.init();
}
@@ -164,12 +164,12 @@ var BazTunnels = function() {
if (tunnelsToInit.includes('systemNotifications')) {
BazNotifications.serviceOffline();
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- BazMessenger.serviceOffline();
- }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- BazAnnouncements.serviceOffline();
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // BazMessenger.serviceOffline();
+ // }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // BazAnnouncements.serviceOffline();
+ // }
if (tunnelsToInit.includes('progress')) {
BazProgress.serviceOffline();
}
diff --git a/public/core/default/js/footer/jsFooterCore.js b/public/core/default/js/footer/jsFooterCore.js
index 6ad89299b..67a732a4b 100644
--- a/public/core/default/js/footer/jsFooterCore.js
+++ b/public/core/default/js/footer/jsFooterCore.js
@@ -3072,7 +3072,37 @@ var BazHelpers = function() {
output += bazCreateHtmlList(obj[k]);
output += '';
} else {
- output += '
' + k + ' : ' + obj[k] + '';
+ if (typeof obj[k] === 'string') {
+ if (obj[k].startsWith('{')) {
+ var regex = /{.*}/g;
+
+ var found = obj[k].match(regex);
+
+ if (found) {
+ //eslint-disable-next-line
+ var data = found[0].replaceAll('\"', '"');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\', '\\\\\\\\');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\\\\\u0022', '"');
+ var objObject = JSON.parse(data);
+
+ if (objObject) {
+ output += '
' + k + ' : ';
+ output += bazCreateHtmlList(objObject);
+ output += '';
+ } else {
+ output += '
' + k + ' : ' + obj[k] + '';
+ }
+ } else {
+ output += '
' + k + ' : ' + obj[k] + '';
+ }
+ } else {
+ output += '
' + k + ' : ' + obj[k] + '';
+ }
+ } else {
+ output += '
' + k + ' : ' + obj[k] + '';
+ }
}
});
output += '';
@@ -6821,10 +6851,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
// Control Column
if (datatableOptions.rowControls) {
listColumns[thisOptions.listOptions.tableName].push({
- data : '__control',
- title : 'ACTIONS',
- orderable : false,
- className : classes
+ data : '__control',
+ title : 'ACTIONS',
+ orderable : false,
+ className : classes,
+ responsivePriority : -1
});
}
@@ -10073,7 +10104,7 @@ var BazContentFieldsValidator = function() {
return bazContentFieldsValidatorConstructor;
}();
/* exported BazTunnels */
-/* globals BazNotifications BazMessenger BazAnnouncements BazProgress ab BazHelpers */
+/* globals BazNotifications BazMessenger BazProgress ab BazHelpers */
/*
* @title : BazTunnels
* @description : Baz Tunnels Lib for wstunnels
@@ -10178,17 +10209,17 @@ var BazTunnels = function() {
});
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- dataCollection.env.wsTunnels.pusher.subscribe('messengerNotifications', function(topic, data) {
- BazMessenger.onMessage(data);
- });
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // dataCollection.env.wsTunnels.pusher.subscribe('messengerNotifications', function(topic, data) {
+ // BazMessenger.onMessage(data);
+ // });
+ // }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- dataCollection.env.wsTunnels.pusher.subscribe('systemAnnouncements', function(topic, data) {
- BazAnnouncements.onMessage('systemAnnouncements', data);
- });
- }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // dataCollection.env.wsTunnels.pusher.subscribe('systemAnnouncements', function(topic, data) {
+ // BazAnnouncements.onMessage('systemAnnouncements', data);
+ // });
+ // }
if (tunnelsToInit.includes('progress')) {
dataCollection.env.wsTunnels.pusher.subscribe('progress', function(topic, data) {
@@ -10202,12 +10233,12 @@ var BazTunnels = function() {
if (tunnelsToInit.includes('systemNotifications')) {
BazNotifications.serviceOnline();
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- BazMessenger.serviceOnline();
- }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- BazAnnouncements.serviceOnline();
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // BazMessenger.serviceOnline();
+ // }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // BazAnnouncements.serviceOnline();
+ // }
if (tunnelsToInit.includes('progress')) {
BazProgress.serviceOnline();
}
@@ -10215,12 +10246,12 @@ var BazTunnels = function() {
if (tunnelsToInit.includes('systemNotifications')) {
BazNotifications.init();
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- BazMessenger.init();
- }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- BazAnnouncements.init();
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // BazMessenger.init();
+ // }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // BazAnnouncements.init();
+ // }
if (tunnelsToInit.includes('progress')) {
BazProgress.init();
}
@@ -10238,12 +10269,12 @@ var BazTunnels = function() {
if (tunnelsToInit.includes('systemNotifications')) {
BazNotifications.serviceOffline();
}
- if (tunnelsToInit.includes('messengerNotifications')) {
- BazMessenger.serviceOffline();
- }
- if (tunnelsToInit.includes('systemAnnouncements')) {
- BazAnnouncements.serviceOffline();
- }
+ // if (tunnelsToInit.includes('messengerNotifications')) {
+ // BazMessenger.serviceOffline();
+ // }
+ // if (tunnelsToInit.includes('systemAnnouncements')) {
+ // BazAnnouncements.serviceOffline();
+ // }
if (tunnelsToInit.includes('progress')) {
BazProgress.serviceOffline();
}
@@ -11845,7 +11876,7 @@ var BazProgress = function() {
var initialized = false;
var progressCounter = 0;
var online = false;
- var element, manualShowHide, hasChild, hasSubProcess, hasCancelButton;
+ var element, manualShowHide, hasChild, hasSubProcess, hasCancelButton, hasDetails;
var callableFunc = null;
var url
var postData = { };
@@ -11895,12 +11926,13 @@ var BazProgress = function() {
console.log('Progress service offline');
}
- function buildProgressBar(el, mSH = false, hC = false, hSP = false, hCB = true) {
+ function buildProgressBar(el, mSH = false, hC = false, hSP = false, hCB = true, hD = true) {
element = el;
manualShowHide = mSH;
hasChild = hC;
hasSubProcess = hSP;
hasCancelButton = hCB;
+ hasDetails = hD;
$(element).html(
'
' +
@@ -11942,17 +11974,37 @@ var BazProgress = function() {
);
}
+ var buttons = '
';
+
if (hasCancelButton) {
- $(element).append(
- '
' +
- '' +
- '
'
- );
+ buttons +=
+ '
' +
+ '
' +
+ '' +
+ '
' +
+ '
';
+ }
+
+ if (hasDetails) {
+ buttons +=
+ '
' +
+ '
' +
+ '' +
+ '
' +
+ '
';
+ }
+
+ buttons += '
';
+
+ $(element).append(buttons);
- $('#' + $(element)[0].id + '-cancel').off();
- $('#' + $(element)[0].id + '-cancel').click(function() {
+ if (hasCancelButton) {
+ $('#' + $(element)[0].id + '-cancel-button').off();
+ $('#' + $(element)[0].id + '-cancel-button').click(function() {
if (pid > 0) {
Swal.fire({
title : '
Cancel current process?',
@@ -11992,6 +12044,8 @@ var BazProgress = function() {
'title' : response.responseMessage
});
+ $('body').trigger('bazProgressCancelled');
+
resetProgressCounter();
} else {
paginatedPNotify('error', {
@@ -12004,6 +12058,32 @@ var BazProgress = function() {
}
});
}
+
+ if (hasDetails) {
+ $('#' + $(element)[0].id + '-details-button').off();
+ $('#' + $(element)[0].id + '-details-button').click(function() {
+ var text = $('#' + $(element)[0].id + '-details-button').text().toLowerCase();
+
+ if (text === 'show details') {
+ $('#' + $(element)[0].id + '-details-button').text('Hide details');
+ $('#details-div').attr('hidden', false);
+ } else if (text === 'hide details') {
+ $('#' + $(element)[0].id + '-details-button').text('Show details');
+ $('#details-div').attr('hidden', true);
+ }
+ });
+
+ $(element).append(
+ '
'
+ );
+ }
}
function getProgress(options) {
@@ -12012,6 +12092,7 @@ var BazProgress = function() {
if (callableFunc && callableFunc['beforeStart']) {
if (callableFunc['beforeStart']() === false) {
resetProgressCounter();
+
return;
}
}
@@ -12044,6 +12125,7 @@ var BazProgress = function() {
if (callableFunc && callableFunc['beforeProcess']) {
if (callableFunc['beforeProcess'](response) === false) {
resetProgressCounter();
+
return;
}
}
@@ -12062,6 +12144,8 @@ var BazProgress = function() {
if (responseData['pid']) {
$('#' + $(element)[0].id + '-cancel').attr('hidden', false);
pid = responseData['pid'];
+
+ $('#details-data').html('PID running : Progress is running with process ID: ' + pid + '
');
}
if (responseData['progressFile']) {
@@ -12069,13 +12153,57 @@ var BazProgress = function() {
}
if (responseData['preCheckComplete'] == false ||
- (responseData['callResult'] && responseData['callResult'] === 'reset')
+ (responseData['callResult'] && responseData['callResult'] === 'reset') ||
+ (responseData['callResult'] && responseData['callResult'] === 'pid_running')
) {
- resetProgressCounter();
+ if (responseData['errors']) {
+ $('#details-div').attr('hidden', false);
+ var html = responseData['errors'];
+ var regex = /{.*}/g;
+ var found = html.match(regex);
+
+ if (found) {
+ //eslint-disable-next-line
+ var data = found[0].replaceAll('\"', '"');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\', '\\\\\\\\');
+ //eslint-disable-next-line
+ data = data.replaceAll('\\\\\\u0022', '"');
+ var obj = JSON.parse(data);
+
+ if (obj) {
+ $('#details-data').html(
+ '
' +
+ BazHelpers.createHtmlList({'obj': obj}));
+ '
'
+ }
+ } else {
+ $('#details-data').html(html);
+ }
+
+ $('#details-data').scrollTop($('#details-data')[0].scrollHeight);
+ }
+
+ if (responseData['callResult'] === 'pid_running') {
+ $('#' + $(element)[0].id).attr('hidden', false);
+ $('#' + $(element)[0].id + '-cancel').attr('hidden', false);
+ $('#' + $(element)[0].id + '-cancel-button').text('Cancel Process: ' + responseData['pid']);
+ }
+
+ if (responseData['callResult'] && responseData['callResult'] === 'reset') {
+ if (!responseData['errors']) {
+ resetProgressCounter();
+ }
+ }
return false;
}
+ if (responseData['details']) {
+ var pidHtml = $('#details-data').html();
+ $('#details-data').html(pidHtml + BazHelpers.createHtmlList({'obj': responseData['details']}));
+ }
+
if (responseData['total'] !== 'undefined' && responseData['completed'] !== 'undefined') {
if (responseData['total'] !== responseData['completed']) {
if (responseData['runners'] && responseData['runners']['running'] !== false) {
@@ -12273,12 +12401,16 @@ var BazProgress = function() {
responseData['runners']['running']['remoteWebCounters']['downloadTotal'] > 0
) {
isDownload = true;
+ isUpload = false;
+ isSteps = false;
downloadTotal = responseData['runners']['running']['remoteWebCounters']['downloadTotal'];
downloadedBytes = responseData['runners']['running']['remoteWebCounters']['downloadedBytes'];
} else if (responseData['runners']['running']['remoteWebCounters']['uploadTotal'] &&
responseData['runners']['running']['remoteWebCounters']['uploadTotal'] > 0
) {
isUpload = true;
+ isDownload = false;
+ isSteps = false;
uploadTotal = responseData['runners']['running']['remoteWebCounters']['uploadTotal'];
uploadedBytes = responseData['runners']['running']['remoteWebCounters']['uploadedBytes'];
}
@@ -12287,6 +12419,8 @@ var BazProgress = function() {
responseData['runners']['running']['stepsCounters']['stepsTotal'] > 0
) {
isSteps = true;
+ isDownload = false;
+ isUpload = false;
stepsTotal = responseData['runners']['running']['stepsCounters']['stepsTotal'];
stepsCurrent = responseData['runners']['running']['stepsCounters']['stepsCurrent'];
}
@@ -12305,7 +12439,7 @@ var BazProgress = function() {
return text;
}
- function resetProgressCounter() {
+ function resetProgressCounter(hideDiv = true) {
if (progressCounter !== 60) {
progressCounter ++;
@@ -12317,10 +12451,14 @@ var BazProgress = function() {
}
}
- $('#' + $(element)[0].id).attr('hidden', true);
+ if (hideDiv) {
+ $('#' + $(element)[0].id).attr('hidden', true);
+ $('#details-div').attr('hidden', true);
+ }
$('.' + $(element)[0].id + '-bar').css('width', '0%');
$('.' + $(element)[0].id + '-bar').attr('aria-valuenow', 0);
switchProgressBarColor('.' + $(element)[0].id + '-bar', 'info');
+ $('#' + $(element)[0].id + '-cancel-button').text('Cancel');
downloadTotal = 0;
downloadedBytes = 0;
uploadTotal = 0;
@@ -12370,8 +12508,8 @@ var BazProgress = function() {
getProgress(options);
}
}
- BazProgress.buildProgressBar = function(el, mSH = false, child = false, hasSubProcess = false, hasCancelButton = true) {
- buildProgressBar(el, mSH, child, hasSubProcess, hasCancelButton);
+ BazProgress.buildProgressBar = function(el, mSH = false, child = false, hasSubProcess = false, hasCancelButton = true, hasDetails = true) {
+ buildProgressBar(el, mSH, child, hasSubProcess, hasCancelButton, hasDetails);
}
BazProgress.switchProgressBarColor = function(el, color) {
switchProgressBarColor(el, color);
diff --git a/system/Base/BaseComponent.php b/system/Base/BaseComponent.php
index 8010c6b9c..2797efbc2 100644
--- a/system/Base/BaseComponent.php
+++ b/system/Base/BaseComponent.php
@@ -298,7 +298,11 @@ protected function checkComponentDependencies($component = null)
if (!$packageModule ||
($packageModule &&
- ($packageModule['installed'] == false || $packageModule['apps'][$this->app['id']]['enabled'] == false)
+ ($packageModule['installed'] == false ||
+ (isset($packageModule['apps'][$this->app['id']]) &&
+ $packageModule['apps'][$this->app['id']]['enabled'] == false
+ )
+ )
)
) {
$this->setErrorDispatcher('controllerDependencyError', ['error' => true]);
diff --git a/system/Base/BasePackage.php b/system/Base/BasePackage.php
index 350c49883..9b276cba3 100644
--- a/system/Base/BasePackage.php
+++ b/system/Base/BasePackage.php
@@ -383,6 +383,10 @@ public function getByParams(array $params, bool $resetCache = false, bool $enabl
}
}
+ if (count($relationColumns) > 0) {
+ $this->ffRelations = true;
+ }
+
$order = null;
$limit = null;
$offset = null;
@@ -408,13 +412,16 @@ public function getByParams(array $params, bool $resetCache = false, bool $enabl
$offset = $params['offset'];
}
if (isset($params['conditions']) && is_array($params['conditions']) && count($params['conditions']) > 0) {
- $this->ffData = $this->ffStore->findBy($params['conditions'], $order, $limit, $offset);
+ $this->ffData =
+ $this->ffStore->findBy(
+ $params['conditions'], $order, $limit, $offset, $this->ffRelations, $this->ffRelationsConditions
+ );
} else if (isset($params['conditions']) &&
((is_array($params['conditions']) && count($params['conditions']) === 0) ||
$params['conditions'] === ''
)
) {
- $this->ffData = $this->ffStore->findAll($order, $limit, $offset);
+ $this->ffData = $this->ffStore->findAll($order, $limit, $offset, $this->ffRelations, $this->ffRelationsConditions);
} else {
throw new \Exception('getByParams needs parameter conditions (array) to be set.');
}
@@ -461,7 +468,7 @@ protected function getRelationColumnsData($relationColumns, $data)
$relationRowData = $model->{$alias}->toArray();
}
} else {
- $relationRowData = $this->ffStore->findById($row['id'], true);
+ $relationRowData = $row;
}
foreach ($relationColumns as $relationColumnKey => $relationColumn) {
@@ -2271,6 +2278,18 @@ protected function addToLog($code, $message, $debug = true)
//Only if debug is enabled.
}
+ public function getDbCount($recount = false)
+ {
+ if ($this->config->databasetype === 'db') {
+ return $this->modelToUse::count();
+ } else {
+ if (!$this->ffStore) {
+ $this->ffStore = $this->ff->store($this->ffStoreToUse);
+ }
+
+ return $this->ffStore->count($recount);
+ }
+ }
// protected function addRefId($data)
// {
// if (!isset($data['ref_id'])) {
diff --git a/system/Base/Helpers.php b/system/Base/Helpers.php
index a52c777a8..189780ee2 100644
--- a/system/Base/Helpers.php
+++ b/system/Base/Helpers.php
@@ -582,4 +582,62 @@ function arrayReplace($array, $findKey, $replace) {
return $array;
}
-}
\ No newline at end of file
+}
+
+if (!function_exists('getRemoteFilesize')) {
+ /**
+ * Get the file size of any remote resource (using get_headers()),
+ * either in bytes or - default - as human-readable formatted string.
+ *
+ * @author Stephan Schmitz
+ * @license MIT
+ * @url
+ *
+ * @param string $url Takes the remote object's URL.
+ * @param boolean $formatSize Whether to return size in bytes or formatted.
+ * @param boolean $useHead Whether to use HEAD requests. If false, uses GET.
+ * @return string Returns human-readable formatted size
+ * or size in bytes (default: formatted).
+ */
+ function getRemoteFilesize($url, $formatSize = false, $useHead = false) {
+ if ($useHead) {
+ stream_context_set_default(array('http' => array('method' => 'HEAD')));
+ }
+
+ $head = array_change_key_case(get_headers($url, 1));
+
+ // content-length of download (in bytes), read from Content-Length: field
+ $clen = isset($head['content-length']) ? $head['content-length'] : 0;
+
+ if (!$clen) {
+ return false;
+ }
+
+ $size = $clen;
+
+ if (is_array($clen) && count($clen) > 0) {
+ array_walk($clen, function($len, $index) use (&$size) {
+ if ($len > (int) 0) {
+ $size = (int) $len;
+
+ return;
+ }
+ });
+ }
+
+ if ($formatSize) {
+ switch ($size) {
+ case $size < 1024:
+ $size = $size .' B'; break;
+ case $size < 1048576:
+ $size = round($size / 1024, 2) .' KiB'; break;
+ case $size < 1073741824:
+ $size = round($size / 1048576, 2) . ' MiB'; break;
+ case $size < 1099511627776:
+ $size = round($size / 1073741824, 2) . ' GiB'; break;
+ }
+ }
+
+ return $size;
+ }
+}
diff --git a/system/Base/Installer/Components/Setup.php b/system/Base/Installer/Components/Setup.php
index 240b4f416..9d8ff6309 100644
--- a/system/Base/Installer/Components/Setup.php
+++ b/system/Base/Installer/Components/Setup.php
@@ -179,7 +179,7 @@ function () {
$this->helper = $this->container->getShared('helper');
if ($onlyUpdateDb === false) {
- $this->progress = $this->basepackages->progress->init($this->container);
+ $this->progress = $this->basepackages->progress->init($this->container, 'setup');
}
$this->config = $configsObj->toArray();
diff --git a/system/Base/Installer/Packages/Setup/Schema.php b/system/Base/Installer/Packages/Setup/Schema.php
index 12a0b48cd..21fe9a780 100644
--- a/system/Base/Installer/Packages/Setup/Schema.php
+++ b/system/Base/Installer/Packages/Setup/Schema.php
@@ -364,7 +364,7 @@ public function getSchema($dev)
]
];
- if ($dev == true) {
+ if ($dev == 'true') {
$schema['apps_core_devtools_files_hash'] = [
'schema' => new \Apps\Core\Packages\Devtools\Modules\Install\Schema\FilesHash,
'model' => new \Apps\Core\Packages\Devtools\Modules\Model\AppsCoreDevtoolsFilesHash,
diff --git a/system/Base/Installer/View/setup.phtml b/system/Base/Installer/View/setup.phtml
index fedf2965c..ea591e8ca 100644
--- a/system/Base/Installer/View/setup.phtml
+++ b/system/Base/Installer/View/setup.phtml
@@ -392,10 +392,10 @@