Implemented settings frontend log level via props
This commit is contained in:
parent
88105559f7
commit
59c14d681d
@ -1,6 +1,6 @@
|
|||||||
import { Builder } from "builder-pattern";
|
import { Builder } from "builder-pattern";
|
||||||
import * as Handlebars from "handlebars";
|
import * as Handlebars from "handlebars";
|
||||||
import * as log from 'loglevel';
|
import * as log from "loglevel";
|
||||||
import { ChatController } from "./controller/ChatController";
|
import { ChatController } from "./controller/ChatController";
|
||||||
import { UserController } from "./controller/UserController";
|
import { UserController } from "./controller/UserController";
|
||||||
import { ChatModel } from "./model/ChatModel";
|
import { ChatModel } from "./model/ChatModel";
|
||||||
@ -20,89 +20,94 @@ import { UserViewDeps } from "./view/UserViewDeps";
|
|||||||
import { ActiveUserViewModel } from "./viewmodel/ActiveUserViewModel";
|
import { ActiveUserViewModel } from "./viewmodel/ActiveUserViewModel";
|
||||||
import moment = require("moment");
|
import moment = require("moment");
|
||||||
|
|
||||||
log.setLevel("TRACE");
|
// log.setLevel("TRACE");
|
||||||
|
|
||||||
const usersListElement = document.getElementById('contacts-box');
|
const usersListElement = document.getElementById("contacts-box");
|
||||||
const userSearchButton = document.getElementById('user-search');
|
const userSearchButton = document.getElementById("user-search");
|
||||||
const userSearchInputElement = document.getElementById('user-search-term') as HTMLInputElement;
|
const userSearchInputElement = document.getElementById(
|
||||||
const userSearchCancelButton = document.getElementById('user-search-cancel');
|
"user-search-term"
|
||||||
const chatArea = document.getElementById('chat-area-new');
|
) as HTMLInputElement;
|
||||||
|
const userSearchCancelButton = document.getElementById("user-search-cancel");
|
||||||
|
const chatArea = document.getElementById("chat-area-new");
|
||||||
|
|
||||||
|
const activeUserSearchService: SearchService<ActiveUserViewModel> = new FuseSearchService(
|
||||||
const activeUserSearchService: SearchService<ActiveUserViewModel> = new FuseSearchService(["userName"]);
|
["userName"]
|
||||||
|
);
|
||||||
const ns: NotificationService = new AlertifyNotificationService();
|
const ns: NotificationService = new AlertifyNotificationService();
|
||||||
const encryptionService = EncryptionServiceFactory.getEncryptionService();
|
const encryptionService = EncryptionServiceFactory.getEncryptionService();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const chatModelHelper = new ChatModelHelper(encryptionService, ns);
|
const chatModelHelper = new ChatModelHelper(encryptionService, ns);
|
||||||
const chatModel = new ChatModel(chatModelHelper);
|
const chatModel = new ChatModel(chatModelHelper);
|
||||||
const userModel = new UserModel(ns);
|
const userModel = new UserModel(ns);
|
||||||
const cvDeps: ChatViewDeps = {
|
const cvDeps: ChatViewDeps = {
|
||||||
chatModel: chatModel,
|
chatModel: chatModel,
|
||||||
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
||||||
messageContainer: chatArea,
|
messageContainer: chatArea,
|
||||||
messageSendTemplate: TemplateFactory.getTemplate('msg_container_send_template'),
|
messageSendTemplate: TemplateFactory.getTemplate(
|
||||||
messageReceiveTemplate: TemplateFactory.getTemplate('msg_container_template'),
|
"msg_container_send_template"
|
||||||
markdownService: new MarkDownItMarkDownService,
|
),
|
||||||
encryptionService: encryptionService,
|
messageReceiveTemplate: TemplateFactory.getTemplate("msg_container_template"),
|
||||||
notificationService: ns,
|
markdownService: new MarkDownItMarkDownService(),
|
||||||
userModel: userModel
|
encryptionService: encryptionService,
|
||||||
}
|
notificationService: ns,
|
||||||
|
userModel: userModel,
|
||||||
|
};
|
||||||
const chatView = new ChatView(cvDeps);
|
const chatView = new ChatView(cvDeps);
|
||||||
chatModel.attach(chatView);
|
chatModel.attach(chatView);
|
||||||
const chatController = new ChatController(chatModel, chatView);
|
const chatController = new ChatController(chatModel, chatView);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const uvDeps: UserViewDeps = {
|
const uvDeps: UserViewDeps = {
|
||||||
model: userModel,
|
model: userModel,
|
||||||
chatModel: chatModel,
|
chatModel: chatModel,
|
||||||
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
||||||
usersListElement: usersListElement,
|
usersListElement: usersListElement,
|
||||||
userSearchInputElement: userSearchInputElement,
|
userSearchInputElement: userSearchInputElement,
|
||||||
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
||||||
userSearchButton: userSearchButton,
|
userSearchButton: userSearchButton,
|
||||||
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
|
||||||
userSearchCancelButton: userSearchCancelButton,
|
userSearchCancelButton: userSearchCancelButton,
|
||||||
searchService: activeUserSearchService,
|
searchService: activeUserSearchService,
|
||||||
userContactOnlineTemplate: TemplateFactory.getTemplate('user-contact-online-template'),
|
userContactOnlineTemplate: TemplateFactory.getTemplate(
|
||||||
userContactOfflineTemplate: TemplateFactory.getTemplate('user-contact-offline-template'),
|
"user-contact-online-template"
|
||||||
notificationService: ns
|
),
|
||||||
}
|
userContactOfflineTemplate: TemplateFactory.getTemplate(
|
||||||
|
"user-contact-offline-template"
|
||||||
|
),
|
||||||
|
notificationService: ns,
|
||||||
|
};
|
||||||
const userView = new UserView(uvDeps);
|
const userView = new UserView(uvDeps);
|
||||||
userModel.attach(userView);
|
userModel.attach(userView);
|
||||||
const userController = new UserController(userModel, userView);
|
const userController = new UserController(userModel, userView);
|
||||||
userController.getActiveUsers();
|
userController.getActiveUsers();
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
Handlebars.registerHelper('moment', require('helper-moment'));
|
Handlebars.registerHelper("moment", require("helper-moment"));
|
||||||
Handlebars.registerHelper('avatar', function () {
|
Handlebars.registerHelper("avatar", function () {
|
||||||
return '<div class="img_cont_msg"> <img src="https://static.turbosquid.com/Preview/001292/481/WV/_D.jpg" class="rounded-circle user_img_msg"> </div>';
|
return '<div class="img_cont_msg"> <img src="https://static.turbosquid.com/Preview/001292/481/WV/_D.jpg" class="rounded-circle user_img_msg"> </div>';
|
||||||
|
});
|
||||||
|
Handlebars.registerHelper("fromNow", function (date: string) {
|
||||||
|
if (date == null) return ": Never";
|
||||||
|
return moment(date).fromNow();
|
||||||
|
});
|
||||||
|
Handlebars.registerHelper("msgDateFormat", function (date: string) {
|
||||||
|
return moment(date).calendar(moment.now(), {
|
||||||
|
lastWeek: "DD/MM/YY hh:mm A",
|
||||||
|
sameElse: "DD/MM/YY hh:mm A",
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Handlebars.registerHelper('fromNow', function (date: string) {
|
|
||||||
if (date == null)
|
|
||||||
return ": Never"
|
|
||||||
return moment(date).fromNow();
|
|
||||||
})
|
|
||||||
Handlebars.registerHelper('msgDateFormat', function (date: string) {
|
|
||||||
return moment(date).calendar(moment.now(), { lastWeek: "DD/MM/YY hh:mm A", sameElse: "DD/MM/YY hh:mm A" })
|
|
||||||
})
|
|
||||||
|
|
||||||
Handlebars.registerHelper('lockIcon', function (unlocked: boolean) {
|
Handlebars.registerHelper("lockIcon", function (unlocked: boolean) {
|
||||||
switch (unlocked) {
|
switch (unlocked) {
|
||||||
case true: { return '<i class="fas fa-lock-open user-passphrase"></i>'; }
|
case true: {
|
||||||
default: { return '<i class="fas fa-lock user-passphrase"></i>'; }
|
return '<i class="fas fa-lock-open user-passphrase"></i>';
|
||||||
}
|
}
|
||||||
})
|
default: {
|
||||||
|
return '<i class="fas fa-lock user-passphrase"></i>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ns.success("Welcome");
|
ns.success("Welcome");
|
||||||
// ns.errorWithDelay("Hmm very long error notif", 10);
|
// ns.errorWithDelay("Hmm very long error notif", 10);
|
||||||
|
|
||||||
|
|
||||||
const test = Builder<UserViewDeps>().build();
|
const test = Builder<UserViewDeps>().build();
|
||||||
|
|
||||||
|
@ -5,4 +5,5 @@ logging.level.org.hibernate.SQL=INFO
|
|||||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=INFO
|
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=INFO
|
||||||
spring.http.log-request-details=false
|
spring.http.log-request-details=false
|
||||||
logging.level.org.springframework.cache = INFO
|
logging.level.org.springframework.cache = INFO
|
||||||
chat-bundle=bundle.min.js
|
chat-bundle=bundle.min.js
|
||||||
|
chatto.frontend.log-level=INFO
|
@ -20,6 +20,7 @@ logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
|||||||
spring.jackson.serialization.write-dates-as-timestamps=false
|
spring.jackson.serialization.write-dates-as-timestamps=false
|
||||||
spring.cache.jcache.config=classpath:ehcache.xml
|
spring.cache.jcache.config=classpath:ehcache.xml
|
||||||
logging.level.org.springframework.cache=DEBUG
|
logging.level.org.springframework.cache=DEBUG
|
||||||
chatto.token.timeout-duration=1
|
chatto.token.timeout-duration=30
|
||||||
chat-bundle=bundle.js
|
chat-bundle=bundle.js
|
||||||
# spring.devtools.add-properties=false
|
# spring.devtools.add-properties=false
|
||||||
|
chatto.frontend.log-level=TRACE
|
@ -11,7 +11,7 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha256-L/W5Wfqfa0sdBNIKN9cG6QA5F2qx4qICmU2VgLruv9Y=" crossorigin="anonymous" />
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha256-L/W5Wfqfa0sdBNIKN9cG6QA5F2qx4qICmU2VgLruv9Y=" crossorigin="anonymous" />
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha256-OUFW7hFO0/r5aEGTQOz9F/aXQOt+TwqI1Z4fbVvww04=" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha256-OUFW7hFO0/r5aEGTQOz9F/aXQOt+TwqI1Z4fbVvww04=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js" integrity="sha256-sfG8c9ILUB8EXQ5muswfjZsKICbRIJUG/kBogvvV5sY=" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/5.4.0/bootbox.min.js" integrity="sha256-sfG8c9ILUB8EXQ5muswfjZsKICbRIJUG/kBogvvV5sY=" crossorigin="anonymous"></script>
|
||||||
@ -40,10 +40,14 @@
|
|||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/loglevel/1.6.4/loglevel.min.js" integrity="sha256-ACTlnmNCkOooSKkPCKYbiex8WLE82aeiN+Z9ElZag5Q=" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/loglevel/1.6.4/loglevel.min.js" integrity="sha256-ACTlnmNCkOooSKkPCKYbiex8WLE82aeiN+Z9ElZag5Q=" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
|
||||||
<link th:href="@{/css/master.css}" href="../../resources/static/css/master.css" rel="stylesheet">
|
<link th:href="@{/css/master.css}" href="../../resources/static/css/master.css" rel="stylesheet">
|
||||||
<link th:href="@{/css/colors.css}" href="../../resources/static/css/colors.css" rel="stylesheet">
|
<link th:href="@{/css/colors.css}" href="../../resources/static/css/colors.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<script th:inline="javascript" defer>
|
||||||
|
let loglevel = /*[[${@environment.getProperty('chatto.frontend.log-level')}]]*/ "DEBUG";
|
||||||
|
window.log.setLevel(loglevel)
|
||||||
|
</script>
|
||||||
|
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title th:include=":: #pageTitle">Layout Generic Title</title>
|
<title th:include=":: #pageTitle">Layout Generic Title</title>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
Loading…
Reference in New Issue
Block a user