Skip to content

Commit

Permalink
Quick code fixes in webapp (#7546)
Browse files Browse the repository at this point in the history
Ticket: #7557
This commit:
- Fixes data types in Enketo Service interface.
- Remove unused parameters in Enketo Service function.
- Fixes alias in imports.
  • Loading branch information
latin-panda authored Mar 22, 2022
1 parent f049436 commit cc8fa8b
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 56 deletions.
2 changes: 1 addition & 1 deletion webapp/src/ts/actions/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Store } from '@ngrx/store';

import { createSingleValueAction } from '@mm-actions/./actionUtils';
import { createSingleValueAction } from '@mm-actions/actionUtils';

export const Actions = {
setAnalyticsModules: createSingleValueAction('SET_ANALYTICS_MODULES', 'analyticsModules'),
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/ts/actions/contacts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Store, createAction } from '@ngrx/store';
import { createSingleValueAction, createMultiValueAction } from './actionUtils';

import { createSingleValueAction, createMultiValueAction } from '@mm-actions/actionUtils';

export const Actions = {
updateContactsList: createSingleValueAction('UPDATE_CONTACTS_LIST', 'contacts'),
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/actions/global.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createAction, Store } from '@ngrx/store';

import { createSingleValueAction, createMultiValueAction } from './actionUtils';
import { createSingleValueAction, createMultiValueAction } from '@mm-actions/actionUtils';

export const Actions = {
updateReplicationStatus: createSingleValueAction('UPDATE_REPLICATION_STATUS', 'replicationStatus'),
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/actions/messages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Store, createAction } from '@ngrx/store';

import { createSingleValueAction } from './actionUtils';
import { createSingleValueAction } from '@mm-actions/actionUtils';
import { GlobalActions } from '@mm-actions/global';

export const Actions = {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/actions/reports.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Store, createAction } from '@ngrx/store';

import { createMultiValueAction, createSingleValueAction } from './actionUtils';
import { createMultiValueAction, createSingleValueAction } from '@mm-actions/actionUtils';
import { GlobalActions } from '@mm-actions/global';

export const Actions = {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/actions/services.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Store } from '@ngrx/store';
import { createSingleValueAction } from './actionUtils';
import { createSingleValueAction } from '@mm-actions/actionUtils';

export const Actions = {
setLastChangedDoc: createSingleValueAction('SET_LAST_CHANGED_DOC', 'lastChangedDoc'),
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/actions/target-aggregates.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Store } from '@ngrx/store';
import { createSingleValueAction } from './actionUtils';
import { createSingleValueAction } from '@mm-actions/actionUtils';

export const Actions = {
setSelectedTargetAggregate: createSingleValueAction('SET_SELECTED_TARGET_AGGREGATE', 'selected'),
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/actions/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Store, createAction } from '@ngrx/store';
import { createSingleValueAction } from './actionUtils';
import { createSingleValueAction } from '@mm-actions/actionUtils';

