Skip to content

Commit 2c72b67

Browse files
authored
Live: Add watch scope and allow dots in namespace (#1269)
1 parent 7d4367d commit 2c72b67

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

live/channel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (c Channel) String() string {
6969
}
7070

7171
var (
72-
scopeNamespacePattern = regexp.MustCompile(`^[A-z0-9_\-]*$`)
72+
scopeNamespacePattern = regexp.MustCompile(`^[A-z0-9_\-\.]*$`)
7373
pathPattern = regexp.MustCompile(`^[A-z0-9_\-/=.]*$`)
7474
)
7575

live/channel_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ func TestParseChannel_IsValid(t *testing.T) {
9696
id: "grafana=/test=/path/dash-and-equal",
9797
isValid: false,
9898
},
99+
{
100+
name: "scope_watch_dashboards",
101+
id: "watch/dashboard.grafana.app/dashboards",
102+
isValid: true,
103+
},
104+
{
105+
name: "scope_watch_dashboards_with_user_id",
106+
id: "watch/dashboard.grafana.app/dashboards/userid",
107+
isValid: true,
108+
},
109+
{
110+
name: "scope_watch_dashboards_with_name_anduser_id",
111+
id: "watch/dashboard.grafana.app/dashboards=XYZ/userid",
112+
isValid: true,
113+
},
99114
}
100115
for _, tt := range tests {
101116
t.Run(tt.name, func(t *testing.T) {

live/scope.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ const (
99
ScopeDatasource = "ds"
1010
// ScopeStream is a managed data frame stream.
1111
ScopeStream = "stream"
12+
// ScopeWatch will watch a k8s style resource
13+
ScopeWatch = "watch"
1214
)

0 commit comments

Comments
 (0)