mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Show size and last updated in missions list
This commit is contained in:
parent
a09651179c
commit
88c3a2067c
@ -1,3 +1,5 @@
|
|||||||
|
var async = require('async');
|
||||||
|
var filesize = require('filesize');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
@ -14,16 +16,30 @@ Missions.prototype.missionPath = function (name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Missions.prototype.list = function (cb){
|
Missions.prototype.list = function (cb){
|
||||||
|
var self = this;
|
||||||
fs.readdir(this.missionsPath(), function (err, files) {
|
fs.readdir(this.missionsPath(), function (err, files) {
|
||||||
if (err) {
|
if (err) {
|
||||||
cb(err);
|
cb(err);
|
||||||
} else {
|
} else {
|
||||||
var missions = files.map(function (filename) {
|
async.map(files, function (filename, cb) {
|
||||||
return {
|
fs.stat(self.missionPath(filename), function (err, stat) {
|
||||||
name: filename,
|
if (err) {
|
||||||
};
|
cb(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
cb(null, {
|
||||||
|
dateCreated: new Date(stat.ctime),
|
||||||
|
dateModified: new Date(stat.mtime),
|
||||||
|
name: filename,
|
||||||
|
size: stat.size,
|
||||||
|
sizeFormatted: filesize(stat.size),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, function (err, missions) {
|
||||||
|
if (cb) {
|
||||||
|
cb(err, missions);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
cb(null, missions);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -20,3 +20,7 @@ body {
|
|||||||
#footer .container .text-muted {
|
#footer .container .text-muted {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-nowrap {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Mission</th>
|
<th>Mission</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Updated</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<td style="width: 100%;">
|
<td style="width: 100%;">
|
||||||
<a href='/api/missions/<%-encodeURI(name)%>'><%-name%></a>
|
<a href='/api/missions/<%-encodeURI(name)%>'><%-name%></a>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="text-nowrap"><%-sizeFormatted%></td>
|
||||||
|
<td class="text-nowrap"><%-dateModified.substring(0, 10)%></td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-danger btn-xs delete">
|
<button type="button" class="btn btn-danger btn-xs delete">
|
||||||
<span class="glyphicon glyphicon-trash"></span> Delete
|
<span class="glyphicon glyphicon-trash"></span> Delete
|
||||||
|
Loading…
Reference in New Issue
Block a user