Author: bricks Date: 2017-10-24 12:34:41 +0200 (Tue, 24 Oct 2017) New Revision: 29908
Modified: trunk/gsa/ChangeLog trunk/gsa/src/html/classic/ng/CMakeLists.txt trunk/gsa/src/html/classic/ng/src/gmp/models/filter/utils.js Log: * src/html/classic/ng/src/gmp/models/filter/utils.js: The utils.js file got committed accidentally. Remove its content and use it for real filter utility functions now. Modified: trunk/gsa/ChangeLog =================================================================== --- trunk/gsa/ChangeLog 2017-10-24 10:28:01 UTC (rev 29907) +++ trunk/gsa/ChangeLog 2017-10-24 10:34:41 UTC (rev 29908) @@ -5,6 +5,12 @@ 2017-10-24 Bj�rn Ricks <bjoern.ri...@greenbone.net> + * src/html/classic/ng/src/gmp/models/filter/utils.js: The utils.js file got + committed accidentally. Remove its content and use it for real filter utility + functions now. + +2017-10-24 Bj�rn Ricks <bjoern.ri...@greenbone.net> + * src/html/classic/ng/CMakeLists.txt, src/html/classic/ng/src/web/app.js, src/html/classic/ng/src/web/pages/cpes/details.js, Modified: trunk/gsa/src/html/classic/ng/CMakeLists.txt =================================================================== --- trunk/gsa/src/html/classic/ng/CMakeLists.txt 2017-10-24 10:28:01 UTC (rev 29907) +++ trunk/gsa/src/html/classic/ng/CMakeLists.txt 2017-10-24 10:34:41 UTC (rev 29908) @@ -112,6 +112,7 @@ ${NG_SRC_DIR}/src/gmp/models/filter/filterterm.js ${NG_SRC_DIR}/src/gmp/models/filter/filtertermlist.js ${NG_SRC_DIR}/src/gmp/models/filter/keywords.js + ${NG_SRC_DIR}/src/gmp/models/filter/utils.js ${NG_SRC_DIR}/src/gmp/models/group.js ${NG_SRC_DIR}/src/gmp/models/host.js ${NG_SRC_DIR}/src/gmp/models/info.js Modified: trunk/gsa/src/html/classic/ng/src/gmp/models/filter/utils.js =================================================================== --- trunk/gsa/src/html/classic/ng/src/gmp/models/filter/utils.js 2017-10-24 10:28:01 UTC (rev 29907) +++ trunk/gsa/src/html/classic/ng/src/gmp/models/filter/utils.js 2017-10-24 10:34:41 UTC (rev 29908) @@ -21,72 +21,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ -import {is_defined, is_empty} from '../../utils.js'; +import {is_defined} from '../../utils.js'; -import {parse_int} from '../../parser.js'; +export const filter_string = filter => + is_defined(filter) && is_defined(filter.toFilterString) ? + filter.toFilterString() : + filter; -const convert_boolean_int = (keyword, value, relation) => { - return { - keyword, - value: - parse_int(value) >= 1 ? 1 : 0, - relation, - }; -}; -function convert_int(keyword, value, relation) { - return { - keyword, - value: parse_int(value), - relation, - }; -} - -function convert_no_relation(keyword, value, relation) { - return { - keyword, - value, - relation: '', - }; -} - -const KEYWORD_CONVERTERS = { - min_qod: convert_int, - apply_overrides: convert_boolean_int, - rows: convert_int, - first: convert_int, - autofp: convert_int, -}; - -const VALUE_CONVERTERS = { - and: convert_no_relation, - or: convert_no_relation, - not: convert_no_relation, - re: convert_no_relation, - regexp: convert_no_relation, - '': convert_no_relation, -}; - -export const convert = (keyword, value, relation) => { - let converter = KEYWORD_CONVERTERS[keyword]; - if (is_defined(converter)) { - return converter(keyword, value, relation); - } - - converter = VALUE_CONVERTERS[value]; - if (is_defined(converter)) { - return converter(keyword, value, relation); - } - - if (is_empty(keyword)) { - return {value, relation}; - } - - return { - value, - keyword, - relation, - }; -}; - // vim: set ts=2 sw=2 tw=80:
_______________________________________________ Openvas-commits mailing list Openvas-commits@wald.intevation.org https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits