-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AzureMonitor: Fix Log Analytics portal links (#65482)
* Fix and update Log Analytics portal links - Build portal URL in backend - Correctly set multiple resource value - Move AddConfigLinks util function - Add necessary types - Remove unused functions * Fix lint issue * Remove unused cache variable
- Loading branch information
Showing
8 changed files
with
98 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package loganalytics | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/grafana/grafana-azure-sdk-go/azsettings" | ||
"github.com/grafana/grafana-plugin-sdk-go/data" | ||
) | ||
|
||
func AddConfigLinks(frame data.Frame, dl string) data.Frame { | ||
for i := range frame.Fields { | ||
if frame.Fields[i].Config == nil { | ||
frame.Fields[i].Config = &data.FieldConfig{} | ||
} | ||
deepLink := data.DataLink{ | ||
Title: "View in Azure Portal", | ||
TargetBlank: true, | ||
URL: dl, | ||
} | ||
frame.Fields[i].Config.Links = append(frame.Fields[i].Config.Links, deepLink) | ||
} | ||
return frame | ||
} | ||
|
||
func GetAzurePortalUrl(azureCloud string) (string, error) { | ||
switch azureCloud { | ||
case azsettings.AzurePublic: | ||
return "https://portal.azure.com", nil | ||
case azsettings.AzureChina: | ||
return "https://portal.azure.cn", nil | ||
case azsettings.AzureUSGovernment: | ||
return "https://portal.azure.us", nil | ||
default: | ||
return "", fmt.Errorf("the cloud is not supported") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.