forked from eclipse-xpanse/xpanse-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'eclipse-xpanse:main' into main
- Loading branch information
Showing
18 changed files
with
920 additions
and
1,878 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
...mponents/content/common/latestServiceOrderStatusQuery/useLatestServiceOrderStatusQuery.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,37 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* SPDX-FileCopyrightText: Huawei Inc. | ||
*/ | ||
|
||
import { useQuery } from '@tanstack/react-query'; | ||
import { | ||
getLatestServiceOrderStatus, | ||
GetLatestServiceOrderStatusData, | ||
taskStatus, | ||
} from '../../../../xpanse-api/generated'; | ||
import { deploymentStatusPollingInterval } from '../../../utils/constants.tsx'; | ||
|
||
export function useLatestServiceOrderStatusQuery( | ||
orderId: string | undefined, | ||
isStartPolling: boolean, | ||
refetchUntilStates: taskStatus[] | ||
) { | ||
return useQuery({ | ||
queryKey: ['getServiceDetailsById', orderId], | ||
queryFn: () => { | ||
const data: GetLatestServiceOrderStatusData = { | ||
lastKnownServiceDeploymentState: undefined, | ||
orderId: orderId ?? '', | ||
}; | ||
return getLatestServiceOrderStatus(data); | ||
}, | ||
refetchInterval: (query) => | ||
query.state.data && refetchUntilStates.includes(query.state.data.taskStatus as taskStatus) | ||
? false | ||
: deploymentStatusPollingInterval, | ||
refetchIntervalInBackground: true, | ||
refetchOnWindowFocus: false, | ||
enabled: orderId !== undefined && isStartPolling, | ||
gcTime: 0, | ||
}); | ||
} |
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
Oops, something went wrong.