52
52
<th style =" text-transform :none ;" ><span style =" color :#000 ;" > File Hash </span ></th >
53
53
<!-- <th style="text-transform:none;"><span style="color:#000;"> Merkle Hash </span></th> -->
54
54
<th style =" width :130px ; text-transform :none ;" > <span style =" color :#000 ;" > Size </span ></th >
55
+ <th style =" width :60px ; text-transform :none ;" > <span uk-icon =" cog" style =" color :#000 ;" > </span ></th >
55
56
</tr >
56
57
</thead >
57
58
<tbody >
66
67
<td class =" normal-txt uk-text-truncate" >
67
68
<span style =" cursor : pointer ;" @click =" copyClipboard(f.hash)" uk-tooltip =" Copy" uk-icon =" icon:copy; ratio:0.9;" ></span > {{ f.hash }}
68
69
</td >
69
- <!-- <td class="uk-text-truncate">
70
- <span>
71
- {{ f.merkle_root_hash }}
72
- </span>
73
- </td> -->
74
70
<td class =" normal-txt" >
75
71
<span >
76
72
{{ $filters.formatsize(f.size) }}
77
73
</span >
78
74
</td >
75
+ <td class =" uk-text-truncate" >
76
+ <span @click =" showFileDeleteModal(f.key)" uk-tooltip =" Delete item locally" style =" color :red ; cursor : pointer ;" uk-icon =" close" >
77
+ </span >
78
+ </td >
79
79
</tr >
80
80
</tbody >
81
81
</table >
113
113
</div >
114
114
</div >
115
115
116
+ <div id =" modal-deletefile" uk-modal =" container: #files-container; esc-close:false; bg-close:false;" >
117
+ <div style =" padding-top : 17px ; width : 60% ; padding-bottom : 20px ;" class =" uk-modal-dialog uk-modal-body uk-margin-auto-vertical" >
118
+ <button id =" close-modal-create" class =" uk-modal-close-default" type =" button" uk-close ></button >
119
+ <h2 class =" modal-header" >Delete File</h2 >
120
+
121
+ <div class =" normal-txt" style =" margin-top :15px ;" >
122
+ Are you sure you want to delete this file?
123
+ </div >
124
+ <div style =" padding :0px 10px ; margin-top :10px ;" >
125
+ <div v-if =" fileDeleteError != ''" style =" margin-top :10px ; text-align : center ;" >
126
+ <span class =" uk-text-small uk-text-danger" > <span style =" margin-right :5px ;"
127
+ uk-icon =" icon: warning;" ></span > {{ fileDeleteError }} </span >
128
+ </div >
129
+ </div >
130
+ <div style =" padding :8px 0px ;" class =" uk-modal-footer uk-text-right" >
131
+ <button @click =" deleteFile(tmpFileKey)" class =" uk-button ffg-button"
132
+ style =" text-transform : none ; width :150px ; height : 40px ;" >
133
+ Delete
134
+ <span class =" uk-icon" uk-icon =" icon: close" ></span >
135
+ </button >
136
+ </div >
137
+ </div >
138
+ </div >
116
139
117
140
</div >
118
141
</template >
@@ -134,6 +157,8 @@ export default {
134
157
},
135
158
data () {
136
159
return {
160
+ tmpFileKey: " " ,
161
+ fileDeleteError: " " ,
137
162
loadingFiles: false ,
138
163
pagination: {},
139
164
nodeAddress: " " ,
@@ -234,13 +259,44 @@ export default {
234
259
paginator .paginate ({ rows: this .files , count: response .data .result .total });
235
260
let pl = paginator .payload ();
236
261
this .pagination = { ... pl };
237
-
262
+
238
263
} catch (e) {
239
264
alert (e .message )
240
265
} finally {
241
266
this .loadingFiles = false ;
242
267
}
243
268
},
269
+ showFileDeleteModal (key ) {
270
+ this .tmpFileKey = key;
271
+ const myModal = document .getElementById (' modal-deletefile' );
272
+ const modal = window .UIkit .modal (myModal);
273
+ modal .show ();
274
+ },
275
+ hideFileDeleteModal (key ) {
276
+ this .tmpFileKey = key;
277
+ const myModal = document .getElementById (' modal-deletefile' );
278
+ const modal = window .UIkit .modal (myModal);
279
+ modal .hide ();
280
+ },
281
+ async deleteFile (fileKey ) {
282
+ try {
283
+ this .fileDeleteError = " " ;
284
+ const data = {
285
+ jsonrpc: ' 2.0' ,
286
+ method: " storage.DeleteUploadedFile" ,
287
+ params: [{ key: fileKey, access_token: this .globalState .jwtAccessToken }],
288
+ id: 1
289
+ };
290
+
291
+ let response = await axios .post (localNodeEndpoint, data);
292
+ if (response .data .result .success ) {
293
+ this .hideFileDeleteModal ()
294
+ this .reload ()
295
+ }
296
+ } catch (e) {
297
+ alert (e .message )
298
+ }
299
+ },
244
300
}
245
301
}
246
302
</script >
0 commit comments