Added error prompt on empty user search
This commit is contained in:
parent
2addcc1fa8
commit
a9d81fce19
@ -175,7 +175,7 @@ export class ChatView implements Observer<ChatMessageViewModel> {
|
|||||||
const msgTime = new Date();
|
const msgTime = new Date();
|
||||||
const context: ChatMessageViewModel = {
|
const context: ChatMessageViewModel = {
|
||||||
fromUser: JsonAPI.principleName,
|
fromUser: JsonAPI.principleName,
|
||||||
toUser: "",
|
toUser: contactName,
|
||||||
message: messageContent,
|
message: messageContent,
|
||||||
messageTime: msgTime,
|
messageTime: msgTime,
|
||||||
};
|
};
|
||||||
@ -192,12 +192,12 @@ export class ChatView implements Observer<ChatMessageViewModel> {
|
|||||||
fromUser: JsonAPI.principleName,
|
fromUser: JsonAPI.principleName,
|
||||||
toUser: contactName,
|
toUser: contactName,
|
||||||
messageCipher: messageCipher,
|
messageCipher: messageCipher,
|
||||||
messageTime: msgTime,
|
messageTime: msgTime.toISOString(),
|
||||||
};
|
};
|
||||||
this._sendMessageAJAX(chatMessageDTO);
|
this._sendMessageAJAX(chatMessageDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _sendMessageAJAX(chatMessageDTO: ChatMessageDTO): void {
|
private _sendMessageAJAX(chatMessageDTO: any): void {
|
||||||
let headers = new Headers();
|
let headers = new Headers();
|
||||||
// console.log("Token = " + btoa("hmm" + ":" + "hmm"))
|
// console.log("Token = " + btoa("hmm" + ":" + "hmm"))
|
||||||
|
|
||||||
|
@ -165,17 +165,22 @@ export class UserView implements Observer<ActiveUserViewModel> {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// log.trace(temp);
|
// log.trace(temp);
|
||||||
const searchTerm = this._userSearchInputElement.value;
|
const searchTerm = this._userSearchInputElement.value;
|
||||||
|
if (searchTerm.length > 0) {
|
||||||
log.debug("search term value = " + searchTerm);
|
log.debug("search term value = " + searchTerm);
|
||||||
const list = this._model.activeUsersList;
|
const list = this._model.activeUsersList;
|
||||||
log.debug("active users");
|
log.debug("active users");
|
||||||
log.debug(list);
|
log.debug(list);
|
||||||
if (list == null) {
|
if (!list) {
|
||||||
log.error("Users list is null");
|
log.error("Users list is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let searchResult = this._searchService.search(list, searchTerm);
|
let searchResult = this._searchService.search(list, searchTerm);
|
||||||
this.update({ data: searchResult, op: "" });
|
this.update({ data: searchResult, op: "" });
|
||||||
log.debug(searchResult);
|
log.debug(searchResult);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._notificationService.error("Please enter a name")
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +188,6 @@ export class UserView implements Observer<ActiveUserViewModel> {
|
|||||||
this._userSearchInputElement.addEventListener("input", (e) => {
|
this._userSearchInputElement.addEventListener("input", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this._userSearchInputElement.value.length < 2) {
|
if (this._userSearchInputElement.value.length < 2) {
|
||||||
log.debug("inputted");
|
|
||||||
this._userSearchCancelButton.hidden = false;
|
this._userSearchCancelButton.hidden = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user