Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language with dataset service #70

Open
wants to merge 21 commits into
base: kavilla/dataset-manager
Choose a base branch
from

Conversation

kavilla
Copy link
Owner

@kavilla kavilla commented Aug 24, 2024

Description

Issues Resolved

Screenshot

Testing the changes

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Comment on lines 43 to 46
groupName: 'Index patterns',
children: indexPatterns,
isLeaf: false,
hasNext: false,
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Comment on lines 43 to 46
* Retrieves the supported query languages for this dataset type.
* @returns {Promise<string[]>} A promise that resolves to an array of supported language names.
*/
supportedLanguages: () => string[];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass the dataset here. ppl and sql arent supported in opensearch serverless yet

Comment on lines 31 to 60
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

Comment on lines 145 to 178
public initDataset = async () => {
await this.datasetService.init();
};

public registerType = (type: DatasetTypeConfig) => {
this.datasetService.registerType(type);
};

public getDatasetType = (type: string) => {
return this.datasetService.getType(type);
};

public getDatasetTypes = () => {
return this.datasetService.getTypes();
};

public getLanguage = (language: string) => {
return this.languageService.getLanguage(language);
};

private getDefaultLanguage() {
return (
this.storage.get('userQueryLanguage') ||
this.uiSettings.get(UI_SETTINGS.SEARCH_QUERY_LANGUAGE)
);
}

public getLanguages = () => {
return this.languageService.getLanguages();
};

public registerLanguage = (languageConfig: LanguageConfig) => {
this.languageService.registerLanguage(languageConfig);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just export the services. Don't re-export each function like this. Its easier. Only export functions here if you need to combine logic between the two services or something else

Comment on lines 165 to 170
const existingIndexPattern = await indexPatterns.get(dataFrame.name!, true);
const dataset = await indexPatterns.create(
dataFrameToSpec(dataFrame, existingIndexPattern?.id),
!existingIndexPattern?.id
);
indexPatterns.saveToCache(dataSetName, dataSet);
indexPatterns.saveToCache(dataset.id!, dataset);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we still need this?

};

const enhancement = this.props.settings.getQueryEnhancements(newQuery.language);
const fields = enhancement?.fields;
const fields = language?.fields;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const fields = language?.fields;
const fieldProps = language?.fields;

@@ -111,14 +108,17 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) {
return {
from:
props.dateRangeFrom ||
queryUiEnhancement?.dateRange?.initialFrom ||
queryLanguage?.searchBar?.dateRange?.initialFrom ||

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Do we need initialFrom and intiialTo? was this there in the legacy languages too?

Comment on lines +67 to +68
initialFrom: moment().subtract(2, 'days').toISOString(),
initialTo: moment().add(2, 'days').toISOString(),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

@@ -3,85 +3,105 @@
* SPDX-License-Identifier: Apache-2.0
*/

/*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 Licences

@@ -151,7 +145,7 @@ export const DatasetExplorer = ({
</div>
);
})}
{!!!path[path.length - 1]?.isLeaf && <LoadingEmptyColumn isLoading={loading} />}
{!!!path[path.length - 1]?.hasNext && <LoadingEmptyColumn isLoading={loading} />}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the boolean logic here needs to be flipped

kavilla added 17 commits August 25, 2024 07:32
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Signed-off-by: Kawika Avilla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants