rep monitoring: disable requests to defunct ninja api until an alternative is available, hide recommended representatives section
This commit is contained in:
parent
70a33cb0be
commit
524d17dc9b
2 changed files with 18 additions and 9 deletions
|
|
@ -188,26 +188,24 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-controls">
|
||||
<!-- <div class="uk-form-controls">
|
||||
<div class="uk-inline uk-width-1-1 uk-margin-top">
|
||||
<button class="uk-button uk-button-default uk-button-small" *ngIf="showRecommendedReps" (click)="showRecommendedReps = !showRecommendedReps"><span uk-icon="icon: minus; ratio: 0.8" style="margin-right: 5px;"></span> Hide Recommended Representatives</button>
|
||||
<button class="uk-button uk-button-primary uk-button-small" *ngIf="!showRecommendedReps" (click)="showRecommendedReps = !showRecommendedReps"><span uk-icon="icon: plus; ratio: 0.8" style="margin-right: 5px;"></span> View Recommended Representatives</button>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div *ngIf="showRecommendedReps">
|
||||
<!-- <div *ngIf="showRecommendedReps">
|
||||
<hr>
|
||||
|
||||
<div class="uk-margin">
|
||||
<p class="uk-text-lead uk-text-center">Select a representative recommended by <a href="https://mynano.ninja" target="_blank" rel="noopener noreferrer" class="uk-link-text">MyNanoNinja</a></p>
|
||||
<!--<h4>Or, Select a recommended representative</h4>-->
|
||||
<ul class="uk-list uk-list-striped" style="margin-bottom: 0;">
|
||||
<li class="uk-list-header">
|
||||
<div uk-grid>
|
||||
<div class="uk-width-expand">Representative</div>
|
||||
<div class="uk-width-1-2">Weight / Uptime / Accounts</div>
|
||||
<!--<div class="uk-width-1-5">Uptime / Delegators</div>-->
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -242,7 +240,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@ import { UtilService } from './util.service';
|
|||
@Injectable()
|
||||
export class NinjaService {
|
||||
|
||||
// URL to Ninja API
|
||||
ninjaUrl = 'https://mynano.ninja/api/';
|
||||
// URL to MyNanoNinja-compatible representative health check API
|
||||
// set to empty string to disable
|
||||
ninjaUrl = '';
|
||||
|
||||
// null - loading, false - offline, true - online
|
||||
status = null;
|
||||
|
|
@ -15,6 +16,10 @@ export class NinjaService {
|
|||
constructor(private http: HttpClient, private notifications: NotificationService, private util: UtilService) { }
|
||||
|
||||
private async request(action): Promise<any> {
|
||||
if (this.ninjaUrl === '') {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
return await this.http.get(this.ninjaUrl + action).toPromise()
|
||||
.then(res => {
|
||||
return res;
|
||||
|
|
@ -62,8 +67,14 @@ export class NinjaService {
|
|||
return replist[0];
|
||||
}
|
||||
|
||||
// false - does not exist, null - any other error
|
||||
// Expected to return:
|
||||
// false, if the representative never voted as part of nano consensus
|
||||
// null, if the representative state is unknown (any other error)
|
||||
async getAccount(account: string): Promise<any> {
|
||||
if (this.ninjaUrl === '') {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
const REQUEST_TIMEOUT_MS = 10000;
|
||||
|
||||
const successPromise =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue