Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
520 additions
and
205 deletions.
There are no files selected for viewing
File renamed without changes.
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
1 change: 1 addition & 0 deletions
1
frontend/packages/kubevirt-plugin/src/components/modals/description-modal/index.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 @@ | ||
export * from './description-modal'; |
2 changes: 1 addition & 1 deletion
2
frontend/packages/kubevirt-plugin/src/components/modals/index.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './modal-resource-launcher'; | ||
export * from './vm-description-modal'; | ||
export * from './description-modal'; | ||
export * from './vm-flavor-modal'; |
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
1 change: 0 additions & 1 deletion
1
frontend/packages/kubevirt-plugin/src/components/modals/vm-description-modal/index.ts
This file was deleted.
Oops, something went wrong.
144 changes: 0 additions & 144 deletions
144
frontend/packages/kubevirt-plugin/src/components/vm-snapshots/snapshot-row.tsx
This file was deleted.
Oops, something went wrong.
8 changes: 7 additions & 1 deletion
8
frontend/packages/kubevirt-plugin/src/components/vm-snapshots/types.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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import { VMRestore } from '../../types'; | ||
import { VMLikeEntityKind } from '../../types/vmLike'; | ||
|
||
export type VMSnapshotRowActionOpts = { withProgress: (promise: Promise<any>) => void }; | ||
export type VMSnapshotRowActionOpts = { | ||
withProgress: (promise: Promise<any>) => void; | ||
restores: { [key: string]: VMRestore }; | ||
}; | ||
|
||
export type VMSnapshotRowCustomData = { | ||
vmLikeEntity: VMLikeEntityKind; | ||
columnClasses: string[]; | ||
isDisabled: boolean; | ||
restores: { [key: string]: VMRestore }; | ||
withProgress: (promise: Promise<any>) => void; | ||
} & VMSnapshotRowActionOpts; |
41 changes: 41 additions & 0 deletions
41
frontend/packages/kubevirt-plugin/src/components/vm-snapshots/use-mapped-vm-restores.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,41 @@ | ||
import * as React from 'react'; | ||
import { VMRestore } from '../../types'; | ||
import { | ||
WatchK8sResource, | ||
useK8sWatchResource, | ||
} from '@console/internal/components/utils/k8s-watch-hook'; | ||
import { VirtualMachineRestoreModel } from '../../models'; | ||
import { getVmRestoreSnapshotName, getVmRestoreTime } from '../../selectors/snapshot/snapshot'; | ||
|
||
export const useMappedVMRestores = ( | ||
namespace: string, | ||
): [{ [key: string]: VMRestore }, boolean, any] => { | ||
const restoreResource: WatchK8sResource = { | ||
isList: true, | ||
kind: VirtualMachineRestoreModel.kind, | ||
namespaced: true, | ||
namespace, | ||
}; | ||
|
||
const [restores, restoresLoaded, restoresError] = useK8sWatchResource<VMRestore[]>( | ||
restoreResource, | ||
); | ||
|
||
const mappedRelevantRestores = React.useMemo( | ||
() => | ||
restores.reduce((restoreMap, currentRestore) => { | ||
const relevantRestore = restoreMap[getVmRestoreSnapshotName(currentRestore)]; | ||
if ( | ||
!relevantRestore || | ||
new Date(getVmRestoreTime(relevantRestore)).getTime() < | ||
new Date(getVmRestoreTime(currentRestore)).getTime() | ||
) { | ||
restoreMap[getVmRestoreSnapshotName(currentRestore)] = currentRestore; | ||
} | ||
return restoreMap; | ||
}, {}), | ||
[restores], | ||
); | ||
|
||
return [mappedRelevantRestores, restoresLoaded, restoresError]; | ||
}; |
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.