|
@@ -510,26 +510,27 @@ App.WidgetPreviewMixin = Ember.Mixin.create({
|
|
|
isLoaded: true,
|
|
|
metrics: [],
|
|
|
content: Em.Object.create({
|
|
|
- widgetName: 'mock-widget',
|
|
|
+ id: 1,
|
|
|
values: []
|
|
|
}),
|
|
|
drawWidget: function () {
|
|
|
- this.loadMetrics();
|
|
|
this.get('content').setProperties({
|
|
|
'values': this.get('controller.widgetValues'),
|
|
|
'properties': this.get('controller.widgetProperties'),
|
|
|
- 'displayName': this.get('controller.widgetName')
|
|
|
+ 'widgetName': this.get('controller.widgetName'),
|
|
|
+ 'metrics': this.get('controller.widgetMetrics').map(function (metric) {
|
|
|
+ return {
|
|
|
+ "name": metric.name,
|
|
|
+ "service_name": metric.serviceName,
|
|
|
+ "component_name": metric.componentName,
|
|
|
+ "metric_path": metric.metricPath,
|
|
|
+ "host_component_criteria": metric.hostComponentCriteria,
|
|
|
+ "category": metric.category
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|
|
|
+ this.loadMetrics();
|
|
|
this._super();
|
|
|
}.observes('controller.widgetProperties', 'controller.widgetValues', 'controller.widgetMetrics', 'controller.widgetName'),
|
|
|
- loadMetrics: function () {
|
|
|
- var metrics = [];
|
|
|
- this.get('controller.widgetMetrics').forEach(function (metric) {
|
|
|
- metrics.push({
|
|
|
- name: metric.name,
|
|
|
- data: this.get('MOCK_VALUE')
|
|
|
- });
|
|
|
- }, this);
|
|
|
- this.set('metrics', metrics);
|
|
|
- }
|
|
|
+ onMetricsLoaded: Em.K
|
|
|
});
|