export const Actions = {
setTasksList: createSingleValueAction('SET_TASKS_LIST', 'tasks'),
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/ts/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { setTheme as setBootstrapTheme } from 'ngx-bootstrap/utils';
import { combineLatest } from 'rxjs';

import { DBSyncService, SyncStatus } from '@mm-services/db-sync.service';
import { Selectors } from './selectors';
import { Selectors } from '@mm-selectors/index';
import { GlobalActions } from '@mm-actions/global';
import { SessionService } from '@mm-services/session.service';
import { AuthService } from '@mm-services/auth.service';
Expand All @@ -17,7 +17,7 @@ import { LocationService } from '@mm-services/location.service';
import { ModalService } from '@mm-modals/mm-modal/mm-modal';
import { ReloadingComponent } from '@mm-modals/reloading/reloading.component';
import { FeedbackService } from '@mm-services/feedback.service';
import { environment } from './environments/environment';
import { environment } from '@mm-environments/environment';
import { FormatDateService } from '@mm-services/format-date.service';
import { XmlFormsService } from '@mm-services/xml-forms.service';
import { JsonFormsService } from '@mm-services/json-forms.service';
Expand Down
16 changes: 9 additions & 7 deletions webapp/src/ts/components/components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';

import { HeaderComponent } from './header/header.component';
import { PipesModule } from '../pipes/pipes.module';
import { DirectivesModule } from '../directives/directives.module';
import { SnackbarComponent } from './snackbar/snackbar.component';
import { ContentRowListItemComponent } from './content-row-list-item/content-row-list-item.component';
import { ReportVerifyValidIconComponent, ReportVerifyInvalidIconComponent } from './status-icons/status-icons.template';

import { HeaderComponent } from '@mm-components/header/header.component';
import { PipesModule } from '@mm-pipes/pipes.module';
import { DirectivesModule } from '@mm-directives/directives.module';
import { SnackbarComponent } from '@mm-components/snackbar/snackbar.component';
import { ContentRowListItemComponent } from '@mm-components/content-row-list-item/content-row-list-item.component';
import {
ReportVerifyValidIconComponent,
ReportVerifyInvalidIconComponent
} from '@mm-components/status-icons/status-icons.template';
import {
MultiDropdownFilterComponent
} from '@mm-components/filters/multi-dropdown-filter/multi-dropdown-filter.component';
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/directives/directives.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';

import { AuthDirective } from './auth.directive';
import { AuthDirective } from '@mm-directives/auth.directive';

@NgModule({
declarations: [
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import pouchdbDebug from 'pouchdb-debug';

import { AppModule } from './app.module';
import { environment } from './environments/environment';
import { environment } from '@mm-environments/environment';
import { POUCHDB_OPTIONS } from './constants';

import * as bootstrapper from '../js/bootstrapper';
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/ts/modals/modals.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { GuidedSetupComponent } from '@mm-modals/guided-setup/guided-setup.compo
import { SendMessageComponent } from '@mm-modals/send-message/send-message.component';
import { DeleteDocConfirmComponent } from '@mm-modals/delete-doc-confirm/delete-doc-confirm.component';
import { UpdatePasswordComponent } from '@mm-modals/edit-user/update-password.component';
import { ConfirmPasswordUpdatedComponent } from './edit-user/confirm-password-updated.component';
import { ConfirmPasswordUpdatedComponent } from '@mm-modals/edit-user/confirm-password-updated.component';
import { EditUserSettingsComponent } from '@mm-modals/edit-user/edit-user-settings.component';
import { NavigationConfirmComponent } from '@mm-modals/navigation-confirm/navigation-confirm.component';
import { TourSelectComponent } from '@mm-modals/tour/tour-select.component';
Expand All @@ -25,7 +25,7 @@ import { CheckDateComponent } from '@mm-modals/check-date/check-date.component';
import { EditMessageGroupComponent } from '@mm-modals/edit-message-group/edit-message-group.component';
import { SessionExpiredComponent } from '@mm-modals/session-expired/session-expired.component';
import { DatabaseClosedComponent } from '@mm-modals/database-closed/database-closed.component';
import { ContactsMutedComponent } from './contacts-muted/contacts-muted.component';
import { ContactsMutedComponent } from '@mm-modals/contacts-muted/contacts-muted.component';


@NgModule({
Expand Down
5 changes: 3 additions & 2 deletions webapp/src/ts/modules/about/about.routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Routes} from '@angular/router';
import {AboutComponent} from './about.component';
import { Routes } from '@angular/router';

import { AboutComponent } from '@mm-modules/about/about.component';

export const routes:Routes = [
{ path: 'about', component: AboutComponent, data: { tab: 'about' } },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Routes} from '@angular/router';
import {ConfigurationUserComponent} from './configuration-user.component';
import { Routes } from '@angular/router';

import { ConfigurationUserComponent } from '@mm-modules/configuration-user/configuration-user.component';

export const routes:Routes = [
{
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/ts/modules/error/error.routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Routes } from '@angular/router';
import { ErrorComponent } from './error.component';

import { ErrorComponent } from '@mm-modules/error/error.component';

export const routes:Routes = [
{ path: 'error/:code', component: ErrorComponent, data: { name: 'error', tab: 'error' }},
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/ts/modules/home/home.routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Routes } from '@angular/router';
import { HomeComponent } from './home.component';

import { HomeComponent } from '@mm-modules/home/home.component';

export const routes:Routes = [
{ path: 'home', component: HomeComponent },
Expand Down
37 changes: 19 additions & 18 deletions webapp/src/ts/modules/modules.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,37 @@ import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { AccordionModule } from 'ngx-bootstrap/accordion';
import { FormsModule } from '@angular/forms';

import { PipesModule } from '@mm-pipes/pipes.module';

import { PipesModule } from '@mm-pipes/pipes.module';
import { HomeComponent } from '@mm-modules/home/home.component';
import { AboutComponent } from './about/about.component';
import { ConfigurationUserComponent } from './configuration-user/configuration-user.component';
import { ErrorComponent } from './error/error.component';
import { AnalyticsComponent } from './analytics/analytics.component';
import { ReportsComponent } from './reports/reports.component';
import { ReportsContentComponent } from './reports/reports-content.component';
import { AboutComponent } from '@mm-modules/about/about.component';
import { ConfigurationUserComponent } from '@mm-modules/configuration-user/configuration-user.component';
import { ErrorComponent } from '@mm-modules/error/error.component';
import { AnalyticsComponent } from '@mm-modules/analytics/analytics.component';
import { ReportsComponent } from '@mm-modules/reports/reports.component';
import { ReportsContentComponent } from '@mm-modules/reports/reports-content.component';
import { ReportsAddComponent } from '@mm-modules/reports/reports-add.component';
import { ReportsFiltersComponent } from '@mm-modules/reports/reports-filters.component';
import { ComponentsModule } from '../components/components.module';
import { MessagesComponent } from './messages/messages.component';
import { ContactsComponent } from './contacts/contacts.component';
import { ComponentsModule } from '@mm-components/components.module';
import { MessagesComponent } from '@mm-modules/messages/messages.component';
import { ContactsComponent } from '@mm-modules/contacts/contacts.component';
import { ContactsContentComponent } from '@mm-modules/contacts/contacts-content.component';
import { ContactsFiltersComponent } from '@mm-modules/contacts/contacts-filters.component';
import { ContactsDeceasedComponent } from '@mm-modules/contacts/contacts-deceased.component';
import { ContactsReportComponent } from '@mm-modules/contacts/contacts-report.component';
import { ContactsEditComponent } from '@mm-modules/contacts/contacts-edit.component';
import { MessagesContentComponent } from './messages/messages-content.component';
import { PrivacyPolicyComponent } from './privacy-policy/privacy-policy.component';
import { AnalyticsTargetsComponent } from './analytics/analytics-targets.component';
import { AnalyticsModulesComponent } from './analytics/analytics-modules.component';
import { AnalyticsTargetAggregatesComponent } from './analytics/analytics-target-aggregates.component';
import { AnalyticsTargetAggregatesDetailComponent } from './analytics/analytics-target-aggregates-detail.component';
import { MessagesContentComponent } from '@mm-modules/messages/messages-content.component';
import { PrivacyPolicyComponent } from '@mm-modules/privacy-policy/privacy-policy.component';
import { AnalyticsTargetsComponent } from '@mm-modules/analytics/analytics-targets.component';
import { AnalyticsModulesComponent } from '@mm-modules/analytics/analytics-modules.component';
import { AnalyticsTargetAggregatesComponent } from '@mm-modules/analytics/analytics-target-aggregates.component';
import {
AnalyticsTargetAggregatesDetailComponent
} from '@mm-modules/analytics/analytics-target-aggregates-detail.component';
import { TasksComponent } from '@mm-modules/tasks/tasks.component';
import { TasksContentComponent } from '@mm-modules/tasks/tasks-content.component';
import { TasksGroupComponent } from '@mm-modules/tasks/tasks-group.component';
import { ThemeComponent } from '@mm-modules/theme/theme.component';
import { TestingComponent } from './testing/testing.component';
import { TestingComponent } from '@mm-modules/testing/testing.component';
import { DirectivesModule } from '@mm-directives/directives.module';

@NgModule({
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/ts/pipes/pipes.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { HeaderLogoPipe, PartnerImagePipe, ResourceIconPipe } from './resource-icon.pipe';
import { HeaderLogoPipe, PartnerImagePipe, ResourceIconPipe } from '@mm-pipes/resource-icon.pipe';
import {
AgePipe,
AutoreplyPipe,
Expand All @@ -15,10 +15,10 @@ import {
StatePipe,
TaskDueDatePipe,
WeeksPregnantPipe
} from './date.pipe';
} from '@mm-pipes/date.pipe';
import {
ClinicPipe, LineagePipe, SummaryPipe, TitlePipe
} from './message.pipe';
} from '@mm-pipes/message.pipe';
import { FormIconNamePipe } from '@mm-pipes/form-icon-name.pipe';
import { FormIconPipe } from '@mm-pipes/form-icon.pipe';
import { SafeHtmlPipe } from '@mm-pipes/safe-html.pipe';
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/reducers/contacts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createReducer, on } from '@ngrx/store';
import { UniqueSortedList } from './utils';

import { UniqueSortedList } from '@mm-reducers/utils';
import { ContactTypesService } from '@mm-services/contact-types.service';
import { Actions } from '@mm-actions/contacts';

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/reducers/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createReducer, on } from '@ngrx/store';

import { Actions } from '@mm-actions/reports';
import { Actions as GlobalActions } from '@mm-actions/global';
import { UniqueSortedList } from './utils';
import { UniqueSortedList } from '@mm-reducers/utils';

const initialState = {
reports: [],
Expand Down
10 changes: 5 additions & 5 deletions webapp/src/ts/services/enketo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class EnketoService {
});
}

private replaceJavarosaMediaWithLoaders(formDoc, formHtml) {
private replaceJavarosaMediaWithLoaders(formHtml) {
formHtml.find('[data-media-src]').each((idx, element) => {
const $img = $(element);
const lang = $img.attr('lang');
Expand Down Expand Up @@ -440,7 +440,7 @@ export class EnketoService {
return this
.transformXml(formDoc)
.then(doc => {
this.replaceJavarosaMediaWithLoaders(formDoc, doc.html);
this.replaceJavarosaMediaWithLoaders(doc.html);
const xmlFormContext: XmlFormContext = {
doc,
wrapper: $selector,
Expand Down Expand Up @@ -831,14 +831,14 @@ interface XmlFormContext {
hasContactSummary: boolean;
};
wrapper: JQuery;
instanceData: Record<string, any>;
instanceData: string|Record<string, any>; // String for report forms, Record<> for contact forms.
titleKey: string;
}

export interface EnketoFormContext {
selector: string;
formDoc: string;
instanceData: Record<string, any>;
formDoc: Record<string, any>;
instanceData: string|Record<string, any>; // String for report forms, Record<> for contact forms.
editedListener: () => void;
valuechangeListener: () => void;
titleKey?: string;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/ts/services/navigation.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';

import { RouteSnapshotService } from '@mm-services/./route-snapshot.service';
import { RouteSnapshotService } from '@mm-services/route-snapshot.service';
import { Selectors } from '@mm-selectors/index';
import { HeaderTabsService } from '@mm-services/header-tabs.service';

Expand Down

0 comments on commit cc8fa8b

Please sign in to comment.