mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
* API call to create queries * Add queries to redux * create query when query form is submitted * Redirect to ShowQueryPage after creating query * Removes theme dropdown and NewQuery component header * Extract NewQueryPage component state to redux state * Pass logic down to NewQuery component as props * Changes NewQuery component name to QueryComposer * Render NewQueryPage for /queries/:id route * Update ReduxConfig for loading a single resource * QueryPage tests * Get query when the query page loads * catch errors when query is invalid * Renames UpdateQueryForm to QueryForm to re-usability * Changes InputField to a controlled component * Always render the Query Form on Query Pages
105 lines
3.1 KiB
JavaScript
105 lines
3.1 KiB
JavaScript
/* eslint-disable */
|
|
import { osqueryTableNames } from '../../../utilities/osquery_tables';
|
|
|
|
ace.define("ace/mode/kolide_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/sql_highlight_rules"], function(acequire, exports, module) {
|
|
"use strict";
|
|
|
|
var oop = acequire("../lib/oop");
|
|
var SqlHighlightRules = acequire("./sql_highlight_rules").SqlHighlightRules;
|
|
|
|
var KolideHighlightRules = function() {
|
|
var keywords = (
|
|
"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
|
|
"when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|" +
|
|
"foreign|not|references|default|null|inner|cross|natural|database|drop|grant"
|
|
);
|
|
|
|
var builtinConstants = (
|
|
"true|false"
|
|
);
|
|
|
|
var builtinFunctions = (
|
|
"avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|" +
|
|
"coalesce|ifnull|isnull|nvl"
|
|
);
|
|
|
|
var dataTypes = (
|
|
"int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|" +
|
|
"money|real|number|integer"
|
|
);
|
|
|
|
var osqueryTables = osqueryTableNames.join('|');
|
|
|
|
var keywordMapper = this.createKeywordMapper({
|
|
"osquery-token": osqueryTables,
|
|
"support.function": builtinFunctions,
|
|
"keyword": keywords,
|
|
"constant.language": builtinConstants,
|
|
"storage.type": dataTypes,
|
|
}, "identifier", true);
|
|
|
|
this.$rules = {
|
|
"start" : [{
|
|
token : "comment",
|
|
regex : "--.*$"
|
|
}, {
|
|
token : "comment",
|
|
start : "/\\*",
|
|
end : "\\*/"
|
|
}, {
|
|
token : "string", // " string
|
|
regex : '".*?"'
|
|
}, {
|
|
token : "string", // ' string
|
|
regex : "'.*?'"
|
|
}, {
|
|
token : "constant.numeric", // float
|
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
|
}, {
|
|
token : keywordMapper,
|
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
|
}, {
|
|
token : "keyword.operator",
|
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
|
}, {
|
|
token : "paren.lparen",
|
|
regex : "[\\(]"
|
|
}, {
|
|
token : "paren.rparen",
|
|
regex : "[\\)]"
|
|
}, {
|
|
token : "text",
|
|
regex : "\\s+"
|
|
}]
|
|
};
|
|
|
|
this.normalizeRules();
|
|
};
|
|
|
|
oop.inherits(KolideHighlightRules, SqlHighlightRules);
|
|
|
|
exports.KolideHighlightRules = KolideHighlightRules;
|
|
});
|
|
|
|
ace.define("ace/mode/kolide",["require","exports","module","ace/lib/oop","ace/mode/sql","ace/mode/kolide_highlight_rules","ace/range"], function(acequire, exports, module) {
|
|
"use strict";
|
|
|
|
var oop = acequire("../lib/oop");
|
|
var TextMode = acequire("./sql").Mode;
|
|
var KolideHighlightRules = acequire("./kolide_highlight_rules").KolideHighlightRules;
|
|
var Range = acequire("../range").Range;
|
|
|
|
var Mode = function() {
|
|
this.HighlightRules = KolideHighlightRules;
|
|
};
|
|
oop.inherits(Mode, TextMode);
|
|
|
|
(function() {
|
|
|
|
this.lineCommentStart = "--";
|
|
|
|
this.$id = "ace/mode/kolide";
|
|
}).call(Mode.prototype);
|
|
|
|
exports.Mode = Mode;
|
|
});
|