-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new filter addition
- Loading branch information
Showing
15 changed files
with
778 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function trimit(item, index, arr) { | ||
arr[index] = item.trim(); | ||
} | ||
|
||
function has_check_contact(event, contact) { | ||
var check_contacts = []; | ||
|
||
if (event.hasOwnProperty("check") && event.check.hasOwnProperty("labels") && event.check.labels.hasOwnProperty("contacts")) { | ||
check_contacts = event.check.labels.contacts.split(","); | ||
check_contacts.forEach(trimit); | ||
} | ||
|
||
// if there are no contacts, the event is not allowed | ||
if (check_contacts.length == 0) { | ||
return false; | ||
} | ||
|
||
// allow the event if contact is present in check contacts | ||
if (check_contacts.indexOf(contact.trim()) >= 0) { | ||
return true; | ||
} | ||
|
||
// otherwise event is not allowed | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function trimit(item, index, arr) { | ||
arr[index] = item.trim(); | ||
} | ||
|
||
function has_entity_contact(event, contact) { | ||
var entity_contacts = []; | ||
|
||
if (event.hasOwnProperty("entity") && event.entity.hasOwnProperty("labels") && event.entity.labels.hasOwnProperty("contacts")) { | ||
entity_contacts = event.entity.labels.contacts.split(","); | ||
entity_contacts.forEach(trimit); | ||
} | ||
|
||
// if there are no contacts, the event is not allowed | ||
if (entity_contacts.length == 0) { | ||
return false; | ||
} | ||
|
||
// allow the event if contact is present in check contacts | ||
if (entity_contacts.indexOf(contact.trim()) >= 0) { | ||
return true; | ||
} | ||
|
||
// otherwise event is not allowed | ||
return false; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function no_check_contact(event) { | ||
var check_contacts = []; | ||
|
||
if (event.hasOwnProperty("check") && event.check.hasOwnProperty("labels") && event.check.labels.hasOwnProperty("contacts")) { | ||
check_contacts = event.check.labels.contacts.split(","); | ||
// filter out any elements which do not contain at least one non-whitespace character | ||
check_contacts = check_contacts.filter(function(entry) { return /\S/.test(entry); }); | ||
} | ||
|
||
if (check_contacts.length == 0) { | ||
return true; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function no_entity_contact(event) { | ||
var entity_contacts = []; | ||
if (event.hasOwnProperty("entity") && event.entity.hasOwnProperty("labels") && event.entity.labels.hasOwnProperty("contacts")) { | ||
entity_contacts = event.entity.labels.contacts.split(","); | ||
// filter out any elements which do not contain at least one non-whitespace character | ||
entity_contacts = entity_contacts.filter(function(entry) { return /\S/.test(entry); }); | ||
} | ||
if (entity_contacts.length == 0) { | ||
return true; | ||
} | ||
return false; | ||
} |
Oops, something went wrong.