Skip to content

Commit 10934b3

Browse files
committed
feature: cloudcmd: add ability to show modification time (#230)
1 parent ddf5a59 commit 10934b3

12 files changed

Lines changed: 87 additions & 4 deletions

File tree

.webpack/js.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ const splitChunks = {
7777
'themes/light',
7878
'columns/name-size',
7979
'columns/name-size-date',
80+
'columns/name-size-time',
81+
'columns/name-size-date-time',
8082
];
8183

8284
return !lazyChunks.includes(chunk.name);
@@ -111,6 +113,7 @@ export default {
111113
'themes/light': `${dirThemes}/light.css`,
112114
'columns/name-size': `${dirColumns}/name-size.css`,
113115
'columns/name-size-date': `${dirColumns}/name-size-date.css`,
116+
'columns/name-size-date-time': `${dirColumns}/name-size-date-time.css`,
114117
'nojs': `${dirCss}/nojs.css`,
115118
'help': `${dirCss}/help.css`,
116119
'view': `${dirCss}/view.css`,

client/modules/config/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global CloudCmd, DOM, io */
21
import '../../../css/config.css';
32
import {rendy} from 'rendy';
43
import currify from 'currify';
@@ -14,6 +13,10 @@ import {getTitle} from '#common/cloudfunc';
1413
import * as Images from '#dom/images';
1514
import * as input from './input.js';
1615

16+
const {
17+
CloudCmd,
18+
DOM,
19+
} = globalThis;
1720
const {Dialog, setTitle} = DOM;
1821

1922
const Name = 'Config';
@@ -78,7 +81,7 @@ function initSocket() {
7881

7982
const ONE_MINUTE = 60 * 1000;
8083

81-
const socket = io.connect(href + prefixSocket + '/config', {
84+
const socket = globalThis.io.connect(href + prefixSocket + '/config', {
8285
reconnectionAttempts: Infinity,
8386
reconnectionDelay: ONE_MINUTE,
8487
path: `${prefix}/socket.io`,

common/cloudfunc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export const buildFromJSON = (params) => {
154154
const name = getFieldName('name');
155155
const size = getFieldName('size');
156156
const date = getFieldName('date');
157+
const time = getFieldName('time');
157158

158159
const header = rendy(templateFile, {
159160
tag: 'div',
@@ -163,6 +164,7 @@ export const buildFromJSON = (params) => {
163164
name,
164165
size,
165166
date,
167+
time,
166168
owner,
167169
mode,
168170
});
@@ -195,6 +197,7 @@ export const buildFromJSON = (params) => {
195197
name: linkResult,
196198
size: '<dir>',
197199
date: '--.--.----',
200+
time: '--.--.----',
198201
owner: '.',
199202
mode: '--- --- ---',
200203
});
@@ -213,6 +216,7 @@ export const buildFromJSON = (params) => {
213216
type,
214217
mode,
215218
date,
219+
time,
216220
owner,
217221
size,
218222
} = file;
@@ -235,6 +239,7 @@ export const buildFromJSON = (params) => {
235239
name: linkResult,
236240
size,
237241
date: formatDate(date),
242+
time,
238243
owner,
239244
mode,
240245
});
@@ -249,6 +254,7 @@ export const buildFromJSON = (params) => {
249254
const updateField = (file) => ({
250255
...file,
251256
date: file.date || '--.--.----',
257+
time: file.time || '--.--.----',
252258
owner: file.owner || 'root',
253259
size: getSize(file),
254260
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.name {
2+
width: 40%;
3+
}
4+
5+
.size {
6+
float: none;
7+
}
8+
9+
.owner {
10+
display: none;
11+
}
12+
13+
.mode {
14+
display: none;
15+
}
16+
17+
.date {
18+
float: right;
19+
width: 20%;
20+
}
21+
22+
.time {
23+
display: inline;
24+
float: right;
25+
width: 20%;
26+
}

css/columns/name-size-date.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@
1818
float: right;
1919
width: 19%;
2020
}
21+
22+
.time {
23+
display: none;
24+
}
25+

css/columns/name-size-time.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.name {
2+
width: 55%;
3+
}
4+
5+
.size {
6+
float: none;
7+
}
8+
9+
.owner {
10+
display: none;
11+
}
12+
13+
.mode {
14+
display: none;
15+
}
16+
17+
.date {
18+
display: none;
19+
}
20+
21+
.time {
22+
float: right;
23+
width: 19%;
24+
}

css/columns/name-size.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@
1818
.date {
1919
display: none;
2020
}
21+
22+
.time {
23+
display: none;
24+
}
25+

css/style.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ a:active {
228228
color: var(--column-color);
229229
}
230230

231+
.time {
232+
color: var(--column-color);
233+
display: none;
234+
}
235+
231236
.owner {
232237
display: inline-block;
233238
width: 13%;

test/common/cloudfunc.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,32 @@
22
<span data-name="js-type" class="mini-icon "></span>
33
<span data-name="js-name" class="name reduce-text">name</span>
44
<span data-name="js-size" class="size reduce-text">size</span>
5+
<span data-name="js-time" class="time reduce-text">time</span>
56
<span data-name="js-date" class="date reduce-text">date</span>
67
<span data-name="js-owner" class="owner reduce-text">owner</span>
78
<span data-name="js-mode" class="mode reduce-text">mode</span>
89
</div><ul data-name="js-files" class="files"><li draggable="true" data-name="js-file-Li4=" class="">
910
<span data-name="js-type" class="mini-icon directory"></span>
1011
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc" title=".." draggable="true">..</a></span>
1112
<span data-name="js-size" class="size reduce-text">&lt;dir&gt;</span>
13+
<span data-name="js-time" class="time reduce-text">--.--.----</span>
1214
<span data-name="js-date" class="date reduce-text">--.--.----</span>
1315
<span data-name="js-owner" class="owner reduce-text">.</span>
1416
<span data-name="js-mode" class="mode reduce-text">--- --- ---</span>
1517
</li><li draggable="true" data-name="js-file-YXBwbG5r" class="">
1618
<span data-name="js-type" class="mini-icon directory"></span>
1719
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc/X11/applnk" title="applnk" draggable="true">applnk</a></span>
1820
<span data-name="js-size" class="size reduce-text">&lt;dir&gt;</span>
21+
<span data-name="js-time" class="time reduce-text">--.--.----</span>
1922
<span data-name="js-date" class="date reduce-text">21.02.2016</span>
2023
<span data-name="js-owner" class="owner reduce-text">root</span>
2124
<span data-name="js-mode" class="mode reduce-text">rwx r-x r-x</span>
2225
</li><li draggable="true" data-name="js-file-JUQwJUIwJUQwJUI5" class="">
2326
<span data-name="js-type" class="mini-icon file"></span>
2427
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc/X11/ай" title="ай" target="_blank" draggable="true">ай</a></span>
2528
<span data-name="js-size" class="size reduce-text">1.30kb</span>
29+
<span data-name="js-time" class="time reduce-text">--.--.----</span>
2630
<span data-name="js-date" class="date reduce-text">--.--.----</span>
2731
<span data-name="js-owner" class="owner reduce-text">root</span>
2832
<span data-name="js-mode" class="mode reduce-text">rwx r-x r-x</span>
29-
</li></ul>
33+
</li></ul>

test/common/cloudfunc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ test('cloudfunc: render', (t) => {
6868
template,
6969
});
7070

71-
Expect += fs.readFileSync(EXPECT_PATH, 'utf8');
71+
Expect += fs.readFileSync(EXPECT_PATH, 'utf8').slice(0, -1);
7272

7373
let i;
7474
const isNotOk = Expect

0 commit comments

Comments
 (0)