Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sondreb committed Jul 23, 2022
1 parent 13b81cb commit be7b9d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ <h2>Configure API</h2>

<div *ngIf="indexers">
<h4>Discovered Indexers</h4>
<div class="scrollable" appDetectScroll (onScroll)="onScroll($event)" [bottomOffset]="400" [topOffset]="400">
<div>
<!-- <div class="grid-list-configure-api" *ngFor="let items of endpoints"> -->
<!-- <span class=""><strong>{{items.Source}}</strong></span> -->
<div class="grid-list-configure-api-inner" *ngFor="let indexer of indexers">
<span class=""><a class="link" (click)="saveDomain($event, indexer)" >{{indexer.domain}}</a></span>
<span class=""><a class="link" (click)="saveDomain(indexer)" >{{indexer.domain}}</a></span>
<span *ngIf="indexer.online == true" class="">online</span>
<span *ngIf="indexer.online != true" class="">offline</span>
</div>
Expand Down
70 changes: 18 additions & 52 deletions src/Blockcore.Explorer/ClientApp/src/app/api/api.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,60 +47,26 @@ export class ApiComponent {
}

async discover() {
// this.dnsendpoints = await BlockcoreDns.getDnsServers();
let chain = this.setup.current;

this.dns = new BlockcoreDns();
await this.dns.load();

this.indexers = this.dns.getOnlineServicesByNetwork(chain.toUpperCase());

// this.indexerProvider = new IndexerProvider();
// await this.indexerProvider.load();

// this.indexerProvider.setNetwork(chain.toUpperCase());

// // console.log(this.indexerProvider);
// // this.endpoints =
// // let chain = this.setup.current;

// this.indexers = await this.indexerProvider..getIndexersByNetwork(
// chain.toUpperCase()
// );

console.log(this.indexers);

// this.dns = new BlockcoreDns("");
// this.dns.setActiveServer();

// this.endpoints = [];

// for (let index = 0; index < this.dnsendpoints.length; index++) {
// const element = this.dnsendpoints[index];

// try {
// let res = await this.api.download(
// element["dns-server"] +
// "/api/dns/services/symbol/" +
// chain.toUpperCase() +
// "/service/Indexer"
// );

// res.Source = element["dns-server"];
// res.Source = res.Source.replace("https://", "");
// this.endpoints.push(res);
// } catch (err) {
// if (err.message[0] === "{") {
// this.errorMessage = JSON.parse(err.message);
// } else {
// this.errorMessage = err;
// }
// console.log(err);
// }
// }
try {
let chain = this.setup.current;

this.dns = new BlockcoreDns();
await this.dns.load();

this.indexers = this.dns.getOnlineServicesByNetwork(
chain.toUpperCase()
);
} catch (err) {
if (err.message[0] === "{") {
this.errorMessage = JSON.parse(err.message);
} else {
this.errorMessage = err;
}
console.log(err);
}
}

async saveDomain(event, item) {
async saveDomain(item) {
var domain = item.domain;
domain = "https://" + domain + "/api";
this.inputUrl = domain;
Expand Down

0 comments on commit be7b9d7

Please sign in to comment.