Skip to content

Commit

Permalink
Revert "Added developer portal type header for all requests (#2171)" (#…
Browse files Browse the repository at this point in the history
…2193)

This reverts commit ef4b854.
  • Loading branch information
harunrst authored Jun 1, 2023
1 parent 9993be4 commit 6df1119
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 38 deletions.
2 changes: 0 additions & 2 deletions src/apim.design.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import { RuntimeConfigurator } from "./services/runtimeConfigurator";
import { CustomHtmlDesignModule } from "./components/custom-html/customHtml.design.module";
import { CustomWidgetDesignModule } from "./components/custom-widget/customWidget.design.module";
import { CodeEditor } from "./components/code-editor/code-editor";
import { NodeHttpClient } from "./http/nodeHttpClient";

export class ApimDesignModule implements IInjectorModule {
public register(injector: IInjector): void {
Expand Down Expand Up @@ -142,7 +141,6 @@ export class ApimDesignModule implements IInjectorModule {
injector.bindToCollection("autostart", RuntimeConfigurator);
injector.bindSingleton("sessionManager", DefaultSessionManager);
injector.bind("CodeEditor", CodeEditor);
injector.bind("httpClient", NodeHttpClient);
injector.bindModule(new CustomWidgetListModule()); // needs "blobStorage"
injector.bindModule(new ContentModule());
injector.bindModule(new HelpModule());
Expand Down
6 changes: 2 additions & 4 deletions src/apim.publish.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ import { CustomHtmlPublishModule } from "./components/custom-html/customHtml.pub
import { CustomWidgetPublishModule } from "./components/custom-widget/customWidget.publish.module";
import { StaticDataHttpClient } from "./services/staticDataHttpClient";
import { PublisherStaticDataProvider } from "./services/publisherStaticDataProvider";
import { staticDataEnvironment, mockStaticDataEnvironment } from "./../environmentConstants";
import { NodeHttpClient } from "./http/nodeHttpClient";
import { staticDataEnvironment,mockStaticDataEnvironment } from "./../environmentConstants";

export class ApimPublishModule implements IInjectorModule {
public register(injector: IInjector): void {
Expand Down Expand Up @@ -87,8 +86,7 @@ export class ApimPublishModule implements IInjectorModule {
injector.bindSingleton("runtimeConfigBuilder", RuntimeConfigBuilder);
injector.bindToCollection("publishers", AadConfigPublisher);
injector.bindToCollection("publishers", RuntimeConfigPublisher);
injector.bind("httpClient", NodeHttpClient);


if (process.env.NODE_ENV === staticDataEnvironment || process.env.NODE_ENV === mockStaticDataEnvironment) {
injector.bind("httpClient", StaticDataHttpClient);
injector.bind("dataProvider", PublisherStaticDataProvider);
Expand Down
2 changes: 0 additions & 2 deletions src/apim.runtime.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ import { StaticDataHttpClient } from "./services/staticDataHttpClient";
import { TagService } from "./services/tagService";
import { TenantService } from "./services/tenantService";
import { UsersService } from "./services/usersService";
import { NodeHttpClient } from "./http/nodeHttpClient";


export class ApimRuntimeModule implements IInjectorModule {
Expand Down Expand Up @@ -162,7 +161,6 @@ export class ApimRuntimeModule implements IInjectorModule {
injector.bindToCollection("autostart", AccessTokenRefrsher);
injector.bind("pagination", Pagination);
injector.bind("oauthServerConfiguration", OauthServerConfiguration);
injector.bind("httpClient", NodeHttpClient);
injector.bindModule(new CustomWidgetRuntimeModule());
injector.bindModule(new RoleBasedSecurityRuntimeModule());

Expand Down
4 changes: 2 additions & 2 deletions src/components/apis/list-of-apis/ko/runtime/api-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

<!-- ko if: apiGroups().length === 0 -->
<div class="table-row" role="row">
<div class="col-12" role="cell">
<div class="col-12">
No APIs found
</div>
</div>
Expand Down Expand Up @@ -114,7 +114,7 @@

<!-- ko if: apis().length === 0 -->
<div class="table-row" role="row">
<div class="col-12" role="cell">
<div class="col-12">
No APIs found
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/configuration/apimSettingsProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Objects from "@paperbits/common/objects";
import { EventManager } from "@paperbits/common/events";
import { XmlHttpRequestClient } from "@paperbits/common/http";
import { HttpClient } from "@paperbits/common/http";
import { ISettingsProvider } from "@paperbits/common/configuration";
import { SessionManager } from "@paperbits/common/persistence/sessionManager";

Expand All @@ -9,6 +9,7 @@ export class ApimSettingsProvider implements ISettingsProvider {
private initializePromise: Promise<void>;

constructor(
private readonly httpClient: HttpClient,
private readonly eventManager: EventManager,
private readonly sessionManager: SessionManager
) { }
Expand All @@ -21,8 +22,7 @@ export class ApimSettingsProvider implements ISettingsProvider {
}

private async loadSettings(): Promise<void> {
const httpClient = new XmlHttpRequestClient();
const commonConfigurationResponse = await httpClient.send<any>({ url: "/config.json" });
const commonConfigurationResponse = await this.httpClient.send<any>({ url: "/config.json" });
const commonConfiguration = commonConfigurationResponse.toObject();

const searializedDesignTimeSettings = await this.sessionManager?.getItem("designTimeSettings");
Expand All @@ -32,7 +32,7 @@ export class ApimSettingsProvider implements ISettingsProvider {
Object.assign(commonConfiguration, designTimeSettings);
}
else {
const apimsConfigurationResponse = await httpClient.send<any>({ url: "/config-apim.json" });
const apimsConfigurationResponse = await this.httpClient.send<any>({ url: "/config-apim.json" });

if (apimsConfigurationResponse.statusCode === 200) {
const apimConfiguration = apimsConfigurationResponse.toObject();
Expand Down
24 changes: 0 additions & 24 deletions src/http/nodeHttpClient.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/logging/clientLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ export class ClientLogger implements Logger {
clientEvent.timestamp = datetime.toISOString();
clientEvent.activityId = uuidv4();

const developerPortalType = await this.settingsProvider.getSetting<string>(Constants.SettingNames.developerPortalType) || Constants.DeveloperPortalType.selfHosted;

const headers: HttpHeader[] = [];
headers.push({ name: "client-version", value: this.clientVersion });
headers.push({ name: "developer-portal-type", value: developerPortalType });

const request: HttpRequest = {
url: await this.getBackendUrl() + `/trace`,
Expand Down

0 comments on commit 6df1119

Please sign in to comment.