diff --git a/generated/api-nisq/models/compiler-selection-dto.ts b/generated/api-nisq/models/compiler-selection-dto.ts index f22e468c..0936154f 100644 --- a/generated/api-nisq/models/compiler-selection-dto.ts +++ b/generated/api-nisq/models/compiler-selection-dto.ts @@ -6,6 +6,6 @@ export type CompilerSelectionDto = { circuitName?: string; circuitUrl?: string; qasmCode?: string; - token?: string; + tokens?: Map; refreshToken?: string; }; diff --git a/generated/api-nisq/models/execute-analysis-result-request-dto.ts b/generated/api-nisq/models/execute-analysis-result-request-dto.ts index e94e3934..779d30d4 100644 --- a/generated/api-nisq/models/execute-analysis-result-request-dto.ts +++ b/generated/api-nisq/models/execute-analysis-result-request-dto.ts @@ -1,5 +1,5 @@ /* tslint:disable */ export type ExecuteAnalysisResultRequestDto = { refreshToken?: string; - token?: string; + tokens?: Map>; }; diff --git a/generated/api-nisq/models/qpu-selection-dto.ts b/generated/api-nisq/models/qpu-selection-dto.ts index 877400b5..207927ea 100644 --- a/generated/api-nisq/models/qpu-selection-dto.ts +++ b/generated/api-nisq/models/qpu-selection-dto.ts @@ -4,7 +4,7 @@ export type QpuSelectionDto = { circuitLanguage?: string; circuitUrl?: string; qasmCode?: string; - tokens?: {}; + tokens?: Map>; refreshToken?: string; circuitName?: string; preciseResultsPreference?: boolean; diff --git a/generated/api-nisq/services/compiler-analysis-result.service.ts b/generated/api-nisq/services/compiler-analysis-result.service.ts index cd8d2721..75d5b133 100644 --- a/generated/api-nisq/services/compiler-analysis-result.service.ts +++ b/generated/api-nisq/services/compiler-analysis-result.service.ts @@ -68,7 +68,9 @@ export class CompilerAnalysisResultService extends BaseService { * * This method doesn't expect any request body. */ - getCompilerAnalysisResults(params?: {}): Observable { + getCompilerAnalysisResults(params?: {}): Observable< + CompilerAnalysisResultListDto + > { return this.getCompilerAnalysisResults$Response(params).pipe( map( (r: StrictHttpResponse) => @@ -264,7 +266,7 @@ export class CompilerAnalysisResultService extends BaseService { */ executeCompilationResult$Response(params: { resId: string; - token: string; + tokens: Map; }): Observable> { const rb = new RequestBuilder( this.rootUrl, @@ -273,7 +275,7 @@ export class CompilerAnalysisResultService extends BaseService { ); if (params) { rb.path('resId', params.resId, {}); - rb.query('token', params.token, {}); + rb.query('tokens', params.tokens, {}); } return this.http .request( @@ -300,7 +302,7 @@ export class CompilerAnalysisResultService extends BaseService { */ executeCompilationResult(params: { resId: string; - token: string; + tokens: Map; }): Observable { return this.executeCompilationResult$Response(params).pipe( map( diff --git a/generated/api-nisq/services/qpu-selection-result.service.ts b/generated/api-nisq/services/qpu-selection-result.service.ts index 3afe765e..dddc7d35 100644 --- a/generated/api-nisq/services/qpu-selection-result.service.ts +++ b/generated/api-nisq/services/qpu-selection-result.service.ts @@ -8,6 +8,7 @@ import { RequestBuilder } from '../request-builder'; import { Observable } from 'rxjs'; import { map, filter } from 'rxjs/operators'; +import { ExecuteAnalysisResultRequestDto } from '../models/execute-analysis-result-request-dto'; import { ExecutionResultDto } from '../models/execution-result-dto'; import { QpuSelectionJobDto } from '../models/qpu-selection-job-dto'; import { QpuSelectionJobListDto } from '../models/qpu-selection-job-list-dto'; @@ -273,11 +274,11 @@ export class QpuSelectionResultService extends BaseService { * This method provides access to the full `HttpResponse`, allowing access to response headers. * To access only the response body, use `executeQpuSelectionResult()` instead. * - * This method doesn't expect any request body. + * This method sends `application/json` and handles request body of type `application/json`. */ executeQpuSelectionResult$Response(params: { resId: string; - token: string; + body: ExecuteAnalysisResultRequestDto; }): Observable> { const rb = new RequestBuilder( this.rootUrl, @@ -286,7 +287,8 @@ export class QpuSelectionResultService extends BaseService { ); if (params) { rb.path('resId', params.resId, {}); - rb.query('token', params.token, {}); + + rb.body(params.body, 'application/json'); } return this.http .request( @@ -309,11 +311,11 @@ export class QpuSelectionResultService extends BaseService { * This method provides access to only to the response body. * To access the full response (for headers, for example), `executeQpuSelectionResult$Response()` instead. * - * This method doesn't expect any request body. + * This method sends `application/json` and handles request body of type `application/json`. */ executeQpuSelectionResult(params: { resId: string; - token: string; + body: ExecuteAnalysisResultRequestDto; }): Observable { return this.executeQpuSelectionResult$Response(params).pipe( map( diff --git a/generated/api-nisq/services/root.service.ts b/generated/api-nisq/services/root.service.ts index 1476f8b1..4950e02f 100644 --- a/generated/api-nisq/services/root.service.ts +++ b/generated/api-nisq/services/root.service.ts @@ -90,12 +90,7 @@ export class RootService extends BaseService { * This method sends `multipart/form-data` and handles request body of type `multipart/form-data`. */ selectCompilerForFile1$FormData$Response(params: { - providerName: string; - qpuName: string; - circuitLanguage: string; - circuitName: string; - token: string; - body: { circuit?: Blob }; + body: { compilerSelectionDto?: CompilerSelectionDto; circuit?: Blob }; }): Observable> { const rb = new RequestBuilder( this.rootUrl, @@ -103,12 +98,6 @@ export class RootService extends BaseService { 'post' ); if (params) { - rb.query('providerName', params.providerName, {}); - rb.query('qpuName', params.qpuName, {}); - rb.query('circuitLanguage', params.circuitLanguage, {}); - rb.query('circuitName', params.circuitName, {}); - rb.query('token', params.token, {}); - rb.body(params.body, 'multipart/form-data'); } return this.http @@ -135,12 +124,7 @@ export class RootService extends BaseService { * This method sends `multipart/form-data` and handles request body of type `multipart/form-data`. */ selectCompilerForFile1$FormData(params: { - providerName: string; - qpuName: string; - circuitLanguage: string; - circuitName: string; - token: string; - body: { circuit?: Blob }; + body: { compilerSelectionDto?: CompilerSelectionDto; circuit?: Blob }; }): Observable { return this.selectCompilerForFile1$FormData$Response(params).pipe( map( @@ -159,11 +143,6 @@ export class RootService extends BaseService { * This method sends `application/xml` and handles request body of type `application/xml`. */ selectCompilerForFile1$Xml$Response(params: { - providerName: string; - qpuName: string; - circuitLanguage: string; - circuitName: string; - token: string; body: CompilerSelectionDto; }): Observable> { const rb = new RequestBuilder( @@ -172,12 +151,6 @@ export class RootService extends BaseService { 'post' ); if (params) { - rb.query('providerName', params.providerName, {}); - rb.query('qpuName', params.qpuName, {}); - rb.query('circuitLanguage', params.circuitLanguage, {}); - rb.query('circuitName', params.circuitName, {}); - rb.query('token', params.token, {}); - rb.body(params.body, 'application/xml'); } return this.http @@ -204,11 +177,6 @@ export class RootService extends BaseService { * This method sends `application/xml` and handles request body of type `application/xml`. */ selectCompilerForFile1$Xml(params: { - providerName: string; - qpuName: string; - circuitLanguage: string; - circuitName: string; - token: string; body: CompilerSelectionDto; }): Observable { return this.selectCompilerForFile1$Xml$Response(params).pipe( @@ -228,11 +196,6 @@ export class RootService extends BaseService { * This method sends `application/json` and handles request body of type `application/json`. */ selectCompilerForFile1$Json$Response(params: { - providerName: string; - qpuName: string; - circuitLanguage: string; - circuitName: string; - token: string; body: CompilerSelectionDto; }): Observable> { const rb = new RequestBuilder( @@ -241,12 +204,6 @@ export class RootService extends BaseService { 'post' ); if (params) { - rb.query('providerName', params.providerName, {}); - rb.query('qpuName', params.qpuName, {}); - rb.query('circuitLanguage', params.circuitLanguage, {}); - rb.query('circuitName', params.circuitName, {}); - rb.query('token', params.token, {}); - rb.body(params.body, 'application/json'); } return this.http @@ -273,11 +230,6 @@ export class RootService extends BaseService { * This method sends `application/json` and handles request body of type `application/json`. */ selectCompilerForFile1$Json(params: { - providerName: string; - qpuName: string; - circuitLanguage: string; - circuitName: string; - token: string; body: CompilerSelectionDto; }): Observable { return this.selectCompilerForFile1$Json$Response(params).pipe( @@ -355,19 +307,7 @@ export class RootService extends BaseService { * This method sends `multipart/form-data` and handles request body of type `multipart/form-data`. */ selectQpuForCircuitFile1$FormData$Response(params: { - allowedProviders: Array; - circuitLanguage: string; - tokens: {}; - circuitName?: string; - userId?: string; - preciseResultsPreference?: boolean; - shortWaitingTimesPreference?: boolean; - queueImportanceRatio?: number; - maxNumberOfCompiledCircuits?: number; - predictionAlgorithm?: string; - metaOptimizer?: string; - compilers?: Array; - body: { circuit?: Blob }; + body: { qpuSelectionDto?: QpuSelectionDto; circuit?: Blob }; }): Observable> { const rb = new RequestBuilder( this.rootUrl, @@ -375,27 +315,6 @@ export class RootService extends BaseService { 'post' ); if (params) { - rb.query('allowedProviders', params.allowedProviders, {}); - rb.query('circuitLanguage', params.circuitLanguage, {}); - rb.query('tokens', params.tokens, {}); - rb.query('circuitName', params.circuitName, {}); - rb.query('userId', params.userId, {}); - rb.query('preciseResultsPreference', params.preciseResultsPreference, {}); - rb.query( - 'shortWaitingTimesPreference', - params.shortWaitingTimesPreference, - {} - ); - rb.query('queueImportanceRatio', params.queueImportanceRatio, {}); - rb.query( - 'maxNumberOfCompiledCircuits', - params.maxNumberOfCompiledCircuits, - {} - ); - rb.query('predictionAlgorithm', params.predictionAlgorithm, {}); - rb.query('metaOptimizer', params.metaOptimizer, {}); - rb.query('compilers', params.compilers, {}); - rb.body(params.body, 'multipart/form-data'); } return this.http @@ -422,19 +341,7 @@ export class RootService extends BaseService { * This method sends `multipart/form-data` and handles request body of type `multipart/form-data`. */ selectQpuForCircuitFile1$FormData(params: { - allowedProviders: Array; - circuitLanguage: string; - tokens: {}; - circuitName?: string; - userId?: string; - preciseResultsPreference?: boolean; - shortWaitingTimesPreference?: boolean; - queueImportanceRatio?: number; - maxNumberOfCompiledCircuits?: number; - predictionAlgorithm?: string; - metaOptimizer?: string; - compilers?: Array; - body: { circuit?: Blob }; + body: { qpuSelectionDto?: QpuSelectionDto; circuit?: Blob }; }): Observable { return this.selectQpuForCircuitFile1$FormData$Response(params).pipe( map( @@ -453,18 +360,6 @@ export class RootService extends BaseService { * This method sends `application/xml` and handles request body of type `application/xml`. */ selectQpuForCircuitFile1$Xml$Response(params: { - allowedProviders: Array; - circuitLanguage: string; - tokens: {}; - circuitName?: string; - userId?: string; - preciseResultsPreference?: boolean; - shortWaitingTimesPreference?: boolean; - queueImportanceRatio?: number; - maxNumberOfCompiledCircuits?: number; - predictionAlgorithm?: string; - metaOptimizer?: string; - compilers?: Array; body: QpuSelectionDto; }): Observable> { const rb = new RequestBuilder( @@ -473,27 +368,6 @@ export class RootService extends BaseService { 'post' ); if (params) { - rb.query('allowedProviders', params.allowedProviders, {}); - rb.query('circuitLanguage', params.circuitLanguage, {}); - rb.query('tokens', params.tokens, {}); - rb.query('circuitName', params.circuitName, {}); - rb.query('userId', params.userId, {}); - rb.query('preciseResultsPreference', params.preciseResultsPreference, {}); - rb.query( - 'shortWaitingTimesPreference', - params.shortWaitingTimesPreference, - {} - ); - rb.query('queueImportanceRatio', params.queueImportanceRatio, {}); - rb.query( - 'maxNumberOfCompiledCircuits', - params.maxNumberOfCompiledCircuits, - {} - ); - rb.query('predictionAlgorithm', params.predictionAlgorithm, {}); - rb.query('metaOptimizer', params.metaOptimizer, {}); - rb.query('compilers', params.compilers, {}); - rb.body(params.body, 'application/xml'); } return this.http @@ -520,18 +394,6 @@ export class RootService extends BaseService { * This method sends `application/xml` and handles request body of type `application/xml`. */ selectQpuForCircuitFile1$Xml(params: { - allowedProviders: Array; - circuitLanguage: string; - tokens: {}; - circuitName?: string; - userId?: string; - preciseResultsPreference?: boolean; - shortWaitingTimesPreference?: boolean; - queueImportanceRatio?: number; - maxNumberOfCompiledCircuits?: number; - predictionAlgorithm?: string; - metaOptimizer?: string; - compilers?: Array; body: QpuSelectionDto; }): Observable { return this.selectQpuForCircuitFile1$Xml$Response(params).pipe( @@ -551,18 +413,6 @@ export class RootService extends BaseService { * This method sends `application/json` and handles request body of type `application/json`. */ selectQpuForCircuitFile1$Json$Response(params: { - allowedProviders: Array; - circuitLanguage: string; - tokens: {}; - circuitName?: string; - userId?: string; - preciseResultsPreference?: boolean; - shortWaitingTimesPreference?: boolean; - queueImportanceRatio?: number; - maxNumberOfCompiledCircuits?: number; - predictionAlgorithm?: string; - metaOptimizer?: string; - compilers?: Array; body: QpuSelectionDto; }): Observable> { const rb = new RequestBuilder( @@ -571,27 +421,6 @@ export class RootService extends BaseService { 'post' ); if (params) { - rb.query('allowedProviders', params.allowedProviders, {}); - rb.query('circuitLanguage', params.circuitLanguage, {}); - rb.query('tokens', params.tokens, {}); - rb.query('circuitName', params.circuitName, {}); - rb.query('userId', params.userId, {}); - rb.query('preciseResultsPreference', params.preciseResultsPreference, {}); - rb.query( - 'shortWaitingTimesPreference', - params.shortWaitingTimesPreference, - {} - ); - rb.query('queueImportanceRatio', params.queueImportanceRatio, {}); - rb.query( - 'maxNumberOfCompiledCircuits', - params.maxNumberOfCompiledCircuits, - {} - ); - rb.query('predictionAlgorithm', params.predictionAlgorithm, {}); - rb.query('metaOptimizer', params.metaOptimizer, {}); - rb.query('compilers', params.compilers, {}); - rb.body(params.body, 'application/json'); } return this.http @@ -618,18 +447,6 @@ export class RootService extends BaseService { * This method sends `application/json` and handles request body of type `application/json`. */ selectQpuForCircuitFile1$Json(params: { - allowedProviders: Array; - circuitLanguage: string; - tokens: {}; - circuitName?: string; - userId?: string; - preciseResultsPreference?: boolean; - shortWaitingTimesPreference?: boolean; - queueImportanceRatio?: number; - maxNumberOfCompiledCircuits?: number; - predictionAlgorithm?: string; - metaOptimizer?: string; - compilers?: Array; body: QpuSelectionDto; }): Observable { return this.selectQpuForCircuitFile1$Json$Response(params).pipe( diff --git a/generated/api-nisq/services/xmcda-criteria.service.ts b/generated/api-nisq/services/xmcda-criteria.service.ts index ed401b8e..3029b3bd 100644 --- a/generated/api-nisq/services/xmcda-criteria.service.ts +++ b/generated/api-nisq/services/xmcda-criteria.service.ts @@ -74,7 +74,9 @@ export class XmcdaCriteriaService extends BaseService { * * This method doesn't expect any request body. */ - getSupportedPrioritizationMethods(params?: {}): Observable { + getSupportedPrioritizationMethods(params?: {}): Observable< + McdaMethodListDto + > { return this.getSupportedPrioritizationMethods$Response(params).pipe( map( (r: StrictHttpResponse) => @@ -688,7 +690,9 @@ export class XmcdaCriteriaService extends BaseService { .pipe( filter((r: any) => r instanceof HttpResponse), map((r: HttpResponse) => { - return r as StrictHttpResponse; + return r as StrictHttpResponse< + CollectionModelEntityModelMcdaSensitivityAnalysisJob + >; }) ); } @@ -707,7 +711,9 @@ export class XmcdaCriteriaService extends BaseService { return this.getSensitivityAnalysisJobs$Response(params).pipe( map( ( - r: StrictHttpResponse + r: StrictHttpResponse< + CollectionModelEntityModelMcdaSensitivityAnalysisJob + > ) => r.body as CollectionModelEntityModelMcdaSensitivityAnalysisJob ) ); diff --git a/src/app/components/algorithms/implementation-view/dialogs/implementation-execution-dialog/implementation-execution-dialog.component.html b/src/app/components/algorithms/implementation-view/dialogs/implementation-execution-dialog/implementation-execution-dialog.component.html index 82aaea17..ac44eefb 100644 --- a/src/app/components/algorithms/implementation-view/dialogs/implementation-execution-dialog/implementation-execution-dialog.component.html +++ b/src/app/components/algorithms/implementation-view/dialogs/implementation-execution-dialog/implementation-execution-dialog.component.html @@ -6,6 +6,7 @@

{{data.title}}

IBMQ Rigetti + IonQ diff --git a/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.html b/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.html index 380c7ae6..998db590 100644 --- a/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.html +++ b/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.html @@ -1,16 +1,26 @@

{{data.title}}

- - Vendor - - IBMQ - + Select vendor:
+ IBMQ +
+ + IBMQ Token + - - Token - + IonQ + + + AWS Access Key + + + + AWS Secret Key + +
Select preferences:
Short Waiting Time @@ -115,7 +125,7 @@

{{data.title}}

-
diff --git a/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.ts b/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.ts index 1680eeb7..3237ee19 100644 --- a/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.ts +++ b/src/app/components/algorithms/implementation-view/dialogs/implementation-nisq-analyzer-qpu-selection-dialog/implementation-nisq-analyzer-qpu-selection-dialog.component.ts @@ -27,11 +27,12 @@ import { NisqAnalyzerService } from '../../../nisq-analyzer/nisq-analyzer.servic export class ImplementationNisqAnalyzerQpuSelectionDialogComponent implements OnInit { qpuSelectionFrom: FormGroup; - provider?: EntityModelProviderDto; + selectedVendors: string[] = []; ready?: boolean; - isIbmqSelected = true; selectedCompilers: string[] = []; + ibmqEnabled = true; + ionqEnabled = true; shortWaitingTimeEnabled = false; stableExecutionResultsEnabled = false; predictionAlgorithmInDialog = 'extra_trees_regressor'; @@ -52,12 +53,20 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent private utilService: UtilService ) {} - get vendor(): AbstractControl | null { - return this.qpuSelectionFrom.get('vendor'); + get vendors(): FormArray | null { + return this.qpuSelectionFrom.get('vendors') as FormArray; } - get token(): AbstractControl | null { - return this.qpuSelectionFrom.get('token'); + get ibmqToken(): AbstractControl | null { + return this.qpuSelectionFrom.get('ibmqToken'); + } + + get awsToken(): AbstractControl | null { + return this.qpuSelectionFrom.get('awsToken'); + } + + get awsSecretToken(): AbstractControl | null { + return this.qpuSelectionFrom.get('awsSecretToken'); } get compilers(): FormArray { @@ -90,11 +99,10 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent ngOnInit(): void { this.qpuSelectionFrom = new FormGroup({ - vendor: new FormControl(this.data.vendor, [ - // eslint-disable-next-line @typescript-eslint/unbound-method - Validators.required, - ]), - token: new FormControl(this.data.token), + vendors: new FormArray([]), + ibmqToken: new FormControl(this.data.ibmqToken), + awsToken: new FormControl(this.data.awsToken), + awsSecretToken: new FormControl(this.data.awsSecretToken), compilers: new FormArray([]), maxNumberOfCompiledCircuits: new FormControl( this.data.maxNumberOfCompiledCircuits, @@ -128,9 +136,11 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent ), }); - this.vendor.setValue('IBMQ'); - this.onVendorChanged(this.vendor.value); - this.setCompilerOptions(this.vendor.value); + this.selectedVendors = ['ibmq', 'ionq']; + for (const vendor of this.selectedVendors) { + this.vendors.push(new FormControl(vendor)); + } + this.setCompilerOptions(this.vendors.value); this.predictionAlgorithm.setValue('extra_trees_regressor'); this.metaOptimizer.setValue('ada_boost_regressor'); this.maxNumberOfCompiledCircuits.setValue(5); @@ -138,8 +148,7 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent this.shortWaitingTime.setValue(false); this.dialogRef.beforeClosed().subscribe(() => { - this.data.vendor = this.vendor.value; - this.data.token = this.token.value; + this.data.vendors = this.selectedVendors; this.data.selectedCompilers = this.selectedCompilers; this.data.maxNumberOfCompiledCircuits = this.maxNumberOfCompiledCircuitsDialog; this.data.metaOptimizer = this.metaOptimizerInDialog; @@ -147,6 +156,9 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent this.data.queueImportanceRatio = this.queueImportanceRatioDialog; this.data.shortWaitingTime = this.shortWaitingTimeEnabled; this.data.stableExecutionResults = this.stableExecutionResultsEnabled; + this.data.ibmqToken = this.ibmqToken.value; + this.data.awsToken = this.awsToken.value; + this.data.awsSecretToken = this.awsSecretToken.value; }); } @@ -154,41 +166,6 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent this.dialogRef.close(); } - isRequiredDataMissing(): boolean { - return this.vendor.errors?.required; - } - - onVendorChanged(value: string): void { - this.isIbmqSelected = true; - if (value === 'IBMQ') { - this.providerService.getProviders().subscribe((result) => { - this.getProviderDtoByName(result); - if (!this.provider) { - console.error('Provider with given name not found!'); - this.ready = true; - return; - } - this.setCompilerOptions(value); - }); - } else { - this.isIbmqSelected = false; - this.setCompilerOptions(value); - } - } - - getProviderDtoByName(result): void { - if (result === null) { - console.error('Error while loading provider!'); - return; - } - for (const providerDto of result._embedded.providerDtoes) { - if (providerDto.name.toLowerCase() === 'ibmq') { - this.provider = providerDto; - return; - } - } - } - updateCompilerSelection(compilerName: string, allowed: boolean): void { if (allowed) { this.selectedCompilers.push(compilerName); @@ -206,24 +183,57 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent return this.selectedCompilers.includes(compilerName); } - checkIfCompilersPresent(): boolean { - if (this.selectedCompilers.length > 0) { + checkIfCompilersAndProvidersPresent(): boolean { + if (this.selectedCompilers.length > 0 && this.selectedVendors.length > 0) { return true; } else { return false; } } - setCompilerOptions(vendor: string): void { - this.nisqAnalyzerService - .getCompilers(vendor) - .subscribe((availableCompilers) => { - this.selectedCompilers = availableCompilers; - this.compilers.clear(); - for (const compiler of availableCompilers) { - this.compilers.push(new FormControl(compiler)); - } - }); + setCompilerOptions(vendors: string[]): void { + debugger; + const setOfAllAvailableCompilers = new Set(); + for (const vendor of vendors) { + this.nisqAnalyzerService + .getCompilers(vendor) + .subscribe((availableCompilers) => { + for (const availableCompiler of availableCompilers) { + setOfAllAvailableCompilers.add(availableCompiler); + } + }); + setOfAllAvailableCompilers.forEach((compiler) => + this.selectedCompilers.push(compiler) + ); + this.compilers.clear(); + for (const compiler of this.selectedCompilers) { + this.compilers.push(new FormControl(compiler)); + } + } + } + + setIbmqEnabled(enabled: boolean): void { + this.ibmqEnabled = enabled; + if (enabled) { + this.selectedVendors.push('ibmq'); + this.setCompilerOptions(['ibmq']); + } else { + this.selectedVendors = this.selectedVendors.filter( + (item) => item !== 'ibmq' + ); + } + } + + setIonqEnabled(enabled: boolean): void { + this.ionqEnabled = enabled; + if (enabled) { + this.selectedVendors.push('ionq'); + this.setCompilerOptions(['ionq']); + } else { + this.selectedVendors = this.selectedVendors.filter( + (item) => item !== 'ionq' + ); + } } setWaitingTimeEnabled(enabled: boolean): void { @@ -269,8 +279,7 @@ export class ImplementationNisqAnalyzerQpuSelectionDialogComponent interface DialogData { title: string; - vendor: string; - token: string; + vendors: string[]; selectedCompilers: string[]; predictionAlgorithm: string; metaOptimizer: string; @@ -278,4 +287,7 @@ interface DialogData { maxNumberOfCompiledCircuits: number; stableExecutionResults: boolean; shortWaitingTime: boolean; + ibmqToken: string; + awsToken: string; + awsSecretToken: string; } diff --git a/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.html b/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.html index 722a7853..f5760ea7 100644 --- a/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.html +++ b/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.html @@ -1,9 +1,17 @@

{{data.title}}

- - Token - + + IBMQ Token + + + + AWS Access Key + + + + AWS Secret Key +
diff --git a/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.ts b/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.ts index 57d31574..f5d51303 100644 --- a/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.ts +++ b/src/app/components/algorithms/implementation-view/dialogs/implementation-token-dialog/implementation-token-dialog.component.ts @@ -25,16 +25,28 @@ export class ImplementationTokenDialogComponent implements OnInit { public dialog: MatDialog ) {} - get token(): AbstractControl | null { - return this.implementationExecutionForm.get('token'); + get ibmqToken(): AbstractControl | null { + return this.implementationExecutionForm.get('ibmqToken'); + } + + get awsToken(): AbstractControl | null { + return this.implementationExecutionForm.get('awsToken'); + } + + get awsSecretToken(): AbstractControl | null { + return this.implementationExecutionForm.get('awsSecretToken'); } ngOnInit(): void { this.implementationExecutionForm = new FormGroup({ - token: new FormControl(this.data.token), + ibmqToken: new FormControl(this.data.ibmqToken), + awsToken: new FormControl(this.data.awsToken), + awsSecretToken: new FormControl(this.data.awsSecretToken), }); this.dialogRef.beforeClosed().subscribe(() => { - this.data.token = this.token.value; + this.data.ibmqToken = this.ibmqToken.value; + this.data.awsToken = this.awsToken.value; + this.data.awsSecretToken = this.awsSecretToken.value; }); } @@ -45,5 +57,8 @@ export class ImplementationTokenDialogComponent implements OnInit { export interface DialogData { title: string; - token: string; + vendor: string; + ibmqToken: string; + awsToken: string; + awsSecretToken: string; } diff --git a/src/app/components/algorithms/implementation-view/implementation-execution/implementation-execution.component.ts b/src/app/components/algorithms/implementation-view/implementation-execution/implementation-execution.component.ts index ec828579..63664f45 100644 --- a/src/app/components/algorithms/implementation-view/implementation-execution/implementation-execution.component.ts +++ b/src/app/components/algorithms/implementation-view/implementation-execution/implementation-execution.component.ts @@ -160,7 +160,11 @@ export class ImplementationExecutionComponent implements OnInit { this.results = undefined; this.executedCompilationResult = analysisResult; this.nisqAnalyzerService - .executeCompilationResult(analysisResult.id, token) + .executeCompilationResult( + analysisResult.id, + analysisResult.provider, + token + ) .subscribe( (results) => { this.utilService.callSnackBar( @@ -288,15 +292,10 @@ export class ImplementationExecutionComponent implements OnInit { circuitName: this.nisqImpl.name, qpuName: dialogResult.qpu, circuitUrl: this.nisqImpl.fileLocation, - token, + tokens: new Map([dialogResult.vendor, token]), }; this.rootService .selectCompilerForFile1$Json({ - providerName: dialogResult.vendor, - circuitLanguage: this.nisqImpl.language, - circuitName: this.nisqImpl.name, - qpuName: dialogResult.qpu, - token, body: compilerSelectionDto, }) .subscribe( diff --git a/src/app/components/algorithms/implementation-view/implementation-nisq-analyzer-qpu-selection/implementation-nisq-analyzer-qpu-selection.component.ts b/src/app/components/algorithms/implementation-view/implementation-nisq-analyzer-qpu-selection/implementation-nisq-analyzer-qpu-selection.component.ts index 3372be00..fa0a508a 100644 --- a/src/app/components/algorithms/implementation-view/implementation-nisq-analyzer-qpu-selection/implementation-nisq-analyzer-qpu-selection.component.ts +++ b/src/app/components/algorithms/implementation-view/implementation-nisq-analyzer-qpu-selection/implementation-nisq-analyzer-qpu-selection.component.ts @@ -28,6 +28,7 @@ import { EntityModelMcdaJob, EntityModelMcdaSensitivityAnalysisJob, EntityModelMcdaWeightLearningJob, + ExecuteAnalysisResultRequestDto, ExecutionResultDto, QpuSelectionDto, QpuSelectionResultDto, @@ -214,18 +215,17 @@ export class ImplementationNisqAnalyzerQpuSelectionComponent this.analyzerJob = undefined; this.jobReady = false; refreshToken = this.planqkService.getRefreshToken(); - const providerTokens = {}; - if (dialogResult.token) { - providerTokens[dialogResult.vendor] = dialogResult.token; - } else { - providerTokens[dialogResult.vendor] = ' '; - } const qpuSelectionDto: QpuSelectionDto = { - allowedProviders: [dialogResult.vendor], + allowedProviders: dialogResult.vendors, circuitLanguage: this.nisqImpl.language, circuitUrl: this.nisqImpl.fileLocation, - tokens: providerTokens, + tokens: this.setVendorTokens( + dialogResult.vendors, + dialogResult.ibmqToken, + dialogResult.awsToken, + dialogResult.awsSecretToken + ), refreshToken, compilers: dialogResult.selectedCompilers, circuitName: this.nisqImpl.name, @@ -239,10 +239,6 @@ export class ImplementationNisqAnalyzerQpuSelectionComponent }; this.nisqAnalyzerRootService .selectQpuForCircuitFile1$Json({ - circuitLanguage: this.nisqImpl.language, - circuitName: this.nisqImpl.name, - allowedProviders: [dialogResult.vendor], - tokens: providerTokens, body: qpuSelectionDto, }) .subscribe((job) => { @@ -307,21 +303,30 @@ export class ImplementationNisqAnalyzerQpuSelectionComponent } execute(analysisResult: QpuSelectionResultDto): void { - let token = ' '; this.utilService .createDialog(ImplementationTokenDialogComponent, { title: 'Enter the token for the Vendor : ' + analysisResult.provider, + vendor: analysisResult.provider, }) .afterClosed() .subscribe((dialogResult) => { - if (dialogResult.token) { - token = dialogResult.token; - } this.loadingResults[analysisResult.id] = true; this.results = undefined; this.executedAnalyseResult = analysisResult; + const executeBodyDto: ExecuteAnalysisResultRequestDto = { + tokens: this.setVendorTokens( + [analysisResult.provider], + dialogResult.ibmqToken, + dialogResult.awsToken, + dialogResult.awsSecretToken + ), + }; + this.qpuSelectionService - .executeQpuSelectionResult({ resId: analysisResult.id, token }) + .executeQpuSelectionResult({ + resId: analysisResult.id, + body: executeBodyDto, + }) .subscribe( (results) => { if ( @@ -358,6 +363,28 @@ export class ImplementationNisqAnalyzerQpuSelectionComponent }); } + setVendorTokens( + vendors: string[], + ibmqToken: string, + awsToken: string, + awsSecretToken: string + ): Map> { + const providerTokens: Map> = new Map(); + const rawTokens: Map = new Map(); + if (vendors.filter((vendor) => vendor === 'ibmq') != null) { + rawTokens.clear(); + rawTokens.set('ibmq', ibmqToken); + providerTokens.set('ibmq', rawTokens); + } + if (vendors.filter((vendor) => vendor === 'ionq') != null) { + rawTokens.clear(); + rawTokens.set('awsAccessKey', awsToken); + rawTokens.set('awsSecretKey', awsSecretToken); + providerTokens.set('ionq', rawTokens); + } + return providerTokens; + } + hasExecutionResult(analysisResult: QpuSelectionResultDto): void { this.qpuSelectionService .getQpuSelectionResult({ resId: analysisResult.id }) diff --git a/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.component.ts b/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.component.ts index ba3730a3..739bc796 100644 --- a/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.component.ts +++ b/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.component.ts @@ -109,7 +109,7 @@ export class NisqAnalyzerComponent implements OnInit { >(); executeAnalysisResultRequestDto: ExecuteAnalysisResultRequestDto = { refreshToken: '', - token: '', + tokens: new Map>(), }; constructor( @@ -379,7 +379,11 @@ export class NisqAnalyzerComponent implements OnInit { if (dialogResult.token) { token = dialogResult.token; } - this.executeAnalysisResultRequestDto.token = token; + const rawTokens: Map = new Map(); + rawTokens.set(analysisResult.provider, token); + const tokens: Map> = new Map(); + tokens.set(analysisResult.provider, rawTokens); + this.executeAnalysisResultRequestDto.tokens = tokens; this.nisqAnalyzerService .execute(analysisResult.id, this.executeAnalysisResultRequestDto) .subscribe( diff --git a/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.service.ts b/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.service.ts index 7698f2b6..ce1c4b87 100644 --- a/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.service.ts +++ b/src/app/components/algorithms/nisq-analyzer/nisq-analyzer.service.ts @@ -57,11 +57,14 @@ export class NisqAnalyzerService { executeCompilationResult( resId: string, - token: string + token: string, + vendor: string ): Observable { + const tokens = new Map(); + tokens.set(vendor, token); return this.compilerAnalysisResult.executeCompilationResult({ resId, - token, + tokens, }); }