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

disable rename conversation api using feature flag #400

Closed

Conversation

kamahuan
Copy link
Contributor

Description

Disable the rename conversation api using feature flag. Upon checking with Binlong and Arjun, disable the api from the frontend is sufficient.

Issues Resolved

NONE

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test.
  • New functionality has user manual doc added.
  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -50,6 +52,13 @@ export const EditConversationNameModal = ({
}
onClose?.('updated', title);
}, [onClose, conversationId, patchConversation, toasts.addSuccess, toasts.addDanger, isAborted]);
console.log('Rename conversation enabled:', configSchema.chat.allowRenameConversation);
Copy link
Member

Choose a reason for hiding this comment

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

Let's cleanup console.log :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@@ -11,6 +11,7 @@ export const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: false }),
trace: schema.boolean({ defaultValue: true }),
feedback: schema.boolean({ defaultValue: true }),
allowRenameConversation: schema.boolean({ defaultValue: true }),
Copy link
Member

Choose a reason for hiding this comment

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

What about name it as coversationManagement? This flag will be used to control conversation edit and delete, am I right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This flag and PR is only about disabling the rename conversation feature. Will submit another PR about disabling delete conversation api.

Copy link
Member

Choose a reason for hiding this comment

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

I see, that also works :)

color="text"
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
Copy link
Member

Choose a reason for hiding this comment

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

we also need to hide the delete button.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will submit a separate PR about deleting the conversation api.

Comment on lines +59 to +60
onClose?.('cancelled');
return null;
Copy link
Member

Choose a reason for hiding this comment

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

Q: curious why adding this? My understanding is there will be no place to trigger this modal as we hide the edit button from the dropdown menu. Perhaps not necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. we can remove this feature flag check and test since the edit button is already hidden when the feature is disabled. Having the check in both places is redundant. I'll update the PR to simplify this.

Comment on lines +16 to +31
jest.spyOn(services, 'getConfigSchema').mockReturnValue({
enabled: true,
chat: {
enabled: true,
allowRenameConversation: true,
trace: true,
feedback: true,
},
incontextInsight: { enabled: true },
next: { enabled: false },
text2viz: { enabled: false },
alertInsight: { enabled: false },
smartAnomalyDetector: { enabled: false },
branding: { label: undefined, logo: undefined },
});

Copy link
Member

@ruanyl ruanyl Jan 22, 2025

Choose a reason for hiding this comment

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

I see this piece of code is repeating in many test files, what about to have this mock in test/setup.jest.ts? This will make the mock work for every tests, and we only need to do manual mock at where we need to test the change the default value.

// test/setup.jest.ts

const DEFAULT_CONFIG = Object.freeze({
  enabled: true,
  chat: {
    enabled: true,
    allowRenameConversation: true,
    trace: true,
    feedback: true,
  },
  incontextInsight: { enabled: true },
  next: { enabled: false },
  text2viz: { enabled: false },
  alertInsight: { enabled: false },
  smartAnomalyDetector: { enabled: false },
  branding: { label: undefined, logo: undefined },
});
jest.spyOn(services, 'getConfigSchema').mockReturnValue(DEFAULT_CONFIG);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes will use a separate file to put this config

@ruanyl ruanyl added the v2.19.0 label Jan 22, 2025
@ruanyl
Copy link
Member

ruanyl commented Jan 22, 2025

@kamahuan would you mind to change the target branch to main and add an entry in CHANGELOG.md? That will make the backport a bit easier :)

@kamahuan kamahuan closed this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants