Skip to content

Conversation

@HeleneAmouzou
Copy link
Contributor

@HeleneAmouzou HeleneAmouzou commented Nov 14, 2025

What does this PR do?

  • Adds Elasticsearch dashboard to index.html,
  • Declines cc-addon-header, cc-addon-info and cc-addon-credentials-beta for Elasticsearch product.

How to review?

  • Check the commits,
  • Check the code,
  • Play with demo-smart.

The .md documentation files has been coded by IA, even though I have checked and adjusted afterwards, please pay attention to it.

TO DO

  • Merge first

@HeleneAmouzou HeleneAmouzou self-assigned this Nov 14, 2025
@github-actions
Copy link
Contributor

🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/dashboard-addons/elastic/index.html.

This preview will be deleted once this PR is closed.

Copy link
Contributor

@florian-sanders-cc florian-sanders-cc left a comment

Choose a reason for hiding this comment

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

A few small fixes but overall great job for a tricky subject 🤯

Comment on lines 106 to 136
updateComponent(
'state',
/** @param {AddonCredentialsBetaStateLoaded|AddonCredentialsBetaStateLoading} state */
(state) => {
state.type = 'loaded';
// Build tabs object with only enabled services
/** @type {Record<string, {content: AddonCredential[], docLink: {text: string, href: string}}>} */
const updatedTabs = {
elastic: {
...state.tabs.elastic,
content: elastic,
},
};

if (enabledServices.kibana) {
updatedTabs.kibana = {
...state.tabs.kibana,
content: kibana,
};
}

if (enabledServices.apm) {
updatedTabs.apm = {
...state.tabs.apm,
content: apm,
};
}

state.tabs = updatedTabs;
},
);
Copy link
Contributor

Choose a reason for hiding this comment

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

praise + question: I really like the way you handled this tricky subjet, especially compared to the solution I initially implemented in the branch (with the Object.entries(Object.fromEntriers()) 💀).

I wonder if we really need the enabledServices stuff, if apm / Kibana is disabled, then kibana & apm will be null / undefined no? We could just check for that and remove the whole enabledServices object 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have remove enabledServices and it seems cleaner, thanks !

Comment on lines 174 to 214
if (tabType === 'elastic') {
return [
{
code: 'host',
value: addonProvider.config.host,
},
{
code: 'user',
value: addonProvider.config.user,
},
{
code: 'password',
value: addonProvider.config.password,
},
];
} else if (tabType === 'kibana') {
return [
{
code: 'user',
value: addonProvider.config.kibana_user,
},
{
code: 'password',
value: addonProvider.config.kibana_password,
},
];
}
return [
{
code: 'user',
value: addonProvider.config.apm_user,
},
{
code: 'password',
value: addonProvider.config.apm_password,
},
{
code: 'token',
value: addonProvider.config.apm_auth_token,
},
];
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: try using a switch instead but I don't know if it's actually better or not, I feel like it could improve readability but I'm not sure.

I'm also unsure if this layer should know about the shape expected by the UI component (code + value) but I'm fine with it and I don't have a better idea so I would stick with that unless we get suggestions 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed it to use a switch, it does improve readability, thanks !

Comment on lines 91 to 92
// Remove encryption since it's not part of the addon features
// TODO: reinstate encryption
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: I remember we discussed this subject but is it still relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot to deleted the comments after adding encryption

@HeleneAmouzou HeleneAmouzou force-pushed the dashboard-addons/elastic branch from 7101f3c to 46371ab Compare November 19, 2025 15:14
Copy link
Member

@roberttran-cc roberttran-cc left a comment

Choose a reason for hiding this comment

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

Great work, the code is clean, making the review really manageable.

Only a couple minor feedback for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants