Large diffs are not rendered by default.

@@ -4,18 +4,18 @@
"private": true,
"dependencies": {
"bower": ">=1.5.3",
"del": "^2.0.2",
"gulp": "^3.9.0",
"gulp-livereload": "^3.8.0",
"gulp-rename": "^1.2.2",
"gulp-stylus": "^2.0.7",
"gulp-typescript": "^2.9.0",
"npm": "^3.3.4",
"shonkwrap": "^1.1.2",
"stylint": "^1.2.3",
"del": ">=2.0.2",
"gulp": ">=3.9.0",
"gulp-livereload": ">=3.8.0",
"gulp-rename": ">=1.2.2",
"gulp-stylus": ">=2.0.7",
"gulp-typescript": ">=2.9.0",
"npm": ">=3.3.4",
"shonkwrap": ">=1.1.2",
"stylint": ">=1.2.3",
"stylus": ">=0.51.1",
"tsd": "^0.6.4",
"tslint": ">=2.3.1-beta",
"typescript": ">=1.5.0-beta"
"tsd": ">=0.6.4",
"tslint": ">=3.0.0-dev.1",
"typescript": ">=1.6.2"
}
}
@@ -29,5 +29,5 @@ m.route(document.getElementById("root"), "/nodes", {
"/store/:store_id": AdminViews.Stores.StorePage,
"/stores/:store_id": AdminViews.Stores.StorePage,
"/store/:store_id/:detail": AdminViews.Stores.StorePage,
"/stores/:store_id/:detail": AdminViews.Stores.StorePage
"/stores/:store_id/:detail": AdminViews.Stores.StorePage,
});
@@ -106,7 +106,7 @@ module Components {
key: s.title(),
color: Controller.colors(s.series()),
area: true,
fillOpacity: .1
fillOpacity: .1,
});
}
});
@@ -43,7 +43,7 @@ module Components {
m("a",
{
config: m.route,
href: args.ts.baseRoute + t.route
href: args.ts.baseRoute + t.route,
},
t.view
)
@@ -47,7 +47,7 @@ module Components {
return m("select", { onchange: m.withAttr("value", ctrl.onChange) }, [
ctrl.items.map(function(item: Item): _mithril.MithrilVirtualElement {
return m("option", { value: item.value, selected: (item.value === ctrl.value()) }, item.text);
})
}),
]);
}
}
@@ -133,7 +133,7 @@ module Components {
m("th",
{
onclick: (e: any): void => this.SetSortColumn(col),
className: this.IsSortColumn(col) ? sortClass : ""
className: this.IsSortColumn(col) ? sortClass : "",
},
col.title));
return m("tr", renderedCols);
@@ -12,9 +12,7 @@ module Components {
export function view(ctrl: any, args: {title: string; }): MithrilVirtualElement {
return m(".topbar", [
m("h2", args.title),
m(".last-updated",
[m("strong", "Updated: "),
"-"])
m(".last-updated", [m("strong", "Updated: "), "-"]),
]);
}
}
@@ -83,7 +83,7 @@ module Models {
startTime: this.startTime(),
endTime: this.endTime(),
max: this.max(),
pattern: this.pattern()
pattern: this.pattern(),
};
// buildQueryString includes empty query strings when they have a null
// value and we need to remove them.
@@ -133,7 +133,7 @@ module Models {
return {
name: this.seriesName,
sources: this.sources(),
aggregator: Proto.QueryAggregator.AVG
aggregator: Proto.QueryAggregator.AVG,
};
};
}
@@ -151,7 +151,7 @@ module Models {
return {
name: this.seriesName,
sources: this.sources(),
aggregator: Proto.QueryAggregator.AVG_RATE
aggregator: Proto.QueryAggregator.AVG_RATE,
};
};
}
@@ -200,7 +200,7 @@ module Models {
let endTime: Date = new Date();
let startTime: Date = new Date(endTime.getTime() - duration);
return [startTime.getTime(), endTime.getTime()];
}
},
};
}
}
@@ -286,7 +286,7 @@ module Models {
let req: Proto.QueryRequestSet = {
start_nanos: Utils.Convert.MilliToNano(ts[0]),
end_nanos: Utils.Convert.MilliToNano(ts[1]),
queries: []
queries: [],
};

// Build a set of requests by looping over selectors. The set of
@@ -57,7 +57,7 @@ module Models {
gc_bytes_age: 0,
sys_bytes: 0,
sys_count: 0,
last_update_nanos: 0
last_update_nanos: 0,
};
}

