Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Oct 15, 2023
1 parent 28331ce commit 8edc926
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 39 deletions.
2 changes: 2 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"zod": "^3.19.0",
"yaml": "^2.0.1",
"flexsearch": "0.7.21",
"@ungap/structured-clone": "^1.2.0",
"minio": "^7.1.1",
"axios": "^0.26.0",
"buffer": "^6.0.3",
Expand Down Expand Up @@ -93,6 +94,7 @@
"@types/react-router-dom": "^5.1.5",
"@types/shell-quote": "^1.7.0",
"@types/flexsearch": "^0.7.3",
"@types/ungap__structured-clone": "0.3.0",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"circular-dependency-plugin": "^5.2.2",
Expand Down
2 changes: 1 addition & 1 deletion web/src/core/adapters/onyxiaApiMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const onyxiaApi: OnyxiaApi = {
}),
{ "promise": true }
),
...createPropertyThatThrowIfAccessed("getCatalogs", "Not mocked"),
...createPropertyThatThrowIfAccessed("getCatalogsAndCharts", "Not mocked"),
...createPropertyThatThrowIfAccessed("getPackageConfig", "Not mocked"),
...createPropertyThatThrowIfAccessed("launchPackage", "Not mocked"),
...createPropertyThatThrowIfAccessed("getRunningServices", "Not mocked"),
Expand Down
23 changes: 14 additions & 9 deletions web/src/core/usecases/launcher/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,19 +581,24 @@ export const thunks = {
})();

