1
0
mirror of https://github.com/salexdv/bsl_console.git synced 2024-11-24 08:33:29 +02:00

Вывод таблиц и кубов для внешнего источника

This commit is contained in:
salexdv 2022-05-01 09:56:05 +03:00
parent 455c4b830c
commit 4a0da52043

View File

@ -1908,6 +1908,53 @@ class bslHelper {
}
/**
* Gets the list of tables and cubes owned by external data source
*
* @param {string} metadataName metadata item type
* @param {string} metadataItem metadata item name
* @param {string} metadataObject metadata item object
* @param {array} suggestions array of completion for object
*/
getExternalDataSourcesCompletion(metadataName, metadataItem, metadataObject, suggestions) {
if (bslMetadata.hasOwnProperty('externalDataSources') &&
bslMetadata.externalDataSources.hasOwnProperty('items') &&
bslMetadata.externalDataSources[this.nameField].toLowerCase() == metadataName) {
for (const [key, value] of Object.entries(bslMetadata.externalDataSources.items)) {
if (key.toLowerCase() == metadataItem) {
metadataObject = metadataObject.replace('.', '');
let item_node = null;
if (value.tables[this.nameField].toLowerCase() == metadataObject)
item_node = value.tables;
else if (value.cubes[this.nameField].toLowerCase() == metadataObject)
item_node = value.cubes;
if (item_node) {
for (const [ikey, ivalue] of Object.entries(item_node.items)) {
suggestions.push({
label: ikey,
kind: monaco.languages.CompletionItemKind.Unit,
insertText: ikey,
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
});
}
}
}
}
}
}
/**
* Gets the list of tabulars owned by object
* (Catalog, Document, etc) and fills the suggestions by it
@ -2395,6 +2442,9 @@ class bslHelper {
requestMetadata(metadataName);
}
else if (metadataFunc) {
this.getExternalDataSourcesCompletion(metadataName, metadataItem, metadataFunc, suggestions);
}
if (!metadataExists)
metadataExists = this.getMetadataItemCompletion(suggestions, data);