@@ -51,7 +51,7 @@ module Models {
leader_range_count: 0,
replicated_range_count: 0,
available_range_count: 0,
stats: Proto.NewMVCCStats()
stats: Proto.NewMVCCStats(),
};
list.forEach((storeStatus: Proto.StoreStatus) => {
Proto.AccumulateStatus(status, storeStatus);
@@ -96,7 +96,7 @@ module Models {
leader_range_count: 0,
replicated_range_count: 0,
available_range_count: 0,
stats: Proto.NewMVCCStats()
stats: Proto.NewMVCCStats(),
};
list.forEach((nodeStatus: Proto.NodeStatus) => {
Proto.AccumulateStatus(status, nodeStatus);
@@ -93,7 +93,7 @@ module AdminViews {
m("",
m("input[type=button]", {
value: buttonText,
onclick: ctrl.toggleGraph
onclick: ctrl.toggleGraph,
})),
]);
}
@@ -35,50 +35,50 @@ module AdminViews {
let date = new Date(Utils.Convert.NanoToMilli(entry.time));
return Utils.Format.Date(date);
},
sortable: true
sortable: true,
},
{
title: "Severity",
view: (entry: LogEntry): string => Utils.Format.Severity(entry.severity)
view: (entry: LogEntry): string => Utils.Format.Severity(entry.severity),
},
{
title: "Message",
view: (entry: LogEntry): string => Utils.Format.LogEntryMessage(entry)
view: (entry: LogEntry): string => Utils.Format.LogEntryMessage(entry),
},
{
title: "Node",
view: (entry: LogEntry): string => entry.node_id ? entry.node_id.toString() : "",
sortable: true,
sortValue: (entry: LogEntry): number => entry.node_id
sortValue: (entry: LogEntry): number => entry.node_id,
},
{
title: "Store",
view: (entry: LogEntry): string => entry.store_id ? entry.store_id.toString() : "",
sortable: true,
sortValue: (entry: LogEntry): number => entry.store_id
sortValue: (entry: LogEntry): number => entry.store_id,
},
{
title: "Range",
view: (entry: LogEntry): string => entry.range_id ? entry.range_id.toString() : "",
sortable: true,
sortValue: (entry: LogEntry): number => entry.range_id
sortValue: (entry: LogEntry): number => entry.range_id,
},
{
title: "Key",
view: (entry: LogEntry): string => entry.key,
sortable: true
sortable: true,
},
{
title: "File:Line",
view: (entry: LogEntry): string => entry.file + ":" + entry.line,
sortable: true
sortable: true,
},
{
title: "Method",
view: (entry: LogEntry): string => entry.method ? entry.method.toString() : "",
sortable: true,
sortValue: (entry: LogEntry): number => entry.method
}
sortValue: (entry: LogEntry): number => entry.method,
},
];

