Commit 8349fd0a by Csók Tamás

html tag got data- prefix

parent b57ec70b
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{% for a in activities %} {% for a in activities %}
<div class="activity{% if a.pk == active.pk %} activity-active{%endif%}" <div class="activity{% if a.pk == active.pk %} activity-active{%endif%}"
data-activity-id="{{ a.pk }}" data-activity-code="{{ a.activity_code }}" timestamp="{{ a.started|date:"U" }}"> data-activity-id="{{ a.pk }}" data-activity-code="{{ a.activity_code }}" data-timestamp="{{ a.started|date:"U" }}">
<span class="timeline-icon{% if a.has_failed %} timeline-icon-failed{% endif %}"> <span class="timeline-icon{% if a.has_failed %} timeline-icon-failed{% endif %}">
<i class="fa {% if not a.finished %}fa-refresh fa-spin {% else %}fa-{{a.icon}}{% endif %}"></i> <i class="fa {% if not a.finished %}fa-refresh fa-spin {% else %}fa-{{a.icon}}{% endif %}"></i>
</span> </span>
......
...@@ -37,6 +37,17 @@ logger = logging.getLogger(SeleniumConfig.logger_name) ...@@ -37,6 +37,17 @@ logger = logging.getLogger(SeleniumConfig.logger_name)
class SeleniumMixin(object): class SeleniumMixin(object):
def current_url(self):
url_base = urlparse.urlparse(self.driver.current_url)
url_save = ("%(host)s%(url)s" % {
'host': self.conf.host,
'url': urlparse.urljoin(url_base.path, url_base.query)})
if url_base.fragment:
url_save = ("%(url)s#%(fragment)s" % {
'url': url_save,
'fragment': url_base.fragment})
return url_save
def list_options(self, select): def list_options(self, select):
try: try:
option_dic = {} option_dic = {}
...@@ -244,10 +255,7 @@ class CircleSeleniumMixin(SeleniumMixin): ...@@ -244,10 +255,7 @@ class CircleSeleniumMixin(SeleniumMixin):
def save_template_from_vm(self, name): def save_template_from_vm(self, name):
try: try:
url_base = urlparse.urlparse(self.driver.current_url) url_save = self.current_url()
url_save = ("%(host)s%(url)s" % {
'host': self.conf.host,
'url': urlparse.urljoin(url_base.path, url_base.query)})
WebDriverWait(self.driver, self.conf.wait_max_sec).until( WebDriverWait(self.driver, self.conf.wait_max_sec).until(
ec.element_to_be_clickable(( ec.element_to_be_clickable((
By.CSS_SELECTOR, By.CSS_SELECTOR,
...@@ -404,14 +412,7 @@ class CircleSeleniumMixin(SeleniumMixin): ...@@ -404,14 +412,7 @@ class CircleSeleniumMixin(SeleniumMixin):
""" """
try: try:
if restore: if restore:
url_base = urlparse.urlparse(self.driver.current_url) url_save = self.current_url()
url_save = ("%(host)s%(url)s" % {
'host': self.conf.host,
'url': urlparse.urljoin(url_base.path, url_base.query)})
if url_base.fragment:
url_save = ("%(url)s#%(fragment)s" % {
'url': url_save,
'fragment': url_base.fragment})
self.driver.get('%(host)s/dashboard/vm/activity/%(id)s/' % { self.driver.get('%(host)s/dashboard/vm/activity/%(id)s/' % {
'host': self.conf.host, 'host': self.conf.host,
'id': operation_id}) 'id': operation_id})
...@@ -512,7 +513,7 @@ class CircleSeleniumMixin(SeleniumMixin): ...@@ -512,7 +513,7 @@ class CircleSeleniumMixin(SeleniumMixin):
logger.warning("Found activity list for %s:" % code_text) logger.warning("Found activity list for %s:" % code_text)
for activity in searched_activity: for activity in searched_activity:
activity_id = activity.get_attribute('data-activity-id') activity_id = activity.get_attribute('data-activity-id')
key = activity.get_attribute('timestamp') key = activity.get_attribute('data-timestamp')
logger.warning("%(id)s @ %(activity)s" % { logger.warning("%(id)s @ %(activity)s" % {
'id': activity_id, 'id': activity_id,
'activity': datetime.fromtimestamp( 'activity': datetime.fromtimestamp(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment