@fc-components/monaco-editor 0.1.14 → 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.
@@ -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
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.14",
6
+ "version": "0.1.16",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/monaco-editor.esm.js",
@@ -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
- 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
- }
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
  }
@@ -121,6 +121,8 @@ export default function YamlEditor(props: YamlEditorProps) {
121
121
  colors: {
122
122
  'editor.background': '#00000000',
123
123
  focusBorder: '#00000000',
124
+ 'editor.lineHighlightBackground': '#00000000',
125
+ 'editor.lineHighlightBorder': '#00000000',
124
126
  },
125
127
  });
126
128
 
@@ -139,6 +141,8 @@ export default function YamlEditor(props: YamlEditorProps) {
139
141
  colors: {
140
142
  'editor.background': '#00000000',
141
143
  focusBorder: '#00000000',
144
+ 'editor.lineHighlightBackground': '#00000000',
145
+ 'editor.lineHighlightBorder': '#00000000',
142
146
  },
143
147
  });
144
148
 
@@ -352,7 +356,9 @@ export default function YamlEditor(props: YamlEditorProps) {
352
356
  top: SIZE_MAP[size].top,
353
357
  bottom: SIZE_MAP[size].bottom,
354
358
  },
355
- renderLineHighlight: 'line',
359
+ renderLineHighlight: 'none',
360
+ renderLineHighlightOnlyWhenFocus: false,
361
+ hideCursorInOverviewRuler: true,
356
362
  scrollbar: {
357
363
  vertical: 'auto',
358
364
  verticalScrollbarSize: 8,