Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): 临时支持插件过滤ip:port #7152 #7153

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions dbm-ui/backend/db_services/mysql/dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
"""
import re
from dataclasses import asdict, dataclass
from typing import Dict, List

from backend.constants import IP_PORT_DIVIDER, IP_PORT_RE_PATTERN
from backend.db_meta.enums.cluster_type import ClusterType


Expand Down Expand Up @@ -44,4 +46,10 @@ def export_filter_conditions(self):
if isinstance(filter_conditions["cluster_type"], list):
filter_conditions["cluster_type__in"] = filter_conditions.pop("cluster_type")

# 如果是实例过滤. TODO: 临时给插件支持,后续统一替换成filter_clusters接口
if re.compile(IP_PORT_RE_PATTERN).match(filter_conditions["immute_domain"]):
ip, port = filter_conditions.pop("immute_domain").split(IP_PORT_DIVIDER)
filter_conditions["storageinstance__machine__ip"] = ip
filter_conditions["storageinstance__port"] = port

return filter_conditions
Loading