backstage-plugins
backstage-plugins copied to clipboard
[Feat]: Add Search Collator for Harness resources
🔖 Feature description
Add a search collator that is able to index all projects, pipelines, services, and other resources available in Harness.
🎤 Context
The search feature of Backstage can be extended with new search index items. Users frequently use the search in Harness to find pipelines or services etc. but struggle to find items if they don't exactly know where they are stored in Harness. It would be beneficial if the backstage search could find those items.
✌️ Possible Implementation
Search collators should be implemented in a backstage backend plugin. However, no backend plugin yet exists. It could be named harness-backend-common
plugins/harness-backend-common/src/search/HarnessCollatorFactory.ts
class HarnessCollatorFactory implements DocumentCollatorFactory {
async getCollator() {
return Readable.from(this.execute());
}
}
packages/backend/src/plugins/search.ts
import { HarnessCollatorFactory } from '@harnessio/backstage-plugin-backend-commong';
...
indexBuilder.addCollator({
schedule,
factory: HarnessCollatorFactory.fromConfig(env.config, {
logger: env.logger,
discovery: env.discovery
}),
});
packages/app/src/components/search/SearchPage.tsx
<Grid item xs={3}>
<SearchType.Accordion
name="Result Type"
defaultValue=""
types={[
{
value: 'harness',
name: 'Harness',
icon: <DocsIcon/>,
},
]}
/>
...
case 'harness':
return (
<HarnessResultListItem
key={document.location}
result={document}
highlight={highlight}
rank={rank}
/>
);
I'm happy to work on this, though don't know how to best add a new backend plugin to this repo.
Hi @stephanschielke thanks for your interest regarding the search collator enhancement, feel free to open a PR , you could take help of our contributing guide to understand more on the same.
This is amazing! Thanks for the suggestion. We can start with just a simple collator to have pipelines searchable.
@stephanschielke As per your question, I think let's use yarn backstage-cli create and choose a common package and start adding the collator piece in there. You can fork this repo and clone your fork locally to do this. Some bits are also described in the contributing guide @Debanitrkl has shared. :)