~launchpad-pqm/launchpad/devel

6016.3.1 by Celso Providelo
Split ArchiveSourceSelectionFormView class from ArchivePackageDeletionView, so it can be reused for ArchivePackageCopyView. Also setup a form-macro page for easily reusing the same template structure.
1
<tal:root
2
  xmlns:tal="http://xml.zope.org/namespaces/tal"
3
  xmlns:metal="http://xml.zope.org/namespaces/metal"
4
  omit-tag="">
5
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
6
<metal:expandable_table_js define-macro="expandable-table-js">
7
  <tal:comment replace="nothing">
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
8
    Javascript needed for expanding/collapsing archive package list
9
    row containing extra publication information via XHR.
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
10
  </tal:comment>
11
12
<script type="text/javascript">
13588.9.2 by Gavin Panella
Rename lazr.anim to lp.anim.
13
LPS.use('node', 'io-base', 'lp.anim', 'lp.soyuz.base',
13453.2.1 by Danilo Segan
Restore expander replacements.
14
        'lp.app.widgets.expander', function(Y) {
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
15
16
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
17
/*
18
 * Communicate the update has failed and allow the user to retry
19
 * the operation.
20
 */
21
function informFailure(transaction_id, response, args) {
11347.3.3 by Michael Nelson
Fixed extra info for sources listed on +packages page.
22
    var failure_message = Y.lp.soyuz.base.makeFailureNode(
13453.2.1 by Danilo Segan
Restore expander replacements.
23
        'Failed to fetch package details.');
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
24
13453.2.1 by Danilo Segan
Restore expander replacements.
25
    args.expander.receive(failure_message);
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
26
13588.9.2 by Gavin Panella
Rename lazr.anim to lp.anim.
27
    var anim = Y.lp.anim.red_flash({
13453.2.1 by Danilo Segan
Restore expander replacements.
28
        node: args.expander.content_node
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
29
        });
30
    anim.run();
31
}
32
7722.1.3 by Celso Providelo
Moving more code to soyuz/base.js.
33
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
34
/*
7722.1.7 by Celso Providelo
applying review comments, r=mars, beuno.
35
 * Update the row with the XHR response.
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
36
 */
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
37
function doUpdate(transaction_id, response, args) {
13453.2.1 by Danilo Segan
Restore expander replacements.
38
    var node = Y.Node.create('<div />')
39
                 .set('innerHTML', response.responseText);
40
    args.expander.receive(node);
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
41
}
42
43
13453.2.1 by Danilo Segan
Restore expander replacements.
44
/**
45
 * Dispatch a XHR to load the given container.
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
46
 */
13453.2.1 by Danilo Segan
Restore expander replacements.
47
function loadDetails(expander) {
13302.5.7 by Danilo Segan
Port to the latest API for the Expander.
48
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
49
    var config = {
50
        on: {
51
            'success': doUpdate,
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
52
            'failure': informFailure
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
53
        },
54
        arguments: {
13453.2.1 by Danilo Segan
Restore expander replacements.
55
            'expander': expander
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
56
        }
57
    };
7722.1.2 by Celso Providelo
Re-organizing DOM ids to make life easier on the event handlers.
58
13453.2.1 by Danilo Segan
Restore expander replacements.
59
    /**
9150.6.12 by Julian Edwards
Fix the context archive on the XHR for +listing-archive-extra
60
     * If a page wants to use this outside of an archive context then it
12442.1.1 by Tim Penhey
Rename LP.client.cache to LP.cache.
61
     * can define LP.cache['archive_context'], which should be a
9150.6.12 by Julian Edwards
Fix the context archive on the XHR for +listing-archive-extra
62
     * full or relative URL to the context archive page required.
63
     */
9150.6.36 by Julian Edwards
Review changes from barry
64
    var base_url = (
12442.1.1 by Tim Penhey
Rename LP.client.cache to LP.cache.
65
        typeof(LP.cache['archive_context_url']) != "undefined")
66
            ? LP.cache['archive_context_url']
9150.6.36 by Julian Edwards
Review changes from barry
67
            : '';
68
    if (base_url !== '') {
13453.2.1 by Danilo Segan
Restore expander replacements.
69
        base_url += '/';
9150.6.12 by Julian Edwards
Fix the context archive on the XHR for +listing-archive-extra
70
    }
13453.2.1 by Danilo Segan
Restore expander replacements.
71
    var pub_id = expander.content_node.get('id')
72
                   .replace('pub', '')
73
                   .replace('-container', '');
9150.6.12 by Julian Edwards
Fix the context archive on the XHR for +listing-archive-extra
74
    var uri = base_url + '+sourcepub/' + pub_id + '/+listing-archive-extra';
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
75
    Y.io(uri, config);
76
}
77
13453.2.1 by Danilo Segan
Restore expander replacements.
78
/**
79
 * Setup expander handlers.
7722.1.1 by Celso Providelo
Applying UI and JS fixes suggested by Maris.
80
 */
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
81
function setupPackageListExpanders() {
13302.5.7 by Danilo Segan
Port to the latest API for the Expander.
82
    var expanders = Y.all('#packages_list a.expander');
13453.2.1 by Danilo Segan
Restore expander replacements.
83
    var widget;
84
    if (expanders !== null) {
85
       function setupExpander(expander) {
86
         var base_id = expander.get('id').replace('-expander', '');
87
         var container = Y.one('#' + base_id);
88
         var content = container.one('td div.package-details');
89
         var in_progress_message = Y.lp.soyuz.base.makeInProgressNode(
90
           'Fetching package details ...');
91
         content.empty();
92
         content.appendChild(in_progress_message);
93
94
         widget = new Y.lp.app.widgets.expander.Expander(
95
             expander, container, { loader: loadDetails,
96
                                    animate_node: content });
97
         widget.setUp();
98
       };
99
       expanders.each(setupExpander);
7968.2.1 by Michael Nelson
Moved changes from previous approved but stale branch to fresh branch.
100
    }
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
101
}
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
102
13302.4.13 by Danilo Segan
Minor reversions.
103
Y.on('domready', setupPackageListExpanders);
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
104
});
105
</script>
106
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
107
<style type="text/css" media="screen, print">
7722.1.1 by Celso Providelo
Applying UI and JS fixes suggested by Maris.
108
div.package-details {
109
    padding-left: 4em;
110
    padding-bottom: 1em;
111
}
7660.6.5 by Celso Providelo
Adding in-progress and failure messages.
112
</style>
113
114
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
115
</metal:expandable_table_js>
116
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
117
<metal:source_package_list define-macro="source-package-list">
118
  <tal:comment replace="nothing">
