Refactor LockManager to standardize lock key format and enhance logging; add debug statement in TemplateManager for template rendering
This commit is contained in:
parent
e1ba1f7871
commit
6be53349b5
BIN
src/.DS_Store
vendored
BIN
src/.DS_Store
vendored
Binary file not shown.
0
src/auth/otpcomponent.js
Normal file
0
src/auth/otpcomponent.js
Normal file
@ -20,7 +20,7 @@ export class LockManager {
|
|||||||
// Add a 'lock' event to the 'locks' stream
|
// Add a 'lock' event to the 'locks' stream
|
||||||
logger.debug('Locking object:', object._id);
|
logger.debug('Locking object:', object._id);
|
||||||
try {
|
try {
|
||||||
await etcdServer.setKey(`/${object.type}s/${object._id}/lock`, {
|
await etcdServer.setKey(`/locks/${object.type}s/${object._id}`, {
|
||||||
...object,
|
...object,
|
||||||
locked: true
|
locked: true
|
||||||
});
|
});
|
||||||
@ -34,7 +34,7 @@ export class LockManager {
|
|||||||
|
|
||||||
async unlockObject(object) {
|
async unlockObject(object) {
|
||||||
// Add an 'unlock' event to the 'locks' stream
|
// Add an 'unlock' event to the 'locks' stream
|
||||||
const key = `/${object.type}s/${object._id}/lock`;
|
const key = `/locks/${object.type}s/${object._id}`;
|
||||||
try {
|
try {
|
||||||
logger.debug('Checking user can unlock:', object._id);
|
logger.debug('Checking user can unlock:', object._id);
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ export class LockManager {
|
|||||||
// Get the current lock status of an object and broadcast it
|
// Get the current lock status of an object and broadcast it
|
||||||
logger.info('Getting lock status for object:', object._id);
|
logger.info('Getting lock status for object:', object._id);
|
||||||
try {
|
try {
|
||||||
const lockKey = `/${object.type}s/${object._id}/lock`;
|
const lockKey = `/locks/${object.type}s/${object._id}`;
|
||||||
const lockValue = await etcdServer.getKey(lockKey);
|
const lockValue = await etcdServer.getKey(lockKey);
|
||||||
|
|
||||||
if (lockValue) {
|
if (lockValue) {
|
||||||
@ -87,7 +87,7 @@ export class LockManager {
|
|||||||
(key, value) => {
|
(key, value) => {
|
||||||
const id = key.split('/').pop();
|
const id = key.split('/').pop();
|
||||||
logger.debug('Lock object event:', id);
|
logger.debug('Lock object event:', id);
|
||||||
this.socketManager.broadcast('notify_lock_update', {
|
this.socketClient.socket.emit('lockUpdate', {
|
||||||
...value,
|
...value,
|
||||||
locked: true
|
locked: true
|
||||||
});
|
});
|
||||||
@ -96,7 +96,7 @@ export class LockManager {
|
|||||||
etcdServer.onPrefixDeleteEvent('/locks', this.socketClient.id, key => {
|
etcdServer.onPrefixDeleteEvent('/locks', this.socketClient.id, key => {
|
||||||
const id = key.split('/').pop();
|
const id = key.split('/').pop();
|
||||||
logger.debug('Unlock object event:', id);
|
logger.debug('Unlock object event:', id);
|
||||||
this.socketManager.broadcast('notify_lock_update', {
|
this.socketClient.socket.emit('lockUpdate', {
|
||||||
_id: id,
|
_id: id,
|
||||||
locked: false
|
locked: false
|
||||||
});
|
});
|
||||||
|
|||||||
@ -15,14 +15,18 @@
|
|||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
min-width: calc(<%= width || '50mm' %> + 100px);
|
min-width: calc((<%= width || '50mm' %> * <%= scale || '1' %>) + 100px);
|
||||||
min-height: calc(<%= height || '50mm' %> + 100px);
|
min-height: calc(
|
||||||
|
(<%= height || '50mm' %> * <%= scale || '1' %>) + 100px
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.previewContainer {
|
.previewContainer {
|
||||||
transform: scale(<%= scale || '1' %>);
|
transform: scale(<%= scale || '1' %>);
|
||||||
min-width: calc(<%= width || '50mm' %> + 100px);
|
min-width: calc((<%= width || '50mm' %> + 100px) * <%= scale || '1' %>);
|
||||||
min-height: calc(<%= height || '50mm' %> + 100px);
|
min-height: calc(
|
||||||
|
(<%= height || '50mm' %> + 100px) * <%= scale || '1' %>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
.previewDocument {
|
.previewDocument {
|
||||||
width: <%= width || '50mm' %>;
|
width: <%= width || '50mm' %>;
|
||||||
|
|||||||
@ -11,6 +11,7 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center; /* Horizontal center */
|
justify-content: center; /* Horizontal center */
|
||||||
align-items: center; /* Vertical center */
|
align-items: center; /* Vertical center */
|
||||||
|
transform-origin: center center;
|
||||||
}
|
}
|
||||||
.previewDocument {
|
.previewDocument {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
@ -71,3 +72,8 @@ h4.documentTitle {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.documentBarcode {
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
|||||||
@ -225,6 +225,7 @@ export class TemplateManager {
|
|||||||
async: true,
|
async: true,
|
||||||
...options
|
...options
|
||||||
};
|
};
|
||||||
|
logger.debug('Rendering template:', id);
|
||||||
|
|
||||||
const documentTemplate = await getObject({
|
const documentTemplate = await getObject({
|
||||||
model: documentTemplateModel,
|
model: documentTemplateModel,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user