Closes #150: Display file name in audit log

This commit is contained in:
Benjamin Gamard 2017-11-12 02:06:41 +01:00
parent 6f3ae6da9d
commit 517e4a4507
4 changed files with 15 additions and 16 deletions

View File

@ -1,18 +1,12 @@
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.Strings;
import com.sismics.util.mime.MimeTypeUtil;
import javax.persistence.*;
import java.util.Date;
/**
* File entity.
*
@ -176,7 +170,8 @@ public class File implements Loggable {
@Override
public String toMessage() {
return documentId;
// Attached document ID and name concatenated
return documentId + name;
}
/**

View File

@ -14,12 +14,12 @@ public interface Loggable {
*
* @return Entity message
*/
public String toMessage();
String toMessage();
/**
* Loggable are soft deletable.
*
* @return deleteDate
*/
public Date getDeleteDate();
Date getDeleteDate();
}

View File

@ -1,13 +1,13 @@
package com.sismics.docs.core.util;
import javax.persistence.EntityManager;
import com.sismics.docs.core.constant.AuditLogType;
import com.sismics.docs.core.dao.jpa.AuditLogDao;
import com.sismics.docs.core.model.jpa.AuditLog;
import com.sismics.docs.core.model.jpa.Loggable;
import com.sismics.util.context.ThreadLocalContext;
import javax.persistence.EntityManager;
/**
* Audit log utilities.
*
@ -17,8 +17,9 @@ public class AuditLogUtil {
/**
* Create an audit log.
*
* @param entity Entity
* @param loggable Loggable
* @param type Audit log type
* @param userId User ID
*/
public static void create(Loggable loggable, AuditLogType type, String userId) {
// Get the entity ID

View File

@ -21,7 +21,10 @@
<a ng-href="#/document/view/{{ log.target }}">{{ log.message }}</a>
</span>
<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>
</span>
<span ng-switch-when="Comment">