119
    Presents a table listing all the published source packages for an
120
    archive.
121
  </tal:comment>
122
7666.2.10 by Michael Nelson
Further clarification of property names.
123
  <div style="padding-top: 1em;" tal:define="batch view/batched_sources">
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
124
125
    <tal:navigation_top
126
        replace="structure view/batchnav/@@+navigation-links-upper" />
127
7666.2.14 by Michael Nelson
Merge RF after resolving conflicts.
128
    <table class="listing" id="packages_list"
129
           tal:condition="batch">
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
130
      <thead>
131
        <tr class="archive_package_row">
132
        <th colspan="2">Source</th>
14449.6.2 by Curtis Hovey
Updated templates to use is_team property.
133
        <th tal:condition="context/owner/is_team">Uploader</th>
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
134
        <th>Published</th>
135
        <th>Status</th>
136
        <th>Series</th>
137
        <th>Section</th>
138
        <th>Build Status</th>
139
        </tr>
140
      </thead>
141
      <tbody>
7666.2.4 by Michael Nelson
Consolidated the separate display of source package lists into one macro, adding batching automatically to the copy/delete package pages.
142
        <tal:non_selectable repeat="publishing batch"
143
                   replace="structure publishing/@@+listing-archive-detailed"
144
                   condition="not:view/selectable_sources">
145
        </tal:non_selectable>
146
        <tal:selectable condition="view/selectable_sources">
147
          <tal:each_term define="widget nocall:view/widgets/selected_sources"
148
                         repeat="term widget/vocabulary">
149
            <tal:block
150
              define="pub term/value"
151
              replace="structure pub/@@+listing-archive-detailed-selectable" />
