mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 11:38:36 -05:00
profile page and summary page (#4769)
* add cluster name to page * implement profile page -1 * fix compilation error due to new method * profile page 0328 * summary page * make divcontainer accessible * handle disposable * add support for "coming soon" cards
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { TargetClusterType, ClusterPorts, ClusterType, ContainerRegistryInfo, TargetClusterTypeInfo, ToolInfo, ToolInstallationStatus } from '../../interfaces';
|
||||
import { TargetClusterType, ClusterPorts, ClusterType, ContainerRegistryInfo, TargetClusterTypeInfo, ToolInfo, ToolInstallationStatus, ClusterProfile, PoolConfiguration, SQLServerMasterConfiguration, ClusterPoolType, ClusterResourceSummary } from '../../interfaces';
|
||||
import { getContexts, KubectlContext, setContext, inferCurrentClusterType } from '../../kubectl/kubectlUtils';
|
||||
import { Kubectl } from '../../kubectl/kubectl';
|
||||
import { Scriptable, ScriptingDictionary } from '../../scripting/scripting';
|
||||
@@ -57,6 +57,7 @@ export class CreateClusterModel implements Scriptable {
|
||||
public getAllTargetClusterTypeInfo(): Thenable<TargetClusterTypeInfo[]> {
|
||||
let promise = new Promise<TargetClusterTypeInfo[]>(resolve => {
|
||||
let aksCluster: TargetClusterTypeInfo = {
|
||||
enabled: false,
|
||||
type: TargetClusterType.NewAksCluster,
|
||||
name: localize('bdc-create.AKSClusterCardText', 'New AKS Cluster'),
|
||||
fullName: localize('bdc-create.AKSClusterFullName', 'New Azure Kubernetes Service cluster'),
|
||||
@@ -69,9 +70,10 @@ export class CreateClusterModel implements Scriptable {
|
||||
};
|
||||
|
||||
let existingCluster: TargetClusterTypeInfo = {
|
||||
enabled: true,
|
||||
type: TargetClusterType.ExistingKubernetesCluster,
|
||||
name: localize('bdc-create.ExistingClusterCardText', 'Existing Cluster'),
|
||||
fullName: localize('bdc-create.ExistingClusterFullName', 'Existing Kubernetes Cluster'),
|
||||
fullName: localize('bdc-create.ExistingClusterFullName', 'Existing Kubernetes cluster'),
|
||||
description: localize('bdc-create.ExistingClusterDescription', 'This option assumes you already have a Kubernetes cluster installed, Once a prerequisite check is done, ensure the correct cluster context is selected.'),
|
||||
iconPath: {
|
||||
dark: 'images/kubernetes.svg',
|
||||
@@ -106,7 +108,7 @@ export class CreateClusterModel implements Scriptable {
|
||||
setTimeout(() => {
|
||||
let tools = this.targetClusterType === TargetClusterType.ExistingKubernetesCluster ? [kubeCtl, mssqlCtl] : [kubeCtl, mssqlCtl, azureCli];
|
||||
resolve(tools);
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
@@ -117,7 +119,7 @@ export class CreateClusterModel implements Scriptable {
|
||||
tool.status = ToolInstallationStatus.Installed;
|
||||
this._tmp_tools_installed = true;
|
||||
resolve();
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
@@ -126,6 +128,8 @@ export class CreateClusterModel implements Scriptable {
|
||||
return path.join(os.homedir(), '.kube', 'config');
|
||||
}
|
||||
|
||||
public clusterName: string;
|
||||
|
||||
public targetClusterType: TargetClusterType;
|
||||
|
||||
public selectedCluster: KubectlContext;
|
||||
@@ -156,6 +160,8 @@ export class CreateClusterModel implements Scriptable {
|
||||
|
||||
public containerRegistryPassword: string;
|
||||
|
||||
public profile: ClusterProfile;
|
||||
|
||||
public async getTargetClusterPlatform(targetContextName: string): Promise<string> {
|
||||
await setContext(this._kubectl, targetContextName);
|
||||
let clusterType = await inferCurrentClusterType(this._kubectl);
|
||||
@@ -207,4 +213,116 @@ export class CreateClusterModel implements Scriptable {
|
||||
public getTargetKubectlContext(): KubectlContext {
|
||||
return this.selectedCluster;
|
||||
}
|
||||
|
||||
public getClusterResource(): Thenable<ClusterResourceSummary> {
|
||||
let promise = new Promise<ClusterResourceSummary>(resolve => {
|
||||
setTimeout(() => {
|
||||
let resoureSummary: ClusterResourceSummary = {
|
||||
hardwareLabels: [
|
||||
{
|
||||
name: '<Default>',
|
||||
totalNodes: 10,
|
||||
totalCores: 22,
|
||||
totalDisks: 128,
|
||||
totalMemoryInGB: 77
|
||||
},
|
||||
{
|
||||
name: '#data',
|
||||
totalNodes: 4,
|
||||
totalCores: 22,
|
||||
totalDisks: 200,
|
||||
totalMemoryInGB: 100
|
||||
},
|
||||
{
|
||||
name: '#compute',
|
||||
totalNodes: 12,
|
||||
totalCores: 124,
|
||||
totalDisks: 24,
|
||||
totalMemoryInGB: 100
|
||||
},
|
||||
{
|
||||
name: '#premium',
|
||||
totalNodes: 10,
|
||||
totalCores: 100,
|
||||
totalDisks: 200,
|
||||
totalMemoryInGB: 770
|
||||
}
|
||||
]
|
||||
};
|
||||
resolve(resoureSummary);
|
||||
}, 1000);
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
||||
public getProfiles(): Thenable<ClusterProfile[]> {
|
||||
let promise = new Promise<ClusterProfile[]>(resolve => {
|
||||
setTimeout(() => {
|
||||
let profiles: ClusterProfile[] = [];
|
||||
profiles.push({
|
||||
name: 'Basic',
|
||||
sqlServerMasterConfiguration: this.createSQLPoolConfiguration(1, 1),
|
||||
computePoolConfiguration: this.createComputePoolConfiguration(2),
|
||||
dataPoolConfiguration: this.createDataPoolConfiguration(2),
|
||||
storagePoolConfiguration: this.createStoragePoolConfiguration(2),
|
||||
sparkPoolConfiguration: this.createSparkPoolConfiguration(2)
|
||||
});
|
||||
profiles.push({
|
||||
name: 'Standard',
|
||||
sqlServerMasterConfiguration: this.createSQLPoolConfiguration(3, 9),
|
||||
computePoolConfiguration: this.createComputePoolConfiguration(5),
|
||||
dataPoolConfiguration: this.createDataPoolConfiguration(5),
|
||||
storagePoolConfiguration: this.createStoragePoolConfiguration(5),
|
||||
sparkPoolConfiguration: this.createSparkPoolConfiguration(5)
|
||||
});
|
||||
profiles.push({
|
||||
name: 'Premium',
|
||||
sqlServerMasterConfiguration: this.createSQLPoolConfiguration(5, 9),
|
||||
computePoolConfiguration: this.createComputePoolConfiguration(7),
|
||||
dataPoolConfiguration: this.createDataPoolConfiguration(7),
|
||||
storagePoolConfiguration: this.createStoragePoolConfiguration(7),
|
||||
sparkPoolConfiguration: this.createSparkPoolConfiguration(7)
|
||||
});
|
||||
resolve(profiles);
|
||||
}, 1000);
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
||||
private createSQLPoolConfiguration(scale: number, maxScale: number): SQLServerMasterConfiguration {
|
||||
return <SQLServerMasterConfiguration>{
|
||||
type: ClusterPoolType.SQL,
|
||||
engineOnly: false,
|
||||
scale: scale,
|
||||
maxScale: maxScale
|
||||
};
|
||||
}
|
||||
|
||||
private createComputePoolConfiguration(scale: number): PoolConfiguration {
|
||||
return {
|
||||
type: ClusterPoolType.Compute,
|
||||
scale: scale
|
||||
};
|
||||
}
|
||||
|
||||
private createDataPoolConfiguration(scale: number): PoolConfiguration {
|
||||
return {
|
||||
type: ClusterPoolType.Data,
|
||||
scale: scale
|
||||
};
|
||||
}
|
||||
|
||||
private createStoragePoolConfiguration(scale: number): PoolConfiguration {
|
||||
return {
|
||||
type: ClusterPoolType.Storage,
|
||||
scale: scale
|
||||
};
|
||||
}
|
||||
|
||||
private createSparkPoolConfiguration(scale: number): PoolConfiguration {
|
||||
return {
|
||||
type: ClusterPoolType.Spark,
|
||||
scale: scale
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user