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

Staging #1646

Merged
merged 10 commits into from
Aug 21, 2021
Merged

Staging #1646

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ async function main() {
default: true,
},
]);
await inquirer.prompt([
{
type: 'confirm',
name: 'checkDocsUpdated',
message: 'Check that docs have been updated',
default: true,
},
]);
log('C\'est fini! 🎉');

} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion chrome-ext-files/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Altair GraphQL Client",
"short_name": "Altair",
"description": "The only graphQL client you'll ever need.",
"version": "4.0.7",
"version": "4.0.9",
"icons": {
"16": "assets/img/altair_logo_128.png",
"48": "assets/img/altair_logo_128.png",
Expand Down
2 changes: 1 addition & 1 deletion cwex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ manifestOptions:
name: Altair GraphQL Client
short_name: Altair
description: A beautiful feature-rich GraphQL client for all platforms
version: 4.0.7
version: 4.0.9
icons:
16: assets/img/altair_logo_128.png
48: assets/img/altair_logo_128.png
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "4.0.7",
"version": "4.0.9",
"registry": "https://registry.npmjs.org/",
"npmClient": "yarn",
"stream": true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "altair",
"version": "4.0.7",
"version": "4.0.9",
"license": "MIT",
"author": "Samuel Imolorhe <altair@sirmuel.design> (https://sirmuel.design/)",
"description": "The best graphQL client you will ever need",
Expand Down
7 changes: 4 additions & 3 deletions packages/altair-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "altair-app",
"version": "4.0.7",
"version": "4.0.9",
"description": "Contains the altair app",
"main": "dist/main.js",
"license": "MIT",
Expand Down Expand Up @@ -51,7 +51,7 @@
"@webcomponents/custom-elements": "^1.4.1",
"abab": "^2.0.5",
"actioncable": "^5.2.4-4",
"altair-graphql-core": "^4.0.7",
"altair-graphql-core": "^4.0.9",
"angular-feather": "^6.0.10",
"apollo-cache-inmemory": "^1.6.6",
"apollo-link": "^1.2.14",
Expand All @@ -73,7 +73,7 @@
"file-dialog": "^0.0.8",
"file-saver": "^2.0.2",
"fuse.js": "^6.4.6",
"graphql": "15.0.0",
"graphql": "^15.5.1",
"graphql-query-compress": "^1.2.2",
"graphql-ws": "^4.4.1",
"lodash-es": "^4.17.21",
Expand All @@ -94,6 +94,7 @@
"ngx-popper": "^7.0.0",
"ngx-sortablejs": "^11.1.0",
"ngx-take-until-destroy": "^5.4.0",
"ngx-toastr": "^14.1.0",
"object-path": "^0.11.5",
"popper.js": "^1.15.0",
"prettier": "^1.18.2",
Expand Down
10 changes: 10 additions & 0 deletions packages/altair-app/src/app/modules/altair/altair.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common
import { Store, StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { ToastrModule } from 'ngx-toastr';

import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
Expand Down Expand Up @@ -152,6 +153,15 @@ const providers = [
deps: [ HttpClient ]
}
}),
ToastrModule.forRoot({
newestOnTop: false,
closeButton: true,
positionClass: 'toast-top-center',
enableHtml: true,
countDuplicates: true,
preventDuplicates: true,
resetTimeoutOnDuplicate: true,
}),
],
providers: providers,
bootstrap: [ AppComponent ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { SharedModule } from '../../modules/shared/shared.module';
import { SchemaFormModule } from '../schema-form/schema-form.module';
import { HttpClientModule } from '@angular/common/http';
import { AltairConfig } from 'altair-graphql-core/build/config';
import { MockProviders } from 'ng-mocks';

describe('SettingsDialogComponent', () => {
let component: SettingsDialogComponent;
Expand All @@ -32,7 +33,7 @@ describe('SettingsDialogComponent', () => {
SchemaFormModule,
],
providers: [
NotifyService,
MockProviders(NotifyService),
KeybinderService,
WindowService,
DbService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { NgxElectronModule } from 'ngx-electron';
import { empty as observableEmpty } from 'rxjs';
import { GqlService } from '../gql/gql.service';
import { HttpClientModule } from '@angular/common/http';
import { MockProvider } from 'ng-mocks';

describe('ElectronAppService', () => {
beforeEach(() => {
Expand All @@ -19,7 +20,7 @@ describe('ElectronAppService', () => {
ElectronAppService,
WindowService,
DbService,
NotifyService,
MockProvider(NotifyService),
GqlService,
{
provide: Store, useValue: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ElectronService } from 'ngx-electron';
import { NotifyService } from '../notify/notify.service';
import { GqlService } from '../gql/gql.service';
import { HttpClientModule } from '@angular/common/http';
import { MockProvider } from 'ng-mocks';

describe('KeybinderService', () => {
beforeEach(() => {
Expand All @@ -23,7 +24,7 @@ describe('KeybinderService', () => {
DbService,
ElectronAppService,
ElectronService,
NotifyService,
MockProvider(NotifyService),
GqlService,
{
provide: Store, useValue: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { TestBed, inject } from '@angular/core/testing';
import { HotToastService } from '@ngneat/hot-toast';
import { ToastrService } from 'ngx-toastr';

import { NotifyService } from './notify.service';
import { Store } from '@ngrx/store';
import { of } from 'rxjs';
import { anyFn, mock } from '../../../../../testing';
import { RootState } from 'altair-graphql-core/build/types/state/state.interfaces';

let mockHotToastService: HotToastService;
let mockToastService: ToastrService;
let mockStore: Store<RootState>;

describe('NotifyService', () => {
beforeEach(() => {
mockHotToastService = mock<HotToastService>({
mockToastService = mock<ToastrService>({
success: anyFn(),
error: anyFn(),
warning: anyFn(),
show: anyFn(),
info: anyFn(),
});
mockStore = mock();
TestBed.configureTestingModule({
Expand All @@ -27,8 +28,8 @@ describe('NotifyService', () => {
useFactory: () => mockStore,
},
{
provide: HotToastService,
useFactory: () => mockHotToastService,
provide: ToastrService,
useFactory: () => mockToastService,
},
]
});
Expand All @@ -40,14 +41,14 @@ describe('NotifyService', () => {

describe('.success', () => {
it('should call .exec with passed options', inject([NotifyService], (service: NotifyService) => {
service.success('message', 'title', { data: {} });
service.success('message', 'title', { data: 'x' });

expect(mockHotToastService.success).toHaveBeenCalledWith(
expect(mockToastService.success).toHaveBeenCalledWith(
'message',
{
autoClose: true,
id: 'message',
}
'title',
({
data: 'x'
}) as any
);
}));
});
Expand All @@ -63,14 +64,14 @@ describe('NotifyService', () => {
}
};
mockStore.select = (predicate: any) => of(predicate(state));
service.warning('message', 'title', { data: {} });
service.warning('message', 'title', { data: 'x' });

expect(mockHotToastService.warning).toHaveBeenCalledWith(
expect(mockToastService.warning).toHaveBeenCalledWith(
'message',
{
autoClose: true,
id: 'message',
}
'title',
({
data: 'x'
}) as any
);
}));

Expand All @@ -84,36 +85,36 @@ describe('NotifyService', () => {
}
};
mockStore.select = (predicate: any) => of(predicate(state));
service.warning('message', 'title', { data: {} });
service.warning('message', 'title', { data: 'x' });

expect(mockHotToastService.warning).not.toHaveBeenCalled();
expect(mockToastService.warning).not.toHaveBeenCalled();
}));
});

describe('.info', () => {
it('should call .exec with passed options', inject([NotifyService], (service: NotifyService) => {
service.info('message', 'title', { data: {} });
service.info('message', 'title', { data: 'x' });

expect(mockHotToastService.show).toHaveBeenCalledWith(
expect(mockToastService.info).toHaveBeenCalledWith(
'message',
{
autoClose: true,
id: 'message',
}
'title',
({
data: 'x'
}) as any
);
}));
});

describe('.error', () => {
it('should call .exec with passed options', inject([NotifyService], (service: NotifyService) => {
service.error('message', 'title', { data: {} });
service.error('message', 'title', { data: 'x' });

expect(mockHotToastService.error).toHaveBeenCalledWith(
expect(mockToastService.error).toHaveBeenCalledWith(
'message',
{
autoClose: true,
id: 'message',
}
'title',
({
data: 'x'
}) as any
);
}));
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import { Injectable } from '@angular/core';
import { HotToastService } from '@ngneat/hot-toast';
import { ToastrService, ActiveToast, IndividualConfig } from 'ngx-toastr';
import { isExtension } from '../../utils';
import { Store } from '@ngrx/store';
import * as fromRoot from '../../store';
import { IDictionary } from '../../interfaces/shared';
import { first } from 'rxjs/operators';
import { RootState } from 'altair-graphql-core/build/types/state/state.interfaces';

interface NotifyOptions {
data?: {
url?: string,
},
disableTimeOut?: boolean;
};

type NotifyType = 'success' | 'error' | 'warning' | 'show';
type NotifyOptions = Partial<IndividualConfig & { data: any }>;
type NotifyType = 'success' | 'error' | 'warning' | 'info';
@Injectable()
export class NotifyService {

extensionNotifications: IDictionary = {};

constructor(
private toast: HotToastService,
private toast: ToastrService,
private store: Store<RootState>
) {
this.manageExtensionNotifications();
Expand All @@ -43,29 +38,29 @@ export class NotifyService {
});
}
info(message: string, title = '', opts: NotifyOptions = {}) {
this.exec('show', message, title, opts);
this.exec('info', message, title, opts);
}
exec(type: NotifyType, message: string, title: string, opts: NotifyOptions = {}) {
let toastContent = message;

if (title) {
toastContent = `<div><b>${title}</b></div>${toastContent}`;
const toast: ActiveToast<any> = this.toast[type](message, title, opts);
if (opts.data && opts.data.url) {
toast.onTap.subscribe(_toast => {
window.open(opts.data.url, '_blank');
})
}
return toast;
// let toastContent = message;

if (opts.data?.url) {
toastContent = `${toastContent}<a href="${opts.data.url}" target="_blank">Link</a>`;
}
return this.toast[type](message, {
id: message,
autoClose: !opts.disableTimeOut,
})
// const toast: ActiveToast<any> = this.toastr[type](message, title, opts);
// if (opts.data && opts.data.url) {
// toast.onTap.subscribe(_toast => {
// window.open(opts.data.url, '_blank');
// })
// if (title) {
// toastContent = `<div><b>${title}</b></div>${toastContent}`;
// }

// if (opts.data?.url) {
// toastContent = `${toastContent}<a href="${opts.data.url}" target="_blank">Link</a>`;
// }
// return toast;
// return this.toast[type](message, {
// id: message,
// autoClose: !opts.disableTimeOut,
// })
}

pushNotify(message: string, title = 'Altair', opts: any = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { WindowService } from './window.service';
import { GqlService } from './gql/gql.service';
import { HttpClientModule } from '@angular/common/http';
import { NotifyService } from './notify/notify.service';
import { MockProvider } from 'ng-mocks';

describe('WindowService', () => {
beforeEach(() => {
Expand All @@ -19,7 +20,7 @@ describe('WindowService', () => {
providers: [
WindowService,
GqlService,
NotifyService,
MockProvider(NotifyService),
services.DbService,
{ provide: Store, useValue: {
subscribe: () => {},
Expand Down