152
          </tal:each_term>
153
        </tal:selectable>
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
154
      </tbody>
155
    </table>
156
157
    <tal:navigation_bottom
158
        replace="structure view/batchnav/@@+navigation-links-lower" />
159
160
    <div id="empty-result"
7666.2.6 by Michael Nelson
Finished refactoring, batching now working on copy/delete, as well as general filtering. One remaining issue for batching when form is posted.
161
            tal:define="name_filter view/specified_name_filter|nothing"
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
162
            tal:condition="not: batch">
163
      No matching package for '<tal:name_filter replace="name_filter" />'.
164
    </div>
165
7660.6.4 by Celso Providelo
encapsulate JS glue so it can be used in PPA index and copy/delete pages.
166
    <metal:js
167
      use-macro="context/@@+macros/expandable-table-js" />
7660.6.2 by Celso Providelo
Using YUI to expand/collapse the rows in archive package table.
168
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
169
  </div>
170
171
</metal:source_package_list>
172
173
<metal:package_copy_request_list define-macro="package-copy-request-list">
174
  <tal:comment replace="nothing">
7630.2.1 by Michael Nelson
Suggestions from Martin and bigjools.
175
    Presents a table listing all the package copy requests for a copy
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
176
    archive.
177
  </tal:comment>
9209.17.1 by Celso Providelo
First take on the 'ppa-install' portlet.
178
179
  <div id="package-copy-request-list" class="portlet"
180
       tal:define="requests view/package_copy_requests">
181
    <h2>Copy archive contents</h2>
182
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
183
    <p tal:condition="not: requests">
184
      There are currently no requests to copy packages into this archive.
185
    </p>
9209.17.1 by Celso Providelo
First take on the 'ppa-install' portlet.
186
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
187
    <tal:request_list tal:condition="requests">
10904.3.3 by Bryce Harrington
Make css .wide class more generally reusable
188
      <table id="package-requests" class="wide listing"
9209.17.1 by Celso Providelo
First take on the 'ppa-install' portlet.
189
        tal:attributes="summary
190
                        string:Package copy requests for ${context/name}">
7630.2.1 by Michael Nelson
Suggestions from Martin and bigjools.
191
        <thead>
192
          <tr>
193
            <th>Copied from</th>
194
            <th>Series</th>
195
            <th>Requested by</th>
196
            <th>When Requested</th>
197
            <th>Status</th>
198
          </tr>
199
        </thead>
200
        <tbody>
201
          <tr tal:repeat="request requests">
202
            <td tal:define="archive request/source_archive">
203
              <a tal:attributes="href archive/fmt:url"
7976.2.1 by Celso Providelo
Renaming IArchive.title to IArchive.displayname in preparation to have user-defined titles, bug #340457.
204
                 tal:content="archive/displayname"
7630.2.1 by Michael Nelson
Suggestions from Martin and bigjools.
205
                 tal:condition="archive/is_ppa" />
7976.2.1 by Celso Providelo
Renaming IArchive.title to IArchive.displayname in preparation to have user-defined titles, bug #340457.
206
              <tal:archive_displayname
207
                 replace="archive/displayname"
208
                 condition="not: archive/is_ppa" />
7630.2.1 by Michael Nelson
Suggestions from Martin and bigjools.
209
            </td>
210
            <td>
7849.13.1 by Brad Crittenden
Update templates to use person formatters
211
              <tal:distroseries
9209.17.1 by Celso Providelo
First take on the 'ppa-install' portlet.
212
                  replace="request/source_distroseries/displayname"
213
                />-<tal:src_pocket
7630.2.1 by Michael Nelson
Suggestions from Martin and bigjools.
214
                  replace="request/source_pocket/name/fmt:lower" />
215
              <tal:component condition="request/source_component">
216
               (<tal:src_component_name
217
                  replace="request/source_component/name" />)
218
              </tal:component>
219
            </td>
7849.13.18 by Brad Crittenden
Changes per review. Change tal:content to tal:replace where appropriate to avoid duplicate <a> wrapping. Formatters 'displayname' and 'unique_displayname' now return strings not HTML.
220
            <td><a tal:replace="structure request/requester/fmt:link" /></td>
