aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/index.html
blob: e86e8fc1eaf58d818c764269b04487efa0a79b95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<html>
<head>
    <title> Cloudron Surfer </title>

    <link rel="stylesheet" href="/_admin/css/font-awesome.min.css">
    <link rel="stylesheet" href="/_admin/css/bootstrap.min.css">
    <link rel="stylesheet" href="/_admin/css/style.css">

    <link href="/_admin/img/logo.png" rel="icon" type="image/png">

</head>
<body id="app" @drop="drop" @dragover="dragOver">

    <nav class="navbar navbar-default" v-cloak>
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">Surfer</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li v-show="session.valid"><a href="#" v-on:click="logout()" id="logoutButton">Logout</a></li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="modal fade" tabindex="-1" role="dialog" id="modalDelete" v-cloak>
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                </div>
                <div class="modal-body">
                    <h5 v-show="deleteData.isFile">Really delete <span style="font-weight: bold;">{{ deleteData.filePath }}</span>?</h5>
                    <h5 v-show="deleteData.isDirectory">Really delete folder <span style="font-weight: bold;">{{ deleteData.filePath }}</span> and all its content?</h5>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
                    <button type="button" class="btn btn-danger" v-on:click="del(deleteData)">Yes</button>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" tabindex="-1" role="dialog" id="modalRename" v-cloak>
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">Rename {{ renameData.entry.filePath }}</h4>
                </div>
                <div class="modal-body">
                    <form v-on:submit.prevent="rename(renameData)">
                        <div class="form-group" v-bind:class="{ 'has-error': renameData.error }">
                            <input type="text" class="form-control" v-model="renameData.newFilePath" placeholder="Name" autofocus="true">
                            <label class="control-label">{{ renameData.error }}</label>
                        </div>
                        <button type="submit" style="display: none;"></button>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
                    <button type="button" class="btn btn-success" v-on:click="rename(renameData)">Yes</button>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" tabindex="-1" role="dialog" id="modalcreateDirectory" v-cloak>
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">New directory name</h4>
                </div>
                <div class="modal-body">
                    <form v-on:submit.prevent="createDirectory(createDirectoryData)">
                        <div class="form-group" v-bind:class="{ 'has-error': createDirectoryError }">
                            <input type="text" class="form-control" v-model="createDirectoryData" id="inputDirectoryName" placeholder="Name" autofocus="true">
                            <label class="control-label" for="inputDirectoryName">{{ createDirectoryError }}</label>
                        </div>
                        <button type="submit" style="display: none;"></button>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" v-on:click="createDirectory(createDirectoryData)">Create</button>
                </div>
            </div>
        </div>
    </div>

    <div class="container" v-show="uploadStatus.busy" v-cloak>
        <div class="row">
            <div class="col-lg-12">
                <p>Uploading... ({{ uploadStatus.done }} / {{ uploadStatus.count }}) </p>
                <center>
                    <div class="progress">
                        <div class="progress-bar progress-bar-striped" role="progressbar" v-bind:style="{ width: uploadStatus.percentDone + '%' }">
                            <span class="sr-only">{{ uploadStatus.percentDone }}% Complete</span>
                        </div>
                    </div>
                </center>
            </div>
        </div>
    </div>

    <div class="container" v-show="!session.valid && !busy" v-cloak>
        <div class="row">
            <div class="col-lg-6 col-lg-offset-3">
                <form id="loginForm" v-on:submit.prevent="login()">
                    <div class="form-group">
                        <label for="inputUsername">Username</label>
                        <input type="text" class="form-control" id="inputUsername" v-model="loginData.username" placeholder="Username">
                    </div>
                    <div class="form-group">
                        <label for="inputPassword">Password</label>
                        <input type="password" class="form-control" id="inputPassword" v-model="loginData.password" placeholder="Password">
                    </div>
                    <button type="submit" class="btn btn-default">Submit</button>
                </form>
            </div>
        </div>
    </div>

    <div class="container main" v-show="session.valid" v-cloak>
        <div class="row">
            <div class="col-lg-12">
                <center v-show="!uploadStatus.busy">
                    <form id="fileUploadForm">
                        <input type="file" v-el:upload style="display: none" id="uploadInput" multiple/>
                        <button class="btn btn-primary" v-on:click.stop.prevent="upload()" id="uploadButton">Upload</button>
                    </form>
                </center>
            </div>
            <div class="col-lg-12">
                <ol class="breadcrumb">
                    <li><a href="#/"><i class="fa fa-home"></i></a></li>
                    <li v-for="part in pathParts.slice(0, -1)">
                        <a href="{{ part.link }}">{{ part.name }}</a>
                    </li>
                    <li>{{ pathParts.slice(-1)[0].name }}</li>
                    <button class="btn btn-default btn-sm pull-right" v-on:click="createDirectoryAsk()">Create Folder</button>
                </ol>
            </div>
            <div class="col-lg-12" v-show="busy">
                <br/>
                <br/>
                <center>
                    <i class="fa fa-refresh fa-4x fa-spin"></i>
                </center>
            </div>
            <div class="col-lg-12" v-show="!busy">
                <table class="table table-hover table-condensed sortable">
                    <thead>
                        <tr>
                            <th>Type</th>
                            <th>Name</th>
                            <th class="sorttable_numeric">Size</th>
                            <th class="sorttable_numeric">Modified</th>
                            <th class="sorttable_nosort" style="text-align: right;">Actions</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-show="entries.length === 0">
                            <td colspan="5"><i>Empty folder</i></td>
                        </tr>
                        <tr v-for="entry in entries" v-on:click="open(entry)" class="hand">
                            <td sorttable_customkey="{{ entry.extension }}">
                                <img v-bind:src="entry.previewUrl" height="48px" width="48px"/>
                            </td>
                            <td>{{ entry.filePath }}</td>
                            <td sorttable_customkey="{{ entry.size }}">{{ entry.size | prettyFileSize }}</td>
                            <td><span v-my-tooltip="foobar" data-toggle="tooltip" title="{{ entry.mtime }}">{{ entry.mtime | prettyDate }}</span></td>
                            <td style="text-align: right;">
                                <span class="entry-toolbar">
                                    <button class="btn btn-sm btn-default" v-on:click.stop="download(entry)" title="Download" v-show="entry.isFile"><i class="fa fa-download"></i></button>
                                    <button class="btn btn-sm btn-default" v-on:click.stop="renameAsk(entry)" title="Rename"><i class="fa fa-pencil"></i></button>
                                    <button class="btn btn-sm btn-danger" v-on:click.stop="delAsk(entry)" title="Delete"><i class="fa fa-trash"></i></button>
                                </span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <!-- Footer -->
    <footer class="text-center">
        <span class="text-muted">Created by the <a href="https://cloudron.io" target="_blank">Cloudron</a> team. <a href="https://git.cloudron.io/cloudron/surfer" target="_blank">Get the code</a></span>
    </footer>

    <script src="/_admin/js/jquery-1.12.1.min.js"></script>
    <script src="/_admin/js/bootstrap.min.js"></script>
    <script src="/_admin/js/vue.min.js"></script>
    <script src="/_admin/js/filesize.min.js"></script>
    <script src="/_admin/js/superagent.js"></script>
    <script src="/_admin/js/sorttable.js"></script>
    <script src="/_admin/js/app.js"></script>

</body>
</html>