Loading cloud.install +57 −0 Original line number Diff line number Diff line Loading @@ -1171,3 +1171,60 @@ function cloud_update_8155(): void { $config->set('cloud_custom_d3_horizon_chart_js_url', 'https://unpkg.com/@docomoinnovations/horizon-chart@1.1.0/dist/d3-horizon-chart.js'); $config->save(); } /** * Update cloud_store entity type. * * This update deletes all cloud_store data and updates the * cloud_store entity structure. Backup your data before * performing this update. */ function cloud_update_8156(): void { // Truncate the cloud_store tables since the new code will conflict with // existing entities. $tables = [ 'cloud_store', 'cloud_store__field_cloud_context', 'cloud_store__field_costs', 'cloud_store__field_resources', 'cloud_store_field_data', 'cloud_store_field_revision', 'cloud_store_revision', 'cloud_store_revision__field_cloud_context', 'cloud_store_revision__field_costs', 'cloud_store_revision__field_resources', ]; $db = \Drupal::database(); foreach ($tables ?: [] as $table) { $db->truncate($table)->execute(); } // Delete and re-add cloud_store. $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $entity_type = \Drupal::entityTypeManager()->getDefinition('cloud_store'); if (!empty($entity_type)) { $definition_update_manager->uninstallEntityType($entity_type); // Finally re-add the entity type. $definition_update_manager->installEntityType($entity_type); } // After uninstalling entity type, delete the revision related tables. $delete_tables = [ 'cloud_store_field_data', 'cloud_store_field_revision', 'cloud_store_revision', 'cloud_store_revision__field_cloud_context', 'cloud_store_revision__field_costs', 'cloud_store_revision__field_resources', ]; foreach ($delete_tables ?: [] as $table) { $db->schema()->dropTable($table); } // Update cloud_store view. $files = [ 'views.view.cloud_store.yml', ]; \Drupal::service('cloud')->updateYmlDefinitions($files, 'cloud'); } cloud.links.task.yml +0 −4 Original line number Diff line number Diff line Loading @@ -110,10 +110,6 @@ entity.cloud_store.delete_form: class: '\Drupal\cloud\Plugin\Derivative\CloudStoreTab' title: 'Delete' entity.cloud_store.version_history: route_name: entity.cloud_store.version_history base_route: entity.cloud_store.canonical title: 'Revisions' # Structure | Cloud service providers | List. # The cloud service provider (CloudConfig) menu items definition. Loading config/install/views.view.cloud_store.yml +3 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ label: 'Cloud store' module: views description: 'Listing page showing all cloud store type.' tag: '' base_table: cloud_store_field_data base_table: cloud_store base_field: id display: default: Loading Loading @@ -127,7 +127,7 @@ display: fields: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -194,7 +194,7 @@ display: sorts: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading modules/cloud_service_providers/k8s/config/install/views.view.k8s_cloud_store.yml +21 −21 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ label: 'K8s cloud store' module: views description: 'Listing page showing all cloud store.' tag: '' base_table: cloud_store_field_data base_table: cloud_store base_field: id display: default: Loading @@ -30,7 +30,7 @@ display: fields: name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -95,7 +95,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -378,7 +378,7 @@ display: sorts: created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading @@ -396,7 +396,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -573,7 +573,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -638,7 +638,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -705,7 +705,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -884,7 +884,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -1081,7 +1081,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -1146,7 +1146,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -1213,7 +1213,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -1455,7 +1455,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -1652,7 +1652,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -1717,7 +1717,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -1784,7 +1784,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -1963,7 +1963,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -2151,7 +2151,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -2216,7 +2216,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -2283,7 +2283,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -2462,7 +2462,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading modules/cloud_service_providers/k8s/k8s.install +34 −1 Original line number Diff line number Diff line Loading @@ -6,9 +6,9 @@ */ use Drupal\Component\Serialization\Yaml; use Drupal\Core\Config\FileStorage; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Config\FileStorage; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\k8s\Entity\K8sEntityInterface; Loading Loading @@ -86,6 +86,7 @@ function k8s_update_dependencies(): array { 8306 => ['cloud' => 8147], 8307 => ['cloud' => 8148], 8332 => ['cloud' => 8153], 8348 => ['cloud' => 8156], ], 'cloud' => [ 8150 => ['k8s' => 8312], Loading Loading @@ -3615,3 +3616,35 @@ function k8s_update_8347(): void { $field ); } /** * Re-add K8s cloud_store bundle after the entity update. */ function k8s_update_8348() { // Add new fields and field_store for cloud_store.k8s. $files = [ 'field.storage.cloud_store.field_cloud_context.yml', 'field.storage.cloud_store.field_costs.yml', 'field.storage.cloud_store.field_resources.yml', 'cloud.cloud_store_type.k8s_cost_store.yml', 'cloud.cloud_store_type.k8s_namespace_resource_store.yml', 'cloud.cloud_store_type.k8s_node_resource_store.yml', 'cloud.cloud_store_type.k8s_pod_resource_store.yml', 'core.entity_view_display.cloud_store.k8s_cost_store.default.yml', 'core.entity_view_display.cloud_store.k8s_namespace_resource_store.default.yml', 'core.entity_view_display.cloud_store.k8s_node_resource_store.default.yml', 'core.entity_view_display.cloud_store.k8s_pod_resource_store.default.yml', 'field.field.cloud_store.k8s_cost_store.field_costs.yml', 'field.field.cloud_store.k8s_cost_store.field_resources.yml', 'field.field.cloud_store.k8s_namespace_resource_store.field_cloud_context.yml', 'field.field.cloud_store.k8s_namespace_resource_store.field_costs.yml', 'field.field.cloud_store.k8s_namespace_resource_store.field_resources.yml', 'field.field.cloud_store.k8s_node_resource_store.field_cloud_context.yml', 'field.field.cloud_store.k8s_node_resource_store.field_resources.yml', 'field.field.cloud_store.k8s_pod_resource_store.field_cloud_context.yml', 'field.field.cloud_store.k8s_pod_resource_store.field_resources.yml', 'views.view.k8s_cloud_store.yml', ]; \Drupal::service('cloud')->updateYmlDefinitions($files, 'k8s'); drupal_flush_all_caches(); } Loading
cloud.install +57 −0 Original line number Diff line number Diff line Loading @@ -1171,3 +1171,60 @@ function cloud_update_8155(): void { $config->set('cloud_custom_d3_horizon_chart_js_url', 'https://unpkg.com/@docomoinnovations/horizon-chart@1.1.0/dist/d3-horizon-chart.js'); $config->save(); } /** * Update cloud_store entity type. * * This update deletes all cloud_store data and updates the * cloud_store entity structure. Backup your data before * performing this update. */ function cloud_update_8156(): void { // Truncate the cloud_store tables since the new code will conflict with // existing entities. $tables = [ 'cloud_store', 'cloud_store__field_cloud_context', 'cloud_store__field_costs', 'cloud_store__field_resources', 'cloud_store_field_data', 'cloud_store_field_revision', 'cloud_store_revision', 'cloud_store_revision__field_cloud_context', 'cloud_store_revision__field_costs', 'cloud_store_revision__field_resources', ]; $db = \Drupal::database(); foreach ($tables ?: [] as $table) { $db->truncate($table)->execute(); } // Delete and re-add cloud_store. $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $entity_type = \Drupal::entityTypeManager()->getDefinition('cloud_store'); if (!empty($entity_type)) { $definition_update_manager->uninstallEntityType($entity_type); // Finally re-add the entity type. $definition_update_manager->installEntityType($entity_type); } // After uninstalling entity type, delete the revision related tables. $delete_tables = [ 'cloud_store_field_data', 'cloud_store_field_revision', 'cloud_store_revision', 'cloud_store_revision__field_cloud_context', 'cloud_store_revision__field_costs', 'cloud_store_revision__field_resources', ]; foreach ($delete_tables ?: [] as $table) { $db->schema()->dropTable($table); } // Update cloud_store view. $files = [ 'views.view.cloud_store.yml', ]; \Drupal::service('cloud')->updateYmlDefinitions($files, 'cloud'); }
cloud.links.task.yml +0 −4 Original line number Diff line number Diff line Loading @@ -110,10 +110,6 @@ entity.cloud_store.delete_form: class: '\Drupal\cloud\Plugin\Derivative\CloudStoreTab' title: 'Delete' entity.cloud_store.version_history: route_name: entity.cloud_store.version_history base_route: entity.cloud_store.canonical title: 'Revisions' # Structure | Cloud service providers | List. # The cloud service provider (CloudConfig) menu items definition. Loading
config/install/views.view.cloud_store.yml +3 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ label: 'Cloud store' module: views description: 'Listing page showing all cloud store type.' tag: '' base_table: cloud_store_field_data base_table: cloud_store base_field: id display: default: Loading Loading @@ -127,7 +127,7 @@ display: fields: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -194,7 +194,7 @@ display: sorts: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading
modules/cloud_service_providers/k8s/config/install/views.view.k8s_cloud_store.yml +21 −21 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ label: 'K8s cloud store' module: views description: 'Listing page showing all cloud store.' tag: '' base_table: cloud_store_field_data base_table: cloud_store base_field: id display: default: Loading @@ -30,7 +30,7 @@ display: fields: name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -95,7 +95,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -378,7 +378,7 @@ display: sorts: created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading @@ -396,7 +396,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -573,7 +573,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -638,7 +638,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -705,7 +705,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -884,7 +884,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -1081,7 +1081,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -1146,7 +1146,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -1213,7 +1213,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -1455,7 +1455,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -1652,7 +1652,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -1717,7 +1717,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -1784,7 +1784,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -1963,7 +1963,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading Loading @@ -2151,7 +2151,7 @@ display: selected_actions: { } name: id: name table: cloud_store_field_data table: cloud_store field: name relationship: none group_type: group Loading Loading @@ -2216,7 +2216,7 @@ display: field_api_classes: false created: id: created table: cloud_store_field_data table: cloud_store field: created relationship: none group_type: group Loading Loading @@ -2283,7 +2283,7 @@ display: field_api_classes: false cloud_context: id: cloud_context table: cloud_store_field_data table: cloud_store field: cloud_context relationship: none group_type: group Loading Loading @@ -2462,7 +2462,7 @@ display: filters: type: id: type table: cloud_store_field_data table: cloud_store field: type relationship: none group_type: group Loading
modules/cloud_service_providers/k8s/k8s.install +34 −1 Original line number Diff line number Diff line Loading @@ -6,9 +6,9 @@ */ use Drupal\Component\Serialization\Yaml; use Drupal\Core\Config\FileStorage; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Config\FileStorage; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\k8s\Entity\K8sEntityInterface; Loading Loading @@ -86,6 +86,7 @@ function k8s_update_dependencies(): array { 8306 => ['cloud' => 8147], 8307 => ['cloud' => 8148], 8332 => ['cloud' => 8153], 8348 => ['cloud' => 8156], ], 'cloud' => [ 8150 => ['k8s' => 8312], Loading Loading @@ -3615,3 +3616,35 @@ function k8s_update_8347(): void { $field ); } /** * Re-add K8s cloud_store bundle after the entity update. */ function k8s_update_8348() { // Add new fields and field_store for cloud_store.k8s. $files = [ 'field.storage.cloud_store.field_cloud_context.yml', 'field.storage.cloud_store.field_costs.yml', 'field.storage.cloud_store.field_resources.yml', 'cloud.cloud_store_type.k8s_cost_store.yml', 'cloud.cloud_store_type.k8s_namespace_resource_store.yml', 'cloud.cloud_store_type.k8s_node_resource_store.yml', 'cloud.cloud_store_type.k8s_pod_resource_store.yml', 'core.entity_view_display.cloud_store.k8s_cost_store.default.yml', 'core.entity_view_display.cloud_store.k8s_namespace_resource_store.default.yml', 'core.entity_view_display.cloud_store.k8s_node_resource_store.default.yml', 'core.entity_view_display.cloud_store.k8s_pod_resource_store.default.yml', 'field.field.cloud_store.k8s_cost_store.field_costs.yml', 'field.field.cloud_store.k8s_cost_store.field_resources.yml', 'field.field.cloud_store.k8s_namespace_resource_store.field_cloud_context.yml', 'field.field.cloud_store.k8s_namespace_resource_store.field_costs.yml', 'field.field.cloud_store.k8s_namespace_resource_store.field_resources.yml', 'field.field.cloud_store.k8s_node_resource_store.field_cloud_context.yml', 'field.field.cloud_store.k8s_node_resource_store.field_resources.yml', 'field.field.cloud_store.k8s_pod_resource_store.field_cloud_context.yml', 'field.field.cloud_store.k8s_pod_resource_store.field_resources.yml', 'views.view.k8s_cloud_store.yml', ]; \Drupal::service('cloud')->updateYmlDefinitions($files, 'k8s'); drupal_flush_all_caches(); }