7630.2.1 by Michael Nelson
Suggestions from Martin and bigjools.
221
            <td tal:content="request/date_created/fmt:approximatedate" />
222
            <td tal:content="request/status/name/capitalize" />
223
          </tr>
224
        </tbody>
225
      </table>
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
226
    </tal:request_list>
9209.17.1 by Celso Providelo
First take on the 'ppa-install' portlet.
227
  </div> <!-- package-copy-request-list -->
228
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
229
</metal:package_copy_request_list>
230
6565.2.2 by Celso Providelo
more UI and interface clean up in preparation to ArchiveRebuild UI.
231
<metal:package_counters define-macro="package-counters">
232
233
  <tal:comment replace="nothing">
234
    Presents package counters for a defined IArchive.
6721.2.16 by Christian Reis
Don't say release-critical when we mean series-targeted, and remove other uses of 'targetted'.
235
    :archive: targeted IArchive.
6565.2.2 by Celso Providelo
more UI and interface clean up in preparation to ArchiveRebuild UI.
236
  </tal:comment>
237
9209.8.3 by Michael Nelson
Updated package counters macro to dl.
238
  <dl tal:define="usage_summary archive/@@+index/repository_usage">
239
    <dt>Number of packages:</dt>
240
    <dd><tal:source_label replace="usage_summary/source_label" />
7573.3.14 by Celso Providelo
Simplified page-macro.
241
       (<tal:sources_size
9209.8.3 by Michael Nelson
Updated package counters macro to dl.
242
          replace="usage_summary/sources_size/fmt:bytes" />)</dd>
243
    <dd>
8367.1.2 by Celso Providelo
applying review comments, r=salgado.
244
       <tal:binary_label replace="usage_summary/binary_label" />
7573.3.14 by Celso Providelo
Simplified page-macro.
245
       (<tal:binaries_size
9209.8.3 by Michael Nelson
Updated package counters macro to dl.
246
          replace="usage_summary/binaries_size/fmt:bytes" />)</dd>
247
    <dt>Repository size:</dt>
248
    <dd><tal:used replace="usage_summary/used/fmt:bytes" />
8367.1.3 by Celso Providelo
Addressing UI issues, r=beuno.
249
       (<span tal:attributes="class usage_summary/used_css_class"
250
              tal:content="string:${usage_summary/used_percentage}%"/>)
9209.8.3 by Michael Nelson
Updated package counters macro to dl.
251
        of <tal:quota replace="usage_summary/quota/fmt:bytes" /></dd>
252
  </dl>
8367.1.1 by Celso Providelo
Fixing bug #371584 (exposing the quota value to users viewing the PPA page).
253
6565.2.2 by Celso Providelo
more UI and interface clean up in preparation to ArchiveRebuild UI.
254
</metal:package_counters>
255
7434.3.5 by Michael Nelson
Added browser tests where appropriate.
256
<metal:build_status_summary define-macro="build-status-summary">
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
257
258
  <tal:comment replace="nothing">
9209.8.2 by Michael Nelson
Initial tmp layout for screenshot.
259
    Present a summary of the packages with build statuses for the archive.
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
260
    :archive: targetted IArchive.
9209.8.10 by Michael Nelson
Added view test for ArchivePackageView.
261
262
    XXX noodles 20090827 bug=419921
263
    Currently we can only provide a direct link to successful builds
264
    as there is no single filtering option for failed and pending
265
    builds.
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
266
  </tal:comment>
267
9209.8.7 by Michael Nelson
Another attempt at presenting the build count summary.
268
  <div id="build-count-summary">
269
9209.8.8 by Michael Nelson
Added link for successful builds from summary.
270
    <p>A total of
271
      <span class="build-count total"
272
            tal:content="view/build_counters/total">100</span> builds have
273
      been dispatched for this PPA.</p>
274
275
    <dl>
276
      <dt>Completed builds</dt>
277
      <dd>
9209.8.20 by Michael Nelson
Initial changes that refactors the package filtering into normal LP-forms, allowing re-use and field selection.
278
        <a tal:attributes="href context/menu:overview/builds_successful/fmt:url">
