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

style: format code with Prettier #44

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
44 changes: 29 additions & 15 deletions src/app/features/home/models/dashboardPayload.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import { CallPriorityResultData, CallResultData, CallTypeResultData, FormResultData, GetPersonnelForCallGridResultData, GetRolesForCallGridResultData, UnitStatusResultData, GroupsForCallGridData, CustomStatusResultData, NoteResultData, CallNoteTemplateResultData, GetConfigResultData, DepartmentRightsResult } from "@resgrid/ngx-resgridlib";
import {
CallPriorityResultData,
CallResultData,
CallTypeResultData,
FormResultData,
GetPersonnelForCallGridResultData,
GetRolesForCallGridResultData,
UnitStatusResultData,
GroupsForCallGridData,
CustomStatusResultData,
NoteResultData,
CallNoteTemplateResultData,
GetConfigResultData,
DepartmentRightsResult,
} from "@resgrid/ngx-resgridlib";

export class DashboardPayload {
public UnitStatuses: UnitStatusResultData[];
public Calls: CallResultData[];
public CallPriorties: CallPriorityResultData[];
public CallTypes: CallTypeResultData[];
public PersonnelForGrid: GetPersonnelForCallGridResultData[];
public GroupsForGrid: GroupsForCallGridData[];
public RolesForGrid: GetRolesForCallGridResultData[];
public NewCallForm: FormResultData;
public PersonnelStatuses: CustomStatusResultData[];
public PersonnelStaffingLevels: CustomStatusResultData[];
public DispatchNote: NoteResultData
public CallNotes: CallNoteTemplateResultData[];
public Config: GetConfigResultData;
public Rights: DepartmentRightsResult;
public UnitStatuses: UnitStatusResultData[];
public Calls: CallResultData[];
public CallPriorties: CallPriorityResultData[];
public CallTypes: CallTypeResultData[];
public PersonnelForGrid: GetPersonnelForCallGridResultData[];
public GroupsForGrid: GroupsForCallGridData[];
public RolesForGrid: GetRolesForCallGridResultData[];
public NewCallForm: FormResultData;
public PersonnelStatuses: CustomStatusResultData[];
public PersonnelStaffingLevels: CustomStatusResultData[];
public DispatchNote: NoteResultData;
public CallNotes: CallNoteTemplateResultData[];
public Config: GetConfigResultData;
public Rights: DepartmentRightsResult;
}
17 changes: 8 additions & 9 deletions src/app/features/home/pages/dashboard/dashboard.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class DashboardPage implements AfterViewInit {
if (this.searchUnitsInput && this.searchUnitsInput.nativeElement) {
this.unitSearchTerm = this.searchUnitsInput.nativeElement.value;
}
})
}),
)
.subscribe();
}
Expand Down Expand Up @@ -144,7 +144,7 @@ export class DashboardPage implements AfterViewInit {
if (this.searchPersonnelInput && this.searchPersonnelInput.nativeElement) {
this.personnelSearchTerm = this.searchPersonnelInput.nativeElement.value;
}
})
}),
)
.subscribe();
}
Expand All @@ -156,7 +156,7 @@ export class DashboardPage implements AfterViewInit {
private voiceStore: Store<VoiceState>,
private router: Router,
private cdr: ChangeDetectorRef,
private homeProvider: HomeProvider
private homeProvider: HomeProvider,
) {
this.homeState$ = this.store.select(selectHomeState);
this.mapData$ = this.store.select(selectMapDataState);
Expand Down Expand Up @@ -201,7 +201,7 @@ export class DashboardPage implements AfterViewInit {
if (this.searchUnitsInput && this.searchUnitsInput.nativeElement) {
this.unitSearchTerm = this.searchUnitsInput.nativeElement.value;
}
})
}),
)
.subscribe();
}
Expand Down Expand Up @@ -575,7 +575,7 @@ export class DashboardPage implements AfterViewInit {
const address = this.newCallForm.get("address").value;
if (!address || address == "") {
this.store.dispatch(
new HomeActions.GetAddressForCoordinates(this.newCallForm.get("latitude").value, this.newCallForm.get("longitude").value)
new HomeActions.GetAddressForCoordinates(this.newCallForm.get("latitude").value, this.newCallForm.get("longitude").value),
);
}
}
Expand Down Expand Up @@ -729,16 +729,15 @@ export class DashboardPage implements AfterViewInit {

if (this.configData && this.configData.MapUrl) {
if (!this.creatingNewCallMap) {

if (!this.newCallMap) {
this.creatingNewCallMap = true;
this.newCallMap = L.map(this.newCallMapContainer.nativeElement, {
scrollWheelZoom: false,
});

L.tileLayer(that.configData.MapUrl, {
attribution: that.configData.MapAttribution,
}).addTo(this.newCallMap);
attribution: that.configData.MapAttribution,
}).addTo(this.newCallMap);

this.newCallMap.scrollWheelZoom.disable();
var mapCenter = this.getMapCenter(data);
Expand Down Expand Up @@ -810,7 +809,7 @@ export class DashboardPage implements AfterViewInit {
.subscribe((state) => {
if (state && state.personnelForGrid && state.unitStatuses) {
this.store.dispatch(
new HomeActions.GetUpdatedPersonnelandUnitsDistancesToCall(location, state.personnelForGrid, state.unitStatuses)
new HomeActions.GetUpdatedPersonnelandUnitsDistancesToCall(location, state.personnelForGrid, state.unitStatuses),
);
}
});
Expand Down
57 changes: 18 additions & 39 deletions src/app/features/home/providers/home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class HomeProvider {
private noteService: NotesService,
private templateService: TemplatesService,
private configService: ConfigService,
private securityProvider: SecurityService
private securityProvider: SecurityService,
) {
//this.personnelStatusUpdated$ = this.events.subscribe(this.consts.SIGNALR_EVENTS.PERSONNEL_STATUS_UPDATED);
//this.personnelStaffingUpdated$ = this.events.subscribe(this.consts.SIGNALR_EVENTS.PERSONNEL_STAFFING_UPDATED);
Expand Down Expand Up @@ -100,17 +100,11 @@ export class HomeProvider {
dispatchNote: getDispatchNote,
callNotes: getQuickNotes,
config: getConfig,
currentUserRights: getCurrentUserRights
currentUserRights: getCurrentUserRights,
}).pipe(
map((results) => {
let localCalls: CallLocalResult[] = new Array();
if (
results &&
results.calls &&
results.calls.Data &&
results.priorities &&
results.priorities.Data
) {
if (results && results.calls && results.calls.Data && results.priorities && results.priorities.Data) {
results.calls.Data.forEach((call) => {
let localCall: CallLocalResult = call as CallLocalResult;

Expand All @@ -129,8 +123,7 @@ export class HomeProvider {

let dispatchNote: NoteResultData = null;

if (results.dispatchNote && results.dispatchNote.Data)
dispatchNote = results.dispatchNote.Data;
if (results.dispatchNote && results.dispatchNote.Data) dispatchNote = results.dispatchNote.Data;

return {
UnitStatuses: results.units.Data,
Expand All @@ -148,7 +141,7 @@ export class HomeProvider {
Config: results.config.Data,
Rights: results.currentUserRights,
};
})
}),
);
}

Expand All @@ -157,39 +150,25 @@ export class HomeProvider {
.select(selectAuthState)
.pipe(take(1))
.subscribe((auth) => {
this.signalRProvider.connectionState$.subscribe(
(state: ConnectionState) => {}
);
this.signalRProvider.connectionState$.subscribe((state: ConnectionState) => {});

this.signalRProvider.start(auth.user.departmentId);
this.init();
});
}

public init() {
this.events.subscribe(
this.consts.SIGNALR_EVENTS.PERSONNEL_STATUS_UPDATED,
(data: any) => {
this.store.dispatch(new HomeActions.GetLatestPersonnelData());
}
);
this.events.subscribe(
this.consts.SIGNALR_EVENTS.PERSONNEL_STAFFING_UPDATED,
(data: any) => {
this.store.dispatch(new HomeActions.GetLatestPersonnelData());
}
);
this.events.subscribe(
this.consts.SIGNALR_EVENTS.UNIT_STATUS_UPDATED,
(data: any) => {
this.store.dispatch(new HomeActions.GetLatestUnitStates());
}
);
this.events.subscribe(
this.consts.SIGNALR_EVENTS.CALLS_UPDATED,
(data: any) => {
this.store.dispatch(new HomeActions.GetLatestCalls());
}
);
this.events.subscribe(this.consts.SIGNALR_EVENTS.PERSONNEL_STATUS_UPDATED, (data: any) => {
this.store.dispatch(new HomeActions.GetLatestPersonnelData());
});
this.events.subscribe(this.consts.SIGNALR_EVENTS.PERSONNEL_STAFFING_UPDATED, (data: any) => {
this.store.dispatch(new HomeActions.GetLatestPersonnelData());
});
this.events.subscribe(this.consts.SIGNALR_EVENTS.UNIT_STATUS_UPDATED, (data: any) => {
this.store.dispatch(new HomeActions.GetLatestUnitStates());
});
this.events.subscribe(this.consts.SIGNALR_EVENTS.CALLS_UPDATED, (data: any) => {
this.store.dispatch(new HomeActions.GetLatestCalls());
});
}
}
4 changes: 2 additions & 2 deletions src/app/features/home/reducers/home.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function reducer(state: HomeState = initialState, action: HomeActionsUnio
dispatchNote: action.payload.DispatchNote,
callNoteTemplates: action.payload.CallNotes,
config: action.payload.Config,
rights: action.payload.Rights,
rights: action.payload.Rights,
};

case HomeActionTypes.LOADING_FAIL:
Expand Down Expand Up @@ -310,4 +310,4 @@ export const getCallTemplate = (state: HomeState) => state.activeCallTemplate;
export const getNewCallAddress = (state: HomeState) => state.newCallLocation;
export const getIsSavingCall = (state: HomeState) => state.isSavingCall;
export const getNewCallLocation = (state: HomeState) => state.newCallAddress;
export const getConfigData = (state: HomeState) => state.config;
export const getConfigData = (state: HomeState) => state.config;
Loading