位置分层

名称:位置分层

描述:在分层中组织您的位置并检索位于位置树中的配置项

版本:1.0.1

发布:2019-05-16

itop-version-min:2.4.0

码:组合位置-分层

状态:稳定

对于版本低于2.7.0的iTop产品,当您通过ITSM Designer添加此扩展时,现有位置将失去其友好名称。运行安装程序以解决此问题。

一旦安装了该扩展程序,您的位置将被这些字段所丰富:

  • 一种类型,可以是以下类型之一:站点,建筑物,地板,房间和瓷砖(以降序排列)(默认值:站点)
  • 一个可选的父位置,可以在具有更高类型的位置中选择。
  • 一个标志,以从其位置父继承地址,邮政编码,站点和国家(地区)或定义自己的标志(默认值:继承)

特征

位置父级

  • 父位置是可选的
  • 它可以属于任何组织,并不限于与编辑位置相同的组织。
  • 父位置的类型应大于或等于当前位置类型。例如。一个房间可以有一个父的建筑物,也可以有一个站点甚至另一个房间

地点名称

  • 位置的全名是根据站点分层计算的,逻辑如下:父级名称,用定义的参数分隔,并从上到下依次排序。
  • 此全名在以下情况下计算
    • 设置或修改了位置父
    • 名称被修改
  • 修改全名后,将重新计算所有子位置的全名。
  • 名称的分隔符默认情况下是2个空格'-'之间的破折号,但是可以在模块配置参数中进行更改。

所在地地址

标记地址?如果应该从父位置自动复制地址,邮政编码,城市和国家/地区,则允许说出一个子位置,这样可以避免重复输入和如果以后修改父地址时出现不一致的情况。

  • 如果定义了父,并且保留了从父复制的标志(如果已定义),则您在地址,邮政编码,城市和国家/地区中所做的任何输入都将被父中的值覆盖。
  • 如果未定义父,则该标志无效。

子位置

一个新的选项卡显示当前位置的直接子位置

搜索的物理设备或联系人

当搜索位于给定位置上的物理设备(或联系人)时,iTop现在将返回位于该位置或分层中以下任何子位置上的所有物理设备(或联系人)。

位置和竖井

由于您可以在属于不同组织的站点下定义子站点,因此您可以对配置项进行细分,将它们放置在其筒仓中的某个位置,并且仍然能够查看配置项站点或任何子位置上的所有组织的所有配置项分层。

修订记录

日期版本描述
2019-05-161.0.1修复PHP警告“缺少第三个参数GetAttributeFlags”
2019-02-271.0.0首批正式版本
2018-12-240.1.0第一个版本

局限性

  • 它提出了五种确切的位置类型,以使您需要自定义的位置更少或更多Q&A.
  • 名称顺序为“父在子代之前”,并且只能通过自定义更改。
  • 由于此扩展完全重新定义了Location表示,因此它可能与其他扩展冲突,后者也会修改Location类。

如果更改了位置类型,则不会控制的子位置类型仍与类型顺序对齐。
例如,如果您在变更的“站点”位置下有“建筑物”子位置,变成“房间”类型的位置,则“建筑物”仍将保留在“房间”下面,这也不合逻辑。如果您修改了其中一个“建筑物”并删除了“房间”父,则一旦提交,便无法将其放回原处。

要求

在iTop上有一个Location类,而不是其他扩展自定义的。

安装

使用标准安装流程 对于此扩展。

如果您是通过ITSM设计器中的“从生产环境移至生产版本”在具有已创建位置的iTop上安装此扩展程序的,则此后必须手动运行安装程序,否则您的位置将显示为无友好名称

配置

安装新模块后,编辑配置文件config-itop.php并查找以下新部分:

  'combodo-location-hierarchy' =>  (
                'separator' => ' - ',
        ),

用法

这是位置列表的样子

https://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-list.png

位置及其子位置的详细信息:

https://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-view.png

编辑父位置,仅限于较高类型级别的位置:

https://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-edit.png

搜索位于某个位置或其下方任何位置的PhysicalDevices:

https://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-searchcis.png

问题和答案

问题:位置类型需要不同的值,我可以变更吗?
答:是的,您可以通过扩展来做到这一点,该扩展会修改字典条目

<dictionaries>
  <dictionary id="EN US" _delta="define_if_not_exist">
    <entries>
      <entry id="Class:Location/Attribute:type/Value:1" _delta="force"><![CDATA[Campus]]></entry>
      <entry id="Class:Location/Attribute:type/Value:2" _delta="force"><![CDATA[Site]]></entry>
      <entry id="Class:Location/Attribute:type/Value:3" _delta="force"><![CDATA[Tower]]></entry>
      <entry id="Class:Location/Attribute:type/Value:4" _delta="force"><![CDATA[Floor]]></entry>
      <entry id="Class:Location/Attribute:type/Value:5" _delta="force"><![CDATA[Room]]></entry>        
    <...>

