Skip to content

Commit

Permalink
feat(ng-yasgui): adding condition to execute the query on click via p…
Browse files Browse the repository at this point in the history
…arent
  • Loading branch information
srikanth committed Dec 7, 2023
1 parent 94e41d8 commit a31c01e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libs/ng-yasgui/src/lib/components/yasgui/yasgui.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export class YasguiComponent implements OnInit, OnChanges, OnDestroy {
@Input()
query?: string;

@Input()
isQueryExecuted = false;

@ViewChild('yasgui', { static: true })
yasguiRef!: ElementRef;

Expand Down Expand Up @@ -58,6 +61,14 @@ export class YasguiComponent implements OnInit, OnChanges, OnDestroy {
if (this.yasgui.current().yasqe.getValue() !== this.query) {
this.yasgui.current().yasqe.setValue(this.query);
}

if (this.isQueryExecuted && this.options?.yasqe) {
this.yasgui.current().yasqe.query({
url: this.options.yasqe.sparql,
reqMethod: 'POST',
args: { arg1: this.query },
});
}
}

private async createYasgui(): Promise<Yasgui> {
Expand Down
1 change: 1 addition & 0 deletions libs/ng-yasgui/src/lib/models/yasgui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface Yasqe {
getValue(): string;
on(event: string | 'change', handler: (e: any) => void): void;
setOption(option: any): void;
query: Function;
}

// http://doc.yasgui.org/doc/#clientConfig
Expand Down

0 comments on commit a31c01e

Please sign in to comment.