Skip to content

FOUR-20281: [SPRING] Remove fades on tab switching #7763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9d5395d
FOUR-20443
pmPaulis Nov 22, 2024
7339f2b
The card needs to hide if the data is null
pmPaulis Nov 22, 2024
81f8e21
Merge remote-tracking branch 'origin/release-2024-fall' into bugfix/F…
pmPaulis Nov 22, 2024
8a902c6
Add method to create Process instance from JSON file
caleeli Nov 22, 2024
389b1c3
Improve modifying exception messages in RunServiceTask
caleeli Nov 22, 2024
8573753
FOUR-20281 : S2: Remove fades
hjonathan Nov 25, 2024
02355d3
Add process name filter
nolanpro Nov 25, 2024
bb05671
FOUR-18935 Ecobank - ERROR 404 ON SECURITY LOGS SWAGGER
julceslauhub Nov 26, 2024
998c1aa
FOUR-20443: solving observations
pmPaulis Nov 26, 2024
0a399a0
Merge pull request #7768 from ProcessMaker/bugfix/FOUR-18935
ryancooley Nov 27, 2024
2e53820
Merge pull request #7765 from ProcessMaker/bugfix/FOUR-20045
ryancooley Nov 27, 2024
10da31a
Merge pull request #7758 from ProcessMaker/bugfix/FOUR-20443
ryancooley Nov 27, 2024
0fe471d
Merge pull request #7761 from ProcessMaker/FOUR-20266
ryancooley Nov 27, 2024
f1ae9af
Version 4.12.0+beta-5
ryancooley Nov 27, 2024
a3161e3
Review all files json
marcoAntonioNina Nov 28, 2024
7e3ecf7
Merge branch 'release-2024-fall' of github.com:ProcessMaker/processma…
marcoAntonioNina Nov 28, 2024
d8c2b99
Added missing translations
danloa Nov 28, 2024
c0b9708
Use new labels for genies assets
danloa Nov 28, 2024
7316382
FOUR-21130
pmPaulis Nov 29, 2024
de600cf
FOUR-21130: solve the unit test
pmPaulis Nov 29, 2024
637aff9
Remove the unnecesary test
pmPaulis Nov 29, 2024
329ed93
FOUR-21104 : Mobile > Tabs do not have the correct style
hjonathan Nov 29, 2024
cdc6a54
Added the collection model to the exporterMap
gustavobascope Nov 29, 2024
6f7a0e9
Removing import change.js from webpack-login.mix.js
CarliPinell Nov 29, 2024
cec2e37
Merge pull request #7776 from ProcessMaker/observation/FOUR-21117
ryancooley Dec 2, 2024
be89b10
Merge pull request #7775 from ProcessMaker/observation/FOUR-21120
ryancooley Dec 2, 2024
da7b313
Merge pull request #7782 from ProcessMaker/bugfix/FOUR-21142
ryancooley Dec 2, 2024
e912b9b
Merge pull request #7781 from ProcessMaker/observation/FOUR-21138
ryancooley Dec 2, 2024
8caef64
Merge pull request #7778 from ProcessMaker/bugfix/FOUR-21130
ryancooley Dec 2, 2024
96b7763
Merge pull request #7780 from ProcessMaker/bugfix/FOUR-21104
ryancooley Dec 2, 2024
78b414e
Update Modeler & Screen Builder
ryancooley Dec 2, 2024
7cef415
Update enterprise packages
ryancooley Dec 2, 2024
63ce99e
Version 4.12.0-RC1
ryancooley Dec 2, 2024
0783b32
Update translations for changed strings
ryancooley Dec 3, 2024
32ea1ff
Merge pull request #7789 from ProcessMaker/translate/changed-strings
ryancooley Dec 3, 2024
2496c6a
Version 4.12.0
ryancooley Dec 3, 2024
7658dea
Merge remote-tracking branch 'origin/release-2024-fall' into feature/…
pmPaulis Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 100 additions & 38 deletions ProcessMaker/Console/Commands/SyncTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function handle()
//Search files
$this->listFiles($translationsCore . '/lang');

