fleet/frontend/components/KolideAce/mode.js
Mike Stone 92d91fdebc Handle server errors (#730)
* consistent error handling

* Display server errors in InviteUserForm

* Handle errors in Form component

* Refactors query form

* creates KolideAce component

* Renders QueryForm from query page and manage hosts page

* Moves ace editor and select targets dropdown to query form

* Render base errors in Form HOC

* LoginPage and ForgotPasswordPage server errors

* Ensure unique key for user blocks

* Adds base error to login form and forgot password form

* Adds base error to query form

* Adds base error to Pack Form

* Adds errors to confirm invite form

* Adds clearErrors action

* clear errors when confirm invite page unmounts

* Handle errors in the App Setting page

* Handle server errors in the User Settings Page

* Handle server errors in the User Management Page
2017-01-05 19:01:17 -05:00

106 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;
});