const { catalogLocation, icon } = await (async () => {
const catalog = await onyxiaApi.getCatalogs().then(apiRequestResult =>
//TODO: Sort in the adapter of even better, assumes version sorted
//and validate this assertion with zod
apiRequestResult.find(({ id }) => id === catalogId)
);
const catalog = await onyxiaApi
.getCatalogsAndCharts()
.then(({ catalogs }) =>
//TODO: Sort in the adapter of even better, assumes version sorted
//and validate this assertion with zod
catalogs.find(({ id }) => id === catalogId)
);

assert(catalog !== undefined);

return {
"catalogLocation": catalog.location,
const charts = await onyxiaApi
.getCatalogsAndCharts()
.then(({ chartsByCatalogId }) => chartsByCatalogId[catalog.id]);

"icon": catalog.charts.find(({ name }) => name === packageName)!
.versions[0].icon
return {
"catalogLocation": catalog.repositoryUrl,
"icon": charts.find(({ name }) => name === packageName)!.versions[0]
.icon
};
})();

Expand Down
6 changes: 3 additions & 3 deletions web/src/core/usecases/restorablePackageConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ export const thunks = {

dispatch(actions.fetchIconStarted());

const apiRequestForIconsResult = await onyxiaApi.getCatalogs();
const apiRequestForIconsResult = await onyxiaApi.getCatalogsAndCharts();

const iconsUrl: IconsUrl = {};

apiRequestForIconsResult.forEach(({ id: catalogId, charts }) => {
apiRequestForIconsResult.catalogs.forEach(({ id: catalogId }) => {
const urlByPackageName: IconsUrl[string] = {};

charts.forEach(chart => {
apiRequestForIconsResult.chartsByCatalogId[catalogId].forEach(chart => {
for (const { icon } of chart.versions) {
if (icon === undefined) {
continue;
Expand Down
7 changes: 4 additions & 3 deletions web/src/core/usecases/serviceManager/thunks/thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ export const thunks = {

//NOTE: We do not have the catalog id so we search in every catalog.
const { getLogoUrl } = await (async () => {
const apiRequestResult = await onyxiaApi.getCatalogs();
const apiRequestResult = await onyxiaApi.getCatalogsAndCharts();

function getLogoUrl(params: { packageName: string }): string | undefined {
const { packageName } = params;

for (const { charts } of apiRequestResult) {
for (const { name, versions } of charts) {
for (const { id: catalogId } of apiRequestResult.catalogs) {
for (const { name, versions } of apiRequestResult
.chartsByCatalogId[catalogId]) {
if (name !== packageName) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions web/src/ui/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function ContextualizedApp() {
"catalog": {
"iconId": "catalog",
"label": t("catalog"),
"link": routes.catalogExplorer().link
"link": routes.catalog().link
},
"myServices": {
"iconId": "services",
Expand Down Expand Up @@ -250,9 +250,9 @@ function ContextualizedApp() {
return "home" as const;
case "account":
return "account";
case "catalogExplorer":
case "catalog":
return "catalog";
case "catalogLauncher":
case "launcher":
return "catalog";
case "myServices":
return "myServices";
Expand Down Expand Up @@ -627,7 +627,7 @@ function useRegionSelectProps() {
}

switch (route.name) {
case "catalogLauncher":
case "launcher":
break;
case "myFiles":
break;
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/de.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ Fühlen Sie sich frei, Ihre Kubernetes-Bereitstellungen zu erkunden und die Kont
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "Nicht gespeicherte Änderungen",
"no longer bookmarked dialog body":
"Klicken Sie erneut auf das Lesezeichensymbol, um Ihre gespeicherte Konfiguration zu aktualisieren."
"Klicken Sie erneut auf das Lesezeichensymbol, um Ihre gespeicherte Konfiguration zu aktualisieren.",
"ok": "Ok"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "Möchten Sie es ersetzen?",
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/en.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,8 @@ Feel free to explore and take charge of your Kubernetes deployments!
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "Your changes wont be saved",
"no longer bookmarked dialog body":
"Click on the bookmark icon again to update your saved configuration"
"Click on the bookmark icon again to update your saved configuration",
"ok": "Ok"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "Would you like to replace it?",
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/fi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ Tutustu vapaasti ja ota hallintaan Kubernetes-julkaisusi!
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "Muutokset eivät tallennu",
"no longer bookmarked dialog body":
"Päivitä tallennettu konfiguraatio napsauttamalla kirjanmerkkikuvaketta uudelleen."
"Päivitä tallennettu konfiguraatio napsauttamalla kirjanmerkkikuvaketta uudelleen.",
"ok": "Ok"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "Haluatko korvata sen?",
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/fr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ N'hésitez pas à explorer et à prendre en main vos déploiements Kubernetes !
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "Changements non enregistrés",
"no longer bookmarked dialog body":
"Cliquer une nouvelle fois sur le symbole marque-page pour mettre à jour votre configuration enregistrée."
"Cliquer une nouvelle fois sur le symbole marque-page pour mettre à jour votre configuration enregistrée.",
"ok": "Ok"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "Souhaitez-vous le remplacer ?",
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/it.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ Sentiti libero di esplorare e prendere il controllo dei tuoi deployment Kubernet
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "Modifiche non salvate",
"no longer bookmarked dialog body":
"Clicca nuovamente sull'icona del segnalibro per aggiornare la configurazione salvata."
"Clicca nuovamente sull'icona del segnalibro per aggiornare la configurazione salvata.",
"ok": "Ok"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "Vuoi sostituirlo?",
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/nl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ Voel je vrij om te verkennen en de controle over je Kubernetes-implementaties te
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "Niet opgeslagen wijzigingen",
"no longer bookmarked dialog body":
"Klik opnieuw op het symbool van de bladwijzer om de opgeslagen configuratie bij te werken."
"Klik opnieuw op het symbool van de bladwijzer om de opgeslagen configuratie bij te werken.",
"ok": "Ok"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "Wilt u het vervangen ?",
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/no.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ Føl deg fri til å utforske og ta kontroll over dine Kubernetes-implementeringe
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "Endringene dine vil ikke bli lagret",
"no longer bookmarked dialog body":
"Klikk på bokmerkeikonet igjen for å oppdatere den lagrede konfigurasjonen din"
"Klikk på bokmerkeikonet igjen for å oppdatere den lagrede konfigurasjonen din",
"ok": "Ok"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "Ønsker du å erstatte den?",
Expand Down
3 changes: 2 additions & 1 deletion web/src/ui/i18n/resources/zh-CN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ ${
},
"NoLongerBookmarkedDialog": {
"no longer bookmarked dialog title": "更改未保存",
"no longer bookmarked dialog body": "再次单击书签符号以更新您保存的配置."
"no longer bookmarked dialog body": "再次单击书签符号以更新您保存的配置.",
"ok": "是"
},
"OverwriteConfigurationConfirmDialog": {
"should overwrite configuration dialog title": "您想更换它吗?",
Expand Down
4 changes: 2 additions & 2 deletions web/src/ui/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function Home(props: Props) {

useConst(() => {
if (getIsHomePageDisabled()) {
routes.catalogExplorer().replace();
routes.catalog().replace();
}
});

Expand All @@ -42,7 +42,7 @@ export default function Home(props: Props) {
const { t } = useTranslation({ Home });

const myFilesLink = useMemo(() => routes.myFiles().link, []);
const catalogExplorerLink = useMemo(() => routes.catalogExplorer().link, []);
const catalogExplorerLink = useMemo(() => routes.catalog().link, []);

return (
<div className={cx(classes.root, className)}>
Expand Down
2 changes: 1 addition & 1 deletion web/src/ui/pages/launcher/Launcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export default function Launcher(props: Props) {
}, [restorablePackageConfigs, restorablePackageConfig]);

const onRequestCancel = useConstCallback(() =>
routes.catalogExplorer({ "catalogId": route.params.catalogId }).push()
routes.catalog({ "catalogId": route.params.catalogId }).push()
);

const onRequestCopyLaunchUrl = useConstCallback(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ export const NoLongerBookmarkedDialog = memo((props: Props) => {
NoLongerBookmarkedDialog.displayName = symToStr({ NoLongerBookmarkedDialog });

export const { i18n } = declareComponentKeys<
"no longer bookmarked dialog title" | "no longer bookmarked dialog body"
"no longer bookmarked dialog title" | "no longer bookmarked dialog body" | "ok"
>()({ NoLongerBookmarkedDialog });
16 changes: 9 additions & 7 deletions web/src/ui/pages/myServices/MyServices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function MyServices(props: Props) {
const { className, route } = props;

const { t } = useTranslation({ MyServices });
const { t: tCatalogLauncher } = useTranslation("CatalogLauncher");
const { t: tCatalogLauncher } = useTranslation("Launcher");

/* prettier-ignore */
const { serviceManager, restorablePackageConfig, k8sCredentials, projectConfigs } = useCoreFunctions();
Expand All @@ -57,7 +57,7 @@ export default function MyServices(props: Props) {
const onButtonBarClick = useConstCallback((buttonId: ButtonId) => {
switch (buttonId) {
case "launch":
routes.catalogExplorer().push();
routes.catalog().push();
return;
case "refresh":
serviceManager.update();
Expand Down Expand Up @@ -118,8 +118,9 @@ export default function MyServices(props: Props) {
restorablePackageConfig.deleteRestorablePackageConfig({
"restorablePackageConfig": displayableConfigs.find(
({ restorablePackageConfig }) =>
routes.catalogLauncher({
...restorablePackageConfig,
routes.launcher({
"catalogId": restorablePackageConfig.catalogId,
"chartName": restorablePackageConfig.packageName,
"autoLaunch": true
}).href === launchLinkHref
)!.restorablePackageConfig
Expand All @@ -133,8 +134,9 @@ export default function MyServices(props: Props) {
displayableConfigs.map(
({ logoUrl, friendlyName, restorablePackageConfig }) => {
const buildLink = (autoLaunch: boolean) =>
routes.catalogLauncher({
...restorablePackageConfig,
routes.launcher({
"catalogId": restorablePackageConfig.catalogId,
"chartName": restorablePackageConfig.packageName,
autoLaunch
}).link;

Expand Down Expand Up @@ -219,7 +221,7 @@ export default function MyServices(props: Props) {
});
}, [route.params.autoLaunchServiceId, runningServices]);

const catalogExplorerLink = useMemo(() => routes.catalogExplorer().link, []);
const catalogExplorerLink = useMemo(() => routes.catalog().link, []);

const [serviceIdRequestedToBeDeleted, setServiceIdRequestedToBeDeleted] = useState<
string | undefined
Expand Down
10 changes: 10 additions & 0 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4152,6 +4152,11 @@
dependencies:
source-map "^0.6.1"

"@types/[email protected]":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@types/ungap__structured-clone/-/ungap__structured-clone-0.3.0.tgz#39ef89de1f04bb1920ed99e549b885331295c47d"
integrity sha512-eBWREUhVUGPze+bUW22AgUr05k8u+vETzuYdLYSvWqGTUe0KOf+zVnOB1qER5wMcw8V6D9Ar4DfJmVvD1yu0kQ==

"@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2", "@types/unist@^2.0.3":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
Expand Down Expand Up @@ -4307,6 +4312,11 @@
"@typescript-eslint/types" "5.59.0"
eslint-visitor-keys "^3.3.0"

"@ungap/structured-clone@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406"
integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==

"@webassemblyjs/[email protected]", "@webassemblyjs/ast@^1.11.5":
version "1.11.5"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.5.tgz#6e818036b94548c1fb53b754b5cae3c9b208281c"
Expand Down

0 comments on commit 8edc926

Please sign in to comment.