private static _queryEveryMS: number = 10000;
@@ -141,7 +141,7 @@ module AdminViews {
export function view(ctrl: Controller): _mithril.MithrilVirtualElement {
let comparisonData: Table.TableData<LogEntry> = {
columns: ctrl.columns,
rows: entries.allEntries
rows: entries.allEntries,
};
let count: number;
if (entries.allEntries()) {
@@ -157,15 +157,15 @@ module AdminViews {
m.component(Components.Select, {
items: _severitySelectOptions,
value: entries.level,
onChange: onChangeSeverity
onChange: onChangeSeverity,
}),
m.trust("&nbsp;&nbsp;Max Results: "),
m("input", { onchange: m.withAttr("value", onChangeMax), value: entries.max() }),
m.trust("&nbsp;&nbsp;Regex Filter: "),
m("input", { onchange: m.withAttr("value", onChangePattern), value: entries.pattern() })
m("input", { onchange: m.withAttr("value", onChangePattern), value: entries.pattern() }),
]),
m("p", count + " log entries retrieved"),
m(".stats-table", Components.Table.create(comparisonData))
m(".stats-table", Components.Table.create(comparisonData)),
]);
};
}
@@ -31,26 +31,26 @@ module AdminViews {
title: "",
route: "/",
icon: SvgIcons.cockroachIcon,
liClass: "cockroach"
liClass: "cockroach",
},
{
title: "Nodes",
route: "/nodes",
icon: SvgIcons.nodesIcon
icon: SvgIcons.nodesIcon,
},
{
title: "Stores",
route: "/stores",
icon: SvgIcons.storesIcon
}
icon: SvgIcons.storesIcon,
},
].map(function(v: {title: string; route: string; icon: string; liClass?: string; }): NavigationBar.Target {
return {
view: [
m(".image-container", m.trust(v.icon)),
m("div", v.title)
m("div", v.title),
],
route: v.route,
liClass: v.liClass
liClass: v.liClass,
};
});

@@ -63,7 +63,7 @@ module AdminViews {
return {
baseRoute: "",
targets: Utils.Prop(Controller.defaultTargets),
isActive: Controller.isActive
isActive: Controller.isActive,
};
};
}
@@ -44,32 +44,32 @@ module AdminViews {
view: (status: NodeStatus): MithrilElement =>
m("a", {href: "/nodes/" + status.desc.node_id, config: m.route}, status.desc.node_id.toString()),
sortable: true,
sortValue: (status: NodeStatus): number => status.desc.node_id
sortValue: (status: NodeStatus): number => status.desc.node_id,
},
{
title: "Address",
view: (status: NodeStatus): string => status.desc.address.address,
sortable: true
sortable: true,
},
{
title: "Started At",
view: (status: NodeStatus): string => {
let date = new Date(Utils.Convert.NanoToMilli(status.started_at));
return Utils.Format.Date(date);
},
sortable: true
sortable: true,
},
{
title: "Live Bytes",
view: (status: NodeStatus): string => Utils.Format.Bytes(status.stats.live_bytes),
sortable: true,
sortValue: (status: NodeStatus): number => status.stats.live_bytes
sortValue: (status: NodeStatus): number => status.stats.live_bytes,
},
{
title: "Logs",
view: (status: NodeStatus): MithrilElement =>
m("a", { href: "/logs/" + status.desc.node_id, config: m.route }, "Log")
}
m("a", { href: "/logs/" + status.desc.node_id, config: m.route }, "Log"),
},
];

private static _queryEveryMS: number = 10000;
@@ -92,24 +92,24 @@ module AdminViews {
return m(".primary-stats", [
m(".stat", [
m("span.title", "Total Ranges"),
m("span.value", allStats.range_count)
m("span.value", allStats.range_count),
]),
m(".stat", [
m("span.title", "Total Live Bytes"),
m("span.value", Utils.Format.Bytes(allStats.stats.live_bytes))
m("span.value", Utils.Format.Bytes(allStats.stats.live_bytes)),
]),
m(".stat", [
m("span.title", "Leader Ranges"),
m("span.value", allStats.leader_range_count)
m("span.value", allStats.leader_range_count),
]),
m(".stat", [
m("span.title", "Available"),
m("span.value", Utils.Format.Percentage(allStats.available_range_count, allStats.leader_range_count))
m("span.value", Utils.Format.Percentage(allStats.available_range_count, allStats.leader_range_count)),
]),
m(".stat", [
m("span.title", "Fully Replicated"),
m("span.value", Utils.Format.Percentage(allStats.replicated_range_count, allStats.leader_range_count))
])
m("span.value", Utils.Format.Percentage(allStats.replicated_range_count, allStats.leader_range_count)),
]),
]);
}
return m(".primary-stats");
@@ -127,12 +127,12 @@ module AdminViews {
export function view(ctrl: Controller): MithrilElement {
let comparisonData: Table.TableData<NodeStatus> = {
columns: ctrl.columns,
rows: nodeStatuses.allStatuses
rows: nodeStatuses.allStatuses,
};
return m(".page", [
m.component(Components.Topbar, {title: "Nodes"}),
m(".section", ctrl.RenderPrimaryStats()),
m(".section", m(".stats-table", Components.Table.create(comparisonData)))
m(".section", m(".stats-table", Components.Table.create(comparisonData))),
]);
}
}
@@ -147,12 +147,12 @@ module AdminViews {
private static defaultTargets: NavigationBar.Target[] = [
{
view: "Overview",
route: ""
route: "",
},
{
view: "Graphs",
route: "graph"
}
route: "graph",
},
];

