Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added http request handler #2550

Merged
merged 24 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/altair-api-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@altairgraphql/db": "^7.1.0",
"altair-graphql-core": "^7.1.0",
"ky": "^0.33.2",
"rxjs": "^6.6.7"
"rxjs": "^7.0.0"
},
"devDependencies": {
"typescript": "5.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/altair-api-utils/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class APIClient {
ky: KyInstance;
authToken?: string;

user$ = new Subject<IUserProfile>();
user$ = new Subject<IUserProfile | undefined>();
private _user?: IUserProfile;
get user() {
return this._user;
Expand Down
2 changes: 1 addition & 1 deletion packages/altair-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"pino-http": "^8.5.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^5.0.5",
"rxjs": "^7.2.0",
"rxjs": "^7.0.0",
"stripe": "^13.7.0",
"swagger-ui-express": "^4.5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/altair-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"ngx-toastr": "^18.0.0",
"object-path": "0.11.5",
"prettier": "^3.2.5",
"rxjs": "6.6.7",
"rxjs": "^7.0.0",
"sanitize-html": "2.7.1",
"subscriptions-transport-ws": "0.9.19",
"sval": "0.4.8",
Expand Down
5 changes: 4 additions & 1 deletion packages/altair-app/src/app/modules/altair/altair.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ const providers = [
services.PluginEventService,
services.PreRequestService,
services.ThemeRegistryService,
services.SubscriptionProviderRegistryService,
services.PluginContextService,
services.QueryService,
services.AccountService,
services.SharingService,
services.FilesService,
services.RequestHandlerRegistryService,
// Setting the reducer provider in main.ts now (for proper config initialization)
// reducerProvider,
CookieService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
<div class="action-bar">
<button class="app-button prettify-button" (click)="this.prettifyCodeChange.next()">
<button
class="app-button prettify-button"
(click)="this.prettifyCodeChange.emit()"
>
{{ 'PRETTIFY_BUTTON' | translate }}
</button>
<button class="app-button clear-editor-button" (click)="this.clearEditorChange.next()">
<button
class="app-button clear-editor-button"
(click)="this.clearEditorChange.emit()"
>
{{ 'CLEAR_BUTTON' | translate }}
</button>
<button class="app-button set-headers-button" (click)="this.toggleHeaderDialog.next()">
<button
class="app-button set-headers-button"
(click)="this.toggleHeaderDialog.emit()"
>
{{ 'SET_HEADERS_BUTTON' | translate }}
</button>
<button class="app-button set-variables-button" (click)="this.toggleVariableDialog.next()">
<button
class="app-button set-variables-button"
(click)="this.toggleVariableDialog.emit()"
>
{{ 'SET_VARIABLES_BUTTON' | translate }}
</button>
<button class="app-button set-subscription-url-button" (click)="this.toggleSubscriptionUrlDialog.next()">
<button
class="app-button set-subscription-url-button"
(click)="this.toggleSubscriptionUrlDialog.emit()"
>
{{ 'SUBSCRIPTION_URL_TEXT' | translate }}
</button>
<div class="actions-right right">
<button class="app-button reload-docs-button" (click)="reloadDocsChange.next()">
<button class="app-button reload-docs-button" (click)="reloadDocsChange.emit()">
{{ 'RELOAD_DOCS_BUTTON' | translate }}
</button>
<button
class="app-button show-docs-button"
(click)="toggleDocsChange.next()"
(click)="toggleDocsChange.emit()"
[ngClass]="{ 'active-grey': showDocs }"
>
{{ 'SHOW_DOCS_BUTTON' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { UrlBoxComponent } from './url-box/url-box.component';
import { SetVariableDialogComponent } from './set-variable-dialog/set-variable-dialog.component';
import { ForkRepoComponent } from './fork-repo/fork-repo.component';
import { WindowSwitcherComponent } from './window-switcher/window-switcher.component';
import { SubscriptionUrlDialogComponent } from './subscription-url-dialog/subscription-url-dialog.component';
import { SubscriptionResultItemComponent } from './subscription-result-item/subscription-result-item.component';
import { HistoryDialogComponent } from './history-dialog/history-dialog.component';
import { SettingsDialogComponent } from './settings-dialog/settings-dialog.component';
import { ImportCurlDialogComponent } from './import-curl-dialog/import-curl-dialog.component';
Expand All @@ -41,7 +39,6 @@ import { CodemirrorComponent } from './codemirror/codemirror.component';
import { ConfirmToastComponent } from './confirm-toast/confirm-toast.component';
import { XInputComponent } from './x-input/x-input.component';
import { BetaIndicatorComponent } from './beta-indicator/beta-indicator.component';
import { LoaderComponent } from './loader/loader.component';
import { TagComponent } from './tag/tag.component';
import { TeamsDialogComponent } from './teams-dialog/teams-dialog.component';
import { UpgradeDialogComponent } from './upgrade-dialog/upgrade-dialog.component';
Expand All @@ -52,6 +49,8 @@ import { AuthorizationBasicComponent } from './authorization/authorization-basic
import { AuthorizationApikeyComponent } from './authorization/authorization-apikey/authorization-apikey.component';
import { AuthorizationOauth2Component } from './authorization/authorization-oauth2/authorization-oauth2.component';
import { RequestExtensionsDialogComponent } from './request-extensions-dialog/request-extensions-dialog.component';
import { RequestHandlerDialogComponent } from './request-handler-dialog/request-handler-dialog.component';
import { TipsComponent } from './tips/tips.component';

// const STANDALONE_COMPONENTS = [];
const COMPONENTS = [
Expand All @@ -62,8 +61,6 @@ const COMPONENTS = [
SetVariableDialogComponent,
ForkRepoComponent,
WindowSwitcherComponent,
SubscriptionUrlDialogComponent,
SubscriptionResultItemComponent,
UrlBoxComponent,
HistoryDialogComponent,
SettingsDialogComponent,
Expand All @@ -88,12 +85,13 @@ const COMPONENTS = [
ConfirmToastComponent,
XInputComponent,
BetaIndicatorComponent,
LoaderComponent,
TagComponent,
TeamsDialogComponent,
QueryRevisionDialogComponent,
UpgradeDialogComponent,
RequestExtensionsDialogComponent,
RequestHandlerDialogComponent,
TipsComponent,
AuthorizationEditorComponent,
AuthorizationApikeyComponent,
AuthorizationBearerComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<nz-modal
[nzVisible]="showDialog"
(nzVisibleChange)="toggleDialog.next($event)"
(nzVisibleChange)="toggleDialog.emit($event)"
[nzCloseIcon]="'close-circle'"
[nzTitle]="showHeader ? modalTitle : null"
[nzContent]="modalContent"
[nzFooter]="showFooter ? modalFooter : null"
[nzWidth]="width"
(nzOnCancel)="toggleDialog.next()"
(nzOnCancel)="toggleDialog.emit()"
>
<ng-template #modalTitle>
<div class="app-dialog-header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
{{ 'DOCS_EXPORT_SDL' | translate }}
</li>
}
<li nz-menu-item (click)="loadSchemaChange.next()">
<li nz-menu-item (click)="loadSchemaChange.emit()">
{{ 'DOCS_LOAD_SCHEMA' | translate }}...
</li>
</ul>
</nz-dropdown-menu>
<div
class="doc-viewer-navigation__option"
(click)="toggleDocsChange.next()"
(click)="toggleDocsChange.emit()"
>
<app-icon name="x"></app-icon>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,10 @@ export class DocViewerComponent implements OnChanges {
const docUtils = await this.getDocUtilsWorker();
this.autocompleteOptions = await docUtils.searchDocs(term);
}
debouncedFilterAutocompleteOptions = debounce(
this.filterAutocompleteOptions,
300
);
debouncedFilterAutocompleteOptions = debounce(this.filterAutocompleteOptions, 300);

setDocView(docView?: DocView) {
this.setDocViewChange.next(docView);
this.setDocViewChange.emit(docView);
if (this.docViewerRef) {
this.docViewerRef.nativeElement.scrollTop = 0;
}
Expand Down Expand Up @@ -198,14 +195,10 @@ export class DocViewerComponent implements OnChanges {
return false;
}
const docUtilsWorker = await this.getDocUtilsWorker();
const generatedQuery = await docUtilsWorker.generateQueryV2(
name,
parentType,
{
tabSize: this.tabSize,
addQueryDepthLimit: this.addQueryDepthLimit,
}
);
const generatedQuery = await docUtilsWorker.generateQueryV2(name, parentType, {
tabSize: this.tabSize,
addQueryDepthLimit: this.addQueryDepthLimit,
});
if (generatedQuery) {
this.addQueryToEditorChange.next(generatedQuery);
}
Expand All @@ -224,7 +217,7 @@ export class DocViewerComponent implements OnChanges {
}

exportSDL() {
this.exportSDLChange.next();
this.exportSDLChange.emit();
}

async getDocUtilsWorker() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,8 @@ import {
} from 'altair-graphql-core/build/types/state/environments.interfaces';
import { Extension } from '@codemirror/state';
import { json, jsonParseLinter } from '@codemirror/lang-json';
import { TODO } from 'altair-graphql-core/build/types/shared';
import { linter } from '@codemirror/lint';
import { CdkDragDrop } from '@angular/cdk/drag-drop';
(window as any).jsonlint = (window as any).jsonlint || {
parser: <TODO>{
parse: function (str: string) {
try {
return JSON.parse(str);
} catch (err) {
if (this.parseError) {
this.parseError('Invalid JSON', {
loc: {
first_line: 1,
first_column: 1,
last_line: 1,
last_column: 1,
},
});
}
}
},
},
};

@Component({
selector: 'app-environment-manager',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export class HistoryDialogComponent {
constructor() {}

restoreHistory(index: number) {
this.restoreHistoryChange.next(index);
this.toggleDialogChange.next();
this.restoreHistoryChange.emit(index);
this.toggleDialogChange.emit();
}

clearHistory() {
this.clearHistoryChange.next();
this.clearHistoryChange.emit();
}

trackByIndex(index: number, h: History) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ export class QueryCollectionItemComponent {

deleteQuery(query: IQuery) {
this.modal.confirm({
nzTitle:
'Are you sure you want to delete this query from the collection?',
nzTitle: 'Are you sure you want to delete this query from the collection?',
nzContent: 'Note: This is an irreversible action.',
nzOkText: 'Yes',
nzCancelText: 'Cancel',
nzOnOk: () => {
if (this.collectionTree) {
this.deleteQueryChange.next({
this.deleteQueryChange.emit({
query,
collectionId: this.collectionTree.id,
});
Expand All @@ -75,7 +74,7 @@ export class QueryCollectionItemComponent {
}

showQueryRevisionsDialog(query: IQuery) {
this.showQueryRevisionsChange.next(query.id);
this.showQueryRevisionsChange.emit(query.id);
}

deleteCollection() {
Expand All @@ -86,7 +85,7 @@ export class QueryCollectionItemComponent {
nzCancelText: 'Cancel',
nzOnOk: () => {
if (this.collectionTree) {
this.deleteCollectionChange.next({
this.deleteCollectionChange.emit({
collectionId: this.collectionTree.id,
});
}
Expand All @@ -98,21 +97,21 @@ export class QueryCollectionItemComponent {
if (!this.collectionTree) {
throw new Error('should never happen');
}
this.editCollectionChange.next({ collection: this.collectionTree });
this.editCollectionChange.emit({ collection: this.collectionTree });
}

syncCollection() {
if (!this.collectionTree) {
throw new Error('should never happen');
}
this.syncCollectionChange.next({ collection: this.collectionTree });
this.syncCollectionChange.emit({ collection: this.collectionTree });
}

exportCollection() {
if (!this.collectionTree) {
throw new Error('should never happen');
}
this.exportCollectionChange.next({
this.exportCollectionChange.emit({
collectionId: this.collectionTree.id,
});
}
Expand Down
Loading
Loading