//updating languages by default
// updating languages by default
foreach ($this->files as $pathFile) {
if (!(str_contains($pathFile, '.json') || str_contains($pathFile, '.php'))) {
if (!(str_contains($pathFile, '.json') || str_contains($pathFile, '.php')) || str_contains($pathFile, '.bak.')) {
continue;
}
// updating resources/lang
Expand All @@ -57,13 +57,9 @@ public function handle()
$this->files = [];
$translationsCore = app()->basePath() . '/resources/lang';
$this->listFiles($translationsCore);
$filesIgnore = ['/fr/', '/de/', '/en/', '/es/', '.gitignore', '/en.json', '/es.json', '/de.json', '/fr.json'];
foreach ($this->files as $pathFile) {
// ignore languages by default
foreach ($filesIgnore as $value) {
if (str_contains($pathFile, $value)) {
continue 2;
}
if (!(str_contains($pathFile, '.json') || str_contains($pathFile, '.php')) || str_contains($pathFile, '.bak.')) {
continue;
}
// updating resources/lang
$backup = str_replace('/resources/', '/resources-core/', preg_replace('/(?<=lang).+?(?=json)/', '/en.', $pathFile));
Expand Down Expand Up @@ -98,14 +94,14 @@ public function handle()
$this->listFiles($translationsPackage . '/lang-' . last($package));
$existsLangOrig = $this->fileExists($translationsPackage . '/lang.orig-' . last($package));
foreach ($this->files as $pathFile) {
if (!str_contains($pathFile, '.json')) {
if (!str_contains($pathFile, '.json') || str_contains($pathFile, '.bak.')) {
continue;
}
// updating resources/lang
$this->syncFile($pathFile, $pathPackage . '/en.json', true);
$this->syncFile($pathFile, $pathPackage . '/en.json');
if ($existsLangOrig) {
// updating resources/lang.orig
$this->syncFile(str_replace('/lang-', '/lang.orig-', $pathFile), $pathPackage . '/en.json', true);
$this->syncFile(str_replace('/lang-', '/lang.orig-', $pathFile), $pathPackage . '/en.json');
}
}

Expand Down Expand Up @@ -163,46 +159,112 @@ private function parseFile($path)
return collect($lines);
}

private function syncFile($target, $backup, $package = false)
/**
* Synchronize translations between target and backup files
*
* @param string $target Path to target file
* @param string $backup Path to backup file
* @return bool
* @throws \Exception
*/
private function syncFile($target, $backup)
{
$pathInfo = pathinfo($target);
$targetTranslations = $this->parseFile($target);
$origin = $this->parseFile($backup);
if (str_contains($target, '.bak.')) {
// Clean up old backup if everything succeeded
if (file_exists($target)) {
unlink($target);
$this->info('Removed bak: ' . $target);
}
$this->info("Skipping backup file: {$target}");

if ($package) {
$filesIgnore = ['/en.json'];
} else {
$filesIgnore = ['/fr/', '/de/', '/en/', '/es/', '/en.json', '/es.json', '/de.json', '/fr.json'];
return true;
}
$clear = true;
foreach ($filesIgnore as $value) {
if (str_contains($target, $value)) {
$clear = false;
continue;
// Create backup before modifications
$backupPath = $target . '.bak.' . date('Y-m-d-His');
try {
if (!copy($target, $backupPath)) {
$this->error("Failed to create backup file: {$backupPath}");

return false;
}
$this->info("Backup created: {$backupPath}");
} catch (\Exception $e) {
$this->error('Error creating backup: ' . $e->getMessage());

return false;
}

if ($clear) {
$diff = $origin->diffKeys($targetTranslations);
$pathInfo = pathinfo($target);

$targetTranslations = $diff->map(function () {
return '';
});
try {
$targetTranslations = $this->parseFile($target);
$origin = $this->parseFile($backup);
} catch (\Exception $e) {
$this->error('Error parsing files: ' . $e->getMessage());

return false;
}

$merged = $origin->merge($targetTranslations);
// search empty values
// send values to openAI.
$contents = $this->generateFile($merged, $pathInfo['extension']);
// Solo obtener las claves que están en origin pero no en target
$diff = $origin->diffKeys($targetTranslations);

file_put_contents($target, $contents);
$this->info($target . ' Saved');
if ($diff->isNotEmpty()) {
$this->info('Found ' . $diff->count() . " new translations to add in {$target}");

// only files en.json to en.json have translations others are empty
$clear = true;
if (str_contains($target, 'en.json') && str_contains($backup, 'en.json')) {
$clear = false;
}

if ($pathInfo['extension'] == 'php') {
$this->clearCache();
// Agregar solo las nuevas claves al targetTranslations
foreach ($diff as $key => $value) {
$targetTranslations[$key] = $clear ? '' : $value;
}
}

return true;
try {
$contents = $this->generateFile($targetTranslations, $pathInfo['extension']);

// Validate content before saving
if (empty($contents)) {
throw new \Exception('Generated content is empty');
}

// Use atomic file writing
$tempFile = $target . '.tmp';
if (file_put_contents($tempFile, $contents) === false) {
throw new \Exception('Failed to write temporary file');
}

if (!rename($tempFile, $target)) {
unlink($tempFile);
throw new \Exception('Failed to move temporary file');
}

$this->info("Successfully updated: {$target}");

// Clean up old backup if everything succeeded
if (file_exists($backupPath)) {
unlink($backupPath);
$this->info('Removed backup file after successful update');
}

if ($pathInfo['extension'] == 'php') {
$this->clearCache();
}

return true;
} catch (\Exception $e) {
// Restore from backup if something went wrong
if (file_exists($backupPath)) {
copy($backupPath, $target);
$this->info('Restored from backup due to error');
}
$this->error('Error saving file: ' . $e->getMessage());

return false;
}
}

private function generateFile($lines, $type)
Expand Down
1 change: 1 addition & 0 deletions ProcessMaker/Enums/ExporterMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum ExporterMap
'process_templates' => [\ProcessMaker\Models\ProcessTemplates::class, \ProcessMaker\ImportExport\Exporters\TemplateExporter::class],
'data_source' => [\ProcessMaker\Packages\Connectors\DataSources\Models\DataSource::class, \ProcessMaker\Packages\Connectors\DataSources\ImportExport\DataSourceExporter::class],
'decision_table' => [\ProcessMaker\Package\PackageDecisionEngine\Models\DecisionTable::class, \ProcessMaker\Package\PackageDecisionEngine\ImportExport\DecisionTableExporter::class],
'collection' => [\ProcessMaker\Plugins\Collections\Models\Collection::class, \ProcessMaker\Plugins\Collections\ImportExport\CollectionExporter::class],
'flow_genie' => [
\ProcessMaker\Package\PackageAi\Models\FlowGenie::class,
\ProcessMaker\Package\PackageAi\ImportExport\FlowGenieExporter::class,
Expand Down
20 changes: 20 additions & 0 deletions ProcessMaker/Filters/BaseFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ abstract class BaseFilter

public const TYPE_PROCESS = 'Process';

public const TYPE_PROCESS_NAME = 'ProcessName';

public const TYPE_RELATIONSHIP = 'Relationship';

public string|null $subjectValue;
Expand Down Expand Up @@ -96,6 +98,8 @@ private function apply($query): void
$this->valueAliasAdapter($valueAliasMethod, $query);
} elseif ($this->subjectType === self::TYPE_PROCESS) {
$this->filterByProcessId($query);
} elseif ($this->subjectType === self::TYPE_PROCESS_NAME) {
$this->filterByProcessName($query);
} elseif ($this->subjectType === self::TYPE_RELATIONSHIP) {
$this->filterByRelationship($query);
} elseif ($this->isJsonData() && $query->getModel() instanceof ProcessRequestToken) {
Expand Down Expand Up @@ -224,6 +228,10 @@ private function subject()
return $this->relationshipSubjectTypeParts()[1];
}

if ($this->subjectType === self::TYPE_PROCESS_NAME) {
return 'name';
}

return $this->subjectValue;
}

Expand Down Expand Up @@ -298,6 +306,18 @@ private function filterByProcessId(Builder $query): void
}
}

private function filterByProcessName(Builder $query): void
{
if ($query->getModel() instanceof ProcessRequestToken) {
$query->whereIn('process_request_id', function ($query) {
$query->select('id')->from('process_requests');
$this->applyQueryBuilderMethod($query);
});
} else {
$query->whereIn('name', (array) $this->value());
}
}

private function filterByRelationship(Builder $query): void
{
$relationshipName = $this->relationshipSubjectTypeParts()[0];
Expand Down
9 changes: 8 additions & 1 deletion ProcessMaker/Http/Controllers/Api/SecurityLogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,16 @@ public function index(Request $request)
$query->pmql($pmql);
}

// Get total
$totalCount = $query->count();

// Always paginate using query object instead "ApiCollection" class
$query->paginate($request->input('per_page', 10));

// Get records
$response = $query->get();

return new ApiCollection($response);
return new ApiCollection($response, $totalCount);
}

/**
Expand Down
8 changes: 6 additions & 2 deletions ProcessMaker/Jobs/RunServiceTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ProcessMaker\Jobs;

use Exception;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Log;
use ProcessMaker\Exception\ConfigurationException;
Expand Down Expand Up @@ -127,8 +128,11 @@ public function action(ProcessRequestToken $token = null, ServiceTaskInterface $
$error->setName($message);

$token->setProperty('error', $error);
$exceptionClass = get_class($exception);
$modifiedException = new $exceptionClass($message);
if ($message !== $exception->getMessage()) {
$modifiedException = new Exception($message, $exception->getCode(), $exception);
} else {
$modifiedException = $exception;
}
$token->logError($modifiedException, $element);

Log::error('Service task failed: ' . $implementation . ' - ' . $message);
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Traits/TaskControllerIndexMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private function applyForCurrentUser($query, $user)
->orWhereIn('id', $user->availableSelfServiceTaskIds());
});
}

public function applyProcessManager($query, $user)
{
$ids = Process::select(['id'])
Expand All @@ -329,7 +329,7 @@ public function applyProcessManager($query, $user)
->get()
->toArray();

$query->orWhere(function ($query) use ($ids) {
$query->where(function ($query) use ($ids) {
$query->whereIn('process_request_tokens.process_id', array_column($ids, 'id'))
->where('process_request_tokens.status', 'ACTIVE');
});
Expand Down
Loading
Loading