-
Notifications
You must be signed in to change notification settings - Fork 1
Support compose mail to all users #204
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
Conversation
| const attachmentRules = [ | ||
| (files: File[]) => { | ||
| if (!files || files.length === 0) return true | ||
| const maxSize = 10 * 1024 * 1024 // 10MB | ||
| const oversized = files.find(file => file.size > maxSize) | ||
| if (oversized) return `File "${oversized.name}" is too large. Maximum size is 10MB.` | ||
| return true | ||
| }, | ||
| (files: File[]) => { | ||
| if (!files || files.length === 0) return true | ||
| if (files.length > 5) return 'Maximum 5 files allowed' | ||
| return true | ||
| } | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attachment rules allow multi attachment files but this is not supported from UI. Only one attachement is enabled per mail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frontend/kubecloud/src/utils/api.ts
Outdated
| method, | ||
| headers: requestHeaders, | ||
| body: body ? JSON.stringify(body) : undefined, | ||
| body: body instanceof FormData ? body : (body ? JSON.stringify(body) : undefined), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| body: body instanceof FormData ? body : (body ? JSON.stringify(body) : undefined), | |
| body: body instanceof FormData ? body : JSON.stringify(body), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body is optional, this was for handling that to avoid passing an undefined body to stringify
frontend/kubecloud/src/utils/api.ts
Outdated
| method, | ||
| headers: requestHeaders, | ||
| body: body ? JSON.stringify(body) : undefined, | ||
| body: body instanceof FormData ? body : (body ? JSON.stringify(body) : undefined), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| body: body instanceof FormData ? body : (body ? JSON.stringify(body) : undefined), | |
| body: body instanceof FormData ? body : JSON.stringify(body), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The body is optional; this was for handling that to avoid passing an undefined body to stringify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I extracted this to another variable to be reusable but the logic still the same
const bodyData = body instanceof FormData ? body : (body ? JSON.stringify(body) : undefined)| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { ref, computed } from 'vue' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused computed prop
| const message = ref('') | ||
| const attachments = ref<File[]>([]) | ||
| const sending = ref(false) | ||
| const result = ref<{ success: boolean; message: string } | null>(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const result = ref<{ success: boolean; message: string } | null>(null) |
Only used in catch and not needed. you can use console.error instead.
|
Please remove all unnecessary new lines. |




Description
add mail card, admin can send an email with attachments to all system users
Changes
Related Issues
Checklist