问题:我希望少于(或多于)5个级别的位置,我该怎么办?
答:是的,您可以通过扩展名来执行此操作,该扩展名将修改类型字段的可能值。

<itop_design>
  <classes>
    <class id="Location">
      <fields>
        <field id="type" _delta="must_exist">
          <values _delta="redefine">
            <value id="1">1</value>
            <value id="2">2</value>
            <value id="3">3</value>
            <value id="4">4</value>
          </values>
        </field>
      <...>

如果您添加级别,请不要忘记为新创建的级别添加字典条目。以降序使用数值(父位置的价值比其子位置低),否则您将破坏建议的父逻辑。

问题:是否可以防止提议与父相同类型的位置?
答:是的,您可以通过扩展名来执行此操作,该扩展名会修改父过滤器

<itop_design>
  <classes>
    <class id="Location">
      <fields>
        <field id="parent_id" _delta="must_exist">
          <filter _delta="redefine">
            <![CDATA[SELECT Location WHERE (type < :this->type)]]>
          </filter>
        </field>
      <...>

问题:我发现一个楼层位置是站点位置的父,这怎么可能?
答:修改位置的类型时,它不会检查也不会修改您所修改的位置的上方和下方的位置的类型,因此有可能以这种方式破坏分层逻辑。您可以构建和审计规则来检查此类意外情况:

https://www.itophub.io/wiki/media?w=400&tok=9b202b&media=extensions%3Alocation-hierarchy-audit-category.png

https://www.itophub.io/wiki/media?w=500&tok=83b316&media=extensions%3Alocation-hierarchy-audit-rule.png

SELECT Location AS p JOIN Location AS c ON c.parent_id BELOW p.id WHERE p.type > c.type

问:我希望Location的全名使用分层的相反顺序吗?
答案:检查定位方法UpdateFromParent和变更此行:

$this->Set('fullname', $sParentName.$sSeparator.$sName);

to replace by this one:

$this->Set('fullname', $sName.$sSeparator.$sParentName);

原贴链接:https://www.itophub.io/wiki/page?id=extensions%3Acombodo-location-hierarchy


Location Hierarchy

name:
Location Hierarchy
description:
Organize your locations in hierarchy and retrieve CIs located on a location tree
version:
1.0.1
release:
2019-05-16
itop-version-min:
2.4.0
code:
combodo-location-hierarchy
state:
Stable

With iTop products older than 2.7.0, when you add this extension through the ITSM Designer, existing Locations will loose their friendlyname. Run a Setup to fix this.

Once you have installed this extension, your locations will be enriched with those fields:

  • type, which can be one of those: Site, Building, Floor, Room and Tile in decreasing order (default: Site)

  • an optional parent location, which is can be chosen among Locations with an higher type.

  • a flag to either inherit Address, Zip, Site and Country from its location parent or define its own (default: inherit)

Features

Location parent

  • The parent location is optional

  • It can belong to any organization, it's not limited to the same organization as the edited location.

  • The parent location is expected to be of a type above or equal to the current location type. Eg. a Room can have a Building as parent, but also a Site or even another Room

Location name

  • The full name of a Location is calculated based on the site hierarchy, with the following logic: name of parents, separated with a defined parameter and ordered from top to current location name.

  • This full name is computed when

    •  

    location parent is set or modified

    •  

    name is modified

  • When full name is modified, all sub-locations full name are recomputed.

  • The separator of names is by default a dash between 2 white-spaces ' - ', but it can be changed in the module configuration parameter.

Location address

A flag Address ? allow to say for a child location if the Address, Zip, City and Country should be automatically copied from the parent location, thus avoiding duplicate entries and incoherence if parent address is modified later.

  • If you defined a parent and leave the flag to copied from parent if defined, then any entry you do in Address, Zip, City and Country will be overwritten by values from the parent.

  • If no parent is defined, that flag has no effect.

Sub-location

A new tab display the direct sub-locations of the current location

Search of Physical Devices or Contacts

When searching for Physical Devices (or Contacts) located on a given Location, iTop will now return all Physical Devices (or Contacts) located on that Location or on any child location below in the hierarchy.

Location and silos

As you can define sub-sites under a site belonging to different organizations, you can segment your CIs, putting them on a Location within their silo and still be able to see all CIs from all organizations located on the parent site or any sub-locations down the hierarchy.

