Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Molkobain committed Jul 22, 2019
2 parents da0c34b + a4bfc18 commit 47bc942
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 8 deletions.
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [1.5.0] - 2019-07-22
### Added
- Include "Molkobain's newsroom provider" module to keep administrators informed on new extensions and updates (can be disabled in the conf. file) (iTop 2.6+ only)

## [1.4.1] - 2019-07-02
### Changed
- Show explicit help cursor on tooltips
- Fix elements displaying under the slot when height greater than 1U

## [1.4.0] - 2019-06-24
### Added
- Add support for PDU in racks and enclosures

### Changed
- Improve rack proportions to be more realistic and fit a 42U in a Full HD screen
- Fix UI glitches on small screens

## [1.3.1] - 2019-06-19
### Changed
- Change compatibility to iTop 2.4+
- Fix glitch in elements' tooltip header when name is too long
- Fix minor UI glitches

## [1.3.0] - 2019-05-26
### Added
- Complete dutch translations thanks to @jbostoen
- Add collapse / expand toggler on unmounted element panels

### Changed
- Fix default background color on devices
- Fix legend sorted by class names
- Fix HTML attributes in element's tooltip

## [1.2.0] - 2019-03-28
### Added
- Move object's rack_units attribute with position attributes in both properties and list display
- Improve UI when no element attached to rack/enclosure
- Improve extensibility

## [1.1.1] - 2019-03-05
### Changed
- Fix obsolete devices displayed even with option disabled #3

## [1.1.0] - 2019-02-03
### Added
- Add option to toggle obsolete devices

### Changed
- Fix devices positioned off host's limits

## [1.0.0] - 2019-01-07
### Added
- Initial release

