mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Closes #150: Display file name in audit log
This commit is contained in:
parent
6f3ae6da9d
commit
517e4a4507
@ -1,18 +1,12 @@
|
|||||||
package com.sismics.docs.core.model.jpa;
|
package com.sismics.docs.core.model.jpa;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Lob;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Transient;
|
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.sismics.util.mime.MimeTypeUtil;
|
import com.sismics.util.mime.MimeTypeUtil;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File entity.
|
* File entity.
|
||||||
*
|
*
|
||||||
@ -176,7 +170,8 @@ public class File implements Loggable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toMessage() {
|
public String toMessage() {
|
||||||
return documentId;
|
// Attached document ID and name concatenated
|
||||||
|
return documentId + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,12 +14,12 @@ public interface Loggable {
|
|||||||
*
|
*
|
||||||
* @return Entity message
|
* @return Entity message
|
||||||
*/
|
*/
|
||||||
public String toMessage();
|
String toMessage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loggable are soft deletable.
|
* Loggable are soft deletable.
|
||||||
*
|
*
|
||||||
* @return deleteDate
|
* @return deleteDate
|
||||||
*/
|
*/
|
||||||
public Date getDeleteDate();
|
Date getDeleteDate();
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package com.sismics.docs.core.util;
|
package com.sismics.docs.core.util;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
|
|
||||||
import com.sismics.docs.core.constant.AuditLogType;
|
import com.sismics.docs.core.constant.AuditLogType;
|
||||||
import com.sismics.docs.core.dao.jpa.AuditLogDao;
|
import com.sismics.docs.core.dao.jpa.AuditLogDao;
|
||||||
import com.sismics.docs.core.model.jpa.AuditLog;
|
import com.sismics.docs.core.model.jpa.AuditLog;
|
||||||
import com.sismics.docs.core.model.jpa.Loggable;
|
import com.sismics.docs.core.model.jpa.Loggable;
|
||||||
import com.sismics.util.context.ThreadLocalContext;
|
import com.sismics.util.context.ThreadLocalContext;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audit log utilities.
|
* Audit log utilities.
|
||||||
*
|
*
|
||||||
@ -17,8 +17,9 @@ public class AuditLogUtil {
|
|||||||
/**
|
/**
|
||||||
* Create an audit log.
|
* Create an audit log.
|
||||||
*
|
*
|
||||||
* @param entity Entity
|
* @param loggable Loggable
|
||||||
* @param type Audit log type
|
* @param type Audit log type
|
||||||
|
* @param userId User ID
|
||||||
*/
|
*/
|
||||||
public static void create(Loggable loggable, AuditLogType type, String userId) {
|
public static void create(Loggable loggable, AuditLogType type, String userId) {
|
||||||
// Get the entity ID
|
// Get the entity ID
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
<a ng-href="#/document/view/{{ log.target }}">{{ log.message }}</a>
|
<a ng-href="#/document/view/{{ log.target }}">{{ log.message }}</a>
|
||||||
</span>
|
</span>
|
||||||
<span ng-switch-when="File">
|
<span ng-switch-when="File">
|
||||||
<a ng-if="log.message" ng-href="#/document/view/{{ log.message }}/content/file/{{ log.target }}">{{ 'open' | translate }}</a>
|
<a ng-if="log.message" ng-href="#/document/view/{{ log.message | limitTo: 36 }}/content/file/{{ log.target }}">
|
||||||
|
<span ng-if="log.message.length > 36">{{ log.message | limitTo: 1000 : 36 }}</span>
|
||||||
|
<span ng-if="log.message.length == 36">{{ 'open' | translate }}</span>
|
||||||
|
</a>
|
||||||
<a ng-if="!log.message" ng-href="#/document/file/{{ log.target }}">{{ 'open' | translate }}</a>
|
<a ng-if="!log.message" ng-href="#/document/file/{{ log.target }}">{{ 'open' | translate }}</a>
|
||||||
</span>
|
</span>
|
||||||
<span ng-switch-when="Comment">
|
<span ng-switch-when="Comment">
|
||||||
|
Loading…
Reference in New Issue
Block a user