private static isActive: (targ: NavigationBar.Target) => boolean = (t: NavigationBar.Target) => {
@@ -199,32 +199,32 @@ module AdminViews {
return m(".primary-stats", [
m(".stat", [
m("span.title", "Started At"),
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(nodeStats.started_at))))
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(nodeStats.started_at)))),
]),
m(".stat", [
m("span.title", "Last Updated At"),
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(nodeStats.updated_at))))
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(nodeStats.updated_at)))),
]),
m(".stat", [
m("span.title", "Total Ranges"),
m("span.value", nodeStats.range_count)
m("span.value", nodeStats.range_count),
]),
m(".stat", [
m("span.title", "Total Live Bytes"),
m("span.value", Utils.Format.Bytes(nodeStats.stats.live_bytes))
m("span.value", Utils.Format.Bytes(nodeStats.stats.live_bytes)),
]),
m(".stat", [
m("span.title", "Leader Ranges"),
m("span.value", nodeStats.leader_range_count)
m("span.value", nodeStats.leader_range_count),
]),
m(".stat", [
m("span.title", "Available"),
m("span.value", Utils.Format.Percentage(nodeStats.available_range_count, nodeStats.leader_range_count))
m("span.value", Utils.Format.Percentage(nodeStats.available_range_count, nodeStats.leader_range_count)),
]),
m(".stat", [
m("span.title", "Fully Replicated"),
m("span.value", Utils.Format.Percentage(nodeStats.replicated_range_count, nodeStats.leader_range_count))
])
m("span.value", Utils.Format.Percentage(nodeStats.replicated_range_count, nodeStats.leader_range_count)),
]),
]);
}
return m(".primary-stats");
@@ -234,7 +234,7 @@ module AdminViews {
return m(".charts", this.axes.map((axis: Metrics.Axis) => {
return m("", { style: "float:left" }, [
m("h4", axis.title()),
Components.Metrics.LineGraph.create(this.exec, axis)
Components.Metrics.LineGraph.create(this.exec, axis),
]);
}));
}
@@ -243,7 +243,7 @@ module AdminViews {
return {
baseRoute: "/nodes/" + this._nodeId + "/",
targets: Utils.Prop(Controller.defaultTargets),
isActive: Controller.isActive
isActive: Controller.isActive,
};
}

