mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +00:00
chg: [terms_management] delete email
This commit is contained in:
parent
2c46c7f2ab
commit
46614c97c8
3 changed files with 58 additions and 18 deletions
|
@ -605,15 +605,19 @@ def disable_hive_auto_alert():
|
|||
@PasteSubmit.route("/PasteSubmit/add_push_tag")
|
||||
def add_push_tag():
|
||||
tag = request.args.get('tag')
|
||||
#limit tag length
|
||||
if len(tag) > 49:
|
||||
tag = tag[0:48]
|
||||
if tag is not None:
|
||||
|
||||
r_serv_db.sadd('list_export_tags', tag)
|
||||
#limit tag length
|
||||
if len(tag) > 49:
|
||||
tag = tag[0:48]
|
||||
|
||||
to_return = {}
|
||||
to_return["tag"] = tag
|
||||
return jsonify(to_return)
|
||||
r_serv_db.sadd('list_export_tags', tag)
|
||||
|
||||
to_return = {}
|
||||
to_return["tag"] = tag
|
||||
return jsonify(to_return)
|
||||
else:
|
||||
return 'None args', 400
|
||||
|
||||
@PasteSubmit.route("/PasteSubmit/delete_push_tag")
|
||||
def delete_push_tag():
|
||||
|
|
|
@ -169,7 +169,7 @@ def terms_management():
|
|||
trackReg_list_num_of_paste = []
|
||||
for tracked_regex in r_serv_term.smembers(TrackedRegexSet_Name):
|
||||
|
||||
notificationEMailTermMapping[tracked_regex] = "\n".join( (r_serv_term.smembers(TrackedTermsNotificationEmailsPrefix_Name + tracked_regex)) )
|
||||
notificationEMailTermMapping[tracked_regex] = r_serv_term.smembers(TrackedTermsNotificationEmailsPrefix_Name + tracked_regex)
|
||||
notificationTagsTermMapping[tracked_regex] = r_serv_term.smembers(TrackedTermsNotificationTagsPrefix_Name + tracked_regex)
|
||||
|
||||
if tracked_regex not in notificationEnabledDict:
|
||||
|
@ -196,7 +196,7 @@ def terms_management():
|
|||
for tracked_set in r_serv_term.smembers(TrackedSetSet_Name):
|
||||
tracked_set = tracked_set
|
||||
|
||||
notificationEMailTermMapping[tracked_set] = "\n".join( (r_serv_term.smembers(TrackedTermsNotificationEmailsPrefix_Name + tracked_set)) )
|
||||
notificationEMailTermMapping[tracked_set] = r_serv_term.smembers(TrackedTermsNotificationEmailsPrefix_Name + tracked_set)
|
||||
notificationTagsTermMapping[tracked_set] = r_serv_term.smembers(TrackedTermsNotificationTagsPrefix_Name + tracked_set)
|
||||
|
||||
if tracked_set not in notificationEnabledDict:
|
||||
|
@ -222,7 +222,7 @@ def terms_management():
|
|||
track_list_num_of_paste = []
|
||||
for tracked_term in r_serv_term.smembers(TrackedTermsSet_Name):
|
||||
|
||||
notificationEMailTermMapping[tracked_term] = "\n".join( r_serv_term.smembers(TrackedTermsNotificationEmailsPrefix_Name + tracked_term))
|
||||
notificationEMailTermMapping[tracked_term] = r_serv_term.smembers(TrackedTermsNotificationEmailsPrefix_Name + tracked_term)
|
||||
notificationTagsTermMapping[tracked_term] = r_serv_term.smembers(TrackedTermsNotificationTagsPrefix_Name + tracked_term)
|
||||
|
||||
if tracked_term not in notificationEnabledDict:
|
||||
|
@ -334,11 +334,8 @@ def terms_management_action():
|
|||
if section == "followTerm":
|
||||
if action == "add":
|
||||
|
||||
# Strip all whitespace
|
||||
notificationEmailsParam = "".join(notificationEmailsParam.split())
|
||||
|
||||
# Make a list of all passed email addresses
|
||||
notificationEmails = notificationEmailsParam.split(",")
|
||||
notificationEmails = notificationEmailsParam.split()
|
||||
|
||||
validNotificationEmails = []
|
||||
# check for valid email addresses
|
||||
|
@ -443,6 +440,16 @@ def terms_management_action():
|
|||
to_return["term"] = term
|
||||
return jsonify(to_return)
|
||||
|
||||
@terms.route("/terms_management/delete_terms_email", methods=['GET'])
|
||||
def delete_terms_email():
|
||||
term = request.args.get('term')
|
||||
email = request.args.get('email')
|
||||
|
||||
if term is not None and email is not None:
|
||||
r_serv_term.srem(TrackedTermsNotificationEmailsPrefix_Name + term, email)
|
||||
return 'sucess'
|
||||
else:
|
||||
return 'None args', 400
|
||||
|
||||
|
||||
@terms.route("/terms_plot_tool/")
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
white-space:pre-wrap;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
.mouse_pointer{
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -98,7 +101,7 @@
|
|||
<div class="form-group input-group" style="margin-bottom: 30px;">
|
||||
<span class="input-group-addon"><span class="fa fa-eye"></span></span>
|
||||
<input id="followTermInput" class="form-control" placeholder="Term to track." type="text" style="max-width: 400px;">
|
||||
<input id="followTermEMailNotificationReceiversInput" class="form-control" placeholder="Notification E-Mails (optional, comma separated)" type="text" style="max-width: 400px;">
|
||||
<input id="followTermEMailNotificationReceiversInput" class="form-control" placeholder="Notification E-Mails (optional, space separated)" type="text" style="max-width: 400px;">
|
||||
<input id="followTermTag" class="form-control" placeholder="Tags (optional, space separated)" type="text" style="max-width: 400px;">
|
||||
<button id="followTermBtn" class="btn btn-success btn-interaction" style="margin-left: 10px;" data-section="followTerm" data-action="add"> Add term</button>
|
||||
</div>
|
||||
|
@ -140,7 +143,13 @@
|
|||
<button class="btn-link btn-interaction" data-toggle="tooltip" data-placement="left" title="Remove this term" data-content="{{ set }}" data-section="followTerm" data-action="delete"><span class="glyphicon glyphicon-trash"></span></button>
|
||||
<input id="checkBoxEMailAlerts" type="checkbox" title="Toggle E-Mail notifications" class="btn-link btn-interaction" data-content="{{ set }}" data-section="followTerm" data-action="toggleEMailNotification" {% if notificationEnabledDict[set] %} checked {% endif %}>
|
||||
</p></td>
|
||||
<td style="white-space:pre">{{ notificationEMailTermMapping[set] }}</td>
|
||||
<td>
|
||||
{% for email in notificationEMailTermMapping[set] %}
|
||||
<div class="btn-link btn-interaction pull-right mouse_pointer" data-toggle="tooltip" data-placement="left" data-original-title="Remove this email"><span class="glyphicon glyphicon-trash" style="color:Red;" onclick="delete_email('{{set}}', '{{email}}')"></span></div>
|
||||
{{ email }}
|
||||
<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<!-- REGEX -->
|
||||
|
@ -166,7 +175,13 @@
|
|||
<button class="btn-link btn-interaction" data-toggle="tooltip" data-placement="left" title="Remove this term" data-content="{{ regex }}" data-section="followTerm" data-action="delete"><span class="glyphicon glyphicon-trash"></span></button>
|
||||
<input id="checkBoxEMailAlerts" type="checkbox" title="Toggle E-Mail notifications" class="btn-link btn-interaction" data-content="{{ regex }}" data-section="followTerm" data-action="toggleEMailNotification" {% if notificationEnabledDict[regex] %} checked {% endif %}>
|
||||
</p></td>
|
||||
<td style="white-space:pre">{{ notificationEMailTermMapping[regex] }}</td>
|
||||
<td>
|
||||
{% for email in notificationEMailTermMapping[regex] %}
|
||||
<div class="btn-link btn-interaction pull-right mouse_pointer" data-toggle="tooltip" data-placement="left" data-original-title="Remove this email"><span class="glyphicon glyphicon-trash" style="color:Red;" onclick="delete_email('{{regex}}', '{{email}}')"></span></div>
|
||||
{{ email }}
|
||||
<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<!-- Normal term -->
|
||||
|
@ -192,7 +207,13 @@
|
|||
<button class="btn-link btn-interaction" data-toggle="tooltip" data-placement="left" title="Remove this term" data-content="{{ term }}" data-section="followTerm" data-action="delete"><span class="glyphicon glyphicon-trash"></span></button>
|
||||
<input id="checkBoxEMailAlerts" type="checkbox" title="Toggle E-Mail notifications" class="btn-link btn-interaction" data-content="{{ term }}" data-section="followTerm" data-action="toggleEMailNotification" {% if notificationEnabledDict[term] %} checked {% endif %}>
|
||||
</p></td>
|
||||
<td style="white-space:pre">{{ notificationEMailTermMapping[term] }}</td>
|
||||
<td>
|
||||
{% for email in notificationEMailTermMapping[term] %}
|
||||
<div class="btn-link btn-interaction pull-right mouse_pointer" data-toggle="tooltip" data-placement="left" data-original-title="Remove this email"><span class="glyphicon glyphicon-trash" style="color:Red;" onclick="delete_email('{{term}}', '{{email}}')"></span></div>
|
||||
{{ email }}
|
||||
<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -428,4 +449,12 @@ function perform_operation(){
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
function delete_email(term, email){
|
||||
$.get("{{ url_for('terms.delete_terms_email') }}", { term: term, email: email }, function(data, status){
|
||||
if(status == "success") {
|
||||
window.location.reload(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue