Skip to content

Commit

Permalink
Error state of non-existent API and Readability of subscription key (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hakashya authored Oct 20, 2020
1 parent 54370df commit 43bcfd1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ <h1>
data-bind="options: versionApis, optionsValue: 'name', optionsText: 'apiVersion', value: currentApiVersion">
</select>
<!-- /ko -->
<select id="apiDefinitions" class="form-control" aria-label="API definitions" data-bind="value: downloadSelected">
<select id="apiDefinitions" class="form-control" aria-label="API definitions"
data-bind="value: downloadSelected">
<option value="" disabled="disabled" selected="selected">API definition</option>
<option value="openapi">Open API 3 (YAML)</option>
<option value="openapi+json">Open API 3 (JSON)</option>
Expand All @@ -44,8 +45,9 @@ <h1>
<!-- /ko -->

<!-- ko ifnot: api -->
<p>No API selected</p>
<p>The specified API does not exist.</p>
<!-- /ko -->

</div>
<!-- /ko -->

Expand Down
11 changes: 7 additions & 4 deletions src/components/apis/details-of-api/ko/runtime/api-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ export class ApiDetails {
return;
}

this.working(true);

const api = await this.apiService.getApi(`apis/${apiName}`);
if (!api) {
this.api(null);
return;
}

this.working(true);
if (api.apiVersionSet && api.apiVersionSet.id) {
const apis = await this.apiService.getApisInVersionSet(api.apiVersionSet.id);
apis.forEach(x => x.apiVersion = x.apiVersion || "Original");
Expand Down Expand Up @@ -148,7 +151,7 @@ export class ApiDetails {

private onVersionChange(selectedApiName: string): void {
const apiName = this.routeHelper.getApiName();
if(apiName !== selectedApiName) {
if (apiName !== selectedApiName) {
const apiUrl = this.routeHelper.getApiReferenceUrl(selectedApiName);
this.router.navigateTo(apiUrl);
}
Expand All @@ -162,4 +165,4 @@ export class ApiDetails {
public dispose(): void {
this.router.removeRouteChangeListener(this.onRouteChange);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,14 @@ export class OperationConsole {
}

keys.push({
name: `Primary-${subscription.primaryKey.substr(0, 4)}`,
name: `Primary: ${((subscription.name == null) || (subscription.name.trim()) ? subscription.name : subscription.primaryKey.substr(0, 4))}`,
//name: `Primary-${subscription.primaryKey.substr(0, 4)}`,
value: subscription.primaryKey
});

keys.push({
name: `Secondary-${subscription.secondaryKey.substr(0, 4)}`,
name: `Secondary: ${((subscription.name == null) || (subscription.name.trim()) ? subscription.name : subscription.secondaryKey.substr(0, 4))}`,
//name: `Secondary-${subscription.secondaryKey.substr(0, 4)}`,
value: subscription.secondaryKey
});
});
Expand Down

0 comments on commit 43bcfd1

Please sign in to comment.