Skip to content

Commit

Permalink
Lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgDaniel committed Nov 28, 2023
1 parent 128c37d commit acd95da
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 211 deletions.
2 changes: 1 addition & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ const routes: Routes = [
exports: [RouterModule],
providers: [ChangePageGuard],
})
export class AppRoutingModule { }
export class AppRoutingModule {}
7 changes: 3 additions & 4 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import { LibraryTableComponent } from './components/libraries/library-table/libr
import { OnDemandComponent } from './components/on-demand-execution/ondemand.component';
import { QunicornAppModule } from './components/qunicorn-service/qunicorn.apps.module';


@NgModule({
declarations: [
// components
Expand Down Expand Up @@ -107,7 +106,7 @@ import { QunicornAppModule } from './components/qunicorn-service/qunicorn.apps.m
AddSlrDialogComponent,
SlrPropertiesComponent,
LibraryTableComponent,
OnDemandComponent
OnDemandComponent,
],
imports: [
MDBBootstrapModule.forRoot(),
Expand Down Expand Up @@ -167,7 +166,7 @@ import { QunicornAppModule } from './components/qunicorn-service/qunicorn.apps.m
bootstrap: [AppComponent],
providers: [
UtilService,
//ChangePageGuard,
// ChangePageGuard,
{
provide: HTTP_INTERCEPTORS,
useClass: AuthInterceptor,
Expand All @@ -181,4 +180,4 @@ import { QunicornAppModule } from './components/qunicorn-service/qunicorn.apps.m
},
],
})
export class AppModule { }
export class AppModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -53,49 +53,49 @@ export class AlgorithmViewComponent implements OnInit, OnDestroy {
private utilService: UtilService,
private config: ApiConfiguration,
public guard: ChangePageGuard,
private planqkPlatformLoginService: PlanqkPlatformLoginService,
private planqkPlatformLoginService: PlanqkPlatformLoginService
) {}

ngOnInit(): void {
this.planqkPlatformLoginService
this.planqkPlatformLoginService
.isLoggedIn()
.subscribe((loggedIn: boolean) => {
if (loggedIn) {
if (loggedIn) {
this.config.rootUrl = 'https://platform.planqk.de/qc-catalog';
} else {
}
this.loadAlgorithm();
this.loadAlgorithm();
});
}

loadAlgorithm() {

Check warning on line 71 in src/app/components/algorithms/algorithm-view/algorithm-view.component.ts

View workflow job for this annotation

GitHub Actions / Run linters

Missing return type on function
this.routeSub = this.route.params.subscribe(({ algoId }) => {
this.algorithmService.getAlgorithm({ algorithmId: algoId }).subscribe(
(algo: AlgorithmDto) => {
this.algorithm = algo;
this.frontendAlgorithm = JSON.parse(
JSON.stringify(algo)
) as AlgorithmDto;
let subheading = this.algorithm.computationModel
.toString()
.toLowerCase();
subheading = subheading[0].toUpperCase() + subheading.slice(1);
this.links[0] = {
heading: this.createBreadcrumbHeader(this.algorithm),
subHeading: subheading + ' Algorithm',
};
this.getApplicationAreasForAlgorithm(algoId);
this.getProblemTypesForAlgorithm(algoId);
this.getTagsForAlgorithm(algoId);
this.fetchRevisions();
},
() => {
this.utilService.callSnackBar(
'Error! Algorithm could not be retrieved.'
);
}
);
});
this.routeSub = this.route.params.subscribe(({ algoId }) => {
this.algorithmService.getAlgorithm({ algorithmId: algoId }).subscribe(
(algo: AlgorithmDto) => {
this.algorithm = algo;
this.frontendAlgorithm = JSON.parse(
JSON.stringify(algo)
) as AlgorithmDto;
let subheading = this.algorithm.computationModel
.toString()
.toLowerCase();
subheading = subheading[0].toUpperCase() + subheading.slice(1);
this.links[0] = {
heading: this.createBreadcrumbHeader(this.algorithm),
subHeading: subheading + ' Algorithm',
};
this.getApplicationAreasForAlgorithm(algoId);
this.getProblemTypesForAlgorithm(algoId);
this.getTagsForAlgorithm(algoId);
this.fetchRevisions();
},
() => {
this.utilService.callSnackBar(
'Error! Algorithm could not be retrieved.'
);
}
);
});
}

changeTab(tabNumber: number): void {
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/navigation/navigation.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class NavigationComponent implements OnInit {
private config: ApiConfiguration,
private utilService: UtilService,
private planqkPlatformLoginService: PlanqkPlatformLoginService
) { }
) {}

ngOnInit(): void {
this.breakpointObserver
Expand All @@ -48,7 +48,7 @@ export class NavigationComponent implements OnInit {
if (loggedIn) {
this.bearerTokenSet = true;
this.config.rootUrl = 'https://platform.planqk.de/qc-catalog';
//this.reloadStartPage();
// this.reloadStartPage();
this.utilService.callSnackBar(
'Successfully logged into the PlanQK platform.'
);
Expand All @@ -62,7 +62,7 @@ export class NavigationComponent implements OnInit {
this.router.navigate(['/']);
}

onSettings(): void { }
onSettings(): void {}

login(): void {
if (!this.bearerTokenSet) {
Expand Down
157 changes: 89 additions & 68 deletions src/app/components/on-demand-execution/ondemand.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,104 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
// Redudant, can be removed or later refined and used as a module

@Component({
selector: 'app-ondemand',
templateUrl: './ondemand.component.html',
styleUrls: ['./ondemand.component.css'],
selector: 'app-ondemand',
templateUrl: './ondemand.component.html',
styleUrls: ['./ondemand.component.css'],
})
export class OnDemandComponent {
response: any;
jobResponse: any;
deploymentResponse: any;
deviceResponse: any;
result: any;
response: any;
jobResponse: any;
deploymentResponse: any;
deviceResponse: any;
result: any;

constructor(private http: HttpClient) { }
constructor(private http: HttpClient) {}

getJobs() {
this.http.get('http://localhost:8080/jobs/', { headers: { accept: 'application/json' } })
.subscribe((data: any) => {
this.response = JSON.stringify(data);
}, (error: any) => {
this.response = 'Error occurred while making the request.';
});
}
getJobs() {
this.http
.get('http://localhost:8080/jobs/', {
headers: { accept: 'application/json' },
})
.subscribe(
(data: any) => {
this.response = JSON.stringify(data);
},
(error: any) => {
this.response = 'Error occurred while making the request.';
}
);
}

submitDeployment() {
const headers = new HttpHeaders()
.set('accept', 'application/json')
.set('Content-Type', 'application/json');

submitDeployment() {
const headers = new HttpHeaders()
.set('accept', 'application/json')
.set('Content-Type', 'application/json');
const requestBody = {
programs: [
{
quantumCircuit:
'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[2];\ncreg meas[2];\nh q[0];\ncx q[0],q[1];\nbarrier q[0],q[1];\nmeasure q[0] -> meas[0];\n \
measure q[1] -> meas[1];\n',
assemblerLanguage: 'QASM2',
},
],
name: 'SeQuenC-UseCase',
};

const requestBody = {
programs: [
{
quantumCircuit: "OPENQASM 2.0;\ninclude \"qelib1.inc\";\nqreg q[2];\ncreg meas[2];\nh q[0];\ncx q[0],q[1];\nbarrier q[0],q[1];\nmeasure q[0] -> meas[0];\nmeasure q[1] -> meas[1];\n (Note: if you have qrisp/qiskit as your assembler language add 'circuit =' to the beginning of your quantumCircuit string)",
assemblerLanguage: "QASM2"
}
],
name: "SeQuenC-UseCase"
};
this.http
.post('http://localhost:8080/deployments/', requestBody, {
headers,
})
.subscribe(
(data: any) => {
this.deploymentResponse = JSON.stringify(data, null, 2);
},
(error: any) => {
this.deploymentResponse = 'Error occurred while making the request.';
}
);
}

this.http.post('http://localhost:8080/deployments/', requestBody, { headers: headers })
.subscribe((data: any) => {
this.deploymentResponse = JSON.stringify(data, null, 2);
}, (error: any) => {
this.deploymentResponse = 'Error occurred while making the request.';
});
}
invokeJob() {
const headers = new HttpHeaders()
.set('accept', 'application/json')
.set('Content-Type', 'application/json');

invokeJob() {
const headers = new HttpHeaders()
.set('accept', 'application/json')
.set('Content-Type', 'application/json');

const requestBody = {
name: "JobName",
providerName: "IBM",
deviceName: "aer_simulator",
shots: 4000,
token: "",
type: "RUNNER",
deploymentId: 1
};

this.http.post('http://localhost:8080/jobs/', requestBody, { headers: headers })
.subscribe((data: any) => {
this.jobResponse = JSON.stringify(data, null, 2);
}, (error: any) => {
this.jobResponse = 'Error occurred while making the request.';
});
}

getResults() {
this.http.get('http://localhost:8080/jobs/3/', { headers: { accept: 'application/json' } })
.subscribe((data: any) => {
this.result = JSON.stringify(data, null, 2);
}, (error: any) => {
this.result = 'Error occurred while making the request.';
});
}
const requestBody = {
name: 'JobName',
providerName: 'IBM',
deviceName: 'aer_simulator',
shots: 4000,
token: '',
type: 'RUNNER',
deploymentId: 1,
};

this.http
.post('http://localhost:8080/jobs/', requestBody, { headers })
.subscribe(
(data: any) => {
this.jobResponse = JSON.stringify(data, null, 2);
},
(error: any) => {
this.jobResponse = 'Error occurred while making the request.';
}
);
}

getResults() {
this.http
.get('http://localhost:8080/jobs/3/', {
headers: { accept: 'application/json' },
})
.subscribe(
(data: any) => {
this.result = JSON.stringify(data, null, 2);
},
(error: any) => {
this.result = 'Error occurred while making the request.';
}
);
}
}
Loading

0 comments on commit acd95da

Please sign in to comment.