[TE] harleyjj/preview - make default time range 1 day for preview
@@ -39,7 +39,7 @@ const TIME_PICKER_INCREMENT = 5; // tells date picker hours field how granularly
const DEFAULT_ACTIVE_DURATION = '1m'; // setting this date range selection as default (Last 24 Hours)
const UI_DATE_FORMAT = 'MMM D, YYYY hh:mm a'; // format for date picker to use (usually varies by route or metric)
const DISPLAY_DATE_FORMAT = 'YYYY-MM-DD HH:mm'; // format used consistently across app to display custom date range
-const TIME_RANGE_OPTIONS = ['1w', '1m', '3m'];
+const TIME_RANGE_OPTIONS = ['1d', '1w', '1m', '3m'];
const ANOMALY_LEGEND_THRESHOLD = 20; // If number of anomalies is larger than this threshold, don't show the legend
export default Component.extend({
@@ -48,7 +48,7 @@ export default Component.extend({
anomalyMapping: {},
timeseries: null,
isLoading: false,
- analysisRange: [moment().add(1, 'day').startOf('day').subtract(1, 'week').valueOf(), moment().add(1, 'day').startOf('day').valueOf()],
+ analysisRange: [moment().subtract(1, 'day').startOf('day').valueOf(), moment().startOf('day').valueOf()],
isPendingData: false,
colorMapping: colorMapping,
zoom: {
@@ -482,10 +482,12 @@ export default Component.extend({
try {
if(isPreviewMode){
applicationAnomalies = yield getYamlPreviewAnomalies(alertYaml, start, end);
+ if (applicationAnomalies && applicationAnomalies.diagnostics && applicationAnomalies.diagnostics['0']) {
metricUrnList = Object.keys(applicationAnomalies.diagnostics['0']);
set(this, 'metricUrnList', metricUrnList);
set(this, 'selectedDimension', toMetricLabel(extractTail(decodeURIComponent(metricUrnList[0]))));
set(this, 'metricUrn', metricUrnList[0]);
+ }
anomalies = applicationAnomalies.anomalies;
} else {
applicationAnomalies = yield getAnomaliesByAlertId(alertId, start, end);
@@ -539,7 +541,7 @@ export default Component.extend({
set(this, 'selectedDimension', 'Choose a dimension');
this._fetchAnomalies();
} else {
- set(this, 'duration', '1w');
+ set(this, 'duration', '1d');
}
},
