Skip to content

Commit

Permalink
Monitoring fix to show error on UI if host call fails (#2542)
Browse files Browse the repository at this point in the history
* only show error if host call is successful

* Small mon fix to gracefully faily Mon UI if host information is not retrieved.
  • Loading branch information
nertim committed Apr 12, 2018
1 parent bce5f6f commit 6025494
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { FunctionInvocations } from '../shared/models/function-monitor';
import { PortalResources } from '../shared/models/portal-resources';
import { PortalService } from './../shared/services/portal.service';
import { CacheService } from './../shared/services/cache.service';
import { BroadcastService } from 'app/shared/services/broadcast.service';
import { DashboardType } from 'app/tree-view/models/dashboard-type';
import { BaseFunctionComponent } from '../shared/components/base-function-component';
import { ExtendedTreeViewInfo } from '../shared/components/navigable-component';
Expand Down Expand Up @@ -43,7 +42,6 @@ export class FunctionMonitorComponent extends BaseFunctionComponent {
private _translateService: TranslateService,
private _portalService: PortalService,
private _cacheService: CacheService,
broadcastService: BroadcastService,
private _scenarioService: ScenarioService,
injector: Injector
) {
Expand Down Expand Up @@ -111,7 +109,19 @@ export class FunctionMonitorComponent extends BaseFunctionComponent {
this.errorsAggregateHeading = `${this._translateService.instant(PortalResources.functionMonitor_errorsAggregate)} ${firstOfMonth.format('MMM Do')}`;

return this._functionAppService.getFunctionHostStatus(this.context)
.flatMap(host => this._functionMonitorService.getDataForSelectedFunction(this.context, this.currentFunction, host.isSuccessful ? host.result.id : ''))
.flatMap(host => {
if (host.isSuccessful) {
return this._functionMonitorService.getDataForSelectedFunction(this.context, this.currentFunction, host.result.id);
} else {
this.showComponentError({
errorId: host.error.errorId,
message: this._translateService.instant(PortalResources.monitorHostFetchFailed),
resourceId: this.context.site.id
});

return Observable.of(null);
}
})
.flatMap(data => {
this.functionId = !!data ? data.functionId : '';
this.successAggregate = !!data ? data.successCount.toString() : this._translateService.instant(PortalResources.appMonitoring_noData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,4 +1006,5 @@
public static pricingTier: string = "pricingTier";
public static deploymentCenterTitle: string = "deploymentCenterTitle";
public static deploymentCenterDesc: string = "deploymentCenterDesc";
public static monitorHostFetchFailed: string = "monitorHostFetchFailed";
}
3 changes: 3 additions & 0 deletions AzureFunctions/ResourcesPortal/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3154,4 +3154,7 @@ Set to "External URL" to use an API definition that is hosted elsewhere.</value>
<data name="deploymentCenterDesc" xml:space="preserve">
<value>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</value>
</data>
<data name="monitorHostFetchFailed" xml:space="preserve">
<value>The call to get Host information failed.</value>
</data>
</root>

0 comments on commit 6025494

Please sign in to comment.