mirror of https://github.com/grafana/grafana
Provisioning: Show file path of provisioning file in save/delete dialogs (#16706)
* Add file path to metadata and show it in dialogs * Make path relative to config directory * Fix tests * Add test for the relative path * Refactor to use path relative to provisioner path * Change return types * Rename attribute * Small fixes from reviewpull/16713/head
parent
76ab0aa059
commit
eb82a75668
@ -0,0 +1,58 @@ |
||||
package provisioning |
||||
|
||||
type Calls struct { |
||||
ProvisionDatasources []interface{} |
||||
ProvisionNotifications []interface{} |
||||
ProvisionDashboards []interface{} |
||||
GetDashboardProvisionerResolvedPath []interface{} |
||||
} |
||||
|
||||
type ProvisioningServiceMock struct { |
||||
Calls *Calls |
||||
ProvisionDatasourcesFunc func() error |
||||
ProvisionNotificationsFunc func() error |
||||
ProvisionDashboardsFunc func() error |
||||
GetDashboardProvisionerResolvedPathFunc func(name string) string |
||||
} |
||||
|
||||
func NewProvisioningServiceMock() *ProvisioningServiceMock { |
||||
return &ProvisioningServiceMock{ |
||||
Calls: &Calls{}, |
||||
} |
||||
} |
||||
|
||||
func (mock *ProvisioningServiceMock) ProvisionDatasources() error { |
||||
mock.Calls.ProvisionDatasources = append(mock.Calls.ProvisionDatasources, nil) |
||||
if mock.ProvisionDatasourcesFunc != nil { |
||||
return mock.ProvisionDatasourcesFunc() |
||||
} else { |
||||
return nil |
||||
} |
||||
} |
||||
|
||||
func (mock *ProvisioningServiceMock) ProvisionNotifications() error { |
||||
mock.Calls.ProvisionNotifications = append(mock.Calls.ProvisionNotifications, nil) |
||||
if mock.ProvisionNotificationsFunc != nil { |
||||
return mock.ProvisionNotificationsFunc() |
||||
} else { |
||||
return nil |
||||
} |
||||
} |
||||
|
||||
func (mock *ProvisioningServiceMock) ProvisionDashboards() error { |
||||
mock.Calls.ProvisionDashboards = append(mock.Calls.ProvisionDashboards, nil) |
||||
if mock.ProvisionDashboardsFunc != nil { |
||||
return mock.ProvisionDashboardsFunc() |
||||
} else { |
||||
return nil |
||||
} |
||||
} |
||||
|
||||
func (mock *ProvisioningServiceMock) GetDashboardProvisionerResolvedPath(name string) string { |
||||
mock.Calls.GetDashboardProvisionerResolvedPath = append(mock.Calls.GetDashboardProvisionerResolvedPath, name) |
||||
if mock.GetDashboardProvisionerResolvedPathFunc != nil { |
||||
return mock.GetDashboardProvisionerResolvedPathFunc(name) |
||||
} else { |
||||
return "" |
||||
} |
||||
} |
Loading…
Reference in new issue