Skip to content

Commit

Permalink
fix(backend): 临时支持插件过滤ip:port #7152
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Sep 26, 2024
1 parent a4acc85 commit c21a7ba
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit c21a7ba

Please sign in to comment.