Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize toast duration #1308

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ui/ManagementPortal/pages/data-sources/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ export default {
return this.$toast.add({
severity: 'error',
detail: error?.response?._data || error,
life: 5000,
});
}

Expand Down
50 changes: 30 additions & 20 deletions src/ui/UserPortal/components/ChatInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ export default {
agentListOpen: false,
showFileUploadDialog: false,
primaryButtonBg: this.$appConfigStore.primaryButtonBg,
primaryButtonText: this.$appConfigStore.primaryButtonText,
primaryButtonText: this.$appConfigStore.primaryButtonText,
secondaryButtonBg: this.$appConfigStore.secondaryButtonBg,
secondaryButtonText: this.$appConfigStore.secondaryButtonText,
secondaryButtonText: this.$appConfigStore.secondaryButtonText,
};
},

Expand Down Expand Up @@ -243,10 +243,20 @@ export default {
const objectId = await this.$appStore.uploadAttachment(formData, this.$appStore.currentSession.sessionId);

console.log(`File uploaded: ObjectId: ${objectId}`);
this.$toast.add({ severity: 'success', summary: 'Success', detail: 'File uploaded successfully.' });
this.$toast.add({
severity: 'success',
summary: 'Success',
detail: 'File uploaded successfully.',
life: 5000,
});
this.showFileUploadDialog = false;
} catch (error) {
this.$toast.add({ severity: 'error', summary: 'Error', detail: `File upload failed. ${error.message}` });
this.$toast.add({
severity: 'error',
summary: 'Error',
detail: `File upload failed. ${error.message}`,
life: 5000,
});
}
},

Expand Down Expand Up @@ -293,19 +303,19 @@ export default {
},

formatSize(bytes) {
const k = 1024;
const dm = 3;
const sizes = this.$primevue.config.locale.fileSizeTypes;
const k = 1024;
const dm = 3;
const sizes = this.$primevue.config.locale.fileSizeTypes;

if (bytes === 0) {
return `0 ${sizes[0]}`;
}
if (bytes === 0) {
return `0 ${sizes[0]}`;
}

const i = Math.floor(Math.log(bytes) / Math.log(k));
const formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm));
const i = Math.floor(Math.log(bytes) / Math.log(k));
const formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm));

return `${formattedSize} ${sizes[i]}`;
}
return `${formattedSize} ${sizes[i]}`;
},
},
};
</script>
Expand Down Expand Up @@ -335,7 +345,7 @@ export default {
}

.chat-input .input-wrapper {
display: flex;
display: flex;
align-items: stretch;
width: 100%;
}
Expand Down Expand Up @@ -411,10 +421,10 @@ export default {

.attached-files {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-wrap: nowrap;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-wrap: nowrap;
}

.file-remove {
Expand Down Expand Up @@ -455,6 +465,6 @@ export default {
width: 100%;
text-align: center;
font-size: 5rem;
color: #000;
color: #000;
}
</style>
4 changes: 2 additions & 2 deletions src/ui/UserPortal/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export default {
this.$toast.add({
severity: 'success',
detail: 'Chat link copied!',
life: 2000,
life: 5000,
});
},

Expand All @@ -176,7 +176,7 @@ export default {
this.$toast.add({
severity: 'success',
detail: message,
life: 2000,
life: 5000,
});
},

Expand Down
Loading