Revision History

DateVersionDescription
2019-05-161.0.1Fix PHP warning “missing 3rd parameter GetAttributeFlags”
2019-02-271.0.0First official version
2018-12-240.1.0First version

Limitations

  • It proposes exactly five types of Location, to have less or more you need to customize Q&A.

  • Name ordering is “parent before child” and can be changed only by customization.

  • As the Location presentation is fully redefined by this extension, it can conflict with other extensions which would modify as well the Location class.

If a location type is changed, there is no control that its children locations types are still aligned with the types order.
Example if you change a 'Site' location having 'Buildings' sub_locations under it, into a 'Room' type of Location, then the 'Buildings' would still remain under the 'Room' also it's not logical. If you modify one of those 'Building' and remove the 'Room' parent, once submitted, it won't be possible to put it back.

Requirements

Have a Location class on your iTop, not customized by other extensions.

Installation

Use the Standard installation process for this extension.

If you install this extension through a Move To Production from the ITSM Designer on an iTop with already created Locations, then you must run a Setup manually after, otherwise your Locations would appear with no friendlyname

Configuration

Once the new module has been installed, edit the configuration file config-itop.php and look for the following new section:

  'combodo-location-hierarchy' =>  (
                'separator' => ' - ',
        ),

Usage

This is how a list of locations will look likehttps://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-list.png

The details of a Location with its sub-locations:https://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-view.png

Editing the parent location, limited to those of a higher Type level:https://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-edit.png

Searching for PhysicalDevices located on a Location or any location below that one:https://www.itophub.io/wiki/media?media=extensions%3Alocation-hierarchy-searchcis.png

Questions & Answers

Question: I need different values for Location types, can I change them?
Answer: Yes, you can do this through an extension which would modify the dictionary entries

<dictionaries>
  <dictionary id="EN US" _delta="define_if_not_exist">
    <entries>
      <entry id="Class:Location/Attribute:type/Value:1" _delta="force"><![CDATA[Campus]]></entry>
      <entry id="Class:Location/Attribute:type/Value:2" _delta="force"><![CDATA[Site]]></entry>
      <entry id="Class:Location/Attribute:type/Value:3" _delta="force"><![CDATA[Tower]]></entry>
      <entry id="Class:Location/Attribute:type/Value:4" _delta="force"><![CDATA[Floor]]></entry>
      <entry id="Class:Location/Attribute:type/Value:5" _delta="force"><![CDATA[Room]]></entry>        
    <...>

Question: I would like less (or more) than 5 level of Locations, how can I do?
Answer: Yes, you can do this through an extension which would modify the possible values for type field.

<itop_design>
  <classes>
    <class id="Location">
      <fields>
        <field id="type" _delta="must_exist">
          <values _delta="redefine">
            <value id="1">1</value>
            <value id="2">2</value>
            <value id="3">3</value>
            <value id="4">4</value>
          </values>
        </field>
      <...>

If you add level don't forget to add also dictionary entries for the newly created level. Use numeric values in decreasing order (parent location having a lower value than its sub-locations) or you will break the proposed parent logic.

Question: Can I prevent location of a same type to be proposed as parent?
Answer: Yes, you can do this through an extension which would modify the parent filter

<itop_design>
  <classes>
    <class id="Location">
      <fields>
        <field id="parent_id" _delta="must_exist">
          <filter _delta="redefine">
            <![CDATA[SELECT Location WHERE (type < :this->type)]]>
          </filter>
        </field>
      <...>

Question: I have found a floor location which is the parent of a site location, how is it possible?
Answer: When you modify the type of a location, it does not check nor modify the types of the locations above and under the one you modify, so it is possible to break the hierarchy logic this way. You can build an audit rule to check such unexpected situation:https://www.itophub.io/wiki/media?w=400&tok=9b202b&media=extensions%3Alocation-hierarchy-audit-category.pnghttps://www.itophub.io/wiki/media?w=500&tok=83b316&media=extensions%3Alocation-hierarchy-audit-rule.png

SELECT Location AS p JOIN Location AS c ON c.parent_id BELOW p.id WHERE p.type > c.type

Question: I want that the fullname of Location uses the reverse order of the hierarchy?
Answer: Check the Location method UpdateFromParent and change this line:

$this->Set('fullname', $sParentName.$sSeparator.$sName);

to replace by this one:

$this->Set('fullname', $sName.$sSeparator.$sParentName);
标签:
由 superadmin 在 2020/08/27, 16:08 创建
    

需要帮助?

如果您需要有关XWiki的帮助,可以联系:

深圳市艾拓先锋企业管理咨询有限公司