-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added logic for displaying the tile correctly
Signed-off-by: Olga Lavtar <[email protected]>
- Loading branch information
Showing
10 changed files
with
128 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
frontend/src/pages/exploreApplication/useIntegratedAppStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as React from 'react'; | ||
import { IntegrationAppStatus, OdhApplication } from '~/types'; | ||
import useFetchState, { FetchState, NotReadyError } from '~/utilities/useFetchState'; | ||
import { getIntegrationAppEnablementStatus } from '~/services/integrationAppService'; | ||
|
||
export const useIntegratedAppStatus = (app?: OdhApplication): FetchState<IntegrationAppStatus> => { | ||
const callback = React.useCallback(() => { | ||
if (!app) { | ||
return Promise.reject(new NotReadyError('Need an app to check')); | ||
} | ||
if (!app.spec.internalRoute) { | ||
// Silently ignore apps who don't have an internal route -- the logic is not needed | ||
return Promise.resolve({ | ||
isInstalled: false, | ||
isEnabled: false, | ||
canInstall: true, | ||
error: '', | ||
}); | ||
} | ||
|
||
return getIntegrationAppEnablementStatus(app.spec.internalRoute); | ||
}, [app]); | ||
|
||
return useFetchState(callback, { | ||
isInstalled: false, | ||
isEnabled: false, | ||
canInstall: false, | ||
error: '', | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters