@perses-dev/loki-plugin 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{Loki.2bd94c1e.js → Loki.ca74c810.js} +3 -3
- package/__mf/js/async/{1728.326f0c08.js → 1728.c6a9c8d6.js} +1 -1
- package/__mf/js/async/{1750.eba509e1.js → 1750.a7bd1384.js} +1 -1
- package/__mf/js/async/208.55931f88.js +4 -0
- package/__mf/js/async/54.f8265ee0.js +22 -0
- package/__mf/js/async/9811.422fb6ad.js +7 -0
- package/__mf/js/async/{__federation_expose_LokiDatasource.3fe6141d.js → __federation_expose_LokiDatasource.5e30f7dd.js} +2 -2
- package/__mf/js/async/{__federation_expose_LokiLogQuery.6591d0db.js → __federation_expose_LokiLogQuery.c30e299e.js} +1 -1
- package/__mf/js/async/{__federation_expose_LokiTimeSeriesQuery.2a9b451a.js → __federation_expose_LokiTimeSeriesQuery.aa1ffedf.js} +1 -1
- package/__mf/js/{main.4d84b446.js → main.34b789cc.js} +3 -3
- package/lib/components/complete.js.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQueryEditor.js.map +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js.map +1 -1
- package/mf-manifest.json +26 -26
- package/mf-stats.json +26 -26
- package/package.json +6 -6
- package/__mf/js/async/54.b3492a7a.js +0 -22
- package/__mf/js/async/7958.f25f7332.js +0 -7
- package/__mf/js/async/9010.44bf2927.js +0 -2
- /package/__mf/js/async/{9010.44bf2927.js.LICENSE.txt → 208.55931f88.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{54.b3492a7a.js.LICENSE.txt → 54.f8265ee0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{7958.f25f7332.js.LICENSE.txt → 9811.422fb6ad.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_LokiDatasource.3fe6141d.js.LICENSE.txt → __federation_expose_LokiDatasource.5e30f7dd.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/complete.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Completion, CompletionContext, CompletionResult, insertCompletionText } from '@codemirror/autocomplete';\nimport { syntaxTree } from '@codemirror/language';\nimport { EditorState } from '@codemirror/state';\nimport { SyntaxNode, Tree } from '@lezer/common';\nimport {\n Selector,\n Matchers,\n Matcher,\n Identifier,\n Eq,\n Neq,\n Re,\n Nre,\n String as StringType,\n Pipe,\n} from '@grafana/lezer-logql';\nimport { EditorView } from '@uiw/react-codemirror';\nimport { toUnixSeconds } from '../model';\nimport { CompletionConfig } from './logql-extension';\n\n/** CompletionScope specifies the completion kind, e.g. whether to complete label names or values */\ntype CompletionScope =\n | { kind: 'LabelName' }\n | { kind: 'LabelValue'; label: string }\n | { kind: 'PipeFunction'; afterPipe: boolean; hasSpace: boolean; afterExclamation: boolean };\n\n/**\n * CompletionInfo specifies the identified scope and position of the completion in the current editor text.\n */\nexport interface CompletionInfo {\n scope: CompletionScope;\n from: number;\n to?: number;\n}\n\nconst quoteChars = ['\"', '`'];\nconst defaultQuoteChar = '\"';\nconst ERROR_NODE = 0; // Lezer parser creates error nodes for incomplete/malformed syntax\n\nexport async function complete(\n completionCfg: CompletionConfig,\n { state, pos }: CompletionContext\n): Promise<CompletionResult | null> {\n // First, identify the completion scope\n const completion = identifyCompletion(state, pos, syntaxTree(state));\n if (!completion) {\n // No completion scope found for current cursor position.\n return null;\n }\n\n // Then, retrieve completion options for the identified scope (from the Loki API).\n const options = await retrieveOptions(completionCfg, completion.scope);\n return { options, from: completion.from, to: completion.to };\n}\n\n/**\n * Identify completion scope (e.g. LabelName, LabelValue) and position, based on the current node in the syntax tree.\n *\n * Function is exported for tests only.\n */\nexport function identifyCompletion(state: EditorState, pos: number, tree: Tree): CompletionInfo | undefined {\n const node = tree.resolveInner(pos, -1);\n\n switch (node.type.id) {\n case Selector:\n case Matchers:\n case Matcher:\n case Identifier:\n case Eq:\n case Neq:\n case Re:\n case Nre:\n case StringType: {\n const labelCompletion = detectLabelCompletion(state, pos, node);\n if (labelCompletion) return labelCompletion;\n break;\n }\n\n case ERROR_NODE: {\n // Check for pipe context first\n const pipeCompletion = detectPipeCompletion(state, node);\n if (pipeCompletion) return pipeCompletion;\n\n // Then check for label completion in error nodes\n const labelCompletion = detectLabelCompletion(state, pos, node);\n if (labelCompletion) return labelCompletion;\n break;\n }\n\n case Pipe: {\n // Pipe operator: suggest parser functions and line filters\n // Examples: {job=\"nginx\"} |▯ or {job=\"nginx\"} | ▯\n const hasSpaceAfterPipe = state.sliceDoc(pos - 1, pos) === ' ';\n return {\n scope: { kind: 'PipeFunction', afterPipe: true, hasSpace: hasSpaceAfterPipe, afterExclamation: false },\n from: pos,\n };\n }\n }\n\n // Fallback checks for contexts not directly on a node\n const textBeforeCursor = state.sliceDoc(0, pos).trim();\n const hasSpace = state.sliceDoc(pos - 1, pos).match(/\\s/) !== null;\n\n // Check if cursor is after a pipe operator followed by whitespace\n // This enables autocomplete after: {job=\"nginx\"} | ▯\n if (textBeforeCursor.endsWith('|') && hasSpace) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: true, hasSpace: true, afterExclamation: false },\n from: pos,\n };\n }\n\n // Check if cursor is after a closing brace (stream selector) followed by whitespace\n // This enables autocomplete after: {job=\"nginx\"} ▯\n if (textBeforeCursor.endsWith('}') && hasSpace) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: false, hasSpace: true, afterExclamation: false },\n from: pos,\n };\n }\n}\n\n/**\n * Retrieve completion options based on the identified completion scope.\n */\nasync function retrieveOptions(completionCfg: CompletionConfig, completion: CompletionScope): Promise<Completion[]> {\n switch (completion.kind) {\n case 'LabelName':\n return completeLabelName(completionCfg);\n\n case 'LabelValue':\n return completeLabelValue(completionCfg, completion.label);\n\n case 'PipeFunction':\n return completePipeFunctions(completion.afterPipe, completion.hasSpace, completion.afterExclamation);\n }\n}\n\n/**\n * Detect label name or value completion contexts within selectors.\n */\nfunction detectLabelCompletion(state: EditorState, pos: number, node: SyntaxNode): CompletionInfo | undefined {\n switch (node.type.id) {\n case Selector:\n // Selector is the entire {label matchers} expression\n // Autocomplete at start: {▯ or empty: {}\n // Do not autocomplete if cursor is after closing brace: {job=\"mysql\"}▯\n if (\n (node.firstChild === null || node.firstChild?.type.id === ERROR_NODE) &&\n !state.sliceDoc(node.from, pos).includes('}')\n ) {\n return { scope: { kind: 'LabelName' }, from: pos };\n }\n break;\n\n case Matchers: {\n // Matchers node contains all label matchers inside {}\n // Autocomplete after comma: { job=\"mysql\",▯ or { job=\"mysql\", ▯\n const text = state.sliceDoc(node.from, pos);\n if (text.endsWith(',') || text.endsWith(', ')) {\n return { scope: { kind: 'LabelName' }, from: pos };\n }\n break;\n }\n\n case Matcher:\n // Single matcher like job=\"mysql\"\n // Autocomplete when cursor is after a complete matcher: { job=\"mysql\" ▯\n if (node.parent?.type.id === Matchers) {\n return { scope: { kind: 'LabelName' }, from: pos };\n }\n break;\n\n case Identifier:\n // Identifier is a label name being typed\n // Autocomplete partial label names: { jo▯ or { job=\"mysql\", na▯\n if (node.parent?.type.id === Matcher) {\n return { scope: { kind: 'LabelName' }, from: node.from };\n }\n break;\n\n case Eq:\n case Neq:\n case Re:\n case Nre:\n // Operators for label matching: =, !=, =~, !~\n // Autocomplete label values right after operator: { job=▯ or { job!=▯\n if (node.parent?.type.id === Matcher) {\n const labelNode = node.parent.firstChild;\n if (labelNode?.type.id === Identifier) {\n const label = state.sliceDoc(labelNode.from, labelNode.to);\n return { scope: { kind: 'LabelValue', label }, from: pos };\n }\n }\n break;\n\n case StringType:\n // String value in a matcher: { job=\"▯\n // Do not autocomplete if cursor is after closing quotes: { job=\"\"▯\n if (node.parent?.type.id === Matcher && !/^\".*\"$/.test(state.sliceDoc(node.from, pos))) {\n const labelNode = node.parent.firstChild;\n if (labelNode?.type.id === Identifier) {\n const label = state.sliceDoc(labelNode.from, labelNode.to);\n return { scope: { kind: 'LabelValue', label }, from: node.from + 1 }; // +1 to skip opening quote\n }\n }\n break;\n\n case ERROR_NODE:\n // Error nodes represent incomplete or malformed syntax\n // Autocomplete incomplete value after operator: { job=mys▯ or { job=\"mys▯\n if (\n (node.prevSibling?.type.id === Eq ||\n node.prevSibling?.type.id === Neq ||\n node.prevSibling?.type.id === Re ||\n node.prevSibling?.type.id === Nre) &&\n node.parent?.type.id === Matcher\n ) {\n const labelNode = node.parent.firstChild;\n if (labelNode?.type.id === Identifier) {\n const label = state.sliceDoc(labelNode.from, labelNode.to);\n // Skip leading quote if present: { name=\"HT▯\n const from = quoteChars.includes(state.sliceDoc(node.from, node.from + 1)) ? node.from + 1 : node.from;\n return { scope: { kind: 'LabelValue', label }, from };\n }\n }\n\n // Autocomplete partial label name: { j▯ or { job=\"mysql\", n▯\n if (node.parent?.type.id === Selector || node.parent?.type.id === Matchers) {\n return { scope: { kind: 'LabelName' }, from: node.from };\n }\n break;\n }\n\n return undefined;\n}\n\n/**\n * Detect pipe function completion contexts (line filters, parsers, formatters).\n */\nfunction detectPipeCompletion(state: EditorState, node: SyntaxNode): CompletionInfo | undefined {\n // Check if we're in an error node right after a pipe operator\n // This handles cases like: {job=\"nginx\"} | !▯\n if (node.prevSibling?.type.id === Pipe) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: true, hasSpace: true, afterExclamation: false },\n from: node.from,\n };\n }\n\n // Check if we're after selector with space and text starts with !\n // This handles cases like: {job=\"nginx\"} !▯\n const errorText = state.sliceDoc(node.from, node.to);\n if (errorText.startsWith('!')) {\n const textBeforeError = state.sliceDoc(0, node.from).trim();\n if (textBeforeError.endsWith('}')) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: false, hasSpace: true, afterExclamation: true },\n from: node.from,\n };\n }\n }\n\n return undefined;\n}\n\n/**\n * Complete LogQL pipe functions, line filters, and parser functions.\n * Context-aware suggestions based on LogQL syntax:\n * - After \"{} \": Show all line filters (|=, !=, |~, !~) + parsers (with | prefix)\n * - After \"{} !\": Show ONLY != and !~\n * - After \"{} |\": Show only pipe-based filters WITHOUT the | (=, ~) + parsers\n * - After \"{} | \": Show ONLY parsers, NO line filters\n */\nfunction completePipeFunctions(afterPipe: boolean, hasSpace: boolean, afterExclamation: boolean): Completion[] {\n const completions: Completion[] = [];\n\n // Line filter operators that START with pipe: |= and |~\n const pipeLineFilters = [\n { operator: '|=', detail: 'Line contains' },\n { operator: '|~', detail: 'Line matches regex' },\n ];\n\n // Line filter operators that DON'T start with pipe: != and !~\n const nonPipeLineFilters = [\n { operator: '!=', detail: 'Line does not contain' },\n { operator: '!~', detail: 'Line does not match regex' },\n ];\n\n // Context: After \"{} !\" - Show ONLY != and !~\n if (afterExclamation) {\n nonPipeLineFilters.forEach(({ operator, detail }) => {\n completions.push(createLineFilterCompletion(operator, detail));\n });\n return completions; // Don't show parsers after !\n }\n\n // Context 1: After \"{} | \" (pipe + space) - ONLY parsers, NO line filters\n if (afterPipe && hasSpace) {\n // Don't show any line filters\n }\n // Context 2: After \"{} |\" (pipe, no space) - Show = and ~ (without pipe prefix)\n else if (afterPipe && !hasSpace) {\n pipeLineFilters.forEach(({ operator, detail }) => {\n // Strip the | since user already typed it\n const strippedOp = operator.replace('|', '');\n completions.push(createLineFilterCompletion(strippedOp, detail));\n });\n }\n // Context 3: After \"{} \" (no pipe) - Show ALL line filters with full syntax\n else {\n [...pipeLineFilters, ...nonPipeLineFilters].forEach(({ operator, detail }) => {\n completions.push(createLineFilterCompletion(operator, detail));\n });\n }\n\n // Parser functions and pipe operations: always show\n // Add pipe prefix when not after pipe (e.g., \"{} \" needs \"| json\" not \" json\")\n const parserPrefix = !afterPipe ? '| ' : hasSpace ? '' : ' ';\n\n // Parsing expressions: Extract structured data\n const parsingExpressions = ['json', 'logfmt', 'pattern', 'regexp', 'unpack', 'unwrap'];\n parsingExpressions.forEach((parser) => {\n completions.push({\n label: `${parserPrefix}${parser}`,\n type: 'function',\n boost: 5,\n });\n });\n\n // Formatting and labels expressions: Format output and manipulate labels\n const formattingAndLabels = ['line_format', 'label_format', 'decolorize', 'drop', 'keep'];\n formattingAndLabels.forEach((expr) => {\n completions.push({\n label: `${parserPrefix}${expr}`,\n type: 'method',\n });\n });\n\n return completions;\n}\n\nasync function completeLabelName(completionCfg: CompletionConfig): Promise<Completion[]> {\n if (!completionCfg.client) {\n return [];\n }\n\n const start = completionCfg.timeRange?.start\n ? toUnixSeconds(new Date(completionCfg.timeRange.start).getTime())\n : undefined;\n const end = completionCfg.timeRange?.end ? toUnixSeconds(new Date(completionCfg.timeRange.end).getTime()) : undefined;\n\n try {\n const response = await completionCfg.client.labels(start, end);\n if (response.status === 'success') {\n return response.data.map((label: string) => ({ label }));\n }\n return [];\n } catch (error) {\n console.error('Error fetching label names:', error);\n return [];\n }\n}\n\nasync function completeLabelValue(completionCfg: CompletionConfig, label: string): Promise<Completion[]> {\n if (!completionCfg.client) {\n return [];\n }\n\n const start = completionCfg.timeRange?.start\n ? toUnixSeconds(new Date(completionCfg.timeRange.start).getTime())\n : undefined;\n const end = completionCfg.timeRange?.end ? toUnixSeconds(new Date(completionCfg.timeRange.end).getTime()) : undefined;\n\n try {\n const response = await completionCfg.client.labelValues(label, start, end);\n if (response.status === 'success') {\n return response.data.map((value: string) => ({\n label: value ?? '',\n displayLabel: value ?? '(empty string)',\n apply: applyQuotedCompletion,\n }));\n }\n return [];\n } catch (error) {\n console.error(`Error fetching values for label ${label}:`, error);\n return [];\n }\n}\n\n/**\n * Create a line filter completion with consistent cursor positioning.\n */\nfunction createLineFilterCompletion(operator: string, detail: string): Completion {\n return {\n label: `${operator} \"\"`,\n detail,\n apply: (view, _completion, from, to) => {\n const insert = `${operator} \"\"`;\n view.dispatch({\n changes: { from, to, insert },\n selection: { anchor: from + insert.length - 1 },\n });\n },\n type: 'text',\n boost: 10,\n };\n}\n\nfunction escapeString(input: string, quoteChar: string) {\n // do not escape raw strings (when using backticks)\n if (quoteChar === '`') {\n return input;\n }\n\n let escaped = input;\n // escape backslashes and quotes\n escaped = escaped.replaceAll('\\\\', '\\\\\\\\');\n escaped = escaped.replaceAll('\"', '\\\\\"');\n return escaped;\n}\n\n/**\n * Add quotes to the completion text in case quotes are not present already.\n * This handles the following cases:\n * { name=HTTP\n * { name=\"x\n * { name=\"x\" where cursor is after the 'x'\n */\nexport function applyQuotedCompletion(view: EditorView, completion: Completion, from: number, to: number): void {\n let quoteChar = defaultQuoteChar;\n if (quoteChars.includes(view.state.sliceDoc(from - 1, from))) {\n quoteChar = view.state.sliceDoc(from - 1, from);\n from--;\n }\n if (quoteChars.includes(view.state.sliceDoc(to, to + 1))) {\n quoteChar = view.state.sliceDoc(to, to + 1);\n to++;\n }\n\n // When using raw strings (`), we cannot escape a backtick.\n // Therefore, switch the quote character.\n if (completion.label.includes('`')) {\n quoteChar = '\"';\n }\n\n const insertText = `${quoteChar}${escapeString(completion.label, quoteChar)}${quoteChar}`;\n view.dispatch(insertCompletionText(view.state, insertText, from, to));\n}\n"],"names":["insertCompletionText","syntaxTree","Selector","Matchers","Matcher","Identifier","Eq","Neq","Re","Nre","String","StringType","Pipe","toUnixSeconds","quoteChars","defaultQuoteChar","ERROR_NODE","complete","completionCfg","state","pos","completion","identifyCompletion","options","retrieveOptions","scope","from","to","tree","node","resolveInner","type","id","labelCompletion","detectLabelCompletion","pipeCompletion","detectPipeCompletion","hasSpaceAfterPipe","sliceDoc","kind","afterPipe","hasSpace","afterExclamation","textBeforeCursor","trim","match","endsWith","completeLabelName","completeLabelValue","label","completePipeFunctions","firstChild","includes","text","parent","labelNode","test","prevSibling","undefined","errorText","startsWith","textBeforeError","completions","pipeLineFilters","operator","detail","nonPipeLineFilters","forEach","push","createLineFilterCompletion","strippedOp","replace","parserPrefix","parsingExpressions","parser","boost","formattingAndLabels","expr","client","start","timeRange","Date","getTime","end","response","labels","status","data","map","error","console","labelValues","value","displayLabel","apply","applyQuotedCompletion","view","_completion","insert","dispatch","changes","selection","anchor","length","escapeString","input","quoteChar","escaped","replaceAll","insertText"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAA0DA,oBAAoB,QAAQ,2BAA2B;AACjH,SAASC,UAAU,QAAQ,uBAAuB;AAGlD,SACEC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,EAAE,EACFC,GAAG,EACHC,EAAE,EACFC,GAAG,EACHC,UAAUC,UAAU,EACpBC,IAAI,QACC,uBAAuB;AAE9B,SAASC,aAAa,QAAQ,WAAW;AAkBzC,MAAMC,aAAa;IAAC;IAAK;CAAI;AAC7B,MAAMC,mBAAmB;AACzB,MAAMC,aAAa,GAAG,mEAAmE;AAEzF,OAAO,eAAeC,SACpBC,aAA+B,EAC/B,EAAEC,KAAK,EAAEC,GAAG,EAAqB;IAEjC,uCAAuC;IACvC,MAAMC,aAAaC,mBAAmBH,OAAOC,KAAKnB,WAAWkB;IAC7D,IAAI,CAACE,YAAY;QACf,yDAAyD;QACzD,OAAO;IACT;IAEA,kFAAkF;IAClF,MAAME,UAAU,MAAMC,gBAAgBN,eAAeG,WAAWI,KAAK;IACrE,OAAO;QAAEF;QAASG,MAAML,WAAWK,IAAI;QAAEC,IAAIN,WAAWM,EAAE;IAAC;AAC7D;AAEA;;;;CAIC,GACD,OAAO,SAASL,mBAAmBH,KAAkB,EAAEC,GAAW,EAAEQ,IAAU;IAC5E,M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A,SAAS6B,aAAaC,KAAa,EAAEC,SAAiB;IACpD,mDAAmD;IACnD,IAAIA,cAAc,KAAK;QACrB,OAAOD;IACT;IAEA,IAAIE,UAAUF;IACd,gCAAgC;IAChCE,UAAUA,QAAQC,UAAU,CAAC,MAAM;IACnCD,UAAUA,QAAQC,UAAU,CAAC,KAAK;IAClC,OAAOD;AACT;AAEA;;;;;;CAMC,GACD,OAAO,SAASZ,sBAAsBC,IAAgB,EAAE3E,UAAsB,EAAEK,IAAY,EAAEC,EAAU;IACtG,IAAI+E,YAAY3F;IAChB,IAAID,WAAWsC,QAAQ,CAAC4C,KAAK7E,KAAK,CAACmB,QAAQ,CAACZ,OAAO,GAAGA,QAAQ;QAC5DgF,YAAYV,KAAK7E,KAAK,CAACmB,QAAQ,CAACZ,OAAO,GAAGA;QAC1CA;IACF;IACA,IAAIZ,WAAWsC,QAAQ,CAAC4C,KAAK7E,KAAK,CAACmB,QAAQ,CAACX,IAAIA,KAAK,KAAK;QACxD+E,YAAYV,KAAK7E,KAAK,CAACmB,QAAQ,CAACX,IAAIA,KAAK;QACzCA;IACF;IAEA,2DAA2D;IAC3D,yCAAyC;IACzC,IAAIN,WAAW4B,KAAK,CAACG,QAAQ,CAAC,MAAM;QAClCsD,YAAY;IACd;IAEA,MAAMG,aAAa,GAAGH,YAAYF,aAAanF,WAAW4B,KAAK,EAAEyD,aAAaA,WAAW;IACzFV,KAAKG,QAAQ,CAACnG,qBAAqBgG,KAAK7E,KAAK,EAAE0F,YAAYnF,MAAMC;AACnE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/complete.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Completion, CompletionContext, CompletionResult, insertCompletionText } from '@codemirror/autocomplete';\nimport { syntaxTree } from '@codemirror/language';\nimport { EditorState } from '@codemirror/state';\nimport { SyntaxNode, Tree } from '@lezer/common';\nimport {\n Selector,\n Matchers,\n Matcher,\n Identifier,\n Eq,\n Neq,\n Re,\n Nre,\n String as StringType,\n Pipe,\n} from '@grafana/lezer-logql';\nimport { EditorView } from '@uiw/react-codemirror';\nimport { toUnixSeconds } from '../model';\nimport { CompletionConfig } from './logql-extension';\n\n/** CompletionScope specifies the completion kind, e.g. whether to complete label names or values */\ntype CompletionScope =\n | { kind: 'LabelName' }\n | { kind: 'LabelValue'; label: string }\n | { kind: 'PipeFunction'; afterPipe: boolean; hasSpace: boolean; afterExclamation: boolean };\n\n/**\n * CompletionInfo specifies the identified scope and position of the completion in the current editor text.\n */\nexport interface CompletionInfo {\n scope: CompletionScope;\n from: number;\n to?: number;\n}\n\nconst quoteChars = ['\"', '`'];\nconst defaultQuoteChar = '\"';\nconst ERROR_NODE = 0; // Lezer parser creates error nodes for incomplete/malformed syntax\n\nexport async function complete(\n completionCfg: CompletionConfig,\n { state, pos }: CompletionContext\n): Promise<CompletionResult | null> {\n // First, identify the completion scope\n const completion = identifyCompletion(state, pos, syntaxTree(state));\n if (!completion) {\n // No completion scope found for current cursor position.\n return null;\n }\n\n // Then, retrieve completion options for the identified scope (from the Loki API).\n const options = await retrieveOptions(completionCfg, completion.scope);\n return { options, from: completion.from, to: completion.to };\n}\n\n/**\n * Identify completion scope (e.g. LabelName, LabelValue) and position, based on the current node in the syntax tree.\n *\n * Function is exported for tests only.\n */\nexport function identifyCompletion(state: EditorState, pos: number, tree: Tree): CompletionInfo | undefined {\n const node = tree.resolveInner(pos, -1);\n\n switch (node.type.id) {\n case Selector:\n case Matchers:\n case Matcher:\n case Identifier:\n case Eq:\n case Neq:\n case Re:\n case Nre:\n case StringType: {\n const labelCompletion = detectLabelCompletion(state, pos, node);\n if (labelCompletion) return labelCompletion;\n break;\n }\n\n case ERROR_NODE: {\n // Check for pipe context first\n const pipeCompletion = detectPipeCompletion(state, node);\n if (pipeCompletion) return pipeCompletion;\n\n // Then check for label completion in error nodes\n const labelCompletion = detectLabelCompletion(state, pos, node);\n if (labelCompletion) return labelCompletion;\n break;\n }\n\n case Pipe: {\n // Pipe operator: suggest parser functions and line filters\n // Examples: {job=\"nginx\"} |▯ or {job=\"nginx\"} | ▯\n const hasSpaceAfterPipe = state.sliceDoc(pos - 1, pos) === ' ';\n return {\n scope: { kind: 'PipeFunction', afterPipe: true, hasSpace: hasSpaceAfterPipe, afterExclamation: false },\n from: pos,\n };\n }\n }\n\n // Fallback checks for contexts not directly on a node\n const textBeforeCursor = state.sliceDoc(0, pos).trim();\n const hasSpace = state.sliceDoc(pos - 1, pos).match(/\\s/) !== null;\n\n // Check if cursor is after a pipe operator followed by whitespace\n // This enables autocomplete after: {job=\"nginx\"} | ▯\n if (textBeforeCursor.endsWith('|') && hasSpace) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: true, hasSpace: true, afterExclamation: false },\n from: pos,\n };\n }\n\n // Check if cursor is after a closing brace (stream selector) followed by whitespace\n // This enables autocomplete after: {job=\"nginx\"} ▯\n if (textBeforeCursor.endsWith('}') && hasSpace) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: false, hasSpace: true, afterExclamation: false },\n from: pos,\n };\n }\n}\n\n/**\n * Retrieve completion options based on the identified completion scope.\n */\nasync function retrieveOptions(completionCfg: CompletionConfig, completion: CompletionScope): Promise<Completion[]> {\n switch (completion.kind) {\n case 'LabelName':\n return completeLabelName(completionCfg);\n\n case 'LabelValue':\n return completeLabelValue(completionCfg, completion.label);\n\n case 'PipeFunction':\n return completePipeFunctions(completion.afterPipe, completion.hasSpace, completion.afterExclamation);\n }\n}\n\n/**\n * Detect label name or value completion contexts within selectors.\n */\nfunction detectLabelCompletion(state: EditorState, pos: number, node: SyntaxNode): CompletionInfo | undefined {\n switch (node.type.id) {\n case Selector:\n // Selector is the entire {label matchers} expression\n // Autocomplete at start: {▯ or empty: {}\n // Do not autocomplete if cursor is after closing brace: {job=\"mysql\"}▯\n if (\n (node.firstChild === null || node.firstChild?.type.id === ERROR_NODE) &&\n !state.sliceDoc(node.from, pos).includes('}')\n ) {\n return { scope: { kind: 'LabelName' }, from: pos };\n }\n break;\n\n case Matchers: {\n // Matchers node contains all label matchers inside {}\n // Autocomplete after comma: { job=\"mysql\",▯ or { job=\"mysql\", ▯\n const text = state.sliceDoc(node.from, pos);\n if (text.endsWith(',') || text.endsWith(', ')) {\n return { scope: { kind: 'LabelName' }, from: pos };\n }\n break;\n }\n\n case Matcher:\n // Single matcher like job=\"mysql\"\n // Autocomplete when cursor is after a complete matcher: { job=\"mysql\" ▯\n if (node.parent?.type.id === Matchers) {\n return { scope: { kind: 'LabelName' }, from: pos };\n }\n break;\n\n case Identifier:\n // Identifier is a label name being typed\n // Autocomplete partial label names: { jo▯ or { job=\"mysql\", na▯\n if (node.parent?.type.id === Matcher) {\n return { scope: { kind: 'LabelName' }, from: node.from };\n }\n break;\n\n case Eq:\n case Neq:\n case Re:\n case Nre:\n // Operators for label matching: =, !=, =~, !~\n // Autocomplete label values right after operator: { job=▯ or { job!=▯\n if (node.parent?.type.id === Matcher) {\n const labelNode = node.parent.firstChild;\n if (labelNode?.type.id === Identifier) {\n const label = state.sliceDoc(labelNode.from, labelNode.to);\n return { scope: { kind: 'LabelValue', label }, from: pos };\n }\n }\n break;\n\n case StringType:\n // String value in a matcher: { job=\"▯\n // Do not autocomplete if cursor is after closing quotes: { job=\"\"▯\n if (node.parent?.type.id === Matcher && !/^\".*\"$/.test(state.sliceDoc(node.from, pos))) {\n const labelNode = node.parent.firstChild;\n if (labelNode?.type.id === Identifier) {\n const label = state.sliceDoc(labelNode.from, labelNode.to);\n return { scope: { kind: 'LabelValue', label }, from: node.from + 1 }; // +1 to skip opening quote\n }\n }\n break;\n\n case ERROR_NODE:\n // Error nodes represent incomplete or malformed syntax\n // Autocomplete incomplete value after operator: { job=mys▯ or { job=\"mys▯\n if (\n (node.prevSibling?.type.id === Eq ||\n node.prevSibling?.type.id === Neq ||\n node.prevSibling?.type.id === Re ||\n node.prevSibling?.type.id === Nre) &&\n node.parent?.type.id === Matcher\n ) {\n const labelNode = node.parent.firstChild;\n if (labelNode?.type.id === Identifier) {\n const label = state.sliceDoc(labelNode.from, labelNode.to);\n // Skip leading quote if present: { name=\"HT▯\n const from = quoteChars.includes(state.sliceDoc(node.from, node.from + 1)) ? node.from + 1 : node.from;\n return { scope: { kind: 'LabelValue', label }, from };\n }\n }\n\n // Autocomplete partial label name: { j▯ or { job=\"mysql\", n▯\n if (node.parent?.type.id === Selector || node.parent?.type.id === Matchers) {\n return { scope: { kind: 'LabelName' }, from: node.from };\n }\n break;\n }\n\n return undefined;\n}\n\n/**\n * Detect pipe function completion contexts (line filters, parsers, formatters).\n */\nfunction detectPipeCompletion(state: EditorState, node: SyntaxNode): CompletionInfo | undefined {\n // Check if we're in an error node right after a pipe operator\n // This handles cases like: {job=\"nginx\"} | !▯\n if (node.prevSibling?.type.id === Pipe) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: true, hasSpace: true, afterExclamation: false },\n from: node.from,\n };\n }\n\n // Check if we're after selector with space and text starts with !\n // This handles cases like: {job=\"nginx\"} !▯\n const errorText = state.sliceDoc(node.from, node.to);\n if (errorText.startsWith('!')) {\n const textBeforeError = state.sliceDoc(0, node.from).trim();\n if (textBeforeError.endsWith('}')) {\n return {\n scope: { kind: 'PipeFunction', afterPipe: false, hasSpace: true, afterExclamation: true },\n from: node.from,\n };\n }\n }\n\n return undefined;\n}\n\n/**\n * Complete LogQL pipe functions, line filters, and parser functions.\n * Context-aware suggestions based on LogQL syntax:\n * - After \"{} \": Show all line filters (|=, !=, |~, !~) + parsers (with | prefix)\n * - After \"{} !\": Show ONLY != and !~\n * - After \"{} |\": Show only pipe-based filters WITHOUT the | (=, ~) + parsers\n * - After \"{} | \": Show ONLY parsers, NO line filters\n */\nfunction completePipeFunctions(afterPipe: boolean, hasSpace: boolean, afterExclamation: boolean): Completion[] {\n const completions: Completion[] = [];\n\n // Line filter operators that START with pipe: |= and |~\n const pipeLineFilters = [\n { operator: '|=', detail: 'Line contains' },\n { operator: '|~', detail: 'Line matches regex' },\n ];\n\n // Line filter operators that DON'T start with pipe: != and !~\n const nonPipeLineFilters = [\n { operator: '!=', detail: 'Line does not contain' },\n { operator: '!~', detail: 'Line does not match regex' },\n ];\n\n // Context: After \"{} !\" - Show ONLY != and !~\n if (afterExclamation) {\n nonPipeLineFilters.forEach(({ operator, detail }) => {\n completions.push(createLineFilterCompletion(operator, detail));\n });\n return completions; // Don't show parsers after !\n }\n\n // Context 1: After \"{} | \" (pipe + space) - ONLY parsers, NO line filters\n if (afterPipe && hasSpace) {\n // Don't show any line filters\n }\n // Context 2: After \"{} |\" (pipe, no space) - Show = and ~ (without pipe prefix)\n else if (afterPipe && !hasSpace) {\n pipeLineFilters.forEach(({ operator, detail }) => {\n // Strip the | since user already typed it\n const strippedOp = operator.replace('|', '');\n completions.push(createLineFilterCompletion(strippedOp, detail));\n });\n }\n // Context 3: After \"{} \" (no pipe) - Show ALL line filters with full syntax\n else {\n [...pipeLineFilters, ...nonPipeLineFilters].forEach(({ operator, detail }) => {\n completions.push(createLineFilterCompletion(operator, detail));\n });\n }\n\n // Parser functions and pipe operations: always show\n // Add pipe prefix when not after pipe (e.g., \"{} \" needs \"| json\" not \" json\")\n const parserPrefix = !afterPipe ? '| ' : hasSpace ? '' : ' ';\n\n // Parsing expressions: Extract structured data\n const parsingExpressions = ['json', 'logfmt', 'pattern', 'regexp', 'unpack', 'unwrap'];\n parsingExpressions.forEach((parser) => {\n completions.push({\n label: `${parserPrefix}${parser}`,\n type: 'function',\n boost: 5,\n });\n });\n\n // Formatting and labels expressions: Format output and manipulate labels\n const formattingAndLabels = ['line_format', 'label_format', 'decolorize', 'drop', 'keep'];\n formattingAndLabels.forEach((expr) => {\n completions.push({\n label: `${parserPrefix}${expr}`,\n type: 'method',\n });\n });\n\n return completions;\n}\n\nasync function completeLabelName(completionCfg: CompletionConfig): Promise<Completion[]> {\n if (!completionCfg.client) {\n return [];\n }\n\n const start = completionCfg.timeRange?.start\n ? toUnixSeconds(new Date(completionCfg.timeRange.start).getTime())\n : undefined;\n const end = completionCfg.timeRange?.end ? toUnixSeconds(new Date(completionCfg.timeRange.end).getTime()) : undefined;\n\n try {\n const response = await completionCfg.client.labels(start, end);\n if (response.status === 'success') {\n return response.data.map((label: string) => ({ label }));\n }\n return [];\n } catch (error) {\n console.error('Error fetching label names:', error);\n return [];\n }\n}\n\nasync function completeLabelValue(completionCfg: CompletionConfig, label: string): Promise<Completion[]> {\n if (!completionCfg.client) {\n return [];\n }\n\n const start = completionCfg.timeRange?.start\n ? toUnixSeconds(new Date(completionCfg.timeRange.start).getTime())\n : undefined;\n const end = completionCfg.timeRange?.end ? toUnixSeconds(new Date(completionCfg.timeRange.end).getTime()) : undefined;\n\n try {\n const response = await completionCfg.client.labelValues(label, start, end);\n if (response.status === 'success') {\n return response.data.map((value: string) => ({\n label: value ?? '',\n displayLabel: value ?? '(empty string)',\n apply: applyQuotedCompletion,\n }));\n }\n return [];\n } catch (error) {\n console.error(`Error fetching values for label ${label}:`, error);\n return [];\n }\n}\n\n/**\n * Create a line filter completion with consistent cursor positioning.\n */\nfunction createLineFilterCompletion(operator: string, detail: string): Completion {\n return {\n label: `${operator} \"\"`,\n detail,\n apply: (view, _completion, from, to): void => {\n const insert = `${operator} \"\"`;\n view.dispatch({\n changes: { from, to, insert },\n selection: { anchor: from + insert.length - 1 },\n });\n },\n type: 'text',\n boost: 10,\n };\n}\n\nfunction escapeString(input: string, quoteChar: string): string {\n // do not escape raw strings (when using backticks)\n if (quoteChar === '`') {\n return input;\n }\n\n let escaped = input;\n // escape backslashes and quotes\n escaped = escaped.replaceAll('\\\\', '\\\\\\\\');\n escaped = escaped.replaceAll('\"', '\\\\\"');\n return escaped;\n}\n\n/**\n * Add quotes to the completion text in case quotes are not present already.\n * This handles the following cases:\n * { name=HTTP\n * { name=\"x\n * { name=\"x\" where cursor is after the 'x'\n */\nexport function applyQuotedCompletion(view: EditorView, completion: Completion, from: number, to: number): void {\n let quoteChar = defaultQuoteChar;\n if (quoteChars.includes(view.state.sliceDoc(from - 1, from))) {\n quoteChar = view.state.sliceDoc(from - 1, from);\n from--;\n }\n if (quoteChars.includes(view.state.sliceDoc(to, to + 1))) {\n quoteChar = view.state.sliceDoc(to, to + 1);\n to++;\n }\n\n // When using raw strings (`), we cannot escape a backtick.\n // Therefore, switch the quote character.\n if (completion.label.includes('`')) {\n quoteChar = '\"';\n }\n\n const insertText = `${quoteChar}${escapeString(completion.label, quoteChar)}${quoteChar}`;\n view.dispatch(insertCompletionText(view.state, insertText, from, to));\n}\n"],"names":["insertCompletionText","syntaxTree","Selector","Matchers","Matcher","Identifier","Eq","Neq","Re","Nre","String","StringType","Pipe","toUnixSeconds","quoteChars","defaultQuoteChar","ERROR_NODE","complete","completionCfg","state","pos","completion","identifyCompletion","options","retrieveOptions","scope","from","to","tree","node","resolveInner","type","id","labelCompletion","detectLabelCompletion","pipeCompletion","detectPipeCompletion","hasSpaceAfterPipe","sliceDoc","kind","afterPipe","hasSpace","afterExclamation","textBeforeCursor","trim","match","endsWith","completeLabelName","completeLabelValue","label","completePipeFunctions","firstChild","includes","text","parent","labelNode","test","prevSibling","undefined","errorText","startsWith","textBeforeError","completions","pipeLineFilters","operator","detail","nonPipeLineFilters","forEach","push","createLineFilterCompletion","strippedOp","replace","parserPrefix","parsingExpressions","parser","boost","formattingAndLabels","expr","client","start","timeRange","Date","getTime","end","response","labels","status","data","map","error","console","labelValues","value","displayLabel","apply","applyQuotedCompletion","view","_completion","insert","dispatch","changes","selection","anchor","length","escapeString","input","quoteChar","escaped","replaceAll","insertText"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C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ACtG,IAAI+E,YAAY3F;IAChB,IAAID,WAAWsC,QAAQ,CAAC4C,KAAK7E,KAAK,CAACmB,QAAQ,CAACZ,OAAO,GAAGA,QAAQ;QAC5DgF,YAAYV,KAAK7E,KAAK,CAACmB,QAAQ,CAACZ,OAAO,GAAGA;QAC1CA;IACF;IACA,IAAIZ,WAAWsC,QAAQ,CAAC4C,KAAK7E,KAAK,CAACmB,QAAQ,CAACX,IAAIA,KAAK,KAAK;QACxD+E,YAAYV,KAAK7E,KAAK,CAACmB,QAAQ,CAACX,IAAIA,KAAK;QACzCA;IACF;IAEA,2DAA2D;IAC3D,yCAAyC;IACzC,IAAIN,WAAW4B,KAAK,CAACG,QAAQ,CAAC,MAAM;QAClCsD,YAAY;IACd;IAEA,MAAMG,aAAa,GAAGH,YAAYF,aAAanF,WAAW4B,KAAK,EAAEyD,aAAaA,WAAW;IACzFV,KAAKG,QAAQ,CAACnG,qBAAqBgG,KAAK7E,KAAK,EAAE0F,YAAYnF,MAAMC;AACnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n useDatasourceClient,\n useTimeRange,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack, ToggleButton, ToggleButtonGroup } from '@mui/material';\nimport { ReactElement, useCallback, useMemo } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { LogQLEditor } from '../../components';\nimport { isDefaultLokiSelector, LOKI_DATASOURCE_KIND, LokiDatasourceSelector, LokiClient } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiLogQuerySpec } from './loki-log-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiLogQuerySpec>;\n\nexport function LokiLogQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n // Get client and time range for autocompletion\n const { data: client } = useDatasourceClient<LokiClient>(selectedDatasource);\n const { absoluteTimeRange } = useTimeRange();\n\n // Create completion config for autocompletion\n const completionConfig = useMemo(() => {\n if (!client) return undefined;\n return {\n client,\n timeRange: absoluteTimeRange,\n };\n }, [client, absoluteTimeRange]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n const nextDatasource = isDefaultLokiSelector(newDatasourceSelection) ? undefined : newDatasourceSelection;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n const handleLogsDirection = (_: React.MouseEvent, v: 'backward' | 'forward') =>\n onChange(\n produce(value, (draft: LokiLogQuerySpec) => {\n draft.direction = v;\n })\n );\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string) => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"Loki Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\n completionConfig={completionConfig}\n // height=\"120px\"\n />\n </div>\n <div>\n <OptionsEditorControl\n label=\"Order\"\n // description=\"Percentage means thresholds relative to min & max\"\n control={\n <ToggleButtonGroup\n exclusive\n value={value?.direction ?? 'backward'}\n onChange={handleLogsDirection}\n sx={{ height: '36px', marginLeft: '10px', width: 'max-content' }}\n >\n <ToggleButton aria-label=\"backward\" value=\"backward\" sx={{ fontWeight: 500 }}>\n Newest first\n </ToggleButton>\n <ToggleButton aria-label=\"forward\" value=\"forward\" sx={{ fontWeight: 500 }}>\n Oldest first\n </ToggleButton>\n </ToggleButtonGroup>\n }\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","useDatasourceClient","useTimeRange","InputLabel","Stack","ToggleButton","ToggleButtonGroup","useCallback","useMemo","produce","OptionsEditorControl","LogQLEditor","isDefaultLokiSelector","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiLogQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","data","client","absoluteTimeRange","completionConfig","undefined","timeRange","handleDatasourceChange","newDatasourceSelection","kind","draft","nextDatasource","Error","handleLogsDirection","_","v","direction","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","control","exclusive","height","marginLeft","width","aria-label"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,EAClCC,mBAAmB,EACnBC,YAAY,QACP,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,gBAAgB;AACnF,SAAuBC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAC3D,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,qBAAqB,EAAEC,oBAAoB,QAA4C,cAAc;AAC9G,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,wBAAwB;AAKtD,OAAO,SAASC,mBAAmBC,KAA2B;IAC5D,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,wBAAwBD,cAAcN;IAC5C,MAAMQ,qBAAqBvB,mCACzBsB,uBACAT;IAEF,MAAM,EAAEW,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGV,cAAcE;IAEpE,+CAA+C;IAC/C,MAAM,EAAES,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,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBnB;4BACrB;wBACF;wBACAuC,aAAY;wBACZjC,kBAAkBA;;;;0BAItB,KAACkB;0BACC,cAAA,KAACtC;oBACC4C,OAAM;oBACN,kEAAkE;oBAClEU,uBACE,MAAC1D;wBACC2D,SAAS;wBACT7C,OAAOA,OAAOsB,aAAa;wBAC3BvB,UAAUoB;wBACVU,IAAI;4BAAEiB,QAAQ;4BAAQC,YAAY;4BAAQC,OAAO;wBAAc;;0CAE/D,KAAC/D;gCAAagE,cAAW;gCAAWjD,OAAM;gCAAW6B,IAAI;oCAAEG,YAAY;gCAAI;0CAAG;;0CAG9E,KAAC/C;gCAAagE,cAAW;gCAAUjD,OAAM;gCAAU6B,IAAI;oCAAEG,YAAY;gCAAI;0CAAG;;;;;;;;AAS1F"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/LokiLogQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n useDatasourceClient,\n useTimeRange,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack, ToggleButton, ToggleButtonGroup } from '@mui/material';\nimport { ReactElement, useCallback, useMemo } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { LogQLEditor } from '../../components';\nimport { isDefaultLokiSelector, LOKI_DATASOURCE_KIND, LokiDatasourceSelector, LokiClient } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiLogQuerySpec } from './loki-log-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiLogQuerySpec>;\n\nexport function LokiLogQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n // Get client and time range for autocompletion\n const { data: client } = useDatasourceClient<LokiClient>(selectedDatasource);\n const { absoluteTimeRange } = useTimeRange();\n\n // Create completion config for autocompletion\n const completionConfig = useMemo(() => {\n if (!client) return undefined;\n return {\n client,\n timeRange: absoluteTimeRange,\n };\n }, [client, absoluteTimeRange]);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n // If they're using the default, just omit the datasource prop (i.e. set to undefined)\n const nextDatasource = isDefaultLokiSelector(newDatasourceSelection) ? undefined : newDatasourceSelection;\n draft.datasource = nextDatasource;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n const handleLogsDirection = (_: React.MouseEvent, v: 'backward' | 'forward'): void =>\n onChange(\n produce(value, (draft: LokiLogQuerySpec) => {\n draft.direction = v;\n })\n );\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"Loki Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\n completionConfig={completionConfig}\n // height=\"120px\"\n />\n </div>\n <div>\n <OptionsEditorControl\n label=\"Order\"\n // description=\"Percentage means thresholds relative to min & max\"\n control={\n <ToggleButtonGroup\n exclusive\n value={value?.direction ?? 'backward'}\n onChange={handleLogsDirection}\n sx={{ height: '36px', marginLeft: '10px', width: 'max-content' }}\n >\n <ToggleButton aria-label=\"backward\" value=\"backward\" sx={{ fontWeight: 500 }}>\n Newest first\n </ToggleButton>\n <ToggleButton aria-label=\"forward\" value=\"forward\" sx={{ fontWeight: 500 }}>\n Oldest first\n </ToggleButton>\n </ToggleButtonGroup>\n }\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","useDatasourceClient","useTimeRange","InputLabel","Stack","ToggleButton","ToggleButtonGroup","useCallback","useMemo","produce","OptionsEditorControl","LogQLEditor","isDefaultLokiSelector","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiLogQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","data","client","absoluteTimeRange","completionConfig","undefined","timeRange","handleDatasourceChange","newDatasourceSelection","kind","draft","nextDatasource","Error","handleLogsDirection","_","v","direction","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","control","exclusive","height","marginLeft","width","aria-label"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,EAClCC,mBAAmB,EACnBC,YAAY,QACP,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,EAAEC,YAAY,EAAEC,iBAAiB,QAAQ,gBAAgB;AACnF,SAAuBC,WAAW,EAAEC,OAAO,QAAQ,QAAQ;AAC3D,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,qBAAqB,EAAEC,oBAAoB,QAA4C,cAAc;AAC9G,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,wBAAwB;AAKtD,OAAO,SAASC,mBAAmBC,KAA2B;IAC5D,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,wBAAwBD,cAAcN;IAC5C,MAAMQ,qBAAqBvB,mCACzBsB,uBACAT;IAEF,MAAM,EAAEW,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGV,cAAcE;IAEpE,+CAA+C;IAC/C,MAAM,EAAES,MAAMC,MAAM,EAAE,GAAG3B,oBAAgC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AAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBnB;4BACrB;wBACF;wBACAuC,aAAY;wBACZjC,kBAAkBA;;;;0BAItB,KAACkB;0BACC,cAAA,KAACtC;oBACC4C,OAAM;oBACN,kEAAkE;oBAClEU,uBACE,MAAC1D;wBACC2D,SAAS;wBACT7C,OAAOA,OAAOsB,aAAa;wBAC3BvB,UAAUoB;wBACVU,IAAI;4BAAEiB,QAAQ;4BAAQC,YAAY;4BAAQC,OAAO;wBAAc;;0CAE/D,KAAC/D;gCAAagE,cAAW;gCAAWjD,OAAM;gCAAW6B,IAAI;oCAAEG,YAAY;gCAAI;0CAAG;;0CAG9E,KAAC/C;gCAAagE,cAAW;gCAAUjD,OAAM;gCAAU6B,IAAI;oCAAEG,YAAY;gCAAI;0CAAG;;;;;;;;AAS1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack } from '@mui/material';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { LogQLEditor } from '../../components';\nimport { LOKI_DATASOURCE_KIND, LokiDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiTimeSeriesQuerySpec>;\n\nexport function LokiQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string) => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"Loki Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","produce","LogQLEditor","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,QAAQ,gBAAgB;AAClD,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAAgC,cAAc;AAC3E,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,wBAAwB;AAKtD,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,wBAAwBD,cAAcN;IAC5C,MAAMQ,qBAAqBhB,mCACzBe,uBACAT;IAEF,MAAM,EAAEW,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGV,cAAcE;IAEpE,MAAMS,yBAA4D,CAACC;QACjE,IAAI,CAACtB,qBAAqBsB,2BAA2BA,uBAAuBC,IAAI,KAAKf,iBAAiB;YACpGK,SACER,QAAQS,OAAO,CAACU;gBACdA,MAAMT,UAAU,GAAGO;YACrB;YAEF;QACF;QAEA,MAAM,IAAIG,MAAM;IAClB;IAEA,6CAA6C;IAC7C,MAAMC,qBAAqB,CAACR;QAC1BL,SACER,QAAQS,OAAO,CAACU;YACdA,MAAMN,KAAK,GAAGA;QAChB;IAEJ;IAEA,MAAMS,wBAAwBvB,YAC5B,CAACwB;QACCT,kBAAkBS;IACpB,GACA;QAACT;KAAkB;IAGrB,qBACE,MAAChB;QAAM0B,SAAS;QAAKC,eAAe;;0BAClC,MAACC;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACpC;wBACCqC,sBAAsB5B;wBACtBM,OAAOG;wBACPJ,UAAUQ;wBACVgB,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC7B;wBACCQ,OAAOI;wBACPL,UAAUc;wBACVY,QAAQnB;wBACRoB,WAAW,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBR;4BACrB;wBACF;wBACA4B,aAAY;;;;;;AAMtB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack } from '@mui/material';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { LogQLEditor } from '../../components';\nimport { LOKI_DATASOURCE_KIND, LokiDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiTimeSeriesQuerySpec>;\n\nexport function LokiQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"Loki Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","produce","LogQLEditor","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,UAAU,EAAEC,KAAK,QAAQ,gBAAgB;AAClD,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ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RoB,WAAW,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBR;4BACrB;wBACF;wBACA4B,aAAY;;;;;;AAMtB"}
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "Loki",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.5.
|
|
8
|
+
"buildVersion": "0.5.1",
|
|
9
9
|
"buildName": "@perses-dev/loki-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/Loki.
|
|
12
|
+
"name": "__mf/js/Loki.ca74c810.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
{
|
|
88
88
|
"id": "Loki:@perses-dev/components",
|
|
89
89
|
"name": "@perses-dev/components",
|
|
90
|
-
"version": "0.53.
|
|
90
|
+
"version": "0.53.1",
|
|
91
91
|
"singleton": true,
|
|
92
|
-
"requiredVersion": "^0.53.
|
|
92
|
+
"requiredVersion": "^0.53.1",
|
|
93
93
|
"assets": {
|
|
94
94
|
"js": {
|
|
95
95
|
"async": [],
|
|
96
96
|
"sync": [
|
|
97
|
-
"__mf/js/async/
|
|
97
|
+
"__mf/js/async/9811.422fb6ad.js"
|
|
98
98
|
]
|
|
99
99
|
},
|
|
100
100
|
"css": {
|
|
@@ -106,14 +106,14 @@
|
|
|
106
106
|
{
|
|
107
107
|
"id": "Loki:@perses-dev/dashboards",
|
|
108
108
|
"name": "@perses-dev/dashboards",
|
|
109
|
-
"version": "0.53.
|
|
109
|
+
"version": "0.53.1",
|
|
110
110
|
"singleton": true,
|
|
111
|
-
"requiredVersion": "^0.53.
|
|
111
|
+
"requiredVersion": "^0.53.1",
|
|
112
112
|
"assets": {
|
|
113
113
|
"js": {
|
|
114
114
|
"async": [],
|
|
115
115
|
"sync": [
|
|
116
|
-
"__mf/js/async/54.
|
|
116
|
+
"__mf/js/async/54.f8265ee0.js"
|
|
117
117
|
]
|
|
118
118
|
},
|
|
119
119
|
"css": {
|
|
@@ -125,14 +125,14 @@
|
|
|
125
125
|
{
|
|
126
126
|
"id": "Loki:@perses-dev/explore",
|
|
127
127
|
"name": "@perses-dev/explore",
|
|
128
|
-
"version": "0.53.
|
|
128
|
+
"version": "0.53.1",
|
|
129
129
|
"singleton": true,
|
|
130
|
-
"requiredVersion": "^0.53.
|
|
130
|
+
"requiredVersion": "^0.53.1",
|
|
131
131
|
"assets": {
|
|
132
132
|
"js": {
|
|
133
133
|
"async": [],
|
|
134
134
|
"sync": [
|
|
135
|
-
"__mf/js/async/1728.
|
|
135
|
+
"__mf/js/async/1728.c6a9c8d6.js"
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
138
|
"css": {
|
|
@@ -144,14 +144,14 @@
|
|
|
144
144
|
{
|
|
145
145
|
"id": "Loki:@perses-dev/plugin-system",
|
|
146
146
|
"name": "@perses-dev/plugin-system",
|
|
147
|
-
"version": "0.53.
|
|
147
|
+
"version": "0.53.1",
|
|
148
148
|
"singleton": true,
|
|
149
|
-
"requiredVersion": "^0.53.
|
|
149
|
+
"requiredVersion": "^0.53.1",
|
|
150
150
|
"assets": {
|
|
151
151
|
"js": {
|
|
152
152
|
"async": [],
|
|
153
153
|
"sync": [
|
|
154
|
-
"__mf/js/async/
|
|
154
|
+
"__mf/js/async/208.55931f88.js"
|
|
155
155
|
]
|
|
156
156
|
},
|
|
157
157
|
"css": {
|
|
@@ -340,18 +340,18 @@
|
|
|
340
340
|
"assets": {
|
|
341
341
|
"js": {
|
|
342
342
|
"sync": [
|
|
343
|
-
"__mf/js/async/__federation_expose_LokiDatasource.
|
|
343
|
+
"__mf/js/async/__federation_expose_LokiDatasource.5e30f7dd.js"
|
|
344
344
|
],
|
|
345
345
|
"async": [
|
|
346
346
|
"__mf/js/async/1825.5005b3af.js",
|
|
347
347
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
348
348
|
"__mf/js/async/8988.1c565f12.js",
|
|
349
349
|
"__mf/js/async/9389.29616aa6.js",
|
|
350
|
-
"__mf/js/async/1750.
|
|
351
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
350
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
351
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.aa1ffedf.js",
|
|
352
352
|
"__mf/js/async/4466.21ddc88c.js",
|
|
353
353
|
"__mf/js/async/6100.e2898f9c.js",
|
|
354
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
354
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.c30e299e.js",
|
|
355
355
|
"__mf/js/async/9249.d90da2ad.js",
|
|
356
356
|
"__mf/js/async/9836.de786d07.js",
|
|
357
357
|
"__mf/js/async/6710.a94fd362.js",
|
|
@@ -385,8 +385,8 @@
|
|
|
385
385
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
386
386
|
"__mf/js/async/8988.1c565f12.js",
|
|
387
387
|
"__mf/js/async/9389.29616aa6.js",
|
|
388
|
-
"__mf/js/async/1750.
|
|
389
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
388
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
389
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.aa1ffedf.js"
|
|
390
390
|
],
|
|
391
391
|
"async": [
|
|
392
392
|
"__mf/js/async/9588.2d82f477.js",
|
|
@@ -401,8 +401,8 @@
|
|
|
401
401
|
"__mf/js/async/6100.e2898f9c.js",
|
|
402
402
|
"__mf/js/async/8988.1c565f12.js",
|
|
403
403
|
"__mf/js/async/9389.29616aa6.js",
|
|
404
|
-
"__mf/js/async/1750.
|
|
405
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
404
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
405
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.c30e299e.js",
|
|
406
406
|
"__mf/js/async/3059.cb101ca2.js",
|
|
407
407
|
"__mf/js/async/9877.b76d1711.js",
|
|
408
408
|
"__mf/js/async/2043.eb7e1c61.js",
|
|
@@ -432,8 +432,8 @@
|
|
|
432
432
|
"__mf/js/async/6100.e2898f9c.js",
|
|
433
433
|
"__mf/js/async/8988.1c565f12.js",
|
|
434
434
|
"__mf/js/async/9389.29616aa6.js",
|
|
435
|
-
"__mf/js/async/1750.
|
|
436
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
435
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
436
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.c30e299e.js"
|
|
437
437
|
],
|
|
438
438
|
"async": [
|
|
439
439
|
"__mf/js/async/9249.d90da2ad.js",
|
|
@@ -445,8 +445,8 @@
|
|
|
445
445
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
446
446
|
"__mf/js/async/8988.1c565f12.js",
|
|
447
447
|
"__mf/js/async/9389.29616aa6.js",
|
|
448
|
-
"__mf/js/async/1750.
|
|
449
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
448
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
449
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.aa1ffedf.js",
|
|
450
450
|
"__mf/js/async/9877.b76d1711.js",
|
|
451
451
|
"__mf/js/async/9588.2d82f477.js",
|
|
452
452
|
"__mf/js/async/5071.a03a64fd.js",
|
package/mf-stats.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "Loki",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.5.
|
|
8
|
+
"buildVersion": "0.5.1",
|
|
9
9
|
"buildName": "@perses-dev/loki-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/Loki.
|
|
12
|
+
"name": "__mf/js/Loki.ca74c810.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -95,17 +95,17 @@
|
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
"singleton": true,
|
|
98
|
-
"requiredVersion": "^0.53.
|
|
98
|
+
"requiredVersion": "^0.53.1",
|
|
99
99
|
"shareScope": "default",
|
|
100
100
|
"name": "@perses-dev/components",
|
|
101
|
-
"version": "0.53.
|
|
101
|
+
"version": "0.53.1",
|
|
102
102
|
"eager": false,
|
|
103
103
|
"id": "Loki:@perses-dev/components",
|
|
104
104
|
"assets": {
|
|
105
105
|
"js": {
|
|
106
106
|
"async": [],
|
|
107
107
|
"sync": [
|
|
108
|
-
"__mf/js/async/
|
|
108
|
+
"__mf/js/async/9811.422fb6ad.js"
|
|
109
109
|
]
|
|
110
110
|
},
|
|
111
111
|
"css": {
|
|
@@ -117,17 +117,17 @@
|
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
"singleton": true,
|
|
120
|
-
"requiredVersion": "^0.53.
|
|
120
|
+
"requiredVersion": "^0.53.1",
|
|
121
121
|
"shareScope": "default",
|
|
122
122
|
"name": "@perses-dev/dashboards",
|
|
123
|
-
"version": "0.53.
|
|
123
|
+
"version": "0.53.1",
|
|
124
124
|
"eager": false,
|
|
125
125
|
"id": "Loki:@perses-dev/dashboards",
|
|
126
126
|
"assets": {
|
|
127
127
|
"js": {
|
|
128
128
|
"async": [],
|
|
129
129
|
"sync": [
|
|
130
|
-
"__mf/js/async/54.
|
|
130
|
+
"__mf/js/async/54.f8265ee0.js"
|
|
131
131
|
]
|
|
132
132
|
},
|
|
133
133
|
"css": {
|
|
@@ -139,17 +139,17 @@
|
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
141
|
"singleton": true,
|
|
142
|
-
"requiredVersion": "^0.53.
|
|
142
|
+
"requiredVersion": "^0.53.1",
|
|
143
143
|
"shareScope": "default",
|
|
144
144
|
"name": "@perses-dev/explore",
|
|
145
|
-
"version": "0.53.
|
|
145
|
+
"version": "0.53.1",
|
|
146
146
|
"eager": false,
|
|
147
147
|
"id": "Loki:@perses-dev/explore",
|
|
148
148
|
"assets": {
|
|
149
149
|
"js": {
|
|
150
150
|
"async": [],
|
|
151
151
|
"sync": [
|
|
152
|
-
"__mf/js/async/1728.
|
|
152
|
+
"__mf/js/async/1728.c6a9c8d6.js"
|
|
153
153
|
]
|
|
154
154
|
},
|
|
155
155
|
"css": {
|
|
@@ -161,17 +161,17 @@
|
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
"singleton": true,
|
|
164
|
-
"requiredVersion": "^0.53.
|
|
164
|
+
"requiredVersion": "^0.53.1",
|
|
165
165
|
"shareScope": "default",
|
|
166
166
|
"name": "@perses-dev/plugin-system",
|
|
167
|
-
"version": "0.53.
|
|
167
|
+
"version": "0.53.1",
|
|
168
168
|
"eager": false,
|
|
169
169
|
"id": "Loki:@perses-dev/plugin-system",
|
|
170
170
|
"assets": {
|
|
171
171
|
"js": {
|
|
172
172
|
"async": [],
|
|
173
173
|
"sync": [
|
|
174
|
-
"__mf/js/async/
|
|
174
|
+
"__mf/js/async/208.55931f88.js"
|
|
175
175
|
]
|
|
176
176
|
},
|
|
177
177
|
"css": {
|
|
@@ -391,18 +391,18 @@
|
|
|
391
391
|
"assets": {
|
|
392
392
|
"js": {
|
|
393
393
|
"sync": [
|
|
394
|
-
"__mf/js/async/__federation_expose_LokiDatasource.
|
|
394
|
+
"__mf/js/async/__federation_expose_LokiDatasource.5e30f7dd.js"
|
|
395
395
|
],
|
|
396
396
|
"async": [
|
|
397
397
|
"__mf/js/async/1825.5005b3af.js",
|
|
398
398
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
399
399
|
"__mf/js/async/8988.1c565f12.js",
|
|
400
400
|
"__mf/js/async/9389.29616aa6.js",
|
|
401
|
-
"__mf/js/async/1750.
|
|
402
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
401
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
402
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.aa1ffedf.js",
|
|
403
403
|
"__mf/js/async/4466.21ddc88c.js",
|
|
404
404
|
"__mf/js/async/6100.e2898f9c.js",
|
|
405
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
405
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.c30e299e.js",
|
|
406
406
|
"__mf/js/async/9249.d90da2ad.js",
|
|
407
407
|
"__mf/js/async/9836.de786d07.js",
|
|
408
408
|
"__mf/js/async/6710.a94fd362.js",
|
|
@@ -438,8 +438,8 @@
|
|
|
438
438
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
439
439
|
"__mf/js/async/8988.1c565f12.js",
|
|
440
440
|
"__mf/js/async/9389.29616aa6.js",
|
|
441
|
-
"__mf/js/async/1750.
|
|
442
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
441
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
442
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.aa1ffedf.js"
|
|
443
443
|
],
|
|
444
444
|
"async": [
|
|
445
445
|
"__mf/js/async/9588.2d82f477.js",
|
|
@@ -454,8 +454,8 @@
|
|
|
454
454
|
"__mf/js/async/6100.e2898f9c.js",
|
|
455
455
|
"__mf/js/async/8988.1c565f12.js",
|
|
456
456
|
"__mf/js/async/9389.29616aa6.js",
|
|
457
|
-
"__mf/js/async/1750.
|
|
458
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
457
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
458
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.c30e299e.js",
|
|
459
459
|
"__mf/js/async/3059.cb101ca2.js",
|
|
460
460
|
"__mf/js/async/9877.b76d1711.js",
|
|
461
461
|
"__mf/js/async/2043.eb7e1c61.js",
|
|
@@ -487,8 +487,8 @@
|
|
|
487
487
|
"__mf/js/async/6100.e2898f9c.js",
|
|
488
488
|
"__mf/js/async/8988.1c565f12.js",
|
|
489
489
|
"__mf/js/async/9389.29616aa6.js",
|
|
490
|
-
"__mf/js/async/1750.
|
|
491
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
490
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
491
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.c30e299e.js"
|
|
492
492
|
],
|
|
493
493
|
"async": [
|
|
494
494
|
"__mf/js/async/9249.d90da2ad.js",
|
|
@@ -500,8 +500,8 @@
|
|
|
500
500
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
501
501
|
"__mf/js/async/8988.1c565f12.js",
|
|
502
502
|
"__mf/js/async/9389.29616aa6.js",
|
|
503
|
-
"__mf/js/async/1750.
|
|
504
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
503
|
+
"__mf/js/async/1750.a7bd1384.js",
|
|
504
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.aa1ffedf.js",
|
|
505
505
|
"__mf/js/async/9877.b76d1711.js",
|
|
506
506
|
"__mf/js/async/9588.2d82f477.js",
|
|
507
507
|
"__mf/js/async/5071.a03a64fd.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/loki-plugin",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "rsbuild dev",
|
|
6
6
|
"build": "npm run build-mf && concurrently \"npm:build:*\"",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"@emotion/react": "^11.7.1",
|
|
23
23
|
"@emotion/styled": "^11.6.0",
|
|
24
24
|
"@hookform/resolvers": "^3.2.0",
|
|
25
|
-
"@perses-dev/components": "^0.53.
|
|
26
|
-
"@perses-dev/core": "^0.53.0
|
|
27
|
-
"@perses-dev/dashboards": "^0.53.
|
|
28
|
-
"@perses-dev/explore": "^0.53.
|
|
29
|
-
"@perses-dev/plugin-system": "^0.53.
|
|
25
|
+
"@perses-dev/components": "^0.53.1",
|
|
26
|
+
"@perses-dev/core": "^0.53.0",
|
|
27
|
+
"@perses-dev/dashboards": "^0.53.1",
|
|
28
|
+
"@perses-dev/explore": "^0.53.1",
|
|
29
|
+
"@perses-dev/plugin-system": "^0.53.1",
|
|
30
30
|
"@tanstack/react-query": "^4.39.1",
|
|
31
31
|
"date-fns": "^4.1.0",
|
|
32
32
|
"date-fns-tz": "^3.2.0",
|