parent
5737dd23ca
commit
8de9db08a6
@ -1,4 +1,10 @@
|
|||||||
div.code-wrapper {
|
div.code-wrapper {
|
||||||
border: 2px solid #8c8c8c;
|
border: 2px solid #8c8c8c;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
||||||
|
&.not-offline {
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 100px;
|
||||||
|
color: #595959;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
import {Model} from './Model';
|
||||||
|
|
||||||
|
export interface ICodium {
|
||||||
|
id?: number;
|
||||||
|
Language: string;
|
||||||
|
NodeId: string;
|
||||||
|
PageId: string;
|
||||||
|
code: string;
|
||||||
|
UUID: string;
|
||||||
|
needsServerUpdate?: boolean;
|
||||||
|
deleted?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Codium extends Model<ICodium> implements ICodium {
|
||||||
|
id?: number;
|
||||||
|
Language: string;
|
||||||
|
NodeId: string;
|
||||||
|
PageId: string;
|
||||||
|
code: string;
|
||||||
|
UUID: string;
|
||||||
|
needsServerUpdate?: boolean;
|
||||||
|
deleted?: boolean;
|
||||||
|
|
||||||
|
public static getTableName() {
|
||||||
|
return 'codiums';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static getSchema() {
|
||||||
|
return '++id, Language, NodeId, PageId, code, UUID, needsServerUpdate, deleted';
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
Language: string,
|
||||||
|
NodeId: string,
|
||||||
|
PageId: string,
|
||||||
|
code: string,
|
||||||
|
UUID: string,
|
||||||
|
needsServerUpdate?: boolean,
|
||||||
|
deleted?: boolean,
|
||||||
|
id?: number
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.Language = Language;
|
||||||
|
this.NodeId = NodeId;
|
||||||
|
this.PageId = PageId;
|
||||||
|
this.code = code;
|
||||||
|
this.UUID = UUID;
|
||||||
|
|
||||||
|
if ( typeof needsServerUpdate !== 'undefined' ) {
|
||||||
|
this.needsServerUpdate = needsServerUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( typeof deleted !== 'undefined' ) {
|
||||||
|
this.deleted = deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( id ) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public fillFromRecord(record: any) {
|
||||||
|
this.Language = record.Language;
|
||||||
|
this.NodeId = record.NodeId;
|
||||||
|
this.PageId = record.PageId;
|
||||||
|
this.code = record.code;
|
||||||
|
this.UUID = record.UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSaveRecord(): any {
|
||||||
|
return {
|
||||||
|
...(this.id ? { id: this.id } : {}),
|
||||||
|
Language: this.Language,
|
||||||
|
NodeId: this.NodeId,
|
||||||
|
PageId: this.PageId,
|
||||||
|
code: this.code,
|
||||||
|
UUID: this.UUID,
|
||||||
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public getDatabase(): Dexie.Table<ICodium, number> {
|
||||||
|
return this.staticClass().dbService.table('codiums') as Dexie.Table<ICodium, number>;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
export function uuid_v4() {
|
||||||
|
// @ts-ignore
|
||||||
|
return ([1e7] + - 1e3 + - 4e3 + - 8e3 + - 1e11).replace(/[018]/g, c =>
|
||||||
|
// tslint:disable-next-line:no-bitwise
|
||||||
|
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in new issue