9209.8.8 by Michael Nelson
Added link for successful builds from summary.
279
          <span class="build-count succeeded"
280
                tal:content="view/build_counters/succeeded">100</span>
281
          successful</a></dd>
282
      <dd>
283
        <span class="build-count failed"
284
              tal:content="view/build_counters/failed">100</span>
285
        failed</dd>
286
    </dl>
287
288
  <p tal:condition="view/build_counters/pending">
289
    A recent upload has resulted in
290
    <span class="build-count pending"
291
          tal:content="view/build_counters/pending">100</span>
292
    pending builds.
9209.8.7 by Michael Nelson
Another attempt at presenting the build count summary.
293
  </p>
9209.8.5 by Michael Nelson
updated the package build summary to use dl (better use of space.)
294
  </div>
7434.3.5 by Michael Nelson
Added browser tests where appropriate.
295
</metal:build_status_summary>
7434.3.3 by Michael Nelson
Initial commit of all front-end-only changes from larger branch. Still
296
7660.8.3 by Michael Nelson
Moved the package filter forms to single macro.
297
<metal:package_filter_form define-macro="package-filter-form">
298
  <tal:comment replace="nothing">
299
    Present the filtering form used on a few archive pages.
300
  </tal:comment>
301
7660.8.4 by Michael Nelson
Moved styling on package search form to style sheet.
302
  <form class="package-search-filter" action="" method="GET">
7660.8.3 by Michael Nelson
Moved the package filter forms to single macro.
303
    <label for="name">Package name contains:</label>
304
    <input id="field.name_filter" title="Package Name" size="20"
305
            type="text" name="field.name_filter"
306
            tal:attributes="value request/field.name_filter|nothing"/>
307
    <tal:status_filter
308
        replace="structure view/plain_status_filter_widget" /> in
309
    <tal:series_filter
310
        replace="structure view/plain_series_filter_widget" />
311
    <input type="submit" value="Filter" />
312
  </form>
313
314
</metal:package_filter_form>
315
9209.15.2 by Michael Nelson
Initial latest updates portlet.
316
<metal:latest_updates_portlet define-macro="latest-updates-portlet">
317
  <tal:comment replace="nothing">
318
    Present the latest updates for a PPA in a portlet.
319
  </tal:comment>
320
321
  <tal:latest_updates define="updates view/latest_updates">
322
  <div id="portlet-latest-updates" class="portlet">
323
    <h2>Latest updates</h2>
324
325
    <p tal:condition="not: updates">
326
      <tal:name replace="context/displayname" /> has no updates.
327
    </p>
328
    <tal:updates condition="updates">
329
      <ul class="latest-ppa-updates">
330
        <li tal:repeat="update updates"
9209.15.5 by Michael Nelson
Some improvements after brad's review.
331
            tal:attributes="class update/status_class">
9209.15.2 by Michael Nelson
Initial latest updates portlet.
332
          <strong tal:content="update/title">Firefox-3.5</strong>
333
          <span class="duration">
334
            <span tal:replace="update/duration/fmt:approximateduration">
335
              3 minutes
336
            </span>
337
            ago
338
          </span><br />
339
          <span tal:replace="update/status">Successful</span>
9710.2.1 by Michael Nelson
Adds the failed builds to the latest updatest portlet on PPA pages.
340
          <span tal:condition="update/builds"
341
                class="build-details">
9710.2.2 by Michael Nelson
Small simplification by returning [] instead of None for statuses other than Failed.
342
            <a tal:repeat="build update/builds"
343
               tal:attributes="href build/fmt:url"
9710.2.1 by Michael Nelson
Adds the failed builds to the latest updatest portlet on PPA pages.
344
               tal:content="build/arch_tag">i386</a>
345
          </span>
9209.15.2 by Michael Nelson
Initial latest updates portlet.
346
        </li>
347
      </ul>
348
    </tal:updates>
349
    </div>
350
  </tal:latest_updates>
351
</metal:latest_updates_portlet>
352
6016.3.1 by Celso Providelo
Split ArchiveSourceSelectionFormView class from ArchivePackageDeletionView, so it can be reused for ArchivePackageCopyView. Also setup a form-macro page for easily reusing the same template structure.
353
</tal:root>