Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
maestro
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
maestro
Commits
09cc99fc
Commit
09cc99fc
authored
2 weeks ago
by
Randy Kolenko
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3521204
: Updater for existing view for Maestro Completed Tasks.
parent
6f7a0c51
No related branches found
No related tags found
No related merge requests found
Pipeline
#482045
passed with warnings
2 weeks ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
maestro.install
+53
-1
53 additions, 1 deletion
maestro.install
with
53 additions
and
1 deletion
maestro.install
+
53
−
1
View file @
09cc99fc
...
...
@@ -315,7 +315,7 @@ function maestro_update_10003() {
$view_yml_file
=
$module_path
.
'/config/install/'
.
$view_file
;
// Check if the file exists.
if
(
file_exists
(
$view_yml_file
))
{
// skip this for now
if
(
file_exists
(
$view_yml_file
))
{
// Load the YAML content.
$yaml_content
=
file_get_contents
(
$view_yml_file
);
...
...
@@ -350,4 +350,56 @@ function maestro_update_10003() {
// Now clear the discovery cache to let views pick up the new filter plugin
\Drupal
::
cache
(
'discovery'
)
->
deleteAll
();
}
/**
* Update views configuration for Maestro Views Based Task Console.
* Update the Maestro Completed Tasks view to add in a proper reference to the Process Entity
*/
function
maestro_update_10004
()
{
$module_path
=
\Drupal
::
service
(
'extension.list.module'
)
->
getPath
(
'maestro'
);
$views_files
=
[
'views.view.maestro_completed_tasks.yml'
,
];
foreach
(
$views_files
as
$view_file
)
{
$view_yml_file
=
$module_path
.
'/config/install/'
.
$view_file
;
// Check if the file exists.
// Check if the file exists.
if
(
file_exists
(
$view_yml_file
))
{
// Load the YAML content.
$yaml_content
=
file_get_contents
(
$view_yml_file
);
try
{
// Remove the old view
$old_view
=
\Drupal
::
configFactory
()
->
getEditable
(
'views.view.maestro_completed_tasks'
);
if
(
$old_view
)
{
$old_view
->
delete
();
}
$view_config
=
Yaml
::
parse
(
$yaml_content
);
if
(
$view_config
)
{
// Gen a UUID if it doesn't exist.
if
(
empty
(
$view_config
[
'uuid'
]))
{
$view_config
[
'uuid'
]
=
\Drupal
::
service
(
'uuid'
)
->
generate
();
}
// Save the configuration to the active storage.
\Drupal
::
configFactory
()
->
getEditable
(
'views.view.'
.
$view_config
[
'id'
])
->
setData
(
$view_config
)
->
save
();
}
else
{
\Drupal
::
logger
(
'maestro'
)
->
error
(
'Failed to parse YAML file: @file'
,
[
'@file'
=>
$view_yml_file
]);
}
}
catch
(
\Exception
$e
)
{
\Drupal
::
logger
(
'maestro'
)
->
error
(
'Error parsing YAML file: @file. Message: @message'
,
[
'@file'
=>
$view_yml_file
,
'@message'
=>
$e
->
getMessage
(),
]);
}
}
else
{
\Drupal
::
logger
(
'maestro'
)
->
error
(
'YAML file not found: @file'
,
[
'@file'
=>
$view_yml_file
]);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment