app.module.ts 12.6 KB
Newer Older
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
1 2 3 4 5 6 7
import {BrowserModule} from '@angular/platform-browser';
import {APP_INITIALIZER, NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {RouterModule, Routes} from '@angular/router';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
8
import {TagInputModule} from 'ngx-chips';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
9 10 11
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {ToastrModule} from 'ngx-toastr';
import {CustomFormsModule} from 'ng2-validation';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
12
import {UiSwitchModule} from 'ngx-ui-switch';
13
import {HttpClient, HttpClientModule} from '@angular/common/http';
14 15 16

import missingTranslationHandler from './app.missingTranslation';

Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
17 18
import {AppComponent} from './app.component';
import {RihaNavbarComponent} from './components/riha-navbar/riha-navbar.component';
mark.kimask's avatar
mark.kimask committed
19
//services
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
20 21 22 23 24 25
import {SystemsService} from './services/systems.service';
import {WindowRefService} from './services/window-ref.service';
import {EnvironmentService} from './services/environment.service';
import {GeneralHelperService} from './services/general-helper.service';
import {SessionHelperService} from './services/session-helper.service';
import {ModalHelperService} from './services/modal-helper.service';
mark.kimask's avatar
mark.kimask committed
26
//components
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
import {CardDeckComponent} from './components/card-deck/card-deck.component';
import {ProducerListComponent} from './components/producer-list/producer-list.component';
import {BrowserListComponent} from './components/browser-list/browser-list.component';
import {FrontPageComponent} from './components/front-page/front-page.component';
import {PageHeaderComponent} from './components/page-header/page-header.component';
import {PageNotFoundComponent} from './components/page-not-found/page-not-found.component';
import {LoginFormComponent} from './components/login-form/login-form.component';
import {ProducerAddComponent} from './components/producer-add/producer-add.component';
import {ProducerDetailsComponent} from './components/producer-details/producer-details.component';
import {ProducerEditComponent} from './components/producer-edit/producer-edit.component';
import {DateRowComponent} from './components/date-row/date-row.component';
import {ProducerDetailsObjectsComponent} from './components/producer-details/producer-details-objects/producer-details-objects.component';
import {ProducerEditObjectsComponent} from './components/producer-edit/producer-edit-objects/producer-edit-objects.component';
import {ProducerDetailsGeneralComponent} from './components/producer-details/producer-details-general/producer-details-general.component';
import {ProducerEditGeneralComponent} from './components/producer-edit/producer-edit-general/producer-edit-general.component';
import {ProducerDetailsDocumentsComponent} from './components/producer-details/producer-details-documents/producer-details-documents.component';
import {ProducerEditDocumentsComponent} from './components/producer-edit/producer-edit-documents/producer-edit-documents.component';
import {ProducerEditLegislationsComponent} from './components/producer-edit/producer-edit-legislations/producer-edit-legislations.component';
import {ProducerDetailsLegislationsComponent} from './components/producer-details/producer-details-legislations/producer-details-legislations.component';
import {AlertComponent} from './components/alert/alert.component';
import {ProducerDetailsIssuesComponent} from './components/producer-details/producer-details-issues/producer-details-issues.component';
import {ApproverAddIssueComponent} from './components/approver-add-issue/approver-add-issue.component';
import {ApproverIssueDetailsComponent} from './components/approver-issue-details/approver-issue-details.component';
import {ActiveOrganizationChooserComponent} from './components/active-organization-chooser/active-organization-chooser.component';
import {TooltipComponent} from './components/tooltip/tooltip.component';
import {ProducerDetailsContactsComponent} from './components/producer-details/producer-details-contacts/producer-details-contacts.component';
import {ProducerEditContactsComponent} from './components/producer-edit/producer-edit-contacts/producer-edit-contacts.component';
import {WarningModalComponent} from './components/session-timeout/warning-modal/warning-modal.component';
import {InfoModalComponent} from './components/session-timeout/info-modal/info-modal.component';
import {ProducerDetailsRelationsComponent} from './components/producer-details/producer-details-relations/producer-details-relations.component';
import {ProducerEditRelationsComponent} from './components/producer-edit/producer-edit-relations/producer-edit-relations.component';
import {GridTotalFoundComponent} from './components/grid-view/grid-total-found/grid-total-found.component';
import {GridCurrentlyShowingComponent} from './components/grid-view/grid-currently-showing/grid-currently-showing.component';
import {SortButtonComponent} from './components/grid-view/sort-button/sort-button.component';
import {ProducerDetailsSecurityComponent} from './components/producer-details/producer-details-security/producer-details-security.component';
import {ProducerEditSecurityComponent} from './components/producer-edit/producer-edit-security/producer-edit-security.component';
import {FileIconComponent} from './components/files-related/file-icon/file-icon.component';
import {FileHintComponent} from './components/files-related/file-hint/file-hint.component';
65
import {FileCreateUpdateDateComponent} from './components/files-related/file-create-update-date/file-create-update-date.component';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
66 67 68 69 70 71 72 73
import {ApproverDashboardComponent} from './components/approver-dashboard/approver-dashboard.component';
import {SystemsForApprovalListComponent} from './components/approver-dashboard/systems-for-approval-list/systems-for-approval-list.component';
import {ActiveDiscussionsComponent} from './components/approver-dashboard/active-discussions/active-discussions.component';
import {DiscussionsListComponent} from './components/approver-dashboard/active-discussions/discussions-list/discussions-list.component';
import {ApproverSystemCheckComponent} from './components/approver-system-check/approver-system-check.component';
import {CheckResultRowComponent} from './components/approver-system-check/check-result-row/check-result-row.component';
import {ProducerDashboardComponent} from './components/producer-dashboard/producer-dashboard.component';
import {BrowserFilesListComponent} from './components/browser-list/browser-files-list/browser-files-list.component';
74
//pipes
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
75 76 77
import {DatemPipe} from './pipes/datem.pipe';
import {LinkifyPipe} from './pipes/linkify.pipe';
import {NoOrganizationModalComponent} from './components/no-organization-modal/no-organization-modal.component';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
78
import {ProducerEditStandardRealisationsComponent} from './components/producer-edit/producer-edit-standard-realisations/producer-edit-standard-realisations.component';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
79
import {LoginLinkComponent} from './components/login-link-component/login-link-component';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
80
import {ProducerSearchFilterComponent} from './components/producer-search-filter/producer-search-filter-component';
81
import {ProducerOrganizationComponent} from './components/producer-organization/producer-organization.component';
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
82
import {httpInterceptorProviders} from "./http-interceptors";
Aleksandr Ivanov's avatar
fixed  
Aleksandr Ivanov committed
83
import {CanDeactivateModalGuard} from './guards/can-deactivate-modal.guard';
84

85
export function HttpLoaderFactory(http: HttpClient) {
86 87 88
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

89 90
export function onApplicationStart(environmentService: EnvironmentService){
  return () => environmentService.onAppStart();
91 92
}

93 94 95 96
export function loadClassifiers(environmentService: EnvironmentService){
  return () => environmentService.loadClassifiers();
}

mark.kimask's avatar
mark.kimask committed
97
const routes: Routes = [
mark.kimask's avatar
mark.kimask committed
98
  { path: '', redirectTo: 'Avaleht', pathMatch: 'full' },
mark.kimask's avatar
mark.kimask committed
99 100
  { path: 'Avaleht', component: FrontPageComponent },
  { path: 'Home', component: FrontPageComponent },
mark.kimask's avatar
mark.kimask committed
101
  { path: 'Login', component: LoginFormComponent },
mark.kimask's avatar
mark.kimask committed
102
  { path: 'Infosüsteemid', component: BrowserListComponent },
103
  { path: 'MinuInfosüsteemid/Arutelud', component: ProducerDashboardComponent },
Mark Kimask's avatar
Mark Kimask committed
104
  { path: 'Andmeobjektid', component: BrowserFilesListComponent },
mark.kimask's avatar
mark.kimask committed
105 106 107
  { path: 'Systems', component: BrowserListComponent },
  { path: 'Kirjelda', component: ProducerListComponent },
  { path: 'Describe', component: ProducerListComponent },
Aleksandr Ivanov's avatar
fixed  
Aleksandr Ivanov committed
108
  { path: 'Infosüsteemid/Vaata/:reference', component: ProducerDetailsComponent, canDeactivate: [CanDeactivateModalGuard] },
109
  { path: 'Infosüsteemid/Vaata/:reference/Arutelu/:issue_id', component: ProducerDetailsComponent },
Mark Kimask's avatar
Mark Kimask committed
110 111 112 113 114
  { path: 'Systems/Vaata/:reference', component: ProducerDetailsComponent },
  { path: 'Kirjelda/Vaata/:reference', component: ProducerDetailsComponent },
  { path: 'Describe/View/:reference', component: ProducerDetailsComponent },
  { path: 'Kirjelda/Muuda/:reference', component: ProducerEditComponent },
  { path: 'Describe/Edit/:reference', component: ProducerEditComponent },
115 116
  { path: 'Kirjelda/Uus', component: ProducerAddComponent },
  { path: 'Describe/New', component: ProducerAddComponent },
Mark Kimask's avatar
Mark Kimask committed
117
  { path: 'Hinda', component: ApproverDashboardComponent },
118
  { path: 'Minu/Organisatsioon', component: ProducerOrganizationComponent },
119
  { path: '**', component: PageNotFoundComponent }
mark.kimask's avatar
mark.kimask committed
120 121
];

122 123 124 125 126 127 128
@NgModule({
  declarations: [
    AppComponent,
    RihaNavbarComponent,
    CardDeckComponent,
    ProducerListComponent,
    ProducerDetailsComponent,
mark.kimask's avatar
mark.kimask committed
129 130
    BrowserListComponent,
    FrontPageComponent,
131
    PageHeaderComponent,
mark.kimask's avatar
mark.kimask committed
132
    PageNotFoundComponent,
133 134
    LoginFormComponent,
    ProducerAddComponent,
135
    ProducerEditComponent,
mark.kimask's avatar
mark.kimask committed
136 137
    DateRowComponent,
    ProducerDetailsObjectsComponent,
138 139
    ProducerEditObjectsComponent,
    ProducerDetailsGeneralComponent,
mark.kimask's avatar
mark.kimask committed
140
    ProducerEditGeneralComponent,
141 142
    ProducerDetailsDocumentsComponent,
    ProducerEditDocumentsComponent,
mark.kimask's avatar
mark.kimask committed
143
    ProducerEditLegislationsComponent,
144
    ProducerDetailsLegislationsComponent,
mark.kimask's avatar
mark.kimask committed
145
    AlertComponent,
146 147
    ProducerDetailsIssuesComponent,
    ApproverAddIssueComponent,
mkima's avatar
mkima committed
148
    ApproverIssueDetailsComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
149
    NoOrganizationModalComponent,
Mark Kimask's avatar
Mark Kimask committed
150
    ActiveOrganizationChooserComponent,
Mark Kimask's avatar
Mark Kimask committed
151 152
    TooltipComponent,
    ProducerDetailsContactsComponent,
Mark Kimask's avatar
Mark Kimask committed
153 154
    ProducerEditContactsComponent,
    WarningModalComponent,
Mark Kimask's avatar
Mark Kimask committed
155
    InfoModalComponent,
156
    ProducerDetailsRelationsComponent,
157 158
    ProducerEditRelationsComponent,
    GridTotalFoundComponent,
159
    GridCurrentlyShowingComponent,
Mark Kimask's avatar
Mark Kimask committed
160 161
    SortButtonComponent,
    ProducerDetailsSecurityComponent,
162
    ProducerEditSecurityComponent,
163
    DatemPipe,
164
    FileIconComponent,
Mark Kimask's avatar
Mark Kimask committed
165
    FileHintComponent,
166
    FileCreateUpdateDateComponent,
Mark Kimask's avatar
Mark Kimask committed
167
    ApproverDashboardComponent,
168 169
    SystemsForApprovalListComponent,
    ActiveDiscussionsComponent,
170
    DiscussionsListComponent,
171 172
    LinkifyPipe,
    ApproverSystemCheckComponent,
173
    CheckResultRowComponent,
174
    ProducerDashboardComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
175
    BrowserFilesListComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
176
    ProducerEditStandardRealisationsComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
177
    LoginLinkComponent,
178
    ProducerSearchFilterComponent,
179
    ProducerOrganizationComponent
180 181 182 183
  ],
  imports: [
    BrowserModule,
    FormsModule,
184
    HttpClientModule,
185 186
    TagInputModule,
    BrowserAnimationsModule,
Mark Kimask's avatar
Mark Kimask committed
187
    CustomFormsModule,
mark.kimask's avatar
mark.kimask committed
188
    RouterModule.forRoot(routes),
Mark Kimask's avatar
Mark Kimask committed
189
    UiSwitchModule ,
190
    ToastrModule.forRoot(),
191 192 193 194 195
    TranslateModule.forRoot({
      missingTranslationHandler,
      loader: {
        provide: TranslateLoader,
        useFactory: (HttpLoaderFactory),
196
        deps: [HttpClient]
197 198
      }
    }),
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
199
    NgbModule
200
  ],
mark.kimask's avatar
mark.kimask committed
201
  entryComponents: [
mark.kimask's avatar
mark.kimask committed
202
    ProducerEditObjectsComponent,
203
    ProducerEditDocumentsComponent,
mark.kimask's avatar
mark.kimask committed
204
    ProducerEditLegislationsComponent,
205
    ApproverAddIssueComponent,
mkima's avatar
mkima committed
206
    ApproverIssueDetailsComponent,
Mark Kimask's avatar
Mark Kimask committed
207
    ActiveOrganizationChooserComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
208
    NoOrganizationModalComponent,
Mark Kimask's avatar
Mark Kimask committed
209 210
    ProducerEditContactsComponent,
    InfoModalComponent,
211
    WarningModalComponent,
Mark Kimask's avatar
Mark Kimask committed
212
    ProducerEditRelationsComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
213
    ProducerEditSecurityComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
214
    ProducerEditStandardRealisationsComponent,
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
215 216
    LoginLinkComponent,
    ProducerSearchFilterComponent
mark.kimask's avatar
mark.kimask committed
217
  ],
218
  bootstrap: [AppComponent],
Mark Kimask's avatar
Mark Kimask committed
219 220 221 222 223 224 225
  providers: [
    SystemsService,
    WindowRefService,
    EnvironmentService,
    GeneralHelperService,
    SessionHelperService,
    ModalHelperService,
226
    { provide: APP_INITIALIZER, useFactory: onApplicationStart, deps: [EnvironmentService], multi: true },
Aleksandr Ivanov's avatar
Aleksandr Ivanov committed
227 228
    { provide: APP_INITIALIZER, useFactory: loadClassifiers, deps: [EnvironmentService], multi: true },
    httpInterceptorProviders,
Aleksandr Ivanov's avatar
fixed  
Aleksandr Ivanov committed
229 230
    CanDeactivateModalGuard,
  ]
231 232 233
})

export class AppModule {}