Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
Replaced policy events log with a view.
Browse files Browse the repository at this point in the history
Added date handlers for policy and policy log date fields.
Cleaned up log types.
Added administrative view to give overview of all policy log entries.
  • Loading branch information
ivangrynenko committed Dec 12, 2015
1 parent aaab3f4 commit 17b39cb
Show file tree
Hide file tree
Showing 18 changed files with 872 additions and 304 deletions.
54 changes: 29 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
# CHANGELOG #

### 1.01 ###
2015-12-08
- Template improvements
- Added bypass to the server snapshot by an automated policy when the VM is down.
- Fixed number of tests.
- Added missing permission, that was preventing administrator from accessing
snapshot policy pages.
- Updated snapshot policy snapshots selector to be server max less 5.
- Fixed Snapshots page layout bug in mobile devices preventing snapshot actions.
- Other bug fixes and improvements.
xs 7.x-1.3, 2015-12-12
----------------------
[] ig: Replaced policy events log with a view.
[] ig: Added date handlers for policy and policy log date fields.
[] ig: Cleaned up log types.
[] ig: Added administrative view to give overview of all policy log entries.

### 1.0 ###
2015-12-05
xs 7.x-1.1, 2015-12-08
----------------------
[] ig: Template improvements
[] ig: Added bypass to the server snapshot by an automated policy when the VM is down.
[] ig: Fixed number of tests.
[] ig: Added missing permission, that was preventing administrator from accessing
snapshot policy pages.
[] ig: Updated snapshot policy snapshots selector to be server max less 5.
[] ig: Fixed Snapshots page layout bug in mobile devices preventing snapshot actions.
[] ig: Other bug fixes and improvements.

- Automated snapshot policies as entities.
- Entity Policy type.
- Entity Policy log.
- One policy per server.
- Ability to store policy events into designated log.
- Automated cron job that manages snapshot creation and removal.
xs 7.x-1.0, 2015-12-05
----------------------
[] ig: Automated snapshot policies as entities.
[] ig: Entity Policy type.
[] ig: Entity Policy log.
[] ig: One policy per server.
[] ig: Ability to store policy events into designated log.
[] ig: Automated cron job that manages snapshot creation and removal.

### RC ###
2015-11-22

Official first public release.
- VM content type available.
- Ability to allocate VM to Drupal users and add Dom-U uuid.
- Ability to create manual snapshots.
xs 7.x-1.x-RC2, 2015-11-12
--------------------------
[] ig: VM content type available.
[] ig: Ability to allocate VM to Drupal users and add Dom-U uuid.
[] ig: Ability to create manual snapshots.
6 changes: 3 additions & 3 deletions includes/xs.snapshots.inc
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ function xs_get_vm_snapshots_from_node($node) {
function xs_get_vm_snapshots_count_from_node($node) {
$vm = xs_get_vm_by_node($node);

return !empty($vm['snapshots']) ? count($vm['snapshots']) : FALSE;
return !empty($vm['snapshots']) ? count($vm['snapshots']) : 0;
}

/**
* Gets the snapshots limit for the VPS.
*
* @param object $node
* Drupal node object.
* @param object|int $node
* Drupal node object or nid.
*
* @return int|bool
* Number of snapshots or FALSE.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
</div>

<div class="col-md-8">
<h5>Recent Policy Events</h5>
<h3>Recent Policy Events</h3>
<?php print $policy_log_table_exposed_form; ?>
<?php print $policy_log_table; ?>
</div>

Expand Down
8 changes: 4 additions & 4 deletions modules/xs_snapshot_policy/theme/xs_snapshot_policy.theme.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function xs_snapshot_policy_output_preprocess(&$variables) {
$variables['policy_snapshots'] = '';
$variables['policy_type'] = '';
$variables['policies_exceeded'] = 'N/A';
$variables['policy_log_table'] = '';

$author_uid = xs_get_vps_owner_uid($variables['node']);
$policy = xs_snapshot_policy_get_policies_per_user($author_uid, $variables['node']->nid);
Expand All @@ -36,7 +35,7 @@ function xs_snapshot_policy_output_preprocess(&$variables) {
$variables['policy_snapshots'] = $policy->snapshots;
$policy_type = xs_snapshot_policy_type_load($policy->type_id);
$variables['policy_type'] = $policy_type->label;
$variables['policy_last_run'] = theme('html_tag', array(
$variables['policy_last_run'] = !empty($policy->last_run) ? theme('html_tag', array(
'element' => array(
'#tag' => 'span',
'#attributes' => array(
Expand All @@ -49,11 +48,12 @@ function xs_snapshot_policy_output_preprocess(&$variables) {
'#value_prefix' => '<span class="glyphicon glyphicon-time" aria-hidden="true"></span> ',
),
)
);
) : t('Never');
$variables['policies_exceeded'] = xs_snapshot_policy_get_policies_count_per_user($author_uid, $variables['node']->nid) >= XS_SNAPSHOT_MAX_POLICIES_PER_USER;

$variables['policy_log_table'] = theme('xs_snapshot_policy_log', array('policy' => $policy));
}

$variables['policy_log_table'] = views_embed_view('xs_policy_log_runs_per_user', 'page_2', $variables['node']->nid);
$spid = !empty($policy->spid) ? $policy->spid : NULL;
$policy_form = drupal_get_form('xs_snapshot_policy_form', $variables['node']->nid, $spid);
$variables['policy_form'] = drupal_render($policy_form);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/**
* @file
* This template is used to print a single field in a view.
*
* It is not actually used in default Views, as this is registered as a theme
* function which has better performance. For single overrides, the template is
* perfectly okay.
*
* Variables available:
* - $view: The view object
* - $field: The field handler object that can process the input
* - $row: The raw SQL result that can be used
* - $output: The processed output that will normally be used.
*
* When fetching output from the $row, this construct should be used:
* $data = $row->{$field->field_alias}
*
* The above will guarantee that you'll always get the correct data,
* regardless of any changes in the aliasing that might happen if
* the view is modified.
*/
?>
<?php print $output; ?>
1 change: 1 addition & 0 deletions modules/xs_snapshot_policy/xs_snapshot_policy.info
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ files[] = xs_snapshot_policy.controller.inc
files[] = xs_snapshot_policy.admin.inc
files[] = xs_snapshot_policy.pages.inc
files[] = xs_snapshot_policy.views_default.inc
files[] = xs_snapshot_policy.views.inc
files[] = tests/xs_snapshot_policy.test
Loading

0 comments on commit 17b39cb

Please sign in to comment.