Jelajahi Sumber

remove finished/not finished spinners

Nick Sweeting 5 tahun lalu
induk
melakukan
c9162a6d09

+ 1 - 1
archivebox/index/__init__.py

@@ -221,7 +221,7 @@ def timed_index_update(out_path: Path):
 
 
 @enforce_types
-def write_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR, finished: bool=False) -> None:
+def write_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR) -> None:
     """Writes links to sqlite3 file for a given list of links"""
 
     log_indexing_process_started(len(links))

+ 1 - 13
archivebox/index/html.py

@@ -49,27 +49,15 @@ def parse_html_main_index(out_dir: Path=OUTPUT_DIR) -> Iterator[str]:
                     yield line.split('"')[1]
     return ()
 
-@enforce_types
-def write_html_main_index(links: List[Link], out_dir: Path=OUTPUT_DIR, finished: bool=False) -> None:
-    """write the html link index to a given path"""
-
-    copy_and_overwrite(str(Path(TEMPLATES_DIR) / FAVICON_FILENAME), str(out_dir / FAVICON_FILENAME))
-    copy_and_overwrite(str(Path(TEMPLATES_DIR) / ROBOTS_TXT_FILENAME), str(out_dir / ROBOTS_TXT_FILENAME))
-    copy_and_overwrite(str(Path(TEMPLATES_DIR) / STATIC_DIR_NAME), str(out_dir / STATIC_DIR_NAME))
-    
-    rendered_html = main_index_template(links, finished=finished)
-    atomic_write(str(out_dir / HTML_INDEX_FILENAME), rendered_html)
-
 
 @enforce_types
