Skip to content

Commit

Permalink
added smartstate poc to discover screen
Browse files Browse the repository at this point in the history
Signed-off-by: borod108 <[email protected]>
  • Loading branch information
borod108 committed Jan 13, 2025
1 parent 15ae20f commit 0ecc1f4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 49 deletions.
21 changes: 20 additions & 1 deletion apps/demo/src/migration-wizard/steps/discovery/DiscoveryStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { ReportPieChart } from "./ReportPieChart";
export const DiscoveryStep: React.FC = () => {
const discoverSourcesContext = useDiscoverySources();
const { inventory } = discoverSourcesContext.sourceSelected as Source;
const { infra, vms } = inventory!;
const { infra, vms, smartState } = inventory!;
const {
datastores,
networks,
Expand Down Expand Up @@ -301,6 +301,24 @@ export const DiscoveryStep: React.FC = () => {
],
};

const smartStateViewData: TreeViewDataItem = {
title: "Smart State POC",
icon: <CogsIcon />,
name: <>This is the collected Smart State data</>,
id: "smarts",
children: [
{
title: "Details",
name: (
<pre style={{ whiteSpace: "pre-wrap", wordBreak: "break-word", maxWidth: "100%" }}>
{smartState ? JSON.stringify(smartState, null, 2) : "No data available"}
</pre>
),
id: "os-details",
},
],
};

const operatingSystemsViewData: TreeViewDataItem = {
title: "Operating systems",
icon: <CogsIcon />,
Expand Down Expand Up @@ -330,6 +348,7 @@ export const DiscoveryStep: React.FC = () => {
networksViewData,
storageViewData,
operatingSystemsViewData,
smartStateViewData,
];

return (
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export default defineConfig((_env) => {
server: {
proxy: {
"/planner/api": {
target: "http://172.17.0.3:3443",
target: "http://192.168.122.1:3443",
changeOrigin: true,
rewrite: (path): string => path.replace(/^\/planner/, ""),
},
"/agent/api/v1": {
target: "http://172.17.0.3:3333",
target: "http://192.168.122.1:3333",
changeOrigin: true,
rewrite: (path): string => path.replace(/^\/agent/, ""),
},
Expand Down
2 changes: 1 addition & 1 deletion openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"version": "7.8.0",
"generators": {
"api-client": {
"inputSpec": "https://raw.githubusercontent.com/kubev2v/migration-planner/main/api/v1alpha1/openapi.yaml",
"inputSpec": "https://raw.githubusercontent.com/kubev2v/migration-planner/41c138c994c82262aef827a322dbc480f5d840f2/api/v1alpha1/openapi.yaml",
"output": "packages/api-client",
"generatorName": "typescript-fetch",
"additionalProperties": {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/src/apis/SourceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export class SourceApi extends runtime.BaseAPI implements SourceApiInterface {
* list sources
*/
async listSources(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Source>> {
const response = await this.listSourcesRaw(initOverrides);
const response = await this.listSourcesRaw(initOverrides);
return await response.value();
}

Expand Down
8 changes: 8 additions & 0 deletions packages/api-client/src/models/Inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ export interface Inventory {
* @memberof Inventory
*/
infra: Infra;
/**
*
* @type {Array<{ [key: string]: any; }>}
* @memberof Inventory
*/
smartState?: Array<{ [key: string]: any; }>;
}

/**
Expand All @@ -81,6 +87,7 @@ export function InventoryFromJSONTyped(json: any, ignoreDiscriminator: boolean):
'vcenter': json['vcenter'],
'vms': json['vms'],
'infra': json['infra'],
'smartState': json['smartState'] == null ? undefined : json['smartState'],
};
}

Expand All @@ -93,6 +100,7 @@ export function InventoryToJSON(value?: Inventory | null): any {
'vcenter': value['vcenter'],
'vms': value['vms'],
'infra': value['infra'],
'smartState': value['smartState'],
};
}

47 changes: 3 additions & 44 deletions packages/api-client/src/models/Source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,6 @@ export interface Source {
* @memberof Source
*/
id: string;
/**
*
* @type {string}
* @memberof Source
*/
name: string;
/**
*
* @type {string}
* @memberof Source
*/
status: SourceStatusEnum;
/**
*
* @type {string}
* @memberof Source
*/
statusInfo: string;
/**
*
* @type {Inventory}
Expand All @@ -79,7 +61,7 @@ export interface Source {
* @type {string}
* @memberof Source
*/
sshKey?: string;
name?: string;
/**
*
* @type {Array<SourceAgentItem>}
Expand All @@ -88,28 +70,11 @@ export interface Source {
agents?: Array<SourceAgentItem>;
}


/**
* @export
*/
export const SourceStatusEnum = {
NotConnected: 'not-connected',
WaitingForCredentials: 'waiting-for-credentials',
Error: 'error',
GatheringInitialInventory: 'gathering-initial-inventory',
UpToDate: 'up-to-date'
} as const;
export type SourceStatusEnum = typeof SourceStatusEnum[keyof typeof SourceStatusEnum];


/**
* Check if a given object implements the Source interface.
*/
export function instanceOfSource(value: object): value is Source {
if (!('id' in value) || value['id'] === undefined) return false;
if (!('name' in value) || value['name'] === undefined) return false;
if (!('status' in value) || value['status'] === undefined) return false;
if (!('statusInfo' in value) || value['statusInfo'] === undefined) return false;
if (!('createdAt' in value) || value['createdAt'] === undefined) return false;
if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false;
return true;
Expand All @@ -126,13 +91,10 @@ export function SourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): So
return {

'id': json['id'],
'name': json['name'],
'status': json['status'],
'statusInfo': json['statusInfo'],
'inventory': json['inventory'] == null ? undefined : InventoryFromJSON(json['inventory']),
'createdAt': (new Date(json['createdAt'])),
'updatedAt': (new Date(json['updatedAt'])),
'sshKey': json['sshKey'] == null ? undefined : json['sshKey'],
'name': json['name'] == null ? undefined : json['name'],
'agents': json['agents'] == null ? undefined : ((json['agents'] as Array<any>).map(SourceAgentItemFromJSON)),
};
}
Expand All @@ -144,13 +106,10 @@ export function SourceToJSON(value?: Source | null): any {
return {

'id': value['id'],
'name': value['name'],
'status': value['status'],
'statusInfo': value['statusInfo'],
'inventory': InventoryToJSON(value['inventory']),
'createdAt': ((value['createdAt']).toISOString()),
'updatedAt': ((value['updatedAt']).toISOString()),
'sshKey': value['sshKey'],
'name': value['name'],
'agents': value['agents'] == null ? undefined : ((value['agents'] as Array<any>).map(SourceAgentItemToJSON)),
};
}
Expand Down

0 comments on commit 0ecc1f4

Please sign in to comment.