Skip to content

Commit

Permalink
Merge pull request #1308 from solliancenet/sc-standardize-toast-duration
Browse files Browse the repository at this point in the history
Standardize toast duration
  • Loading branch information
ciprianjichici authored Aug 1, 2024
2 parents 1cf1527 + a2c8edc commit 1b9e35f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
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 @@ -623,6 +623,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

0 comments on commit 1b9e35f

Please sign in to comment.