Move problems query to the data source

This commit is contained in:
Alexander Zobnin
2020-05-07 13:38:55 +03:00
parent 64f64ff71f
commit 29d902326a
6 changed files with 246 additions and 11 deletions

View File

@@ -351,3 +351,19 @@ export function getArrayDepth(a, level = 0) {
export function isNumeric(n: any): boolean {
return !isNaN(parseFloat(n)) && isFinite(n);
}
/**
* Parses tags string into array of {tag: value} objects
*/
export function parseTags(tagStr: string): any[] {
if (!tagStr) {
return [];
}
let tags: any[] = _.map(tagStr.split(','), (tag) => tag.trim());
tags = _.map(tags, (tag) => {
const tagParts = tag.split(':');
return {tag: tagParts[0].trim(), value: tagParts[1].trim()};
});
return tags;
}