1<%--
2  ~ Copyright (c) 2018 Google Inc. All Rights Reserved.
3  ~
4  ~ Licensed under the Apache License, Version 2.0 (the "License"); you
5  ~ may not use this file except in compliance with the License. You may
6  ~ obtain a copy of the License at
7  ~
8  ~     http://www.apache.org/licenses/LICENSE-2.0
9  ~
10  ~ Unless required by applicable law or agreed to in writing, software
11  ~ distributed under the License is distributed on an "AS IS" BASIS,
12  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13  ~ implied. See the License for the specific language governing
14  ~ permissions and limitations under the License.
15  --%>
16<%@ page contentType='text/html;charset=UTF-8' language='java' %>
17<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions' %>
18<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>
19
20<html>
21  <%@ include file="header.jsp" %>
22  <link rel='stylesheet' href='/css/show_gcs_log.css'>
23  <link rel='stylesheet' href='/css/search_header.css'>
24  <script src='https://www.gstatic.com/external_hosted/moment/min/moment-with-locales.min.js'></script>
25  <script src='js/time.js'></script>
26  <script src='js/plan_runs.js'></script>
27  <script src='js/search_header.js'></script>
28  <script type='text/javascript'>
29      $(document).ready(function() {
30        var paraMap = {'path': '', 'entry': ''};
31        $('.modal').modal({
32          dismissible: true,  // Modal can be dismissed by clicking outside of the modal
33          opacity: .5,  // Opacity of modal background
34          inDuration: 300,  // Transition in duration
35          outDuration: 200,  // Transition out duration
36          startingTop: '4%',  // Starting top style attribute
37          endingTop: '10%',  // Ending top style attribute
38          ready: function(modal, trigger) {  // Callback for Modal open. Modal and trigger parameters available.
39            $('.loading-overlay').show();
40            if ($(modal).attr("id") == "logEntryListModal") {
41              console.log($(trigger));
42              $(trigger).addClass("active");
43              paraMap['path'] = "${path}" + trigger.text().trim();
44              var fileName = paraMap['path'].substring(paraMap['path'].lastIndexOf('/')+1);  // Getting filename
45              $(modal).find('#entry-list-modal-title').text(fileName);  // Set file name for modal window
46              var url = "${requestScope['javax.servlet.forward.servlet_path']}?path=" + paraMap['path'];
47              $(modal).find('#downloadLink').prop('href', url + "&action=download");
48              $.get( url, function(data) {
49                var entryList = $(modal).find('#modal-entry-list');
50                $(data.entryList).each(function( index, element ) {
51                  entryList.append("<li class='collection-item'><a href='#logEntryViewModal' class='modal-trigger'>" + element + "</a></li>");
52                });
53              }).done(function() {
54                  $('.loading-overlay').hide();
55              });
56            } else {
57              paraMap['entry'] = trigger.text().trim();
58              $(modal).find('#entry-view-modal-title').text(paraMap['entry']);
59              var entryUrl = "${requestScope['javax.servlet.forward.servlet_path']}?path=" + paraMap['path'] + "&entry=" + paraMap['entry'];
60              $.get( entryUrl, function(data) {
61                $(modal).find('#entry-view-modal-content').text(data.entryContent);
62              }).done(function() {
63                $('.loading-overlay').hide();
64              });
65            }
66          },
67          complete: function(modal) {
68              if ($(modal).attr("id") == "logEntryListModal") {
69                  $(modal).find('#modal-entry-list').find("li").remove();
70                  $("div.collection > a.collection-item.active").removeClass('active')
71              } else {
72                  $(modal).find('#entry-view-modal-content').text('');
73              }
74          }  // Callback for Modal close
75        });
76      });
77  </script>
78
79  <body>
80    <div class='wide container'>
81      <div class='row' id='release-container'>
82        <h5>Current Directory Path : ${path}</h5>
83        <hr/>
84        <div class="row">
85          <div class="col s7">
86            <h4>Directory List</h4>
87            <ul class="collection">
88            <c:forEach varStatus="dirLoop" var="dirName" items="${dirList}">
89              <li class="collection-item">
90                <a href="${requestScope['javax.servlet.forward.servlet_path']}?path=${dirName}">
91                  <c:out value="${dirName}"></c:out>
92                  <c:if test="${dirLoop.first && path ne '/'}">
93                    (Move to Parent)
94                  </c:if>
95                </a>
96              </li>
97              <c:if test="${!dirLoop.last}">
98              </c:if>
99            </c:forEach>
100            </ul>
101          </div>
102          <div class="col s5">
103            <h4>File List</h4>
104            <div class="collection">
105            <c:forEach varStatus="fileLoop" var="fileName" items="${fileList}">
106              <a href="#logEntryListModal" class="collection-item modal-trigger">
107                <c:out value="${fileName}"></c:out>
108              </a>
109              <c:if test="${!fileLoop.last}">
110              </c:if>
111            </c:forEach>
112            </div>
113          </div>
114        </div>
115
116      </div>
117    </div>
118
119    <%@ include file="footer.jsp" %>
120
121    <!-- Modal For Zip file entries -->
122    <div id="logEntryListModal" class="modal">
123      <div class="modal-content">
124        <h4 id="entry-list-modal-title" class="truncate"></h4>
125        <div id="entry-list-modal-content">
126          <ul id="modal-entry-list" class="collection"></ul>
127        </div>
128      </div>
129      <div class="modal-footer">
130        <div class="row">
131          <div class="col s3 offset-s6">
132            <a href="#!" id="downloadLink" class="modal-action modal-close waves-effect waves-green btn">Download</a>
133          </div>
134          <div class="col s3">
135            <a href="#!" class="modal-action modal-close waves-effect waves-green btn">Close</a>
136          </div>
137        </div>
138      </div>
139
140      <div class="loading-overlay">
141        <div class="preloader-wrapper big active" style="top: 25%; left: 45%;">
142          <div class="spinner-layer spinner-blue-only">
143            <div class="circle-clipper left">
144              <div class="circle"></div>
145            </div>
146            <div class="gap-patch">
147              <div class="circle"></div>
148            </div>
149            <div class="circle-clipper right">
150              <div class="circle"></div>
151            </div>
152          </div>
153        </div>
154      </div>
155
156    </div>
157
158    <!-- Modal For Zip file entry's content -->
159    <div id="logEntryViewModal" class="modal modal-fixed-footer">
160      <div class="modal-content">
161        <h4 id="entry-view-modal-title" class="truncate"></h4>
162        <div id="entry-view-modal-content">
163
164        </div>
165      </div>
166      <div class="modal-footer">
167        <a href="#!" class="modal-action modal-close waves-effect waves-green btn">Close</a>
168      </div>
169
170      <div class="loading-overlay">
171        <div class="preloader-wrapper big active" style="top: 25%; left: 45%;">
172          <div class="spinner-layer spinner-blue-only">
173            <div class="circle-clipper left">
174              <div class="circle"></div>
175            </div>
176            <div class="gap-patch">
177              <div class="circle"></div>
178            </div>
179            <div class="circle-clipper right">
180              <div class="circle"></div>
181            </div>
182          </div>
183        </div>
184      </div>
185
186    </div>
187  </body>
188</html>
189