Skip to content

Commit

Permalink
Merge pull request #46 from xmpp-grid-broker/XGB-194-barrel-imports
Browse files Browse the repository at this point in the history
[#XGB-194] Barrel Imports
  • Loading branch information
fabianhauser committed May 31, 2018
2 parents 7cd9fb0 + 1c8b407 commit 4012090
Show file tree
Hide file tree
Showing 152 changed files with 486 additions and 415 deletions.
8 changes: 8 additions & 0 deletions e2e/page-elements/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export * from './bread-crumbs';
export * from './form';
export * from './list';
export * from './locatable';
export * from './spinner';
export * from './tab';
export * from './toast';
export * from './urlAddressableComponent';
4 changes: 1 addition & 3 deletions e2e/page-objects/app.po.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {UrlAddressableComponent} from '../page-elements/urlAddressableComponent';
import {Locatable} from '../page-elements/locatable';
import {BreadCrumbs, Locatable, UrlAddressableComponent} from '../page-elements';
import {by, element, ElementFinder} from 'protractor';
import {BreadCrumbs} from '../page-elements/bread-crumbs';

export class AppPage extends UrlAddressableComponent implements Locatable {
get landingUrl(): string {
Expand Down
2 changes: 1 addition & 1 deletion e2e/page-objects/create-collection.po.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {UrlAddressableComponent} from '../page-elements/urlAddressableComponent';
import {UrlAddressableComponent} from '../page-elements';

export class CreateCollectionPage extends UrlAddressableComponent {
get landingUrl(): string {
Expand Down
2 changes: 1 addition & 1 deletion e2e/page-objects/create-topic.po.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {UrlAddressableComponent} from '../page-elements/urlAddressableComponent';
import {UrlAddressableComponent} from '../page-elements';

export class CreateTopicPage extends UrlAddressableComponent {
get landingUrl(): string {
Expand Down
5 changes: 5 additions & 0 deletions e2e/page-objects/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './app.po';
export * from './create-collection.po';
export * from './create-topic.po';
export * from './topic-details.po';
export * from './topics-overview.po';
9 changes: 1 addition & 8 deletions e2e/page-objects/topic-details.po.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import {UrlAddressableComponent} from '../page-elements/urlAddressableComponent';
import {Form, List, Locatable, Spinner, Tab, Toast, UrlAddressableComponent} from '../page-elements';
import {by, element, ElementFinder} from 'protractor';
import {Tab} from '../page-elements/tab';
import {Spinner} from '../page-elements/spinner';
import {Form} from '../page-elements/form';
import {Locatable} from '../page-elements/locatable';
import {Toast} from '../page-elements/toast';
import {List} from '../page-elements/list';
import {toPromise} from '../helpers';
import {BreadCrumbs} from '../page-elements/bread-crumbs';

type TopicDetailsTab = TopicDetailsConfigurationTab | TopicDetailsAffiliationTab;

Expand Down
6 changes: 1 addition & 5 deletions e2e/page-objects/topics-overview.po.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import {by, element, ElementFinder} from 'protractor';
import {UrlAddressableComponent} from '../page-elements/urlAddressableComponent';
import {Tab} from '../page-elements/tab';
import {List, Locatable, Spinner, Tab, UrlAddressableComponent} from '../page-elements';
import {CreateTopicPage} from './create-topic.po';
import {Spinner} from '../page-elements/spinner';
import {CreateCollectionPage} from './create-collection.po';
import {List} from '../page-elements/list';
import {Locatable} from '../page-elements/locatable';

type TopicsOverviewTab = TopicOverviewRootCollectionsTab | TopicOverviewAllTopicsTab | TopicOverviewAllCollectionsTab;

Expand Down
3 changes: 1 addition & 2 deletions e2e/routes.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {browser} from 'protractor';
import {TopicOverviewRootCollectionsTab, TopicsOverviewPage} from './page-objects/topics-overview.po';
import {AppPage} from './page-objects/app.po';
import {AppPage, TopicOverviewRootCollectionsTab, TopicsOverviewPage} from './page-objects';


describe('Routes', () => {
Expand Down
9 changes: 2 additions & 7 deletions e2e/topic-details.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import {browser} from 'protractor';
import {
TopicDetailsConfigurationTab,
TopicDetailsPage,
TopicDetailsAffiliationTab
} from './page-objects/topic-details.po';
import {Spinner} from './page-elements/spinner';
import {ToastContent} from './page-elements/toast';
import {TopicDetailsAffiliationTab, TopicDetailsConfigurationTab, TopicDetailsPage} from './page-objects';
import {Spinner, ToastContent} from './page-elements';


describe('TopicDetails', () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/topic-overview.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
TopicOverviewAllTopicsTab,
TopicOverviewRootCollectionsTab,
TopicsOverviewPage
} from './page-objects/topics-overview.po';
} from './page-objects';
import {browser} from 'protractor';


Expand Down
3 changes: 1 addition & 2 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {ErrorPageComponent} from './core/error-page/error-page.component';
import {ErrorPageComponent} from './core/';
import {TopicOverviewModule} from './topic-overview/topic-overview.module';
import {TopicCreationModule} from './topic-creation/topic-creation.module';
import {TopicDetailsModule} from './topic-details/topic-details.module';


export const routes: Routes = [
{
path: '',
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component, ViewContainerRef} from '@angular/core';
import {NavigationCancel, NavigationEnd, NavigationError, NavigationStart, Router, RouterEvent} from '@angular/router';
import {NotificationService} from './core/notifications/notification.service';
import {NotificationService} from './core';

/**
* Root-Component of the xmpp-grid broker app.
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {RouterModule, UrlSerializer} from '@angular/router';
import {AppRoutingModule} from './app-routing.module';
import {CustomUrlSerializer} from './custom-url-serializer';
import {CustomUrlSerializer} from './core/custom-url-serializer';

/**
* Root-Module of the XMPP-Grid Broker App.
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/config.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Observable} from 'rxjs/Observable';
import {Config, XmppConfig, XmppTransport} from '../models';
import {ConfigService} from './config.service';
import {Config, XmppConfig, XmppTransport} from './models/config';
import {XmppService} from './xmpp/xmpp.service';
import {XmppService} from './xmpp';


class FakeErrorResponse {
Expand Down
6 changes: 3 additions & 3 deletions src/app/core/config.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Config} from './models/config';
import {environment} from '../../environments/environment';
import {XmppService} from './xmpp/xmpp.service';
import {Config} from '../models';
import {XmppService} from './xmpp';
import {environment} from '../../environments';

@Injectable()
export class ConfigService {
Expand Down
27 changes: 15 additions & 12 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import {ErrorHandler, NgModule, Optional, SkipSelf} from '@angular/core';
import {CommonModule} from '@angular/common';
import {HttpClientModule} from '@angular/common/http';
import {ErrorPageComponent} from './error-page/error-page.component';
import {HeaderComponent} from './header/header.component';
import {
AlertNotificationComponent,
ConfigService,
ConfirmNotificationComponent,
ErrorLogService,
ErrorPageComponent,
GlobalErrorHandlerService,
HeaderComponent,
NavigationService,
NotificationService,
XmppClientFactory,
XmppFeatureGuardService,
XmppFeatureService,
XmppService
} from '.';
import {RouterModule} from '@angular/router';
import {NavigationService} from './navigation.service';
import {XmppClientFactory, XmppService} from './xmpp/xmpp.service';
import {XmppFeatureService} from './xmpp/xmpp-feature.service';
import {GlobalErrorHandlerService} from './global-error-handler.service';
import {NotificationService} from './notifications/notification.service';
import {ConfigService} from './config.service';
import {XmppFeatureGuardService} from './xmpp/xmpp-feature-guard.service';
import {ConfirmNotificationComponent} from './notifications/confirm-notification/confirm-notification.component';
import {AlertNotificationComponent} from './notifications/alert-notification/alert-notification.component';
import {ErrorLogService} from './errors/error-log.service';


@NgModule({
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/core/error-page/error-page.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ErrorPageComponent} from './error-page.component';
import {ErrorPageComponent} from '.';
import {fakeAsync, TestBed} from '@angular/core/testing';
import {ComponentFixture} from '@angular/core/testing/src/component_fixture';
import {ActivatedRoute} from '@angular/router';
Expand Down
1 change: 1 addition & 0 deletions src/app/core/error-page/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './error-page.component';
2 changes: 1 addition & 1 deletion src/app/core/errors/error-log.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ErrorLogService} from './error-log.service';
import {ErrorLogService} from '.';

describe(ErrorLogService.name, () => {
let errorLog: ErrorLogService;
Expand Down
4 changes: 2 additions & 2 deletions src/app/core/errors/error-log.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Injectable} from '@angular/core';
import {environment} from '../../../environments/environment';
import {LogLevel} from './log-level';
import {environment} from '../../../environments';
import {LogLevel} from '../../models';

@Injectable()
export class ErrorLogService {
Expand Down
3 changes: 2 additions & 1 deletion src/app/core/errors/error-utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {ErrorToString, JxtErrorToXmppError, XmppError, XmppErrorCondition} from './error-utils';
import {ErrorToString, JxtErrorToXmppError} from '.';
import {XmppError, XmppErrorCondition} from '../../models';

describe('XmppError', () => {
// (See https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)
Expand Down
36 changes: 1 addition & 35 deletions src/app/core/errors/error-utils.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
/**
* All possible Xmpp error conditions used in xep-0060.
*/
export enum XmppErrorCondition {
BadRequest = 'bad-request',
Conflict = 'conflict',
FeatureNotImplemented = 'feature-not-implemented',
Forbidden = 'forbidden',
Gone = 'gone',
InternalServerError = 'internal-server-error',
ItemNotFound = 'item-not-found',
JidMalformed = 'jid-malformed',
NotAcceptable = 'not-acceptable',
NotAllowed = 'not-allowed',
NotAuthorized = 'not-authorized',
PaymentRequired = 'payment-required',
PolicyViolation = 'policy-violation',
Timeout = 'timeout',
UnexpectedRequest = 'unexpected-request',
Unsupported = 'unsupported',
}

/**
* An XMPP specific error object that contains the condition in addition to a user friendly message.
*/
export class XmppError extends Error {

constructor(message: string, public readonly condition: XmppErrorCondition | string) {
super(message);

// Set the prototype explicitly
// (See https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)
Object.setPrototypeOf(this, XmppError.prototype);
}
}
import {XmppError, XmppErrorCondition} from '../../models';

/**
* Maps the given error object into an XmppError.
Expand Down
1 change: 1 addition & 0 deletions src/app/core/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './error-log.service';
export * from './error-utils';
4 changes: 2 additions & 2 deletions src/app/core/global-error-handler.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ErrorHandler, Injectable, Injector} from '@angular/core';
import {NotificationService} from './notifications/notification.service';
import {ErrorLogService} from './errors/error-log.service';
import {ErrorLogService} from './errors';
import {NotificationService} from './notifications';

@Injectable()
export class GlobalErrorHandlerService implements ErrorHandler {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/header/header.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {TestBed} from '@angular/core/testing';
import {ComponentFixture} from '@angular/core/testing/src/component_fixture';
import {RouterTestingModule} from '@angular/router/testing';
import {HeaderComponent} from './header.component';
import {HeaderComponent} from '.';


describe('HeaderComponent', () => {
Expand Down
1 change: 1 addition & 0 deletions src/app/core/header/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './header.component';
9 changes: 9 additions & 0 deletions src/app/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export * from './error-page';
export * from './errors';
export * from './header';
export * from './notifications';
export * from './xmpp';
export * from './xmpp-feature-detection';
export * from './config.service';
export * from './global-error-handler.service';
export * from './navigation.service';
1 change: 0 additions & 1 deletion src/app/core/models/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/core/navigation.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NavigationService} from './navigation.service';
import {LeafTopic} from './models/topic';
import {LeafTopic} from '../models';

describe('NavigationService', () => {

Expand Down
2 changes: 1 addition & 1 deletion src/app/core/navigation.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Injectable} from '@angular/core';
import {Router} from '@angular/router';
import {Topic} from './models/topic';
import {Topic} from '../models';

@Injectable()
export class NavigationService {
Expand Down
1 change: 1 addition & 0 deletions src/app/core/notifications/alert-notification/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './alert-notification.component';
1 change: 1 addition & 0 deletions src/app/core/notifications/confirm-notification/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './confirm-notification.component';
3 changes: 3 additions & 0 deletions src/app/core/notifications/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './alert-notification';
export * from './confirm-notification';
export * from './notification.service';
4 changes: 2 additions & 2 deletions src/app/core/notifications/notification.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {NotificationService} from './notification.service';
import {AlertNotificationComponent} from './alert-notification';
import {ConfirmNotificationComponent} from './confirm-notification';
import {ComponentFactoryResolver, ViewContainerRef} from '@angular/core';
import {AlertNotificationComponent} from './alert-notification/alert-notification.component';
import {ConfirmNotificationComponent} from './confirm-notification/confirm-notification.component';
import createSpyObj = jasmine.createSpyObj;
import SpyObj = jasmine.SpyObj;

Expand Down
4 changes: 2 additions & 2 deletions src/app/core/notifications/notification.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'rxjs/add/operator/publish';
import {ComponentFactoryResolver, Injectable, ViewContainerRef} from '@angular/core';
import {AlertNotificationComponent} from './alert-notification/alert-notification.component';
import {ConfirmNotificationComponent} from './confirm-notification/confirm-notification.component';
import {AlertNotificationComponent} from './alert-notification';
import {ConfirmNotificationComponent} from './confirm-notification';

/**
* The Notification can be used to send notification
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/xmpp-feature-detection/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './xmpp-feature.service';
export * from './xmpp-feature-guard.service';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {XmppService} from '../xmpp/';
import {ErrorLogService} from '../errors/index';
import {XmppFeatureService} from './xmpp-feature.service';
import {ErrorLogService} from '../errors/error-log.service';
import {XmppService} from './xmpp.service';
import SpyObj = jasmine.SpyObj;
import createSpyObj = jasmine.createSpyObj;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot} from '@angular/router';
import {ConfigService} from '../config.service';
import {NotificationService} from '../notifications/index';
import {XmppFeatureService} from './xmpp-feature.service';
import {NotificationService} from '../notifications/notification.service';
import {Injectable} from '@angular/core';
import {ConfigService} from '../config.service';

@Injectable()
export class XmppFeatureGuardService implements CanActivate {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Injectable} from '@angular/core';
import {IqType, XmppService} from './xmpp.service';
import {ErrorLogService} from '../errors/error-log.service';
import {ErrorLogService} from '../errors/';
import {XmppService} from '../xmpp/';
import {XmppIqType} from '../../models/';

@Injectable()
export class XmppFeatureService {
Expand Down Expand Up @@ -71,7 +72,7 @@ export class XmppFeatureService {
}

const cmd = {
type: IqType.Get,
type: XmppIqType.Get,
to: this.xmppService.getServerTitle(),
discoInfo: {}
};
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/xmpp/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './raw-xml-stanza';
export * from './xmpp.service';
Loading

0 comments on commit 4012090

Please sign in to comment.