Skip to content

Commit a5a3684

Browse files
author
Ian
committed
users get alerted when messages fail to send. Users can load more than 20 thread previews at once without searching.
1 parent 4fef477 commit a5a3684

33 files changed

+193
-320
lines changed

frontend/components/Alerts/Alert.vue

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
import { emitter } from '../../lib/global';
33
export type AlertData= {
44
error: String,
5-
message: String,
6-
status: Number,
5+
ReasonPhrase: String,
6+
statusCode: String,
77
type: String,
88
}
99
export default {
1010
name: 'WTAlert',
1111
props:{
1212
error: String,
13-
message: String,
14-
status: Number,
13+
ReasonPhrase: String,
14+
statusCode: String,
1515
type: String,
16+
sourceURL: String,
1617
},
1718
emits: {
1819
'Close-Alert': String
@@ -21,10 +22,17 @@ export default {
2122
//TODO Status switch to change class depending on status code (warning vs danger vs success)
2223
</script>
2324
<template>
24-
<div class="alert alert-dismissible fade show z-3 {{this.status>300 ? alert-warning : alert-warning }}" role="alert">
25-
{{"Status Code: " + this.status + "\n" + (this.message ? this.message : "Success!") }}
26-
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
25+
<div class="position-absolute top-0 start-50 alert alert-dismissible alert-danger fade show z-6 mb-3 w-100 translate-middle-x" role="alert">
26+
{{"Status Code: " + this.statusCode + "\n" + this.ReasonPhrase + "."}}
27+
<p> Please contact support for assistance.</p>
28+
<button type="button" class="close" data-dismiss="alert" aria-label="Close" >
2729
<span aria-hidden="true">&times;</span>
2830
</button>
2931
</div>
3032
</template>
33+
34+
<style scoped>
35+
.z-6{
36+
z-index: 6;
37+
}
38+
</style>

frontend/components/Alerts/AlertFactory.vue

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,17 @@ export default {
1515
},
1616
mounted() {
1717
emitter.on('delete-template-failed', (payload:AlertData)=>{
18-
//console.log("failed to delete template make an alert about it.");
1918
payload.message = "failed to delete template make an alert about it.";
2019
payload.type='Error';
2120
this.AddAlert(payload);
22-
2321
})
2422
emitter.on('delete-template-success', (payload)=>{
25-
console.log("deleted template Sucessfully.");
2623
this.AddAlert(payload);
27-
2824
})
2925
emitter.on('group-rename-failed', (payload)=>{
30-
console.log("failed to rename group make an alert about it");
3126
this.AddAlert(payload);
32-
3327
})
3428
emitter.on('group-rename-success', (payload)=>{
35-
console.log("Succesfully renamed group.");
3629
this.AddAlert(payload);
3730
})
3831
emitter.on('template-save-complete', (payload)=>{
@@ -42,32 +35,29 @@ export default {
4235
this.AddAlert(payload);
4336
})
4437
emitter.on('message-failed', (payload:AlertData)=>{
45-
console.log("message failed to send make an alert about it");
46-
this.AddAlert(payload);
47-
38+
this.AddAlert(payload);
39+
})
40+
emitter.on('message-sent', (payload:AlertData)=>{
41+
this.AddAlert(payload);
4842
})
4943
},
5044
methods: {
5145
AddAlert(arg:AlertData){
52-
//create a new <Alert> component
53-
//add it to the alert-box div
54-
console.log('alert box outbound message event listener');
55-
console.log(arg);
56-
this.$data.AlertList.push(arg);
57-
46+
this.$data.AlertList.push(arg);
5847
}
5948
},
6049
}
6150
</script>
6251
<template>
6352
<div class="alert-box">
64-
<Alert v-for="(alert,index) in this.$data.AlertList" :status="alert.status" :error="alert.error" :message="alert.message" :type="alert.type" v-bind:key="index"/>
53+
<Alert v-for="(alert,index) in this.$data.AlertList" :statusCode="alert.statusCode" :error="alert.error" :ReasonPhrase="alert.ReasonPhrase" :type="alert.type" v-bind:key="index"/>
6554
</div>
6655
</template>
6756
<style scoped>
6857
.alert-box{
69-
position:fixed !important;
70-
width:100%;
71-
justify-content: flex-end;
58+
/*position:fixed !important;*/
59+
width:100%;
60+
display: flex;
61+
justify-content: center;
7262
}
7363
</style>

frontend/components/MenuList/MenuList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default {
1414
//mounted emitter.on for menuPreview click emits
1515
mounted(){
1616
emitter.on('menu-change',(payload:string) => {
17-
console.log('change menu please')
18-
console.log(payload)
17+
//console.log('change menu please')
18+
//console.log(payload)
1919
if(payload){
2020
this.activeMenu = payload;
2121
this.selectedMenu =true;

frontend/components/MenuPreview/MenuPreview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
},
1717
methods:{
1818
menuLinkClickHandler(){
19-
console.log(this.name)
19+
//console.log(this.name)
2020
emitter.emit("menu-change",this.name)
2121
}
2222
}

frontend/components/NewMessage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
},
1515
methods:{
1616
numberPaste(e: ClipboardEvent) {
17-
console.log(e);
17+
//console.log(e);
1818
}
1919
},
2020
mounted() {
@@ -33,7 +33,7 @@ export default {
3333
}
3434
});
3535
refreshElement.addEventListener('touchend', e => {
36-
console.log("touch end")
36+
//console.log("touch end")
3737
let pullToRefresh = document.querySelector('.pull-to-refresh');
3838
3939
if (pullToRefresh && pullToRefresh.classList.contains('visible')) {

frontend/components/PaginatorButton/PaginatorButton.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export default{
1313
1414
paginatorClickFunction(){
1515
const buttonData = document.getElementById('MORE-PREVIEWS');
16-
console.log("Button data: ", buttonData);
16+
//console.log("Button data: ", buttonData);
1717
emitter.emit("backfill-previews-requested");
18-
console.log(state.page);
19-
console.log(updatePageNumber());
18+
//console.log(state.page);
19+
//console.log(updatePageNumber());
2020
2121
},
2222
},

frontend/components/SendBox/SendBox.vue

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default {
8585
if (state.connected) {
8686
this.send();
8787
} else {
88-
console.log("[Sendbox] Not connected, can't send message");
88+
//console.log("[Sendbox] Not connected, can't send message");
8989
}
9090
return false;
9191
}
@@ -139,7 +139,7 @@ export default {
139139
const attachment = this.pendingAttachments.shift();
140140
await attachment.upload;
141141
142-
console.log("[Sendbox] sending attachment:", attachment);
142+
//console.log("[Sendbox] sending attachment:", attachment);
143143
const cpim = new CPIM(attachment.uploadedURL, attachment.file.type);
144144
if (this.groupUUID) {
145145
cpim.headers["Group-UUID"] = this.groupUUID;
@@ -154,15 +154,15 @@ export default {
154154
155155
if (this.enteredText.length > 0) {
156156
let message = this.getMessageData();
157-
console.log(message);
157+
//console.log(message);
158158
if (this.groupUUID) {
159159
const url = await uploadText(this.enteredText);
160160
const cpim = new CPIM(url, "text/plain");
161161
cpim.bodyText = this.enteredText;
162162
if (this.groupUUID) {
163163
cpim.headers["Group-UUID"] = this.groupUUID;
164164
}
165-
console.log("outgoing cpim", cpim);
165+
//console.log("outgoing cpim", cpim);
166166
message.contentType = "message/cpim";
167167
message.cpim = cpim;
168168
message.body = cpim.serialize();
@@ -227,7 +227,7 @@ export default {
227227
cpim.headers["Group-UUID"] = this.groupUUID;
228228
}
229229
230-
console.log("[Sendbox.sendnewMessage] Outgoing CPIM", cpim);
230+
//console.log("[Sendbox.sendnewMessage] Outgoing CPIM", cpim);
231231
232232
message.contentType = "message/cpim";
233233
message.cpim = cpim;
@@ -242,12 +242,7 @@ export default {
242242
//console.log('emitting message', message);
243243
emitter.emit("outbound-message", message);
244244
setTimeout(
245-
() =>
246-
console.log(
247-
"[Sendbox.sendnewMessage] duplicate send prevention timeout"
248-
),
249-
500
250-
);
245+
() => console.log("[Sendbox.sendnewMessage] duplicate send prevention timeout"),500);
251246
this.enteredText = "";
252247
}
253248
} else {
@@ -296,11 +291,7 @@ export default {
296291
},
297292
removeAttachment(attachment: PendingAttachment) {
298293
let position = this.pendingAttachments.indexOf(attachment);
299-
console.log(
300-
"[Sendbox.removeAttachment] Removing attachment",
301-
position,
302-
attachment
303-
);
294+
//console.log("[Sendbox.removeAttachment] Removing attachment", position, attachment);
304295
this.pendingAttachments.splice(position, 1);
305296
},
306297
async uploadAttachment(attachment: PendingAttachment): Promise<void> {
@@ -312,15 +303,15 @@ export default {
312303
313304
attachment.uploadedURL = uploadTarget.download_url;
314305
315-
console.log("[Sendbox.uploadAttachment] Uploading ", uploadTarget);
306+
//console.log("[Sendbox.uploadAttachment] Uploading ", uploadTarget);
316307
const resp = await fetch(uploadTarget.upload_url, {
317308
method: "PUT",
318309
body: await attachment.file.arrayBuffer(),
319310
});
320311
321312
attachment.progress = 100;
322313
323-
console.log("[Sendbox] uploaded: ", resp);
314+
//console.log("[Sendbox] uploaded: ", resp);
324315
} else {
325316
//alert('Attachments not supported for new conversations at this time.')
326317
}
@@ -356,7 +347,7 @@ export default {
356347
},
357348
onPaste(e: ClipboardEvent) {
358349
var items = e.clipboardData.items;
359-
console.log(JSON.stringify(items)); // will give you the mime types
350+
//console.log(JSON.stringify(items)); // will give you the mime types
360351
for (const item of items) {
361352
switch (item.type) {
362353
case "image/png":
@@ -397,10 +388,7 @@ export default {
397388
case "text/plain":
398389
continue;
399390
default:
400-
console.log(
401-
"[Sendbox.onPaste] Discarding clipboard data of unknown type:",
402-
item
403-
);
391+
//console.log("[Sendbox.onPaste] Discarding clipboard data of unknown type:", item);
404392
}
405393
}
406394
},
@@ -422,7 +410,7 @@ export default {
422410
}
423411
};
424412
emitter.on("dropup-selection-recieved", (payload: String) => {
425-
console.log("[Sendbox] Selection Recieved. You selected: " + payload);
413+
//console.log("[Sendbox] Selection Recieved. You selected: " + payload);
426414
this.enteredText = payload;
427415
});
428416
emitter.on(

frontend/components/TemplatePreview/TemplatePreview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default {
5757
},
5858
methods:{
5959
menuLinkClickHandler(){
60-
console.log(this.description)
60+
//console.log(this.description)
6161
emitter.emit("template-change",this.props)
6262
},
6363
deleteTemplateRequest(){

frontend/components/TemplatesForm/TemplatesForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default {
4545
},
4646
requestTemplateSave(event){
4747
event.preventDefault();
48-
console.log(this.formInputs)
48+
//console.log(this.formInputs)
4949
if(this.formInputs.templateName || this.formInputs.body ){
5050
if(this.formInputs.body.length>1600){
5151
console.error('Error Submitting Form. Quick Response templates must contain less than 160 characters')

frontend/components/TemplatesMenu/TemplatesMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default {
3939
removeTemplate(targetUUID: string){
4040
let index = 0;
4141
for(let value in this.templatePreviews){
42-
console.log(this.templatePreviews[value].template_uuid);
42+
//console.log(this.templatePreviews[value].template_uuid);
4343
if(this.templatePreviews[value].template_uuid===targetUUID){
4444
this.templatePreviews.splice(index,1);
4545
//console.log("match found removing template from list")

0 commit comments

Comments
 (0)