@fc-components/monaco-editor 0.1.15 → 0.1.16
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/dist/monaco-editor.cjs.development.js +15 -17
- package/dist/monaco-editor.cjs.development.js.map +1 -1
- package/dist/monaco-editor.cjs.production.min.js +1 -1
- package/dist/monaco-editor.cjs.production.min.js.map +1 -1
- package/dist/monaco-editor.esm.js +15 -17
- package/dist/monaco-editor.esm.js.map +1 -1
- package/dist/promql/completion/DataProvider.d.ts +1 -1
- package/package.json +1 -1
- package/src/promql/completion/DataProvider.ts +2 -1
- package/src/promql/completion/completions.ts +17 -17
|
@@ -19,7 +19,7 @@ export declare class DataProvider {
|
|
|
19
19
|
setVariablesNames(variablesNames: string[]): void;
|
|
20
20
|
private buildRequest;
|
|
21
21
|
private request;
|
|
22
|
-
fetchSeries: (selector: string, withLimit?: string | undefined) => Promise<Record<string, string>[]>;
|
|
22
|
+
fetchSeries: (selector: string, withLimit?: string | undefined) => Promise<Record<string, string | undefined>[]>;
|
|
23
23
|
fetchLabels: (selector: string) => Promise<string[]>;
|
|
24
24
|
fetchLabelValues: (labelName: string, selector: string) => Promise<string[]>;
|
|
25
25
|
getAllMetricNames(): string[];
|
package/package.json
CHANGED
|
@@ -112,7 +112,7 @@ export class DataProvider {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
fetchSeries = async (selector: string, withLimit?: string): Promise<Record<string, string>[]> => {
|
|
115
|
+
fetchSeries = async (selector: string, withLimit?: string): Promise<Record<string, string | undefined>[]> => {
|
|
116
116
|
const end = new Date();
|
|
117
117
|
const start = new Date(end.getTime() - this.lookbackInterval);
|
|
118
118
|
const url = `${this.apiPrefix}/series`;
|
|
@@ -174,6 +174,7 @@ export class DataProvider {
|
|
|
174
174
|
if (selector) {
|
|
175
175
|
urlParams['match[]'] = selector;
|
|
176
176
|
}
|
|
177
|
+
|
|
177
178
|
const request = this.buildRequest(url, new URLSearchParams(urlParams));
|
|
178
179
|
|
|
179
180
|
return await this.request<string[]>(request.uri, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import UFuzzy from '@leeoniya/ufuzzy';
|
|
1
|
+
// import UFuzzy from '@leeoniya/ufuzzy';
|
|
2
2
|
|
|
3
3
|
import { FUNCTIONS } from '../promql';
|
|
4
4
|
import { makeSelector, NeverCaseError } from '../util';
|
|
@@ -17,26 +17,26 @@ type Completion = {
|
|
|
17
17
|
triggerOnInsert?: boolean;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const metricNamesSearchClient = new UFuzzy({ intraMode: 1 });
|
|
20
|
+
// const metricNamesSearchClient = new UFuzzy({ intraMode: 1 });
|
|
21
21
|
|
|
22
22
|
// we order items like: history, functions, metrics
|
|
23
23
|
function getAllMetricNamesCompletions(dataProvider: DataProvider): Completion[] {
|
|
24
24
|
let metricNames = dataProvider.getAllMetricNames();
|
|
25
25
|
|
|
26
|
-
if (metricNames.length > dataProvider.metricNamesSuggestionLimit) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
26
|
+
// if (metricNames.length > dataProvider.metricNamesSuggestionLimit) {
|
|
27
|
+
// const { monacoSettings } = dataProvider;
|
|
28
|
+
// monacoSettings.enableAutocompleteSuggestionsUpdate();
|
|
29
|
+
|
|
30
|
+
// if (monacoSettings.inputInRange) {
|
|
31
|
+
// metricNames =
|
|
32
|
+
// metricNamesSearchClient
|
|
33
|
+
// .filter(metricNames, monacoSettings.inputInRange)
|
|
34
|
+
// ?.slice(0, dataProvider.metricNamesSuggestionLimit)
|
|
35
|
+
// .map((idx) => metricNames[idx]) ?? [];
|
|
36
|
+
// } else {
|
|
37
|
+
// metricNames = metricNames.slice(0, dataProvider.metricNamesSuggestionLimit);
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
40
40
|
|
|
41
41
|
return dataProvider.metricNamesToMetrics(metricNames).map((metric) => ({
|
|
42
42
|
type: 'METRIC_NAME',
|
|
@@ -143,7 +143,7 @@ async function getLabelValues(metric: string | undefined, labelName: string, oth
|
|
|
143
143
|
if (key === '__name__') {
|
|
144
144
|
continue;
|
|
145
145
|
}
|
|
146
|
-
if (key === labelName) {
|
|
146
|
+
if (key === labelName && value) {
|
|
147
147
|
labelValues.add(value);
|
|
148
148
|
}
|
|
149
149
|
}
|