Skip to content
Snippets Groups Projects
Commit 2d4d5536 authored by baldwinlouie's avatar baldwinlouie
Browse files

git commit -m 'Issue #2994688 by baldwinlouie: Swap the /clouds and...

git commit -m 'Issue #2994688 by baldwinlouie: Swap the /clouds and /cloud/designs out for views pages'
parent b0f8c835
No related branches found
No related merge requests found
Showing with 787 additions and 21 deletions
# MENU_NORMAL_ITEM
cloud.service_providers.menu:
title: 'Cloud Service Providers'
route_name: 'cloud.service_providers'
route_name: 'view.cloud_listing.page_1'
# MENU_NORMAL_ITEM
cloud.design.menu:
title: 'Design'
route_name: 'cloud.design'
route_name: 'view.server_template_listing.page_1'
# Cloud config menu items definition
entity.cloud_config.collection:
......
# MENU_CALLBACK
cloud.service_providers:
path: '/clouds'
defaults:
_controller: 'Drupal\cloud\Controller\CloudController::getInstanceList'
_title: 'Clouds'
requirements:
_permission: 'access dashboard'
# MENU_CALLBACK
cloud.design:
path: '/clouds/design'
defaults:
_controller: 'Drupal\cloud\Controller\CloudController::getCloudServerTemplateList'
_title: 'Server Templates'
requirements:
_permission: 'access dashboard'
# MENU_CALLBACK
cloud.getData:
path: '/clouds/getdata'
......
uuid: 1a1ec361-af62-460b-8429-6f1a75275675
langcode: en
status: true
dependencies:
module:
- cloud
- user
id: cloud_listing
label: 'Cloud Listing'
module: views
description: 'Listing page showing all clouds'
tag: ''
base_table: cloud_config_field_data
base_field: id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access dashboard'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: mini
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ‹‹
next: ››
style:
type: table
row:
type: fields
fields:
name:
table: cloud_config_field_data
field: name
id: name
entity_type: null
entity_field: name
plugin_id: field
relationship: none
group_type: group
admin_label: ''
label: Name
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings: { }
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
cloud_context_1:
id: cloud_context_1
table: cloud_config_field_data
field: cloud_context
relationship: none
group_type: group
admin_label: ''
label: 'Cloud Provider Machine Name'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: cloud_config
entity_field: cloud_context
plugin_id: field
list_instances_cloud_config:
id: list_instances_cloud_config
table: cloud_config
field: list_instances_cloud_config
relationship: none
group_type: group
admin_label: ''
label: Instances
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
text: view
entity_type: cloud_config
plugin_id: cloud_list_instances
filters: { }
sorts: { }
title: 'Cloud Service Providers'
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- user.permissions
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: clouds
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- user.permissions
tags: { }
uuid: 1392c577-44a1-48e0-ba56-489873b9ebd1
langcode: en
status: true
dependencies:
module:
- cloud
- user
id: server_template_listing
label: 'Server Template Listing'
module: views
description: 'Listing page showing all server templates'
tag: ''
base_table: cloud_config_field_data
base_field: id
core: 8.x
display:
default:
display_plugin: default
id: default
display_title: Master
position: 0
display_options:
access:
type: perm
options:
perm: 'access dashboard'
cache:
type: tag
options: { }
query:
type: views_query
options:
disable_sql_rewrite: false
distinct: false
replica: false
query_comment: ''
query_tags: { }
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
pager:
type: mini
options:
items_per_page: 10
offset: 0
id: 0
total_pages: null
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
tags:
previous: ‹‹
next: ››
style:
type: table
row:
type: fields
fields:
name:
table: cloud_config_field_data
field: name
id: name
entity_type: null
entity_field: name
plugin_id: field
relationship: none
group_type: group
admin_label: ''
label: Name
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings: { }
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
cloud_context_1:
id: cloud_context_1
table: cloud_config_field_data
field: cloud_context
relationship: none
group_type: group
admin_label: ''
label: 'Cloud Provider Machine Name'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: cloud_config
entity_field: cloud_context
plugin_id: field
list_server_templates_cloud_config:
id: list_server_templates_cloud_config
table: cloud_config
field: list_server_templates_cloud_config
relationship: none
group_type: group
admin_label: ''
label: 'Server Templates'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
text: view
entity_type: cloud_config
plugin_id: cloud_list_templates
filters: { }
sorts: { }
title: 'Server Templates'
header: { }
footer: { }
empty: { }
relationships: { }
arguments: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- user.permissions
tags: { }
page_1:
display_plugin: page
id: page_1
display_title: Page
position: 1
display_options:
display_extenders: { }
path: clouds/design
cache_metadata:
max-age: -1
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- user.permissions
tags: { }
# Schema for the views plugins
views.field.cloud_list_instances:
type: views_field
label: 'Link to an instance list'
mapping:
text:
type: label
label: 'Text to display'
views.field.cloud_server_template_list:
type: views_field
label: 'Link to cloud server template list'
mapping:
text:
type: label
label: 'Text to display'
\ No newline at end of file
......@@ -96,4 +96,11 @@ class AwsCloudConfigPlugin extends PluginBase implements CloudConfigPluginInterf
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getInstanceCollectionTemplateName() {
return 'entity.aws_cloud_instance.collection';
}
}
\ No newline at end of file
......@@ -13,11 +13,27 @@ class CloudConfigViewsData extends EntityViewsData {
* {@inheritdoc}
*/
public function getViewsData() {
$entity_type_id = $this->entityType->id();
$data = parent::getViewsData();
// Additional information for Views integration, such as table joins, can be
// put here.
$data[$entity_type_id]['list_instances_' . $entity_type_id] = [
'field' => [
'title' => $this->t('Instances'),
'help' => $this->t('Provide a listing link to instances'),
'id' => 'cloud_list_instances',
],
];
if ($this->moduleHandler->moduleExists('cloud_server_template')) {
$data[$entity_type_id]['list_server_templates_' . $entity_type_id] = [
'field' => [
'title' => $this->t('Server Templates'),
'help' => $this->t('Provide a listing link to server template'),
'id' => 'cloud_list_templates',
],
];
}
return $data;
}
......
......@@ -31,4 +31,10 @@ interface CloudConfigPluginInterface {
*/
public function loadCredentials($cloud_context);
/**
* Return the name of the aws_cloud_instance collection template name
* @return string
*/
public function getInstanceCollectionTemplateName();
}
\ No newline at end of file
......@@ -153,4 +153,18 @@ class CloudConfigPluginManager extends DefaultPluginManager implements CloudConf
public function loadCredentials() {
return $this->plugin->loadCredentials($this->cloud_context);
}
/**
* {@inheritdoc}
*/
public function getInstanceCollectionTemplateName() {
return $this->plugin->getInstanceCollectionTemplateName();
}
/**
* {@inheritdoc}
*/
public function getServerTemplateCollectionName() {
return 'entity.cloud_server_template.collection.list_all.context';
}
}
......@@ -44,4 +44,16 @@ interface CloudConfigPluginManagerInterface extends PluginManagerInterface {
*/
public function loadCredentials();
/**
* Load routes for implementing class's instances
* @return String of template name
*/
public function getInstanceCollectionTemplateName();
/**
* Load route for server templates
* @return String of template name
*/
public function getServerTemplateCollectionName();
}
<?php
namespace Drupal\cloud\Plugin\views\field;
use Drupal\cloud\Plugin\CloudConfigPluginManagerInterface;
use Drupal\Core\Access\AccessManagerInterface;
use Drupal\Core\Url;
use Drupal\views\Plugin\views\field\LinkBase;
use Drupal\views\ResultRow;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Field handler to present a link to a list of instance
*
* @ingroup views_field_handlers
*
* @ViewsField("cloud_list_instances")
*/
class CloudInstanceListLink extends LinkBase {
/**
* CloudConfigPlugin
* @var \Drupal\cloud\Plugin\CloudConfigPluginManagerInterface
*/
protected $cloudConfigPluginManager;
/**
* Constructs a LinkBase object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Access\AccessManagerInterface $access_manager
* The access manager.
* @param \Drupal\cloud\Plugin\CloudConfigPluginManagerInterface $cloud_config_plugin_manager
* The cloud config plugin manager
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, AccessManagerInterface $access_manager, CloudConfigPluginManagerInterface $cloud_config_plugin_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $access_manager);
$this->cloudConfigPluginManager = $cloud_config_plugin_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('access_manager'),
$container->get('plugin.manager.cloud_config_plugin')
);
}
/**
* {@inhertdoc}
*/
protected function getUrlInfo(ResultRow $row) {
$this->cloudConfigPluginManager->setCloudContext($row->_entity->cloud_context());
$route = $this->cloudConfigPluginManager->getInstanceCollectionTemplateName();
return Url::fromRoute($route, ['cloud_context' => $row->_entity->cloud_context()]);
}
/**
* {@inheritdoc}
*/
protected function getDefaultLabel() {
return $this->t('view');
}
}
\ No newline at end of file
<?php
namespace Drupal\cloud\Plugin\views\field;
use Drupal\cloud\Plugin\CloudConfigPluginManagerInterface;
use Drupal\Core\Access\AccessManagerInterface;
use Drupal\Core\Url;
use Drupal\views\Plugin\views\field\LinkBase;
use Drupal\views\ResultRow;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Field handler to present a link to a list of server templates
*
* @ingroup views_field_handlers
*
* @ViewsField("cloud_list_templates")
*/
class ServerTemplateListLink extends LinkBase {
/**
* CloudConfigPlugin
* @var \Drupal\cloud\Plugin\CloudConfigPluginManagerInterface
*/
protected $cloudConfigPluginManager;
/**
* Constructs a LinkBase object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Access\AccessManagerInterface $access_manager
* The access manager.
* @param \Drupal\cloud\Plugin\CloudConfigPluginManagerInterface $cloud_config_plugin_manager
* The cloud config plugin manager
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, AccessManagerInterface $access_manager, CloudConfigPluginManagerInterface $cloud_config_plugin_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $access_manager);
$this->cloudConfigPluginManager = $cloud_config_plugin_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('access_manager'),
$container->get('plugin.manager.cloud_config_plugin')
);
}
protected function getUrlInfo(ResultRow $row) {
$this->cloudConfigPluginManager->setCloudContext($row->_entity->cloud_context());
$route = $this->cloudConfigPluginManager->getServerTemplateCollectionName();
return Url::fromRoute($route, ['cloud_context' => $row->_entity->cloud_context()]);
}
/**
* {@inheritdoc}
*/
protected function getDefaultLabel() {
return $this->t('view');
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment