瀏覽代碼

fix: alert list links did not work, changed dashboardUri to Url, this is breaking api change in alert api (#10756)

Torkel Ödegaard 7 年之前
父節點
當前提交
07fa2f1722

+ 4 - 4
docs/sources/http_api/alerting.md

@@ -62,7 +62,7 @@ Content-Type: application/json
       }
     "newStateDate": "2016-12-25",
     "executionError": "",
-    "dashboardUri": "http://grafana.com/dashboard/db/sensors"
+    "url": "http://grafana.com/dashboard/db/sensors"
   }
 ]
 ```
@@ -94,7 +94,7 @@ Content-Type: application/json
   "state": "alerting",
   "newStateDate": "2016-12-25",
   "executionError": "",
-  "dashboardUri": "http://grafana.com/dashboard/db/sensors"
+  "url": "http://grafana.com/dashboard/db/sensors"
 }
 ```
 
@@ -196,7 +196,7 @@ Content-Type: application/json
 
 ## Create alert notification
 
-You can find the full list of [supported notifers](/alerting/notifications/#all-supported-notifier) at the alert notifiers page. 
+You can find the full list of [supported notifers](/alerting/notifications/#all-supported-notifier) at the alert notifiers page.
 
 `POST /api/alert-notifications`
 
@@ -294,4 +294,4 @@ Content-Type: application/json
 {
   "message": "Notification deleted"
 }
-```
+```

+ 1 - 1
pkg/api/alerting.go

@@ -105,7 +105,7 @@ func transformToDTOs(alerts []*models.Alert, c *middleware.Context) ([]*dtos.Ale
 	for _, alert := range alertDTOs {
 		for _, dash := range dashboardsQuery.Result {
 			if alert.DashboardId == dash.Id {
-				alert.DashbboardUri = dash.GenerateUrl()
+				alert.Url = dash.GenerateUrl()
 				break
 			}
 		}

+ 1 - 1
pkg/api/dtos/alerting.go

@@ -19,7 +19,7 @@ type AlertRule struct {
 	EvalDate       time.Time        `json:"evalDate"`
 	EvalData       *simplejson.Json `json:"evalData"`
 	ExecutionError string           `json:"executionError"`
-	DashbboardUri  string           `json:"dashboardUri"`
+	Url            string           `json:"url"`
 	CanEdit        bool             `json:"canEdit"`
 }
 

+ 1 - 1
public/app/containers/AlertRuleList/AlertRuleList.jest.tsx

@@ -23,7 +23,7 @@ describe('AlertRuleList', () => {
             .format(),
           evalData: {},
           executionError: '',
-          dashboardUri: 'd/ufkcofof/my-goal',
+          url: 'd/ufkcofof/my-goal',
           canEdit: true,
         },
       ])

+ 1 - 1
public/app/containers/AlertRuleList/AlertRuleList.tsx

@@ -137,7 +137,7 @@ export class AlertRuleItem extends React.Component<AlertRuleItemProps, any> {
       'fa-pause': !rule.isPaused,
     });
 
-    let ruleUrl = `${rule.dashboardUri}?panelId=${rule.panelId}&fullscreen=true&edit=true&tab=alert`;
+    let ruleUrl = `${rule.url}?panelId=${rule.panelId}&fullscreen=true&edit=true&tab=alert`;
 
     return (
       <li className="alert-rule-item">

+ 1 - 1
public/app/plugins/panel/alertlist/module.html

@@ -12,7 +12,7 @@
         <div class="alert-rule-item__body">
           <div class="alert-rule-item__header">
             <p class="alert-rule-item__name">
-              <a href="dashboard/{{alert.dashboardUri}}?panelId={{alert.panelId}}&fullscreen&edit&tab=alert">
+              <a href="{{alert.url}}?panelId={{alert.panelId}}&fullscreen&edit&tab=alert">
                 {{alert.name}}
               </a>
             </p>

+ 1 - 1
public/app/stores/AlertListStore/AlertListStore.jest.ts

@@ -14,7 +14,7 @@ function getRule(name, state, info) {
       .format(),
     evalData: {},
     executionError: '',
-    dashboardUri: 'db/mygool',
+    url: 'db/mygool',
     stateText: state,
     stateIcon: 'fa',
     stateClass: 'asd',

+ 1 - 1
public/app/stores/AlertListStore/AlertRule.ts

@@ -13,7 +13,7 @@ export const AlertRule = types
     stateClass: types.string,
     stateAge: types.string,
     info: types.optional(types.string, ''),
-    dashboardUri: types.string,
+    url: types.string,
     canEdit: types.boolean,
   })
   .views(self => ({