Skip to content

Commit

Permalink
[Search] introduce config feature flag for ai playground (#176755)
Browse files Browse the repository at this point in the history
## Summary

Introduce a config flag to hide development of the AI Playground page
while in development.

Usage of this flag will be added in a different PR.
  • Loading branch information
TattdCodeMonkey authored Feb 13, 2024
1 parent dac9302 commit 789fe56
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const DEFAULT_INITIAL_APP_DATA = {
hasIncrementalSyncEnabled: true,
hasNativeConnectors: true,
hasWebCrawler: true,
showAIPlayground: false,
},
appSearch: {
accountId: 'some-id-string',
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/enterprise_search/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export const DEFAULT_PRODUCT_FEATURES: ProductFeatures = {
hasIncrementalSyncEnabled: true,
hasNativeConnectors: true,
hasWebCrawler: true,
showAIPlayground: false,
};

export const CONNECTORS_ACCESS_CONTROL_INDEX_PREFIX = '.search-acl-filter-';
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/enterprise_search/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export interface ProductFeatures {
hasIncrementalSyncEnabled: boolean;
hasNativeConnectors: boolean;
hasWebCrawler: boolean;
// Temp Feature Flag for AI Playground page
showAIPlayground: boolean;
}

export interface SearchOAuth {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const mockKibanaProps: KibanaLogicProps = {
hasIncrementalSyncEnabled: true,
hasNativeConnectors: true,
hasWebCrawler: true,
showAIPlayground: false,
},
renderHeaderActions: jest.fn(),
security: securityMock.createStart(),
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/enterprise_search/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export const configSchema = schema.object({
ui: schema.object({
enabled: schema.boolean({ defaultValue: true }),
}),
// Temp Feature Flag for AI Playground page
showAIPlayground: schema.boolean({ defaultValue: false }),
});

export type ConfigType = TypeOf<typeof configSchema>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ describe('callEnterpriseSearchConfigAPI', () => {
hasDefaultIngestPipeline: false,
hasNativeConnectors: false,
hasWebCrawler: false,
showAIPlayground: false,
host: '',
};

Expand All @@ -224,6 +225,7 @@ describe('callEnterpriseSearchConfigAPI', () => {
hasDefaultIngestPipeline: false,
hasNativeConnectors: false,
hasWebCrawler: false,
showAIPlayground: false,
},
kibanaVersion: '1.0.0',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const callEnterpriseSearchConfigAPI = async ({
hasIncrementalSyncEnabled: config.hasIncrementalSyncEnabled,
hasNativeConnectors: config.hasNativeConnectors,
hasWebCrawler: config.hasWebCrawler,
showAIPlayground: config.showAIPlayground,
},
kibanaVersion: kibanaPackageJson.version,
};
Expand Down Expand Up @@ -111,6 +112,7 @@ export const callEnterpriseSearchConfigAPI = async ({
hasIncrementalSyncEnabled: config.hasIncrementalSyncEnabled,
hasNativeConnectors: config.hasNativeConnectors,
hasWebCrawler: config.hasWebCrawler,
showAIPlayground: config.showAIPlayground,
},
publicUrl: stripTrailingSlash(data?.settings?.external_url),
readOnlyMode: !!data?.settings?.read_only_mode,
Expand Down

0 comments on commit 789fe56

Please sign in to comment.