[Unreleased]: https://github.com/Molkobain/itop-datacenter-view/compare/v1.5.0...HEAD
[1.5.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.5.0
[1.4.1]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.4.1
[1.4.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.4.0
[1.3.1]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.3.1
[1.3.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.3.0
[1.2.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.2.0
[1.1.1]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.1.1
[1.1.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.1.0
[1.0.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.0.0
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [Installation](#installation)
* [Configuration](#configuration)
* [How to](#how-to)
* [Change log](CHANGELOG.md)

## Description
Easily manage & visualize your racks, enclosures and datacenter devices.
Expand Down Expand Up @@ -87,14 +88,15 @@ Manage devices with non standard size / positioning such as USB drives, vertical

## Online demo
You can try this extension on the online demo. There are already some racks, enclosures and devices mounted as an example. Just click on the links below to access it:
* [Administration console](http://mbc.itop.molkobain.com/pages/UI.php?operation=details&class=Rack&id=15&c[menu]=SearchCIs&auth_user=admin&auth_pwd=admin#tabbedContent_0=7) (admin / admin)
* [Administration console](http://mbc.itop.molkobain.com/pages/UI.php?operation=details&class=Rack&id=15&c[menu]=SearchCIs&auth_user=admin&auth_pwd=admin#tabbedContent_0=8) (admin / admin)

## Compatibility
Compatible with iTop 2.4+

## Dependencies
* Module `molkobain-handy-framework/1.2.3`
* Module `molkobain-console-tooltips/1.0.2`
* Module `molkobain-newsroom-provider/1.0.0`

*Note: All dependencies are included in the `dist/` folder, so all you need to do is follow the installation section below.*

Expand Down
6 changes: 3 additions & 3 deletions dist/molkobain-datacenter-view/extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<author><![CDATA[Guillaume Lajarige]]></author>
<label><![CDATA[Datacenter view]]></label>
<description><![CDATA[Visual representation of racks, enclosures & devices]]></description>
<version>1.4.1</version>
<release_date>2019-07-02</release_date>
<version_description><![CDATA[Add unmounted elements count on icon, plus minor UI fixes]]></version_description>
<version>1.5.0</version>
<release_date>2019-07-22</release_date>
<version_description><![CDATA[Include "Molkobain's newsroom provider" module to keep administrators informed on new extensions and updates (can be disabled in the conf. file) (iTop 2.6+ only)]]></version_description>
<itop_version_min>2.4.0</itop_version_min>
<status>stable</status>
<mandatory>false</mandatory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
/** @noinspection PhpUnhandledExceptionInspection */
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'molkobain-datacenter-view/1.4.1', array(
'molkobain-datacenter-view/1.5.0', array(
// Identification
'label' => 'Datacenter view (racks visual representation)',
'category' => 'business',

// Setup
'dependencies' => array(
'itop-datacenter-mgmt/2.2.0||itop-config-mgmt/2.2.0||itop-storage-mgmt/2.2.0',
'molkobain-handy-framework/1.2.3',
'molkobain-handy-framework/1.2.4',
'molkobain-console-tooltips/1.0.2',
'molkobain-newsroom-provider/1.0.0',
),
'mandatory' => false,
'visible' => true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/**
* Copyright (c) 2015 - 2019 Molkobain.
*
* This file is part of licensed extension.
*
* Use of this extension is bound by the license you purchased. A license grants you a non-exclusive and non-transferable right to use and incorporate the item in your personal or commercial projects. There are several licenses available (see https://www.molkobain.com/usage-licenses/ for more informations)
*/

namespace Molkobain\iTop\Extension\NewsroomProvider\Common\Helper;

use Molkobain\iTop\Extension\HandyFramework\Common\Helper\ConfigHelper as BaseConfigHelper;
use UserRights;

/**
* Class ConfigHelper
*
* @package Molkobain\iTop\Extension\NewsroomProvider\Common\Helper
* @since v1.0.0
*/
class ConfigHelper extends BaseConfigHelper
{
const MODULE_NAME = 'molkobain-datacenter-view';
const API_VERSION = '1.0';

const SETTING_CONST_FQCN = 'Molkobain\\iTop\\Extension\\NewsroomProvider\\Common\\Helper\\ConfigHelper';

// Note: Mind to update defaults values in the module file when changing those default values.
const DEFAULT_SETTING_DEBUG = false;
const DEFAULT_SETTING_ENDPOINT = 'https://www.molkobain.com/support/pages/exec.php?exec_module=molkobain-newsroom-editor&exec_page=index.php';

/**
* Returns true if the debug option is enabled
*
* @return boolean
*/
public static function IsDebugEnabled()
{
return static::GetSetting('debug');
}

/**
* Returns the version of the API called on the remote server
*
* @return string
*/
public static function GetVersion()
{
return static::API_VERSION;
}

/**
* Returns an hash to identify the current user
*
* Note: User ID is sent as a non-reversible hash to ensure user's privacy
*
* @return string
*/
public static function GetUserHash()
{
$sUserId = UserRights::GetUserId();

// Prepare a unique hash to identify users across all iTops in order to be able for them to tell which news they have already read.
return hash('fnv1a64', $sUserId);
}

/**
* Returns an hash to identify the current iTop instance
*
* Note: iTop UUID is sent as a non-reversible hash to ensure user's privacy
*
* @return string
*/
public static function GetInstanceHash()
{
$sITopUUID = (string) trim(@file_get_contents(APPROOT . 'data/instance.txt'), "{} \n");

// Note: We don't retrieve DB UUID for now as it is not of any use for now.
return hash('fnv1a64', $sITopUUID);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?php
/**
* Copyright (c) 2015 - 2019 Molkobain.
*
* This file is part of licensed extension.
*
* Use of this extension is bound by the license you purchased. A license grants you a non-exclusive and non-transferable right to use and incorporate the item in your personal or commercial projects. There are several licenses available (see https://www.molkobain.com/usage-licenses/ for more informations)
*/

namespace Molkobain\iTop\Extension\NewsroomProvider\Core;

use Molkobain\iTop\Extension\NewsroomProvider\Common\Helper\ConfigHelper;
use NewsroomProviderBase;
use User;
use UserRights;

// Protection for iTop older than 2.6.0 when the extension is packaged with another.
if(class_exists('NewsroomProviderBase'))
{
/**
* Class MolkobainNewsroomProvider
*
* Note: This is greatly inspired by the itop-hub-connector module.
*
* @package Molkobain\iTop\Extension\NewsroomProvider\Core
* @since v1.0.0
*/
class MolkobainNewsroomProvider extends NewsroomProviderBase
{
/**
* @inheritDoc
*/
public function GetTTL()
{
// Update every hour
return 60 * 60;
}

/**
* @inheritDoc
*/
public function IsApplicable(User $oUser = null)
{
if(!ConfigHelper::IsEnabled())
{
return false;
}
elseif($oUser !== null)
{
return UserRights::IsAdministrator($oUser);
}
else
{
return false;
}

}

/**
* @inheritDoc
*/
public function GetLabel()
{
return 'Molkobain I/O';
}

/**
* @inheritDoc
*/
public function GetMarkAllAsReadURL()
{
return $this->MakeUrl('mark_all_as_read');
}

/**
* @inheritDoc
*/
public function GetFetchURL()
{
return $this->MakeUrl('fetch');
}

/**
* @inheritDoc
*/
public function GetViewAllURL()
{
return $this->MakeUrl('view_all');
}

/**
* @inheritDoc
*
* Note: Placeholders are only used in the news' URL
*/
public function GetPlaceholders()
{
$aPlaceholders = array();

$oUser = UserRights::GetUserObject();
if($oUser !== null)
{
$aPlaceholders['%user_login%'] = $oUser->Get('login');
$aPlaceholders['%user_hash%'] = ConfigHelper::GetUserHash();
}

$oContact = UserRights::GetContactObject();
if($oContact !== null)
{
$aPlaceholders['%contact_firstname%'] = $oContact->Get('first_name');
$aPlaceholders['%contact_lastname%'] = $oContact->Get('name');
$aPlaceholders['%contact_email%'] = $oContact->Get('email');
$aPlaceholders['%contact_organization%'] = $oContact->Get('org_id_friendlyname');
$aPlaceholders['%contact_location%'] = $oContact->Get('location_id_friendlyname');
}
else
{
$aPlaceholders['%contact_firstname%'] = '';
$aPlaceholders['%contact_lastname%'] = '';
$aPlaceholders['%contact_email%'] = '';
$aPlaceholders['%contact_organization%'] = '';
$aPlaceholders['%contact_location%'] = '';
}

return $aPlaceholders;
}

/**
* @inheritDoc
*/
public function GetPreferencesUrl()
{
return null;
}

/**
* Returns an URL to the news editor for the $sOperation and current user
*
* @param string $sOperation
*
* @return string
*/
private function MakeUrl($sOperation)
{
return ConfigHelper::GetSetting('endpoint')
. '&operation=' . $sOperation
. '&version=' . ConfigHelper::GetVersion()
. '&user=' . urlencode(ConfigHelper::GetUserHash())
. '&instance=' . urlencode(ConfigHelper::GetInstanceHash());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
/**
* Copyright (c) 2015 - 2019 Molkobain.
*
* This file is part of licensed extension.
*
* Use of this extension is bound by the license you purchased. A license grants you a non-exclusive and non-transferable right to use and incorporate the item in your personal or commercial projects. There are several licenses available (see https://www.molkobain.com/usage-licenses/ for more informations)
*/

Dict::Add('EN US', 'English', 'English', array());
Loading

0 comments on commit 47bc942

Please sign in to comment.