- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.9k
 
feat:Allow templating in AliyunSMS #6002
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -15,6 +15,24 @@ | |
| <label for="signName" class="form-label">{{ $t("SignName") }}<span style="color: red;"><sup>*</sup></span></label> | ||
| <input id="signName" v-model="$parent.notification.signName" type="text" class="form-control" required> | ||
| 
     | 
||
| <div class="form-check form-switch mb-3"> | ||
| <input id="enableCustomTemplate" v-model="$parent.notification.enableCustomTemplate" class="form-check-input" type="checkbox"> | ||
| <label for="enableCustomTemplate" class="form-check-label">{{ $t("Enable Custom Template") }}</label> | ||
| </div> | ||
| 
     | 
||
| <div v-if="$parent.notification.enableCustomTemplate" class="mb-3"> | ||
| <label for="customName" class="form-label">{{ $t("Custom Name") }}</label> | ||
| <input id="customName" v-model="$parent.notification.customName" type="text" class="form-control"> | ||
| </div> | ||
| 
     | 
||
| <div v-if="$parent.notification.enableCustomTemplate" class="mb-3"> | ||
| <label for="statusTemplate" class="form-label">{{ $t("${status} Template") }}</label> | ||
| <textarea id="statusTemplate" v-model="$parent.notification.statusTemplate" class="form-control" rows="2" placeholder="{% if status == 'UP' %}[在线]{% else %}[故障]{% endif %}"></textarea> | ||
| 
         
      Comment on lines
    
      +29
     to 
      +30
    
   
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess with the added context that you cannot send a full template, I don't think this makes that much sense anymore to template the status. Given that aliyun seems to be quite focussed on china, I think simplifying this to just respond with chinese (no translation) is fair. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, as only 4 variables can be sent to aliyun API, my initial solution was to forcefully overwrite the original English fields, allowing users to set them to any content. The content of the SMS is mainly to remind operation and maintenance personnel that there is a serious system failure, prompting them to pay attention in a timely manner.  | 
||
| 
     | 
||
| <label for="msgTemplate" class="form-label">{{ $t("${msg} Template") }}</label> | ||
| <textarea id="msgTemplate" v-model="$parent.notification.msgTemplate" class="form-control" rows="2" placeholder="{% if status == 'UP' %}请查看钉钉{% else %}请及时处理{% endif %}"></textarea> | ||
| 
         
      Comment on lines
    
      +32
     to 
      +33
    
   
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't re-invent the weel here. Use   | 
||
| </div> | ||
| 
     | 
||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can explain the limitation that templates are fixed and only the content can be changed more clearly.  | 
||
| <div class="form-text"> | ||
| <p>{{ $t("Sms template must contain parameters: ") }}<br> <code>${name} ${time} ${status} ${msg}</code></p> | ||
| <i18n-t tag="p" keypath="Read more:"> | ||
| 
          
            
          
           | 
    ||
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.
could you add a quick helptext to explain in which circumstances this setting is usefull?
I think currently a lot of people would not know when to use this
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.
Of course, I will add it later.