You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/17 15:37:14 UTC

[GitHub] [apisix-dashboard] starsz commented on a change in pull request #1061: feat: support search route by label

starsz commented on a change in pull request #1061:
URL: https://github.com/apache/apisix-dashboard/pull/1061#discussion_r545185163



##########
File path: api/internal/utils/utils.go
##########
@@ -94,3 +95,38 @@ func InterfaceToString(val interface{}) string {
 	str := fmt.Sprintf("%v", val)
 	return str
 }
+
+func GenLabelMap(label string) map[string]string {
+	mp := make(map[string]string)
+
+	if label == "" {
+		return mp
+	}
+
+	labels := strings.Split(label, ",")
+	for _, l := range labels {
+		kv := strings.Split(l, ":")
+		if len(kv) == 2 {
+			mp[kv[0]] = kv[1]
+		} else if len(kv) == 1 {
+			mp[kv[0]] = ""
+		}

Review comment:
       No, I think it's not a malformed label.It's a way only filter labels by key.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org