Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stackle-app/src/app/secure/secure.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ <h5 class="mat-h5">By Opensource, For Opensource</h5>
<div class="example-container">
<form>
<mat-form-field>
<input matInput placeholder="Stack Name">
<input matInput placeholder="Stack Name" [(ngModel)]="stackNameToSearch" name="stackNameText">
</mat-form-field>
<button mat-button color="primary" type="submit">
<button mat-button color="primary" type="submit" (click)="onSearchSubmit()">
<mat-icon matListIcon>search</mat-icon>
Search
</button>
Expand Down
17 changes: 17 additions & 0 deletions stackle-app/src/app/secure/secure.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class SecureComponent implements OnInit {

private subscribedStacks = [];
private userAvatarUrl;
public stackNameToSearch: String;
public stackInfo: any;

constructor(
private auth: AuthService,
Expand Down Expand Up @@ -59,4 +61,19 @@ export class SecureComponent implements OnInit {
this.router.navigate(['app/stack'], { queryParams: { name: stackName }});
}

public onSearchSubmit(){
let stackToSearch = {
stackName: this.stackNameToSearch
};
console.log(stackToSearch);
this.stackService.getStack(stackToSearch.stackName).subscribe((res)=>{
console.log(res);
if(res.success){
this.stackInfo = res.result;
}
}, (err)=>{
console.log(err);
});
}

}
5 changes: 5 additions & 0 deletions stackle-app/src/app/services/stack.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,9 @@ export class StackService {

}

public getStack(stackName){
return this.http.get(`${this.apiUrl}/api/org/name/${stackName}`)
.map((res: Response) => res.json())
.catch((error: any) => Observable.throw(error.json().error) || 'Server error');
}
}