]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blob - frontend/index.html
20154da6a77229223d711d829c3a30f1b284ceea
[perso/Immae/Projets/Nodejs/Surfer.git] / frontend / index.html
1 <html>
2 <head>
3 <title> Surfer </title>
4
5 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
6
7 <link rel="icon" type="image/png" href="/_admin/img/logo.png">
8
9 <link rel="stylesheet" href="/_admin/css/theme-chalk_2.11.1.css">
10 <link rel="stylesheet" href="/_admin/css/style.css">
11
12 <script src="/_admin/js/jquery-1.12.1.min.js"></script>
13 <script src="/_admin/js/vue.min.js"></script>
14 <script src="/_admin/js/element-ui_2.11.1.min.js"></script>
15 <script src="/_admin/js/element-ui_en_2.11.1.min.js"></script>
16 <script src="/_admin/js/filesize.min.js"></script>
17 <script src="/_admin/js/superagent.js"></script>
18
19 </head>
20 <body>
21
22 <div id="app" @drop="drop" @dragover="dragOver">
23
24 <el-container>
25 <input type="file" ref="upload" style="display: none" multiple/>
26 <input type="file" ref="uploadFolder" style="display: none" multiple webkitdirectory directory/>
27
28 <el-dialog title="Login" :visible.sync="ready && !session.valid" width="30%" :close-on-press-escape="false" :show-close="false">
29 <el-form :model="loginData" label-position="top" @submit.native.prevent>
30 <el-form-item label="Username"><el-input v-model="loginData.username" id="loginUsernameInput" required autofocus :disabled="loginData.busy"></el-input></el-form-item>
31 <el-form-item label="Password"><el-input v-model="loginData.password" id="loginPasswordInput" type="password" required :disabled="loginData.busy"></el-input></el-form-item>
32 <input type="submit" @click="onLogin" v-show="false"/>
33 </el-form>
34 <span slot="footer" class="dialog-footer">
35 <el-button type="primary" @click="onLogin" id="loginSubmitButton"><i class="el-icon-loading" v-show="loginData.busy"></i><span v-show="!loginData.busy">Login</span></el-button>
36 </span>
37 </el-dialog>
38
39 <el-dialog title="Access Tokens" :visible.sync="accessTokensDialogVisible" width="30%">
40 Tokens can be used with the surfer <a href="https://www.npmjs.com/package/cloudron-surfer" target="_blank">cli tool</a> or using the Api directly.
41 They are shared between all users.
42 <br/>
43 <br/>
44 <div>
45 <div v-for="accessToken in accessTokens">
46 <el-input suffix-icon="el-icon-copy-document" v-model="accessToken" class="access-token-input" @focus="onCopyAccessToken" size="small"></el-input>
47 <el-button icon="el-icon-delete" type="danger" size="small" @click="onDeleteAccessToken(accessToken)"></el-button>
48 </div>
49 </div>
50 <br/>
51 <el-button @click="onCreateAccessToken()" size="small" type="primary">Create Access Token</el-button>
52 </el-dialog>
53
54 <el-header>
55 <el-row type="flex" justify="space-between">
56 <div style="padding: 7px;">
57 <span>Surfer</span>
58 </div>
59 <div v-show="session.valid">
60 <el-button type="primary" size="small" icon="el-icon-arrow-left" :disabled="!pathParts.slice(-1).length" @click="onUp"></el-button>
61 </div>
62 <div style="flex-grow: 2; padding: 0 7px;" v-show="session.valid">
63 <el-breadcrumb separator-class="el-icon-arrow-right">
64 <el-breadcrumb-item><a href="#/">Path /</a></el-breadcrumb-item>
65 <el-breadcrumb-item v-for="part in pathParts.slice(0, -1)"><a :href="part.link">{{ part.name }}</a></el-breadcrumb-item>
66 <el-breadcrumb-item v-show="pathParts.slice(-1).length">{{ pathParts.slice(-1).length ? pathParts.slice(-1)[0].name : '' }}</el-breadcrumb-item>
67 </el-breadcrumb>
68 </div>
69 <div align="right" v-show="session.valid">
70 <el-button-group>
71 <el-button type="primary" icon="el-icon-upload2" size="small" @click="onUpload">Upload File</el-button>
72 <el-button type="primary" icon="el-icon-upload" size="small" @click="onUploadFolder">Upload Folder</el-button>
73 <el-button type="primary" icon="el-icon-plus" size="small" @click="onNewFolder">New Folder</el-button>
74 </el-button-group>
75 <el-dropdown @command="onOptionsMenu" :hide-on-click="false" trigger="click">
76 <el-button size="small" icon="el-icon-more" id="burgerMenuButton"></el-button>
77 <el-dropdown-menu slot="dropdown">
78 <el-dropdown-item disabled>Public Folder Listing</el-dropdown-item>
79 <el-dropdown-item command="folderListing">
80 <el-switch v-model="folderListingEnabled" active-text="Enabled" inactive-text="Disabled"></el-switch>
81 </el-dropdown-item>
82 <el-dropdown-item disabled divided>WebDAV Endpoint</el-dropdown-item>
83 <el-dropdown-item><a href="/_webdav/" target="_blank">{{ origin }}/_webdav/</a></el-dropdown-item>
84 <el-dropdown-item command="apiAccess" divided><i class="el-icon-connection"></i> Access Tokens</el-dropdown-item>
85 <el-dropdown-item command="about" divided><i class="el-icon-info"></i> About</el-dropdown-item>
86 <el-dropdown-item command="logout" id="logoutButton"><i class="el-icon-circle-close"></i> Logout</el-dropdown-item>
87 </el-dropdown-menu>
88 </el-dropdown>
89 </div>
90 </el-row>
91 </el-header>
92 <el-main>
93
94 <div v-show="busy">
95 <center><h1><i class="el-icon-loading"></i></h1></center>
96 </div>
97
98 <div v-show="!busy && session.valid" v-cloak>
99 <center>
100 <el-table :data="entries" style="max-width: 1280px;width: 100%" height="100%" empty-text="Folder is emtpy" :default-sort="{ prop: 'filePath', order: 'descending' }" @row-click="open">
101 <el-table-column prop="previewUrl" label="Type" width="100px" sortable>
102 <template slot-scope="scope">
103 <img v-bind:src="scope.row.previewUrl" height="48px" width="48px" style="object-fit: cover;"/>
104 </template>
105 </el-table-column>
106 <el-table-column prop="filePath" label="Name" sortable>
107 <template slot-scope="scope">
108 <el-input v-on:keyup.native.enter="onRenameSubmit(scope.row)" v-on:keyup.native.esc="onRenameEnd(scope.row)" @blur="onRenameEnd(scope.row)" v-model="scope.row.filePathNew" :id="'filePathRenameInputId-' + scope.$index" v-show="scope.row.rename"></el-input>
109 <span v-show="!scope.row.rename">{{ scope.row.filePath }}</span>
110 </template>
111 </el-table-column>
112 <el-table-column prop="size" label="Size" width="150px" sortable :formatter="prettyFileSize"></el-table-column>
113 <el-table-column prop="mtime" label="Modified" width="150px" sortable :formatter="prettyDate"></el-table-column>
114 <el-table-column label="Actions" align="right" width="200px" class-name="list-actions">
115 <template slot-scope="scope">
116 <el-button size="small" icon="el-icon-edit" circle v-show="!scope.row.rename" @click.stop="onRename(scope.row, scope)"></el-button>
117 <el-button size="small" icon="el-icon-download" circle v-show="!scope.row.rename && scope.row.isFile" @click.stop="onDownload(scope.row)"></el-button>
118 <el-button size="small" icon="el-icon-delete" circle v-show="!scope.row.rename" @click.stop="onDelete(scope.row)"></el-button>
119 </template>
120 </el-table-column>
121 </el-table>
122 </center>
123 </div>
124
125 </el-main>
126 <el-footer v-show="uploadStatus.busy">
127 <el-row v-if="uploadStatus.uploadListCount">
128 <center><i class="el-icon-loading"></i> Fetching file information for upload <el-badge class="mark" :value="uploadStatus.uploadListCount"/></center>
129 </el-row>
130 <el-row v-else>
131 <el-col :span="4">
132 Uploading {{ uploadStatus.count }} files ({{ Math.round(uploadStatus.done/1000/1000) }}MB / {{ Math.round(uploadStatus.size/1000/1000) }}MB)
133 </el-col>
134 <el-col :span="20">
135 <el-progress :text-inside="true" :stroke-width="18" :percentage="uploadStatus.percentDone"></el-progress>
136 </el-col>
137 </el-row>
138 </el-footer>
139 </el-container>
140
141 </div>
142
143 <script src="/_admin/js/app.js"></script>
144
145 </body>
146 </html>