mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1. Replace the current layout library wcDocker with ReactJS based rc-dock. #6479 2. Have close buttons on individual panel tabs instead of common. #2821 3. Changes in the context menu on panel tabs - Add close, close all and close others menu items. #5394 4. Allow closing all the tabs, including SQL and Properties. #4733 5. Changes in docking behaviour of different tabs based on user requests and remove lock layout menu. 6. Fix an issue where the scroll position of panels was not remembered on Firefox. #2986 7. Reset layout now will not require page refresh and is done spontaneously. 8. Use the zustand store for storing preferences instead of plain JS objects. This will help reflecting preferences immediately. 9. The above fix incorrect format (no indent) of SQL stored functions/procedures. #6720 10. New version check is moved to an async request now instead of app start to improve startup performance. 11. Remove jQuery and Bootstrap completely. 12. Replace jasmine and karma test runner with jest. Migrate all the JS test cases to jest. This will save time in writing and debugging JS tests. 13. Other important code improvements and cleanup.
276 lines
11 KiB
Python
276 lines
11 KiB
Python
#
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
#
|
|
# Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
|
# This software is released under the PostgreSQL Licence
|
|
#
|
|
##########################################################################
|
|
|
|
|
|
class TreeAreaLocators:
|
|
"""This will contains element locators for tree area, will also contain
|
|
parametrized xpath where applicable"""
|
|
|
|
# Server Group Node
|
|
@staticmethod
|
|
def server_group_node(server_group_name):
|
|
return "//span[starts-with(text(),'%s')]" % server_group_name
|
|
|
|
@staticmethod
|
|
def server_group_node_exp_status(server_group_name):
|
|
return "//i[@class='directory-toggle open']/following-sibling::" \
|
|
"span//span[starts-with(text(),'%s')]" % server_group_name
|
|
|
|
# Server Node
|
|
@staticmethod
|
|
def server_node(server_name):
|
|
return "//div[@id='id-object-explorer']" \
|
|
"//span[starts-with(text(),'%s')]" \
|
|
% server_name
|
|
|
|
@staticmethod
|
|
def server_node_exp_status(server_name):
|
|
return "//i[@class='directory-toggle open']/following-sibling::" \
|
|
"span//span[starts-with(text(),'%s')]" % server_name
|
|
|
|
# Server Connection
|
|
@staticmethod
|
|
def server_connection_status_element(server_name):
|
|
return "//div[@id='id-object-explorer']" \
|
|
"//span[starts-with(text(),'%s')]/" \
|
|
"preceding-sibling::i" % server_name
|
|
|
|
# Databases Node
|
|
@staticmethod
|
|
def databases_node(server_name):
|
|
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[text()='Databases']" % server_name
|
|
|
|
@staticmethod
|
|
def databases_node_exp_status(server_name):
|
|
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[span[text()='Databases']]/" \
|
|
"preceding-sibling::i[@class='directory-toggle open']" \
|
|
% server_name
|
|
|
|
# Database Node
|
|
@staticmethod
|
|
def database_node(database_name):
|
|
return "//div[@data-depth='4']/span/span[text()='%s']" % database_name
|
|
|
|
@staticmethod
|
|
def database_node_exp_status(database_name):
|
|
return "//i[@class='directory-toggle open']/following-sibling::" \
|
|
"span//span[text()='%s']" % database_name
|
|
|
|
# Schemas Node
|
|
@staticmethod
|
|
def schemas_node(database_name):
|
|
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[text()='Schemas']" % database_name
|
|
|
|
@staticmethod
|
|
def schemas_node_exp_status(database_name):
|
|
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[span[text()='Schemas']]/" \
|
|
"preceding-sibling::i[@class='directory-toggle open']" \
|
|
% database_name
|
|
|
|
# Schema Node
|
|
@staticmethod
|
|
def schema_node(schema_name):
|
|
return "//div[@id='id-object-explorer']" \
|
|
"//span[text()='%s']" % schema_name
|
|
|
|
@staticmethod
|
|
def schema_node_exp_status(schema_name):
|
|
return "//i[@class='directory-toggle open']/" \
|
|
"following-sibling::span//span[text()='%s']" % schema_name
|
|
|
|
# Tables Node
|
|
@staticmethod
|
|
def tables_node(schema_name):
|
|
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[text()='Tables']" % schema_name
|
|
|
|
@staticmethod
|
|
def tables_node_exp_status(schema_name):
|
|
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[span[text()='Tables']]/" \
|
|
"preceding-sibling::i[@class='directory-toggle open']"\
|
|
% schema_name
|
|
|
|
# Schema child
|
|
child_node_exp_status = \
|
|
"//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[span[text()='%s']]/" \
|
|
"preceding-sibling::i[@class='directory-toggle open']"
|
|
|
|
child_node = "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[text()='%s']"
|
|
|
|
@staticmethod
|
|
def schema_child_node_exp_status(schema_name, child_node_name):
|
|
return TreeAreaLocators.child_node_exp_status \
|
|
% (schema_name, child_node_name)
|
|
|
|
@staticmethod
|
|
def schema_child_node(schema_name, child_node_name):
|
|
return TreeAreaLocators.child_node % (schema_name, child_node_name)
|
|
|
|
@staticmethod
|
|
def schema_child_node_expand_icon_xpath(schema_name, child_node_name):
|
|
return "//div[div[span[span[starts-with(text(),'%s')]]]]/" \
|
|
"following-sibling::div//span[text()='%s']/../" \
|
|
"preceding-sibling::i" % (schema_name, child_node_name)
|
|
|
|
# Database child
|
|
@staticmethod
|
|
def database_child_node_exp_status(database_name, child_node_name):
|
|
return TreeAreaLocators.child_node_exp_status \
|
|
% (database_name, child_node_name)
|
|
|
|
@staticmethod
|
|
def database_child_node(database_name, child_node_name):
|
|
return TreeAreaLocators.child_node % (database_name, child_node_name)
|
|
|
|
# Server child
|
|
@staticmethod
|
|
def server_child_node_exp_status(server_name, child_node_name):
|
|
return TreeAreaLocators.child_node_exp_status \
|
|
% (server_name, child_node_name)
|
|
|
|
@staticmethod
|
|
def server_child_node(server_name, child_node_name):
|
|
return TreeAreaLocators.child_node % (server_name, child_node_name)
|
|
|
|
# Table Node
|
|
@staticmethod
|
|
def table_node(table_name):
|
|
return "//div[@data-depth='8']/span/span[text()='%s']" % table_name
|
|
|
|
# Function Node
|
|
@staticmethod
|
|
def function_node(table_name):
|
|
return "//div[@data-depth='8']/span/span[text()='%s']" % table_name
|
|
|
|
# Role Node
|
|
@staticmethod
|
|
def role_node(role_name):
|
|
return "//div[@data-depth='4']/span/span[text()='%s']" % role_name
|
|
|
|
# Context element option
|
|
@staticmethod
|
|
def context_menu_element(schema_name):
|
|
return "[role='menuitem'][data-label='%s']" % schema_name
|
|
|
|
# Old xpaths
|
|
# server_group_sub_nodes_exp_status = \
|
|
# "//div[div[span[span[contains(text(),'Servers')]]]]" \
|
|
# "/following-sibling::ul/li/div"
|
|
#
|
|
# server_group_sub_nodes_connected_status = \
|
|
# "//div[div[span[span[contains(text(), 'Servers')]]]]/" \
|
|
# "following-sibling::ul/li/div/div/div/span[2]"
|
|
#
|
|
# specified_tree_node = \
|
|
# "//div[@id='id-object-explorer']//span[@class='aciTreeItem']/" \
|
|
# "span[(@class='aciTreeText') and text()='{}']"
|
|
#
|
|
# specified_tree_node_exp_status = \
|
|
# "//div[@id='id-object-explorer']//span[@class='aciTreeItem']/" \
|
|
# "span[(@class='aciTreeText') and text()='{}']" \
|
|
# "//ancestor::*[@class='aciTreeLine']"
|
|
#
|
|
# sub_nodes_of_tables_node = \
|
|
# "//div[div[div[div[div[div[div[div[span[span[" \
|
|
# "contains(text(),'Tables')]]]]]]]]]]/" \
|
|
# "following-sibling::ul/li/div//div/span[2]/span[2]"
|
|
#
|
|
# sub_nodes_of_functions_node = \
|
|
# "//div[div[div[div[div[div[div[div[span[span[" \
|
|
# "contains(text(),'Functions')]]]]]]]]]]/" \
|
|
# "following-sibling::ul/li/div//div/span[2]/span[2]"
|
|
#
|
|
# sub_nodes_of_login_group_node = \
|
|
# "//div[div[div[span[span[contains(text(),'Login/Group Roles')]]]]]" \
|
|
# "/following::ul/li/div[@class='aciTreeLine']"
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_a_server_node(server_name):
|
|
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
|
# "following-sibling::ul/li/div[@class='aciTreeLine']" % \
|
|
# server_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_a_server_node_exp_status(server_name):
|
|
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
|
# "following-sibling::ul/li/div" % server_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def databases_node_of_a_server_node(server_name):
|
|
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
|
# "following-sibling::ul/li/div/div/div/div/span[2]/span[2 " \
|
|
# "and text()='Databases ']" % server_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_databases_node(server_name):
|
|
# xpath = "//div[div[div[span[span[contains(text(),'%s')]]]]]/" \
|
|
# "following-sibling::ul/li[1]/div/following-sibling::ul/li/" \
|
|
# "div/div/div/div/div/span[2]/span[@class='aciTreeText']" % \
|
|
# server_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_databases_node_exp_status(server_name):
|
|
# xpath = "//div[div[div[span[span[contains(text(), '%s')]]]]]/" \
|
|
# "following-sibling::ul/li[1]/div/following-sibling::ul/li/" \
|
|
# "div" % server_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_database_node(database_name):
|
|
# xpath = "//div[div[div[div[div[span[span[contains(text()," \
|
|
# "'%s')]]]]]]]/following-sibling::" \
|
|
# "ul/li/div/div/div/div/div/div/span[2]/span[2]"\
|
|
# % database_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_database_node_exp_status(database_name):
|
|
# xpath = "//div[div[div[div[div[span[span[contains(text(), " \
|
|
# "'%s')]]]]]]]/following-sibling::ul/li/div" % database_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_schemas_node(database_name):
|
|
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
|
# "following-sibling::ul/li[" \
|
|
# "@role='presentation']/ul/li/div//div/span/span[" \
|
|
# "@class='aciTreeText']" % database_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_schemas_node_exp_status(database_name):
|
|
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
|
# "following-sibling::ul/li[@role='presentation']/ul/li/div" \
|
|
# % database_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_schema_node(database_name):
|
|
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
|
# "following-sibling::ul/li[@role='presentation']" \
|
|
# "/ul/li/ul/li/div//div/span[2]/span[2]" % database_name
|
|
# return xpath
|
|
#
|
|
# @staticmethod
|
|
# def sub_nodes_of_schema_node_exp_status(database_name):
|
|
# xpath = "//div[div[div[div[div[span[span[text()='%s']]]]]]]/" \
|
|
# "following-sibling::ul/li[@role='presentation']" \
|
|
# "/ul/li/ul/li/div" % database_name
|
|
# return xpath
|