Commit ce2ba1b1 authored by Dmitry Volodin's avatar Dmitry Volodin
Browse files

New collection synching scheme

--HG--
branch : feature/inventory
parent 2b1c77c0
......@@ -58,9 +58,9 @@ Ext.define("NOC.inv.modelinterface.Application", {
allowBlank: false
},
{
name: "is_builtin",
xtype: "checkboxfield",
boxLabel: "Is Builtin"
name: "uuid",
xtype: "displayfield",
fieldLabel: "UUID"
},
{
name: "description",
......
......@@ -17,7 +17,8 @@ Ext.define("NOC.inv.modelinterface.Model", {
},
{
name: "is_builtin",
type: "boolean"
type: "boolean",
persist: false
},
{
name: "description",
......@@ -27,6 +28,11 @@ Ext.define("NOC.inv.modelinterface.Model", {
name: "name",
type: "string"
},
{
name: "uuid",
type: "string",
persist: false
},
{
name: "attrs",
type: "auto"
......
......@@ -9,6 +9,7 @@
## NOC modules
from noc.lib.app import ExtDocApplication, view
from noc.inv.models.modelinterface import ModelInterface
from noc.main.models.collectioncache import CollectionCache
class ModelInterfaceApplication(ExtDocApplication):
......@@ -20,6 +21,9 @@ class ModelInterfaceApplication(ExtDocApplication):
model = ModelInterface
query_fields = ["name__icontains", "description__icontains"]
def field_is_builtin(self, o):
return bool(CollectionCache.objects.filter(uuid=o.uuid))
@view(url="^(?P<id>[0-9a-f]{24})/json/$", method=["GET"],
access="read", api=True)
def api_json(self, request, id):
......
......@@ -18,17 +18,17 @@ Ext.define("NOC.inv.vendor.Application", {
dataIndex: "name",
width: 200
},
{
text: "Builtin",
dataIndex: "is_builtin",
renderer: NOC.render.Bool,
width: 50
},
{
text: "Code",
dataIndex: "code",
width: 100
},
{
text: "Builtin",
dataIndex: "is_builtin",
width: 30,
renderer: NOC.render.Bool
},
{
text: "Site",
dataIndex: "site",
......@@ -44,9 +44,9 @@ Ext.define("NOC.inv.vendor.Application", {
allowBlank: false
},
{
name: "is_builtin",
xtype: "checkboxfield",
boxLabel: "Is Builtin"
name: "uuid",
xtype: "displayfield",
fieldLabel: "UUID"
},
{
name: "code",
......@@ -61,13 +61,6 @@ Ext.define("NOC.inv.vendor.Application", {
allowBlank: false
}
],
filters: [
{
title: "By Is Builtin",
name: "is_builtin",
ftype: "boolean"
}
],
//
initComponent: function() {
var me = this;
......
......@@ -24,13 +24,18 @@ Ext.define("NOC.inv.vendor.Model", {
type: "string"
},
{
name: "is_builtin",
type: "boolean",
defaultValue: false
name: "uuid",
type: "string",
persist: false
},
{
name: "site",
type: "string"
},
{
name: "is_builtin",
type: "boolean",
persist: false
}
]
});
......@@ -9,6 +9,7 @@
## NOC modules
from noc.lib.app import ExtDocApplication, view
from noc.inv.models.vendor import Vendor
from noc.main.models.collectioncache import CollectionCache
class VendorApplication(ExtDocApplication):
......@@ -18,7 +19,12 @@ class VendorApplication(ExtDocApplication):
title = "Vendor"
menu = "Setup | Vendors"
model = Vendor
query_fields = ["name__icontains", "site__icontains"]
query_fields = [
"name__icontains", "code__icontains", "site__icontains"
]
def field_is_builtin(self, o):
return bool(CollectionCache.objects.filter(uuid=o.uuid))
@view(url="^(?P<id>[0-9a-f]{24})/json/$", method=["GET"],
access="read", api=True)
......
[
{
"name": "airflow",
"description": "Air from from cold intake to host exhaust",
"attrs": [
{
"name": "exhaust",
"type": "str",
"description": "Hot exhaust direction",
"required": true,
"is_const": true
},
{
"name": "intake",
"type": "str",
"description": "Cold intake direction",
"required": true,
"is_const": true
}
]
}
]
{
"name": "airflow",
"uuid": "f7a27faf-3b5d-45a6-b3f3-bedf20ea3337",
"description": "Air from from cold intake to host exhaust",
"attrs": [
{
"name": "exhaust",
"type": "str",
"description": "Hot exhaust direction",
"required": true,
"is_const": true
},
{
"name": "intake",
"type": "str",
"description": "Cold intake direction",
"required": true,
"is_const": true
}
]
}
[
{
"name": "asset",
"description": "Asset management interface holding part numbers, serial numbers and asset numbers",
"attrs": [
{
"name": "part_no0",
"type": "str",
"description": "Part number",
"required": true,
"is_const": true
},
{
"name": "part_no1",
"type": "str",
"description": "Alternative part number",
"required": false,
"is_const": true
},
{
"name": "part_no2",
"type": "str",
"description": "Alternative part number",
"required": false,
"is_const": true
},
{
"name": "part_no3",
"type": "str",
"description": "Alternative part number",
"required": false,
"is_const": true
},
{
"name": "order_part_no0",
"type": "str",
"description": "Ordering part number",
"required": false,
"is_const": true
},
{
"name": "order_part_no1",
"type": "str",
"description": "Alternative ordering part number",
"required": false,
"is_const": true
},
{
"name": "serial",
"type": "str",
"description": "Serial Number",
"required": false,
"is_const": false
},
{
"name": "asset_no",
"type": "str",
"description": "Asset number",
"required": false,
"is_const": false
},
{
"name": "revision",
"type": "str",
"description": "Revision id",
"required": false,
"is_const": false
}
]
}
]
{
"name": "asset",
"uuid": "e8e9a35f-d051-4b11-8e0b-0d14dcbdffb1",
"description": "Asset management interface holding part numbers, serial numbers and asset numbers",
"attrs": [
{
"name": "part_no0",
"type": "str",
"description": "Part number",
"required": true,
"is_const": true
},
{
"name": "part_no1",
"type": "str",
"description": "Alternative part number",
"required": false,
"is_const": true
},
{
"name": "part_no2",
"type": "str",
"description": "Alternative part number",
"required": false,
"is_const": true
},
{
"name": "part_no3",
"type": "str",
"description": "Alternative part number",
"required": false,
"is_const": true
},
{
"name": "order_part_no0",
"type": "str",
"description": "Ordering part number",
"required": false,
"is_const": true
},
{
"name": "order_part_no1",
"type": "str",
"description": "Alternative ordering part number",
"required": false,
"is_const": true
},
{
"name": "serial",
"type": "str",
"description": "Serial Number",
"required": false,
"is_const": false
},
{
"name": "asset_no",
"type": "str",
"description": "Asset number",
"required": false,
"is_const": false
},
{
"name": "revision",
"type": "str",
"description": "Revision id",
"required": false,
"is_const": false
}
]
}
[
{
"name": "container",
"description": "Generic container properties",
"attrs": [
{
"name": "container",
"type": "bool",
"description": "Is object a container?",
"required": true,
"is_const": true
}
]
}
]
{
"name": "container",
"uuid": "0aef5942-e41a-4acf-ab3e-5bc406aaee08",
"description": "Generic container properties",
"attrs": [
{
"name": "container",
"type": "bool",
"description": "Is object a container?",
"required": true,
"is_const": true
}
]
}
[
{
"name": "dimensions",
"description": "Object dimension properties",
"attrs": [
{
"name": "units",
"type": "int",
"description": "Object's height in units. 0 - if not rackmountable",
"required": true,
"is_const": true
},
{
"name": "depth",
"type": "int",
"description": "Object's depth in mm",
"required": true,
"is_const": true
},
{
"name": "height",
"type": "int",
"description": "Object's height in mm",
"required": true,
"is_const": true
},
{
"name": "width",
"type": "int",
"description": "Object's width in mm",
"required": true,
"is_const": true
}
]
}
]
{
"name": "dimensions",
"uuid": "6aa71d8c-c4c7-4cca-91a5-3fc1af708f65",
"description": "Object dimension properties",
"attrs": [
{
"name": "units",
"type": "int",
"description": "Object's height in units. 0 - if not rackmountable",
"required": true,
"is_const": true
},
{
"name": "depth",
"type": "int",
"description": "Object's depth in mm",
"required": true,
"is_const": true
},
{
"name": "height",
"type": "int",
"description": "Object's height in mm",
"required": true,
"is_const": true
},
{
"name": "width",
"type": "int",
"description": "Object's width in mm",
"required": true,
"is_const": true
}
]
}
[
{
"name": "length",
"description": "Cable length",
"attrs": [
{
"name": "length",
"type": "float",
"description": "Cable length in meters",
"required": true,
"is_const": false
}
]
}
]
{
"name": "length",
"uuid": "ba30451d-61f6-4fff-9443-f3ebfe30bbfe",
"description": "Cable length",
"attrs": [
{
"name": "length",
"type": "float",
"description": "Cable length in meters",
"required": true,
"is_const": false
}
]
}
[
{
"name": "management",
"description": "ManagedObject binding",
"attrs": [
{
"name": "managed",
"type": "bool",
"description": "Object can be bind to the ManagedObject",
"required": false,
"is_const": true
},
{
"name": "managed_object",
"type": "int",
"description": "Managed Object id",
"required": false,
"is_const": false
}
]
}
]
{
"name": "management",
"uuid": "2bfdfe3a-78dc-429c-99c7-a3db73d3e491",
"description": "ManagedObject binding",
"attrs": [
{
"name": "managed",
"type": "bool",
"description": "Object can be bind to the ManagedObject",
"required": false,
"is_const": true
},
{
"name": "managed_object",
"type": "int",
"description": "Managed Object id",
"required": false,
"is_const": false
}
]
}
name,uuid,path,hash
airflow,f7a27faf-3b5d-45a6-b3f3-bedf20ea3337,airflow.json,bc42db1be6b6977304f6e24125efd48876df23ebfd9f099d859a5d680e21b575
asset,e8e9a35f-d051-4b11-8e0b-0d14dcbdffb1,asset.json,eb3a89682622cff184d1c33d3f29088525f0fcc738df8d422d5308b6419a3d9c
container,0aef5942-e41a-4acf-ab3e-5bc406aaee08,container.json,82bb38f8440f7fc2aca5e231b732cf2cfdab8a8de9b718e71d893178dd7f2c38
dimensions,6aa71d8c-c4c7-4cca-91a5-3fc1af708f65,dimensions.json,f732f288ceda00ac3f78c1db012bdc08f1e55e0482ddf201c59b756359dc0350
length,ba30451d-61f6-4fff-9443-f3ebfe30bbfe,length.json,7aa360037c20d5d44e327d95f2c98856cc67a36b78e4fce5b84c2fdeeeb03427
management,2bfdfe3a-78dc-429c-99c7-a3db73d3e491,management.json,45df7e89468a49f22edb2876dd094ef7adfed22225bfe8af7c8b070e60a744b1
power,a3c13162-a7bf-420c-99e3-5977a5f0f47e,power.json,564056f72473ed63f0f98c2203018836b78559e4d8ca47f5c4f1aa2451fb8a9b
rack,a15da7b7-98de-4843-b256-0da049137833,rack.json,62b0dc38b3adedc3eab5883785454ae2fd3b6f9e835156518e1d5a374d445f0a
rackmount,b26d8388-0450-4c30-886d-d3d6da86c401,rackmount.json,34bf72312a245166796ef7714913141972af465209e42f6ea2c4083e16ae6d41
splitter,62b945a4-ebf6-4174-94a7-c77e327d16d4,splitter.json,2fcbc5cd534a290cae26a824ee63a9f506a0b8c8edeb4f4485bd6c1bca5dde24
stack,c3cb0577-9ed2-4edb-b3e3-eaca6f1fed38,stack.json,0303cf75f116288f55f32b74675d7def528448fe5a9ad57087b97b81c93a4f77
twinax,22e46608-0ed9-4822-b80f-d833a7f05e35,twinax.json,c6c6ab1c988694b276614dc3c37b454d334c08a06c5adf0c4dcf1b0db0d3588a
weight,2a928f8d-4380-4d0a-83c4-1f00c9536484,weight.json,a0bd44f6374986899f661c77e492254eac1f1db9f8862d98183ca69485f96401
[
{
"name": "power",
"description": "Object's power consumption",
"attrs": [
{
"name": "is_recursive",
"type": "bool",
"description": "Add nested object's power consumption if true",
"required": true,
"is_const": true
},
{
"name": "power",
"type": "float",
"description": "Object's own power consumption in W",
"required": true,
"is_const": true
}
]
}
]
{
"name": "power",
"uuid": "a3c13162-a7bf-420c-99e3-5977a5f0f47e",
"description": "Object's power consumption",
"attrs": [
{
"name": "is_recursive",
"type": "bool",
"description": "Add nested object's power consumption if true",
"required": true,
"is_const": true
},
{
"name": "power",
"type": "float",
"description": "Object's own power consumption in W",
"required": true,
"is_const": true
}
]
}
[
{
"name": "rack",
"description": "Rack enclosures",
"attrs": [
{
"name": "units",
"type": "int",
"description": "Internal height in units",
"required": true,
"is_const": true
},
{
"name": "width",
"type": "int",
"description": "Max. equipment width in mm",
"required": true,
"is_const": true
},
{
"name": "depth",
"type": "int",
"description": "Max. equipment depth in mm",
"required": true,
"is_const": true