mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 23:34:45 +00:00
feat: optimize commonjs (#6906)
Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import { Utils } from '../utils/utils';
|
||||
import FileTag from './file-tag';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
class Dirent {
|
||||
constructor(json) {
|
||||
this.id = json.id || '0000000000000000';
|
||||
this.name = json.name;
|
||||
this.type = json.type;
|
||||
this.mtime = json.mtime;
|
||||
if (json.mtime == 0) {
|
||||
if (!json.mtime) {
|
||||
this.mtime_relative = '';
|
||||
} else {
|
||||
this.mtime_relative = moment.unix(json.mtime).fromNow();
|
||||
this.mtime_relative = dayjs.unix(json.mtime).fromNow();
|
||||
}
|
||||
this.permission = json.permission || 'rw';
|
||||
this.isSelected = false; // is check or not
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import moment from 'moment';
|
||||
moment.locale(window.app.config.lang);
|
||||
import dayjs from 'dayjs';
|
||||
dayjs.locale(window.app.config.lang);
|
||||
|
||||
export default class FileHistory {
|
||||
|
||||
constructor(object) {
|
||||
this.commitId = object.commit_id || undefined;
|
||||
this.ctime = object.ctime ? moment(object.ctime).format('YYYY-MM-DD HH:mm') : '';
|
||||
this.ctime = object.ctime ? dayjs(object.ctime).format('YYYY-MM-DD HH:mm') : '';
|
||||
this.creatorName = object.creator_name || '';
|
||||
this.size = object.size || 0;
|
||||
this.revRenamedOldPath = object.rev_renamed_old_path || '';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { lang } from '../utils/constants';
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
moment.locale(lang);
|
||||
dayjs.locale(lang);
|
||||
|
||||
class OrgGroupInfo {
|
||||
constructor(object) {
|
||||
@@ -10,7 +10,7 @@ class OrgGroupInfo {
|
||||
this.creatorName = object.creator_name;
|
||||
this.creatorEmail = object.creator_email;
|
||||
this.creatorContactEmail = object.creator_contact_email;
|
||||
this.ctime = moment(object.ctime).format('YYYY-MM-DD HH:mm:ss');
|
||||
this.ctime = dayjs(object.ctime).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { lang } from '../utils/constants';
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
moment.locale(lang);
|
||||
dayjs.locale(lang);
|
||||
|
||||
class OrgLogsFileAuditEvent {
|
||||
constructor(object) {
|
||||
@@ -15,7 +15,7 @@ class OrgLogsFileAuditEvent {
|
||||
this.user_name = object.user_name;
|
||||
this.user_email = object.user_email;
|
||||
this.user_contact_email = object.user_contact_email;
|
||||
this.time = moment(object.time).format('YYYY-MM-DD HH:mm:ss');
|
||||
this.time = dayjs(object.time).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { lang } from '../utils/constants';
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
moment.locale(lang);
|
||||
dayjs.locale(lang);
|
||||
|
||||
class OrgLogsFileUpdateEvent {
|
||||
constructor(object) {
|
||||
@@ -13,7 +13,7 @@ class OrgLogsFileUpdateEvent {
|
||||
this.repo_encrypted = object.repo_encrypted;
|
||||
this.repo_commit_id = object.repo_commit_id;
|
||||
this.user_contact_email = object.user_contact_email;
|
||||
this.time = moment(object.time).format('YYYY-MM-DD HH:mm:ss');
|
||||
this.time = dayjs(object.time).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { lang } from '../utils/constants';
|
||||
import moment from 'moment';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
moment.locale(lang);
|
||||
dayjs.locale(lang);
|
||||
|
||||
class OrgLogsPermAuditEvent {
|
||||
constructor(object) {
|
||||
@@ -18,7 +18,7 @@ class OrgLogsPermAuditEvent {
|
||||
this.repo_name = object.repo_name;
|
||||
this.folder_name = object.folder_name;
|
||||
this.folder_path = object.folder_path;
|
||||
this.time = moment(object.time).format('YYYY-MM-DD HH:mm:ss');
|
||||
this.time = dayjs(object.time).format('YYYY-MM-DD HH:mm:ss');
|
||||
this.permission = object.permission;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,9 @@
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import { lang } from '../utils/constants';
|
||||
import moment from 'moment';
|
||||
|
||||
moment.locale(lang);
|
||||
dayjs.locale(lang);
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
class OrgUserInfo {
|
||||
constructor(object) {
|
||||
@@ -12,8 +14,8 @@ class OrgUserInfo {
|
||||
this.is_active = object.is_active;
|
||||
this.quota_usage = object.quota_usage;
|
||||
this.quota_total = object.quota_total;
|
||||
this.last_login = object.last_login ? moment(object.last_login).fromNow() : '--';
|
||||
this.ctime = moment(object.ctime).format('YYYY-MM-DD HH:mm:ss');
|
||||
this.last_login = object.last_login ? dayjs(object.last_login).fromNow() : '--';
|
||||
this.ctime = dayjs(object.ctime).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user