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

flow: Merged <release> '0.8' to <master> ('default').

parents 2035c609 ad0e441e
......@@ -33,7 +33,7 @@ vcs_registry.register_all()
#
OBJECT_TYPES = ["config", "dns", "prefix-list", "rpsl"]
OBJECT_TYPE_CHOICES = [(x, x) for x in OBJECT_TYPES]
OBJECT_TYPE_CHOICES = [(x, x) for x in OBJECT_TYPES if x != "config"]
class ObjectNotify(models.Model):
......@@ -359,6 +359,7 @@ class Config(Object):
managed_object__in=ManagedObject.user_objects(user))
def get_notification_groups(self, immediately=False, delayed=False):
# @todo: Remove method
q = Q(type=self.repo_name)
if immediately:
q &= Q(notify_immediately=True)
......@@ -374,7 +375,7 @@ class Config(Object):
[n.notification_group for n in ObjectNotify.objects.filter(q)])
def write(self, data):
if type(data) == types.ListType:
if isinstance(data, list):
# Convert list to plain text
r = []
for d in sorted(data, lambda x, y: cmp(x["name"], y["name"])):
......@@ -391,11 +392,13 @@ class Config(Object):
managed_object=self.managed_object, config=data)
if warnings:
# There are some warnings. Notify responsible persons
NotificationGroup.group_notify(
groups=self.get_notification_groups(immediately=True),
subject="NOC: Warnings in '%s' config" % str(self),
body="Following warnings have been found in the '%s' config:\n\n%s\n" % (
str(self), "\n".join(warnings)))
self.managed_object.event(
self.managed_object.EV_CONFIG_POLICY_VIOLATION,
{
"object": self.managed_object,
"warnings": warnings
}
)
# Save to the repo
super(Config, self).write(data)
......@@ -429,6 +432,29 @@ class Config(Object):
return self.last_pull is None or (now - self.last_pull).days >= 2
return False
def on_object_changed(self):
"""
Temporary stub to use ObjectNotification
:return:
"""
revs = self.revisions
is_new = len(revs) == 1
diff = None
if not is_new:
diff = self.notification_diff(revs[1], revs[0])
if not diff:
# No significant difference to notify
return
self.managed_object.event(
self.managed_object.EV_CONFIG_CHANGED,
{
"object": self.managed_object,
"is_new": is_new,
"config": self.data,
"diff": diff
}
)
class PrefixList(Object):
class Meta:
......
......@@ -13,7 +13,7 @@ Ext.define("NOC.dns.dnsserver.Model", {
fields: [
{
name: "id",
type: "int"
type: "string"
},
{
name: "name",
......
......@@ -13,7 +13,7 @@ Ext.define("NOC.dns.dnszone.Model", {
fields: [
{
name: "id",
type: "int"
type: "string"
},
{
name: "name",
......
......@@ -14,7 +14,7 @@ Ext.define("NOC.dns.dnszone.RecordsModel", {
fields: [
{
name: "id",
type: "int"
type: "string"
},
{
name: "name",
......
......@@ -13,7 +13,7 @@ Ext.define("NOC.dns.dnszoneprofile.Model", {
fields: [
{
name: "id",
type: "int"
type: "string"
},
{
name: "name",
......
......@@ -17,3 +17,6 @@ heartbeat= false
# Interface profile name to use as default, when
# event interface is not found in inventory
default_interface_profile =
# Interval in seconds to find duplicated events
# 0 - disable deduplication
deduplication_window = 3
\ No newline at end of file
......@@ -188,11 +188,18 @@ logo_height = 24
favicon_url = /static/img/logo_24x24_deep_azure.png
# Default theme
default_theme = gray
# Top panel colors
branding_background_color = #c0c0c0
branding_color = #000
#
# UI themes
#
[themes]
neptune.name = Neptune
neptune.css = /static/pkg/extjs/resources/css/ext-all-neptune.css
neptune.enabled = true
blue.name = Blue
blue.css = /static/pkg/extjs/resources/css/ext-all.css
blue.enabled = true
......@@ -499,3 +506,10 @@ enabled = false
initial_submit_interval = 900
# Upper limit of new schedule submitted at once
initial_submit_concurrency = 20
[oam_discovery]
enabled = false
# Inject new schedules every N seconds
initial_submit_interval = 900
# Upper limit of new schedule submitted at once
initial_submit_concurrency = 20
noc-pkg-handlebars-debug==1.0.0
noc-pkg-shjs-debug==0.6
noc-pkg-extjs-debug==4.0.7
noc-pkg-extjs-debug==4.2.1
noc-pkg-mxgraph-debug==1.10.4.2
noc-pkg-openlayers-debug==2.13
noc-pkg-cubism-debug==1.2.2
......
......@@ -22,8 +22,10 @@ noc-pkg-handlebars==1.0.0
noc-pkg-shjs==0.6
noc-pkg-famfamfam-silk==1.3
noc-pkg-silk-companion1==1.0
noc-pkg-extjs==4.0.7
noc-pkg-extjs==4.2.1
noc-pkg-mxgraph==1.10.4.2
noc-pkg-openlayers==2.13
noc-pkg-cubism==1.2.2
noc-pkg-d3==3.2.2
noc-pkg-font-awesome==3.2.1
......@@ -40,6 +40,7 @@ REPO=https://bitbucket.org/nocproject/noc
# release/<version> - pre-release testing branch
# feature/<name> - feature development branch
# hotfix/<version> - hotfix development branch
# none - do not pull and apply repo updates
#
BRANCH=default
......
......@@ -20,8 +20,7 @@ Ext.define("NOC.fm.alarm.AlarmPanel", {
},
initComponent: function() {
var me = this,
lw = 60;
var me = this;
me.alarmIdField = Ext.create("Ext.form.DisplayField", {
fieldLabel: "ID",
......@@ -30,49 +29,15 @@ Ext.define("NOC.fm.alarm.AlarmPanel", {
labelClsExtra: "noc-label-required"
});
me.subjectField = Ext.create("Ext.form.DisplayField", {
fieldLabel: "Alarm",
labelWidth: lw
});
me.objectField = Ext.create("Ext.form.DisplayField", {
fieldLabel: "Object",
labelWidth: lw
});
me.alarmClassField = Ext.create("Ext.form.DisplayField", {
fieldLabel: "Class",
labelWidth: lw
});
me.timeField = Ext.create("Ext.form.DisplayField", {
fieldLabel: "Time",
labelWidth: lw
});
me.watchersField = Ext.create("Ext.form.DisplayField", {
fieldLabel: "Watchers",
labelWidth: lw
});
me.topPanel = Ext.create("Ext.panel.Panel", {
height: 120,
height: 100,
bodyPadding: 4,
layout: {
type: "vbox",
align: "stretch",
pack: "start"
},
defaults: {
labelClsExtra: "noc-label-required"
},
items: [
me.subjectField,
me.objectField,
me.alarmClassField,
me.timeField,
me.watchersField
]
layout: "fit",
items: [{
xtype: "container",
autoScroll: true,
padding: 4
}]
});
me.overviewPanel = Ext.create("Ext.panel.Panel", {
......@@ -247,7 +212,7 @@ Ext.define("NOC.fm.alarm.AlarmPanel", {
me.clearButton = Ext.create("Ext.Button", {
text: "Clear",
iconCls: "icon_pill",
glyph: NOC.glyph.eraser,
scope: me,
handler: me.onClear
});
......@@ -255,14 +220,14 @@ Ext.define("NOC.fm.alarm.AlarmPanel", {
me.watchButton = Ext.create("Ext.Button", {
text: "Watch",
enableToggle: true,
iconCls: "icon_star_grey",
glyph: NOC.glyph.star,
scope: me,
handler: me.onWatch
});
me.setRootButton = Ext.create("Ext.Button", {
text: "Set Root Cause",
iconCls: "icon_attach",
glyph: NOC.glyph.paper_clip,
scope: me,
handler: me.onSetRoot
});
......@@ -275,13 +240,13 @@ Ext.define("NOC.fm.alarm.AlarmPanel", {
items: [
{
text: "Close",
iconCls: "icon_arrow_undo",
glyph: NOC.glyph.arrow_left,
scope: me,
handler: me.onClose
},
{
text: "Refresh",
iconCls: Ext.baseCSSPrefix + "tbar-loading",
glyph: NOC.glyph.refresh,
scope: me,
handler: me.onRefresh
},
......@@ -335,27 +300,9 @@ Ext.define("NOC.fm.alarm.AlarmPanel", {
me.data = data;
//
me.alarmIdField.setValue(me.data.id);
//
me.subjectField.setValue(
Ext.String.format("{0} [{1}]",
me.data.subject,
me.app.STATUS_MAP[me.data.status]
)
me.topPanel.items.first().update(
me.app.templates.SummaryPanel(me.data)
);
// Managed object details
if(me.data.managed_object_address) {
o.push(me.data.managed_object_address);
}
o.push(me.data.managed_object_profile);
if(me.data.managed_object_platform) {
o.push(me.data.managed_object_platform);
}
if(me.data.managed_object_version) {
o.push(me.data.managed_object_version);
}
me.objectField.setValue(me.data.managed_object__label + " (" + o.join(", ") + ")");
me.alarmClassField.setValue(me.data.alarm_class__label);
me.timeField.setValue(me.data.timestamp);
//
me.updatePanel(me.overviewPanel, me.app.templates.Overview,
data.subject, data);
......@@ -473,7 +420,7 @@ Ext.define("NOC.fm.alarm.AlarmPanel", {
}
return v.name + " (" + v.login + ")";
}).join(", ");
me.watchersField.setValue(msg);
// me.watchersField.setValue(msg);
me.watchButton.setIconCls(
is_watcher? "icon_star" : "icon_star_grey"
);
......
......@@ -11,7 +11,8 @@ Ext.define("NOC.fm.alarm.Application", {
requires: [
"NOC.fm.alarm.templates.Overview",
"NOC.fm.alarm.templates.Help",
"NOC.fm.alarm.templates.Data"
"NOC.fm.alarm.templates.Data",
"NOC.fm.alarm.templates.SummaryPanel"
],
layout: "card",
STATUS_MAP: {
......@@ -30,7 +31,8 @@ Ext.define("NOC.fm.alarm.Application", {
pageSize: 1,
customFields: [],
filterParams: {
status: "A"
status: "A",
collapse: 1
}
});
......@@ -101,12 +103,17 @@ Ext.define("NOC.fm.alarm.Application", {
}
});
me.expandButton = Ext.create("Ext.button.Button", {
text: "Expand",
tooltip: "Show/collapse children alarms",
enableToggle: true,
glyph: NOC.glyph.expand,
scope: me,
handler: me.onChangeFilter
});
me.gridPanel = Ext.create("Ext.grid.Panel", {
store: me.store,
features: [{
ftype: "selectable",
id: "selectable"
}],
border: false,
stateful: true,
stateId: "fm.alarm-grid",
......@@ -120,7 +127,8 @@ Ext.define("NOC.fm.alarm.Application", {
me.objectCombo,
me.alarmClassCombo,
me.fromDateField,
me.toDateField
me.toDateField,
me.expandButton
]
},
{
......@@ -155,6 +163,12 @@ Ext.define("NOC.fm.alarm.Application", {
width: 200,
renderer: NOC.render.Lookup("managed_object")
},
{
text: "Severity",
dataIndex: "severity",
width: 70,
renderer: NOC.render.Lookup("severity")
},
{
text: "Class",
dataIndex: "alarm_class",
......@@ -166,6 +180,13 @@ Ext.define("NOC.fm.alarm.Application", {
dataIndex: "subject",
flex: 1
},
{
text: "Duration",
dataIndex: "duration",
width: 70,
align: "right",
renderer: NOC.render.Duration
},
{
text: "Events",
dataIndex: "events",
......@@ -181,6 +202,7 @@ Ext.define("NOC.fm.alarm.Application", {
}
},
viewConfig: {
enableTextSelection: true,
getRowClass: Ext.bind(me.getRowClass, me)
/* listeners: {
scope: me,
......@@ -228,7 +250,10 @@ Ext.define("NOC.fm.alarm.Application", {
setIf("timestamp__gte", me.fromDateField.getValue());
// To Date
setIf("timestamp__lte", me.toDateField.getValue());
//
// Expand
if(!me.expandButton.pressed) {
q.collapse = 1;
}
me.currentQuery = q;
me.reloadStore();
},
......
......@@ -50,6 +50,18 @@ Ext.define("NOC.fm.alarm.Model", {
name: "row_class",
type: "string",
persist: true
},
{
name: "duration",
type: "int"
},
{
name: "severity",
type: "int"
},
{
name: "severity__label",
type: "string"
}
]
});
<table border="0">
<tr><td colspan="2"><b>Alarm Variables</b></td></tr>
<tr><th colspan="2">Alarm Variables</th></tr>
{{#each vars}}
<tr>
<td><b>{{this.[0]}}</b></td>
......
<div class="{{row_class}}">
<u><b>{{subject}}</b> [{{status__label}}]</u><br/>
<b>Severity:</b> {{severity__label}} ({{severity}})<br/>
<b>Object:</b> {{managed_object__label}} ({{managed_object__address}},
{{managed_object__platform}}, {{managed_object__version}})<br/>
<b>Class:</b> {{alarm_class__label}} <br/>
<b>Timestamp:</b> {{timestamp}} (duration {{formatDuration duration}})<br/>
<b>Watchers:</b>
</div>
\ No newline at end of file
......@@ -79,6 +79,12 @@ class AlarmApplication(ExtApplication):
qp = p.split("__")[0]
if qp in self.clean_fields:
q[p] = self.clean_fields[qp].form_clean(q[p])
#
if "collapse" in q:
c = q["collapse"]
del q["collapse"]
if c != "0":
q["root__exists"] = False
return q
def instance_to_dict(self, o, fields=None):
......@@ -91,11 +97,14 @@ class AlarmApplication(ExtApplication):
"status": o.status,
"managed_object": o.managed_object.id,
"managed_object__label": o.managed_object.name,
"severity": s.severity,
"severity__label": s.name,
"alarm_class": str(o.alarm_class.id),
"alarm_class__label": o.alarm_class.name,
"timestamp": self.to_json(o.timestamp),
"subject": o.get_translated_subject(lang),
"events": n_events,
"duration": o.duration,
"row_class": s.style.css_class_name
}
......@@ -127,6 +136,11 @@ class AlarmApplication(ExtApplication):
d["probable_causes"] = alarm.get_translated_probable_causes(lang)
d["recommended_actions"] = alarm.get_translated_recommended_actions(lang)
d["vars"] = sorted(alarm.vars.items())
d["status"] = alarm.status
d["status__label"] = {
"A": "Active",
"C": "Cleared"
}[alarm.status]
# Managed object properties
mo = alarm.managed_object
d["managed_object_address"] = mo.address
......
......@@ -91,7 +91,7 @@ Ext.define("NOC.fm.alarmclass.Application", {
formToolbar: [
{
text: "JSON",
iconCls: "icon_page",
glyph: NOC.glyph.file,
tooltip: "View as JSON",
hasAccess: NOC.hasPermission("read"),
scope: me,
......@@ -112,5 +112,9 @@ Ext.define("NOC.fm.alarmclass.Application", {
var me = this;
me.showItem(me.ITEM_JSON);
me.jsonPanel.preview(me.currentRecord);
},
//
onSave: function() {
NOC.info("Sorry! Not implemented still. Please apply changes to JSON files directly");
}
});
......@@ -13,7 +13,7 @@ Ext.define("NOC.fm.alarmtrigger.Model", {
fields: [
{
name: "id",
type: "int"
type: "string"
},
{
name: "name",
......
//---------------------------------------------------------------------
// fm.classificationrule application
//---------------------------------------------------------------------
// Copyright (C) 2007-2013 The NOC Project
// See LICENSE for details
//---------------------------------------------------------------------
console.debug("Defining NOC.fm.classificationrule.Application");
Ext.define("NOC.fm.classificationrule.Application", {
extend: "NOC.core.ModelApplication",
requires: [
"NOC.fm.classificationrule.Model",
"NOC.fm.eventclass.LookupField",
"Ext.ux.form.GridField",
"NOC.fm.classificationrule.templates.TestResult"
],
model: "NOC.fm.classificationrule.Model",
search: true,
columns: [
{
text: "Name",
dataIndex: "name",
width: 500
},
{
text: "Builtin",
dataIndex: "is_builtin",
width: 50,
renderer: NOC.render.Bool
},
{
text: "Event Class",
dataIndex: "event_class",
flex: 1,
renderer: NOC.render.Lookup("event_class")
},
{
text: "Pref",
dataIndex: "preference",
width: 50
}
],
filters: [
{
title: "Builtin",
name: "is_builtin",
ftype: "boolean"
},
{
title: "By Event Class",
name: "event_class",
ftype: "lookup",
lookup: "fm.eventclass"
}
],
initComponent: function() {
var me = this;
me.jsonPanel = Ext.create("NOC.core.JSONPreview", {
app: me,
restUrl: "/fm/classificationrule/{{id}}/json/",
previewName: "Classification Rule: {{name}}"
});
me.ITEM_JSON = me.registerItem(me.jsonPanel);
//
me.testForm = Ext.create("NOC.fm.classificationrule.TestForm", {
app: me
});
me.ITEM_TEST_FORM = me.registerItem(me.testForm);
//
me.testResultPanel = Ext.create("NOC.core.TemplatePreview", {
app: me,