-def main_index_template(links: List[Link], finished: bool=True, template: str=MAIN_INDEX_TEMPLATE) -> str:
+def main_index_template(links: List[Link], template: str=MAIN_INDEX_TEMPLATE) -> str:
     """render the template for the entire main index"""
 
     return render_legacy_template(template, {
         'version': VERSION,
         'git_sha': GIT_SHA,
         'num_links': str(len(links)),
-        'status': 'finished' if finished else 'running',
         'date_updated': datetime.now().strftime('%Y-%m-%d'),
         'time_updated': datetime.now().strftime('%Y-%m-%d %H:%M'),
         'rows': '\n'.join(

+ 2 - 2
archivebox/logging_util.py

@@ -501,10 +501,10 @@ def printable_folders(folders: Dict[str, Optional["Link"]],
     elif html:
         from .index.html import main_index_template
         if with_headers:
-            output = main_index_template(links, True)
+            output = main_index_template(links)
         else:
             from .index.html import MINIMAL_INDEX_TEMPLATE
-            output = main_index_template(links, True, MINIMAL_INDEX_TEMPLATE)
+            output = main_index_template(links, template=MINIMAL_INDEX_TEMPLATE)
         return output
     elif csv:
         from .index.csv import links_to_csv

+ 3 - 3
archivebox/main.py

@@ -376,7 +376,7 @@ def init(force: bool=False, out_dir: Path=OUTPUT_DIR) -> None:
         print('        archivebox list --status=invalid')
 
 
-    write_main_index(list(pending_links.values()), out_dir=out_dir, finished=True)
+    write_main_index(list(pending_links.values()), out_dir=out_dir)
 
     print('\n{green}------------------------------------------------------------------{reset}'.format(**ANSI))
     if existing_index:
@@ -565,7 +565,7 @@ def add(urls: Union[str, List[str]],
     imported_links = list({link.url: link for link in (new_links + new_links_depth)}.values())
     new_links = dedupe_links(all_links, imported_links)
 
-    write_main_index(links=new_links, out_dir=out_dir, finished=not new_links)
+    write_main_index(links=new_links, out_dir=out_dir)
     all_links = load_main_index(out_dir=out_dir)
 
     if index_only:
@@ -583,7 +583,7 @@ def add(urls: Union[str, List[str]],
         archive_links(imported_links, overwrite=True, **archive_kwargs)
     elif new_links:
         archive_links(new_links, overwrite=False, **archive_kwargs)
-    
+
     return all_links
 
 @enforce_types

+ 0 - 7
archivebox/themes/default/base.html

@@ -187,13 +187,6 @@
             display: none;
         }
         
-        body[data-status~=finished] .files-spinner {
-            display: none;
-        }
-        
-        /*body[data-status~=running] .in-progress {
-            display: inline-block;
-        }*/
         tr td a.favicon img {
             padding-left: 6px;
             padding-right: 12px;

+ 56 - 56
archivebox/themes/default/core/snapshot_list.html

@@ -2,63 +2,63 @@
 {% load static %}
 
 {% block body %}
-<br>
-        <form action="{% url 'public-index' %}" method="get">
-            <input name="q" type="text" placeholder="Search...">
-            <button type="submit">Search</button>
-            <button onclick="location.href='{% url 'public-index' %}'" type="button">
-                Reload Index</button>
-          </form>
-            <table id="table-bookmarks">
-            <thead>
+    <br>
+    <form action="{% url 'public-index' %}" method="get">
+        <input name="q" type="text" placeholder="Search...">
+        <button type="submit">Search</button>
+        <button onclick="location.href='{% url 'public-index' %}'" type="button">
+            Reload Index</button>
+    </form>
+    <table id="table-bookmarks">
+        <thead>
+            <tr>
+                <th style="width: 100px;">Bookmarked</th>
+                <th style="width: 26vw;">Saved Link ({{num_links}})</th>
+                <th style="width: 140px">Files</th>
+                <th style="width: 16vw;whitespace:nowrap;overflow-x:hidden;">Original URL</th>
+            </tr>
+        </thead>
+        <tbody>
+            {% for link in object_list %}
                 <tr>
-                    <th style="width: 100px;">Bookmarked</th>
-                    <th style="width: 26vw;">Saved Link ({{num_links}})</th>
-                    <th style="width: 140px">Files</th>
-                    <th style="width: 16vw;whitespace:nowrap;overflow-x:hidden;">Original URL</th>
+                    <td title="{{link.timestamp}}">{{link.added}}</td>
+                    <td class="title-col">
+                        {% if link.is_archived %}
+                            <a href="archive/{{link.timestamp}}/index.html"><img src="archive/{{link.timestamp}}/favicon.ico" class="link-favicon" decoding="async"></a>
+                        {% else %}
+                            <a href="archive/{{link.timestamp}}/index.html"><img src="{% static 'spinner.gif' %}" class="link-favicon" decoding="async"></a>
+                        {% endif %}
+                        <a href="archive/{{link.timestamp}}/index.html" title="{{link.title}}">
+                            <span data-title-for="{{link.url}}" data-archived="{{link.is_archived}}">{{link.title|default:'Loading...'}}</span>
+                            <small style="float:right">{{link.tags_str}}</small>
+                        </a>
+                    </td>
+                    <td>
+                        {{link.icons}}
+                    </td>
+                    <td style="text-align:left">
+                        <a href="{{link.url}}">{{link.url}}</a>
+                    </td>
                 </tr>
-            </thead>
-            <tbody>
-                {% for link in object_list %}
-                    <tr>
-                        <td title="{{link.timestamp}}">{{link.added}}</td>
-                        <td class="title-col">
-                            {% if link.is_archived %}
-                                <a href="archive/{{link.timestamp}}/index.html"><img src="archive/{{link.timestamp}}/favicon.ico" class="link-favicon" decoding="async"></a>
-                            {% else %}
-                                <a href="archive/{{link.timestamp}}/index.html"><img src="{% static 'spinner.gif' %}" class="link-favicon" decoding="async"></a>
-                            {% endif %}
-                            <a href="archive/{{link.timestamp}}/index.html" title="{{link.title}}">
-                                <span data-title-for="{{link.url}}" data-archived="{{link.is_archived}}">{{link.title|default:'Loading...'}}</span>
-                                <small style="float:right">{{link.tags_str}}</small>
-                            </a>
-                        </td>
-                        <td>
-                            <a href="archive/{{link.timestamp}}/index.html">📄 
-                                <span data-number-for="{{link.url}}" title="Fetching any missing files...">{{link.icons}} <img src="{% static 'spinner.gif' %}" class="files-spinner" decoding="async"/></span>
-                            </a>
-                        </td>
-                        <td style="text-align:left"><a href="{{link.url}}">{{link.url}}</a></td>
-                    </tr>
-                {% endfor %}
-            </tbody>
-        </table>
-        <center>
-            <span class="step-links">
-                {% if page_obj.has_previous %}
-                    <a href="{% url 'public-index' %}?page=1">&laquo; first</a>
-                    <a href="{% url 'public-index' %}?page={{ page_obj.previous_page_number }}">previous</a>
-                {% endif %}
-        
-                <span class="current">
-                    Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
-                </span>
-        
-                {% if page_obj.has_next %}
-                    <a href="{% url 'public-index' %}?page={{ page_obj.next_page_number }}">next </a>
-                    <a href="{% url 'public-index' %}?page={{ page_obj.paginator.num_pages }}">last &raquo;</a>
-                {% endif %}
+            {% endfor %}
+        </tbody>
+    </table>
+    <center>
+        <span class="step-links">
+            {% if page_obj.has_previous %}
+                <a href="{% url 'public-index' %}?page=1">&laquo; first</a>
+                <a href="{% url 'public-index' %}?page={{ page_obj.previous_page_number }}">previous</a>
+            {% endif %}
+    
+            <span class="current">
+                Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
             </span>
-            <br>
+    
+            {% if page_obj.has_next %}
+                <a href="{% url 'public-index' %}?page={{ page_obj.next_page_number }}">next </a>
+                <a href="{% url 'public-index' %}?page={{ page_obj.paginator.num_pages }}">last &raquo;</a>
+            {% endif %}
+        </span>
+        <br>
     </center>
-        {% endblock %}
+{% endblock %}

+ 3 - 9
archivebox/themes/default/main_index.html

@@ -161,12 +161,6 @@
             .in-progress {
                 display: none;
             }
-            body[data-status~=finished] .files-spinner {
-                display: none;
-            }
-            /*body[data-status~=running] .in-progress {
-                display: inline-block;
-            }*/
             tr td a.favicon img {
                 padding-left: 6px;
                 padding-right: 12px;
@@ -210,7 +204,7 @@
             });
         </script>
     </head>
-    <body data-status="finished">
+    <body>
         <header>
             <div class="header-top container-fluid">
                 <div class="row nav">
@@ -248,13 +242,13 @@
                                 <a href="archive/{{link.timestamp}}/index.html"><img src="{% static 'spinner.gif' %}" class="link-favicon" decoding="async"></a>
                             {% endif %}
                             <a href="archive/{{link.timestamp}}/{{link.canonical_outputs.wget_path}}" title="{{link.title}}">
-                                <span data-title-for="{{link.url}}" data-archived="{{link.is_archived}}">{{link.title|default:'Loading...'}}</span>
+                                <span data-archived="{{link.is_archived}}">{{link.title|default:'Loading...'}}</span>
                                 <small style="float:right">{{link.tags|default:''}}</small>
                             </a>
                         </td>
                         <td>
                             <a href="archive/{{link.timestamp}}/index.html">📄 
-                                <span data-number-for="{{link.url}}" title="Fetching any missing files...">{{link.num_outputs}} <img src="{% static 'spinner.gif' %}" class="files-spinner" decoding="async"/></span>
+                                <span title="Number of extractor outputs present">{{link.num_outputs}}</span>
                             </a>
                         </td>
                         <td style="text-align:left"><a href="{{link.url}}">{{link.url}}</a></td>

+ 1 - 0
archivebox/themes/default/static/admin.css

@@ -91,6 +91,7 @@ body.model-snapshot.change-list #content .object-tools {
     padding: 0px;
     background: none;
     margin-right: 0px;
+    width: auto;
 }
 
 #content #changelist .actions .button {

+ 1 - 7
archivebox/themes/legacy/main_index.html

@@ -127,12 +127,6 @@
             .in-progress {
                 display: none;
             }
-            body[data-status~=finished] .files-spinner {
-                display: none;
-            }
-            /*body[data-status~=running] .in-progress {
-                display: inline-block;
-            }*/
             tr td a.favicon img {
                 padding-left: 6px;
                 padding-right: 12px;
@@ -176,7 +170,7 @@
             });
         </script>
     </head>
-    <body data-status="$status">
+    <body>
         <header>
             <div class="header-top container-fluid">
                 <div class="row nav">

+ 1 - 1
archivebox/themes/legacy/main_index_row.html

@@ -9,7 +9,7 @@
     </td>
     <td>
         <a href="$archive_path/index.html">📄 
-            <span data-number-for="$url" title="Fetching any missing files...">$num_outputs <img src="static/spinner.gif" class="files-spinner" decoding="async"/></span>
+            <span data-number-for="$url" title="Number of extractor outputs">$num_outputs</span>
         </a>
     </td>
     <td style="text-align:left"><a href="$url">$url</a></td>