Skip to content

Commit 352a645

Browse files
authored
Merge branch 'main' into ssaikia/RHIDP-14185-startTestBackend-spike
2 parents e1accd7 + 5551345 commit 352a645

245 files changed

Lines changed: 18189 additions & 7724 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

workspaces/adoption-insights/e2e-tests/utils/translations.ts

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,47 @@ import adoptionInsightsTranslationJa from '../../plugins/adoption-insights/src/t
2626

2727
export type InsightsMessages = typeof adoptionInsightsMessages;
2828

29-
function transform(messages: typeof adoptionInsightsTranslationDe.messages) {
30-
const result = Object.keys(messages).reduce((res, key) => {
29+
function transformFlatMessagesIntoTree(
30+
flatMessages: typeof adoptionInsightsTranslationDe.messages,
31+
) {
32+
const messages = {} as Record<string, any>;
33+
for (const key of Object.keys(flatMessages)) {
3134
const path = key.split('.');
32-
const lastIndex = path.length - 1;
33-
path.reduce((acc, currentPath, i) => {
34-
acc[currentPath] =
35-
lastIndex === i ? messages[key] : acc[currentPath] || {};
36-
return acc[currentPath];
37-
}, res);
38-
return res;
39-
}, {});
40-
41-
return result as InsightsMessages;
35+
let current = messages;
36+
for (let i = 0; i < path.length - 1; i++) {
37+
current[path[i]] = current[path[i]] || {};
38+
current = current[path[i]] as Record<string, any>;
39+
}
40+
current[path[path.length - 1]] =
41+
flatMessages[key as keyof typeof flatMessages];
42+
}
43+
return messages as InsightsMessages;
4244
}
4345

4446
export function getTranslations(locale: string) {
4547
switch (locale) {
4648
case 'en':
4749
return adoptionInsightsMessages;
4850
case 'de':
49-
return transform(adoptionInsightsTranslationDe.messages);
51+
return transformFlatMessagesIntoTree(
52+
adoptionInsightsTranslationDe.messages,
53+
);
5054
case 'es':
51-
return transform(adoptionInsightsTranslationEs.messages);
55+
return transformFlatMessagesIntoTree(
56+
adoptionInsightsTranslationEs.messages,
57+
);
5258
case 'fr':
53-
return transform(adoptionInsightsTranslationFr.messages);
59+
return transformFlatMessagesIntoTree(
60+
adoptionInsightsTranslationFr.messages,
61+
);
5462
case 'it':
55-
return transform(adoptionInsightsTranslationIt.messages);
63+
return transformFlatMessagesIntoTree(
64+
adoptionInsightsTranslationIt.messages,
65+
);
5666
case 'ja':
57-
return transform(adoptionInsightsTranslationJa.messages);
67+
return transformFlatMessagesIntoTree(
68+
adoptionInsightsTranslationJa.messages,
69+
);
5870
default:
5971
return adoptionInsightsMessages;
6072
}

workspaces/adoption-insights/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"lint": "backstage-cli repo lint --since origin/main",
3030
"lint:all": "backstage-cli repo lint",
3131
"prettier:check": "prettier --check .",
32+
"prettier:fix": "prettier --write .",
3233
"new": "backstage-cli new --scope @red-hat-developer-hub",
3334
"postinstall": "cd ../../ && yarn install"
3435
},
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions': minor
3+
---
4+
5+
Scaffold new AIResource catalog extension and add upstream module to workspace

workspaces/ai-integrations/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
},
4040
"devDependencies": {
4141
"@backstage/cli": "^0.36.3",
42+
"@backstage/cli-defaults": "^0.1.3",
4243
"@backstage/e2e-test-utils": "^0.1.2",
4344
"@backstage/repo-tools": "^0.17.3",
4445
"@changesets/cli": "^2.27.1",

workspaces/ai-integrations/packages/backend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.20",
3030
"@backstage/plugin-auth-node": "^0.7.2",
3131
"@backstage/plugin-catalog-backend": "^3.8.0",
32+
"@backstage/plugin-catalog-backend-module-ai-model": "^0.1.1",
3233
"@backstage/plugin-catalog-backend-module-logs": "^0.1.23",
3334
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.21",
3435
"@backstage/plugin-kubernetes-backend": "^0.21.5",
@@ -46,6 +47,7 @@
4647
"@backstage/plugin-search-backend-node": "^1.4.5",
4748
"@backstage/plugin-techdocs-backend": "^2.2.1",
4849
"@red-hat-developer-hub/backstage-plugin-ai-experience-backend": "workspace:^",
50+
"@red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions": "workspace:^",
4951
"@red-hat-developer-hub/backstage-plugin-catalog-backend-module-model-catalog": "workspace:^",
5052
"@red-hat-developer-hub/backstage-plugin-catalog-techdoc-url-reader-backend": "workspace:^",
5153
"app": "link:../app",

workspaces/ai-integrations/packages/backend/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,10 @@ backend.add(
7676
'@red-hat-developer-hub/backstage-plugin-catalog-techdoc-url-reader-backend'
7777
),
7878
);
79+
backend.add(import('@backstage/plugin-catalog-backend-module-ai-model'));
80+
backend.add(
81+
import(
82+
'@red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions'
83+
),
84+
);
7985
backend.start();
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright Red Hat, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# @red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions
2+
3+
The catalog-backend-module-ai-resource-extensions backend module for the catalog plugin.
4+
5+
_This plugin was created through the Backstage CLI_
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "@red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions",
3+
"version": "0.1.0",
4+
"license": "Apache-2.0",
5+
"description": "The catalog-backend-module-ai-resource-extensions backend module for the catalog plugin.",
6+
"main": "src/index.ts",
7+
"types": "src/index.ts",
8+
"publishConfig": {
9+
"access": "public",
10+
"main": "dist/index.cjs.js",
11+
"types": "dist/index.d.ts"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/redhat-developer/rhdh-plugins",
16+
"directory": "workspaces/ai-integrations/plugins/catalog-backend-module-catalog-backend-module-ai-resource-extensions"
17+
},
18+
"backstage": {
19+
"role": "backend-plugin-module",
20+
"pluginId": "catalog",
21+
"pluginPackage": "@backstage/plugin-catalog-backend"
22+
},
23+
"scripts": {
24+
"start": "backstage-cli package start",
25+
"build": "backstage-cli package build",
26+
"lint": "backstage-cli package lint",
27+
"test": "backstage-cli package test",
28+
"clean": "backstage-cli package clean",
29+
"prepack": "backstage-cli package prepack",
30+
"postpack": "backstage-cli package postpack"
31+
},
32+
"dependencies": {
33+
"@backstage/backend-plugin-api": "^1.9.2"
34+
},
35+
"devDependencies": {
36+
"@backstage/backend-test-utils": "^1.11.4",
37+
"@backstage/cli": "^0.36.3"
38+
},
39+
"files": [
40+
"dist"
41+
]
42+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## API Report File for "@red-hat-developer-hub/backstage-plugin-catalog-backend-module-catalog-backend-module-ai-resource-extensions"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
import { BackendFeature } from '@backstage/backend-plugin-api';
7+
8+
// @public
9+
const catalogModuleCatalogBackendModuleAiResourceExtensions: BackendFeature;
10+
export default catalogModuleCatalogBackendModuleAiResourceExtensions;
11+
12+
// (No @packageDocumentation comment for this package)
13+
```

0 commit comments

Comments
 (0)