@@ -270,7 +270,7 @@ module AdminViews {
export function view(ctrl: Controller): MithrilElement {
let detail: string = m.route.param("detail");

// Page title.
// Page title.
let title: string = "Nodes: Node " + ctrl.GetNodeId();
if (detail === "graph") {
title += ": Graphs";
@@ -287,7 +287,7 @@ module AdminViews {
return m(".page", [
m.component(Components.Topbar, {title: title}),
m.component(NavigationBar, {ts: ctrl.TargetSet()}),
m(".section", primaryContent)
m(".section", primaryContent),
]);
}
}
@@ -44,35 +44,35 @@ module AdminViews {
return m("a", {href: "/stores/" + status.desc.store_id, config: m.route}, status.desc.store_id.toString());
},
sortable: true,
sortValue: (status: StoreStatus): number => status.desc.store_id
sortValue: (status: StoreStatus): number => status.desc.store_id,
},
{
title: "Node ID",
view: (status: StoreStatus): MithrilElement => {
return m("a", {href: "/nodes/" + status.desc.node.node_id, config: m.route}, status.desc.node.node_id.toString());
},
sortable: true,
sortValue: (status: StoreStatus): number => status.desc.node.node_id
sortValue: (status: StoreStatus): number => status.desc.node.node_id,
},
{
title: "Address",
view: (status: StoreStatus): string => status.desc.node.address.address,
sortable: true
sortable: true,
},
{
title: "Started At",
view: (status: StoreStatus): string => {
let date = new Date(Utils.Convert.NanoToMilli(status.started_at));
return Utils.Format.Date(date);
},
sortable: true
sortable: true,
},
{
title: "Live Bytes",
view: (status: StoreStatus): string => Utils.Format.Bytes(status.stats.live_bytes),
sortable: true,
sortValue: (status: StoreStatus): number => status.stats.live_bytes
}
sortValue: (status: StoreStatus): number => status.stats.live_bytes,
},
];

private static _queryEveryMS: number = 10000;
@@ -94,24 +94,24 @@ module AdminViews {
return m(".primary-stats", [
m(".stat", [
m("span.title", "Total Ranges"),
m("span.value", allStats.range_count)
m("span.value", allStats.range_count),
]),
m(".stat", [
m("span.title", "Total Live Bytes"),
m("span.value", Utils.Format.Bytes(allStats.stats.live_bytes))
m("span.value", Utils.Format.Bytes(allStats.stats.live_bytes)),
]),
m(".stat", [
m("span.title", "Leader Ranges"),
m("span.value", allStats.leader_range_count)
m("span.value", allStats.leader_range_count),
]),
m(".stat", [
m("span.title", "Available"),
m("span.value", Utils.Format.Percentage(allStats.available_range_count, allStats.leader_range_count))
m("span.value", Utils.Format.Percentage(allStats.available_range_count, allStats.leader_range_count)),
]),
m(".stat", [
m("span.title", "Fully Replicated"),
m("span.value", Utils.Format.Percentage(allStats.replicated_range_count, allStats.leader_range_count))
])
m("span.value", Utils.Format.Percentage(allStats.replicated_range_count, allStats.leader_range_count)),
]),
]);
}
return m(".primary-stats");
@@ -129,12 +129,12 @@ module AdminViews {
export function view(ctrl: Controller): MithrilElement {
let comparisonData: Table.TableData<StoreStatus> = {
columns: ctrl.columns,
rows: storeStatuses.allStatuses
rows: storeStatuses.allStatuses,
};
return m(".page", [
m.component(Topbar, {title: "Stores"}),
m(".section", ctrl.RenderPrimaryStats()),
m(".section", m(".stats-table", Components.Table.create(comparisonData)))
m(".section", m(".stats-table", Components.Table.create(comparisonData))),
]);
}
}
@@ -149,12 +149,12 @@ module AdminViews {
private static defaultTargets: NavigationBar.Target[] = [
{
view: "Overview",
route: ""
route: "",
},
{
view: "Graphs",
route: "graph"
}
route: "graph",
},
];

private static isActive: (targ: NavigationBar.Target) => boolean = (t: NavigationBar.Target) => {
@@ -236,32 +236,32 @@ module AdminViews {
return m(".primary-stats", [
m(".stat", [
m("span.title", "Started At"),
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(storeStats.started_at))))
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(storeStats.started_at)))),
]),
m(".stat", [
m("span.title", "Last Updated At"),
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(storeStats.updated_at))))
m("span.value", Utils.Format.Date(new Date(Utils.Convert.NanoToMilli(storeStats.updated_at)))),
]),
m(".stat", [
m("span.title", "Total Ranges"),
m("span.value", storeStats.range_count)
m("span.value", storeStats.range_count),
]),
m(".stat", [
m("span.title", "Total Live Bytes"),
m("span.value", Utils.Format.Bytes(storeStats.stats.live_bytes))
m("span.value", Utils.Format.Bytes(storeStats.stats.live_bytes)),
]),
m(".stat", [
m("span.title", "Leader Ranges"),
m("span.value", storeStats.leader_range_count)
m("span.value", storeStats.leader_range_count),
]),
m(".stat", [
m("span.title", "Available"),
m("span.value", Utils.Format.Percentage(storeStats.available_range_count, storeStats.leader_range_count))
m("span.value", Utils.Format.Percentage(storeStats.available_range_count, storeStats.leader_range_count)),
]),
m(".stat", [
m("span.title", "Fully Replicated"),
m("span.value", Utils.Format.Percentage(storeStats.replicated_range_count, storeStats.leader_range_count))
])
m("span.value", Utils.Format.Percentage(storeStats.replicated_range_count, storeStats.leader_range_count)),
]),
]);
}
return m(".primary-stats");
@@ -271,7 +271,7 @@ module AdminViews {
return m(".charts", this.axes.map((axis: Metrics.Axis) => {
return m("", { style: "float:left" }, [
m("h4", axis.title()),
Components.Metrics.LineGraph.create(this.exec, axis)
Components.Metrics.LineGraph.create(this.exec, axis),
]);
}));
}
@@ -280,7 +280,7 @@ module AdminViews {
return {
baseRoute: "/stores/" + this._storeId + "/",
targets: Utils.Prop(Controller.defaultTargets),
isActive: Controller.isActive
isActive: Controller.isActive,
};
}

@@ -307,7 +307,7 @@ module AdminViews {
export function view(ctrl: Controller): MithrilElement {
let detail: string = m.route.param("detail");

// Page title.
// Page title.
let title: string = "Stores: Store " + ctrl.GetStoreId();
if (detail === "graph") {
title += ": Graphs";
@@ -324,7 +324,7 @@ module AdminViews {
return m(".page", [
m.component(Components.Topbar, {title: title}),
m.component(NavigationBar, {ts: ctrl.TargetSet()}),
m(".section", primaryContent)
m(".section", primaryContent),
]);
}
}
@@ -26,39 +26,39 @@ module TestTable {
title: "ID Column",
view: (r: TestTableRow): MithrilElement => m("span.id", r.id),
sortable: true,
sortValue: (r: TestTableRow): number => r.id
sortValue: (r: TestTableRow): number => r.id,
},
{
title: "Title",
view: (r: TestTableRow): string => r.title,
sortable: false
sortable: false,
},
{
title: "Value",
view: (r: TestTableRow): MithrilElement => m("span.value", r.value),
sortable: true,
sortValue: (r: TestTableRow): number => r.value
}
sortValue: (r: TestTableRow): number => r.value,
},
];
let data: Table.TableData<TestTableRow> = {
columns: Utils.Prop(columns),
rows: Utils.Prop([
{
id: 2,
title: "CCC",
value: 60
value: 60,
},
{
id: 1,
title: "AAA",
value: 40
value: 40,
},
{
id: 3,
title: "BBB",
value: 10
value: 10,
},
])
]),
};

test("Sorts data correctly", () => {
@@ -104,7 +104,7 @@ suite("Properties", () => {
Utils.Prop("Leonardo"),
Utils.Prop("Donatello"),
Utils.Prop("Raphael"),
Utils.Prop("Michaelangelo")
Utils.Prop("Michaelangelo"),
];
recomputeCount = 0;
computed = Utils.Computed(parents[0], parents[1], parents[2], parents[3],
@@ -56,7 +56,10 @@
"no-require-imports": false,
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-comma": true,
"trailing-comma": [true, {
"multiline": "always",
"singleline": "never"
}],
"no-trailing-whitespace": true,
"no-unreachable": true,
"no-unused-expression": true,