Skip to content

Commit

Permalink
removed the no longer used ScenarioEventPlus interface
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-tspencer committed Sep 20, 2024
1 parent d319038 commit a0a3432
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 83 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blueprint-ui",
"version": "1.2.2",
"version": "1.2.3-rc1",
"license": "MIT",
"config": {
"openapiArgs": "--additional-properties ngVersion=15.1 --additional-properties modelPropertyNaming=original --type-mappings=DateTime=Date",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { DataFieldDataService } from 'src/app/data/data-field/data-field-data.se
import { DataValueDataService } from 'src/app/data/data-value/data-value-data.service';
import {
ScenarioEventDataService,
ScenarioEventPlus,
DataValuePlus,
} from 'src/app/data/scenario-event/scenario-event-data.service';
import { MselQuery } from 'src/app/data/msel/msel.query';
Expand All @@ -37,6 +36,7 @@ import {
Team,
User,
Card,
ScenarioEvent,
} from 'src/app/generated/blueprint.api';
import { UntypedFormControl } from '@angular/forms';
import { MselPlus } from 'src/app/data/msel/msel-data.service';
Expand Down Expand Up @@ -73,7 +73,7 @@ export class EventDetailPageComponent {
cardList: Card[] = [];
dateFormControls = new Map<string, UntypedFormControl>();
dataValues: DataValue[] = [];
scenarioEvent: ScenarioEventPlus = {} as ScenarioEventPlus;
scenarioEvent: ScenarioEvent = {};
moveList: Move[] = [];
teamList: Team[] = [];
filterString = '';
Expand Down Expand Up @@ -221,7 +221,7 @@ export class EventDetailPageComponent {
if (scenarioEvents && scenarioEvents.length > 0) {
this.scenarioEvent = scenarioEvents.find(
(m) => m.id === this.scenarioEventId
) as ScenarioEventPlus;
);
}
});
this.moveQuery
Expand Down Expand Up @@ -269,10 +269,8 @@ export class EventDetailPageComponent {
});
}

getEditableScenarioEvents(
scenarioEvents: ScenarioEventPlus[]
): ScenarioEventPlus[] {
const editableList: ScenarioEventPlus[] = [];
getEditableScenarioEvents(scenarioEvents: ScenarioEvent[]): ScenarioEvent[] {
const editableList: ScenarioEvent[] = [];
scenarioEvents.forEach((scenarioEvent) => {
const newScenarioEvent = { ...scenarioEvent };
editableList.push(newScenarioEvent);
Expand Down
47 changes: 19 additions & 28 deletions src/app/components/msel-playbook/msel-playbook.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { DataFieldDataService } from 'src/app/data/data-field/data-field-data.se
import { DataValueDataService } from 'src/app/data/data-value/data-value-data.service';
import {
ScenarioEventDataService,
ScenarioEventPlus,
DataValuePlus,
} from 'src/app/data/scenario-event/scenario-event-data.service';
import { MselQuery } from 'src/app/data/msel/msel.query';
Expand Down Expand Up @@ -66,11 +65,11 @@ export class MselPlaybookComponent {
allDataFields: DataField[] = [];
dateFormControls = new Map<string, UntypedFormControl>();
dataValues: DataValue[] = [];
mselScenarioEvents: ScenarioEventPlus[] = [];
sortedScenarioEvents: ScenarioEventPlus[] = [];
mselScenarioEvents: ScenarioEvent[] = [];
sortedScenarioEvents: ScenarioEvent[] = [];
moveAndGroupNumbers: Record<string, number[]>[] = [];
moveList: Move[] = [];
filteredScenarioEventList: ScenarioEventPlus[] = [];
filteredScenarioEventList: ScenarioEvent[] = [];
filterString = '';
blankDataValue = {
id: '',
Expand Down Expand Up @@ -178,7 +177,7 @@ export class MselPlaybookComponent {
.pipe(takeUntil(this.unsubscribe$))
.subscribe((scenarioEvents) => {
this.mselScenarioEvents = this.getEditableScenarioEvents(
scenarioEvents as ScenarioEventPlus[]
scenarioEvents as ScenarioEvent[]
);
if (scenarioEvents && scenarioEvents.length > 0) {
this.moveAndGroupNumbers =
Expand Down Expand Up @@ -241,10 +240,8 @@ export class MselPlaybookComponent {
});
}

getEditableScenarioEvents(
scenarioEvents: ScenarioEventPlus[]
): ScenarioEventPlus[] {
const editableList: ScenarioEventPlus[] = [];
getEditableScenarioEvents(scenarioEvents: ScenarioEvent[]): ScenarioEvent[] {
const editableList: ScenarioEvent[] = [];
scenarioEvents.forEach((scenarioEvent) => {
const newScenarioEvent = { ...scenarioEvent };
editableList.push(newScenarioEvent);
Expand All @@ -253,8 +250,8 @@ export class MselPlaybookComponent {
return editableList;
}

getFilteredScenarioEvents(): ScenarioEventPlus[] {
const mselScenarioEvents: ScenarioEventPlus[] = [];
getFilteredScenarioEvents(): ScenarioEvent[] {
const mselScenarioEvents: ScenarioEvent[] = [];
if (this.mselScenarioEvents) {
this.mselScenarioEvents.forEach((se) => {
if (se.mselId === this.msel.id) {
Expand Down Expand Up @@ -283,7 +280,7 @@ export class MselPlaybookComponent {
}

getDataValue(
scenarioEvent: ScenarioEventPlus,
scenarioEvent: ScenarioEvent,
dataFieldName: string
): DataValuePlus {
if (!(this.msel && scenarioEvent && scenarioEvent.id)) {
Expand All @@ -308,36 +305,30 @@ export class MselPlaybookComponent {
return dataValuePlus;
}

getDataFieldIdByName(scenarioEvent: ScenarioEventPlus, name: string): string {
getDataFieldIdByName(scenarioEvent: ScenarioEvent, name: string): string {
const dataField = this.allDataFields.find(
(df) => df.name.toLowerCase() === name.toLowerCase()
);
return dataField ? dataField.id : '';
}

getSortedScenarioEvents(
scenarioEvents: ScenarioEventPlus[]
): ScenarioEventPlus[] {
let sortedScenarioEvents: ScenarioEventPlus[];
getSortedScenarioEvents(scenarioEvents: ScenarioEvent[]): ScenarioEvent[] {
let sortedScenarioEvents: ScenarioEvent[];
if (scenarioEvents) {
if (scenarioEvents.length > 0 && this.sort && this.sort.direction) {
sortedScenarioEvents = (scenarioEvents as ScenarioEventPlus[]).sort(
(a: ScenarioEventPlus, b: ScenarioEventPlus) =>
this.sortScenarioEvents(a, b)
sortedScenarioEvents = (scenarioEvents as ScenarioEvent[]).sort(
(a: ScenarioEvent, b: ScenarioEvent) => this.sortScenarioEvents(a, b)
);
} else {
sortedScenarioEvents = (scenarioEvents as ScenarioEventPlus[]).sort(
sortedScenarioEvents = (scenarioEvents as ScenarioEvent[]).sort(
(a, b) => (+a.deltaSeconds > +b.deltaSeconds ? 1 : -1)
);
}
}
return sortedScenarioEvents;
}

private sortScenarioEvents(
a: ScenarioEventPlus,
b: ScenarioEventPlus
): number {
private sortScenarioEvents(a: ScenarioEvent, b: ScenarioEvent): number {
const dir = this.sort.direction === 'desc' ? -1 : 1;
if (!this.sort.direction || this.sort.active === 'deltaSeconds') {
this.sort = { active: 'deltaSeconds', direction: 'asc' };
Expand Down Expand Up @@ -382,11 +373,11 @@ export class MselPlaybookComponent {
}
}

getScenarioEventById(id: string): ScenarioEventPlus | undefined {
getScenarioEventById(id: string): ScenarioEvent | undefined {
return this.mselScenarioEvents.find((se) => se.id === id);
}

getScenarioEventTitle(scenarioEvent: ScenarioEventPlus): string {
getScenarioEventTitle(scenarioEvent: ScenarioEvent): string {
if (!scenarioEvent) {
return '';
}
Expand Down Expand Up @@ -430,7 +421,7 @@ export class MselPlaybookComponent {
this.pageSize = event.pageSize;
}

getPagedScenarioEvents(): ScenarioEventPlus[] {
getPagedScenarioEvents(): ScenarioEvent[] {
const startIndex = this.pageIndex * this.pageSize;
const endIndex = startIndex + this.pageSize;
return this.sortedScenarioEvents.slice(startIndex, endIndex);
Expand Down
14 changes: 5 additions & 9 deletions src/app/components/msel-view/msel-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
ScenarioEventDataService,
ScenarioEventView,
ScenarioEventViewIndexing,
ScenarioEventPlus,
} from 'src/app/data/scenario-event/scenario-event-data.service';
import { ScenarioEventQuery } from 'src/app/data/scenario-event/scenario-event.query';
import { UIDataService } from 'src/app/data/ui/ui-data.service';
Expand All @@ -65,7 +64,7 @@ export class MselViewComponent implements OnDestroy, ScenarioEventView {
showSearch = false;

// ScenarioEventView Fields
mselScenarioEvents: ScenarioEventPlus[] = [];
mselScenarioEvents: ScenarioEvent[] = [];
filterString = '';
sort: Sort = { active: '', direction: '' };
sortedScenarioEvents: ScenarioEvent[];
Expand Down Expand Up @@ -274,10 +273,10 @@ export class MselViewComponent implements OnDestroy, ScenarioEventView {
return false;
}

get displayedScenarioEvents(): ScenarioEventPlus[] {
get displayedScenarioEvents(): ScenarioEvent[] {
return this.sortedScenarioEvents;
}
set displayedScenarioEvents(evts: ScenarioEventPlus[]) {
set displayedScenarioEvents(evts: ScenarioEvent[]) {
this.sortedScenarioEvents = evts;
}

Expand Down Expand Up @@ -330,7 +329,7 @@ export class MselViewComponent implements OnDestroy, ScenarioEventView {
}

getDataValue(
scenarioEvent: ScenarioEventPlus,
scenarioEvent: ScenarioEvent,
dataFieldName: string
): DataValuePlus {
if (!(this.msel && scenarioEvent && scenarioEvent.id)) {
Expand All @@ -343,10 +342,7 @@ export class MselViewComponent implements OnDestroy, ScenarioEventView {
);
}

getDisplayValue(
scenarioEvent: ScenarioEventPlus,
dataFieldName: string
): string {
getDisplayValue(scenarioEvent: ScenarioEvent, dataFieldName: string): string {
if (!(this.msel && scenarioEvent && scenarioEvent.id)) {
return '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import {
EventType,
MselItemStatus,
MselRole,
ScenarioEvent,
} from 'src/app/generated/blueprint.api';
import { Sort } from '@angular/material/sort';
import {
ScenarioEventPlus,
DataValuePlus,
} from 'src/app/data/scenario-event/scenario-event-data.service';
import { DataValuePlus } from 'src/app/data/scenario-event/scenario-event-data.service';
import {
MatLegacyDialogRef as MatDialogRef,
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
Expand All @@ -30,8 +28,8 @@ import { AngularEditorConfig } from '@kolkov/angular-editor';
export class ScenarioEventEditDialogComponent implements OnDestroy, OnInit {
@Output() editComplete = new EventEmitter<any>();
sort: Sort = { active: '', direction: '' };
sortedScenarioEvents: ScenarioEventPlus[] = [];
newScenarioEvent: ScenarioEventPlus;
sortedScenarioEvents: ScenarioEvent[] = [];
newScenarioEvent: ScenarioEvent;
isAddingScenarioEvent = false;
canDoAnything = false;
private unsubscribe$ = new Subject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import {
ScenarioEventDataService,
ScenarioEventView,
ScenarioEventViewIndexing,
ScenarioEventPlus,
DataValuePlus,
} from 'src/app/data/scenario-event/scenario-event-data.service';
import { ScenarioEventEditDialogComponent } from '../scenario-event-edit-dialog/scenario-event-edit-dialog.component';
Expand Down Expand Up @@ -81,7 +80,7 @@ export class ScenarioEventListComponent
mselScenarioEvents: ScenarioEvent[] = [];
filterString = '';
sort: Sort = { active: '', direction: '' };
displayedScenarioEvents: ScenarioEventPlus[] = [];
displayedScenarioEvents: ScenarioEvent[] = [];
headerDataFields: DataField[] = [];
dataValues: DataValue[] = [];
cardList: Card[] = [];
Expand All @@ -92,7 +91,7 @@ export class ScenarioEventListComponent
mselDataFields: DataField[] = [];
expandedScenarioEventId = '';
expandedMoreScenarioEventIds: string[] = [];
newScenarioEvent: ScenarioEventPlus;
newScenarioEvent: ScenarioEvent;
isAddingScenarioEvent = false;
canDoAnything = false;
private unsubscribe$ = new Subject();
Expand Down Expand Up @@ -414,7 +413,7 @@ export class ScenarioEventListComponent
return users;
}

toggleNoneSelection(scenarioEvent: ScenarioEventPlus, dataFieldName: string) {
toggleNoneSelection(scenarioEvent: ScenarioEvent, dataFieldName: string) {
const newValues = new Array('None');
this.getDataValue(scenarioEvent, dataFieldName).value =
newValues.join(', ');
Expand Down Expand Up @@ -481,7 +480,7 @@ export class ScenarioEventListComponent
}

getDataValue(
scenarioEvent: ScenarioEventPlus,
scenarioEvent: ScenarioEvent,
dataFieldName: string
): DataValuePlus {
if (!(this.msel && scenarioEvent && scenarioEvent.id)) {
Expand All @@ -494,10 +493,7 @@ export class ScenarioEventListComponent
);
}

getDisplayValue(
scenarioEvent: ScenarioEventPlus,
dataFieldName: string
): string {
getDisplayValue(scenarioEvent: ScenarioEvent, dataFieldName: string): string {
if (!(this.msel && scenarioEvent && scenarioEvent.id)) {
return '';
}
Expand All @@ -516,7 +512,7 @@ export class ScenarioEventListComponent
return team ? team.shortName : '';
}

onContextMenu(event: MouseEvent, scenarioEvent: ScenarioEventPlus) {
onContextMenu(event: MouseEvent, scenarioEvent: ScenarioEvent) {
event.preventDefault();
this.contextMenuPosition.x = event.clientX + 'px';
this.contextMenuPosition.y = event.clientY + 'px';
Expand Down Expand Up @@ -623,7 +619,7 @@ export class ScenarioEventListComponent
this.displayEditDialog(editScenarioEvent);
}

copyScenarioEvent(scenarioEvent: ScenarioEventPlus): void {
copyScenarioEvent(scenarioEvent: ScenarioEvent): void {
const newScenarioEvent = { ...scenarioEvent };
newScenarioEvent.id = uuidv4();
newScenarioEvent.dataValues = [];
Expand Down Expand Up @@ -706,7 +702,7 @@ export class ScenarioEventListComponent
}

saveDataValue(
scenarioEvent: ScenarioEventPlus,
scenarioEvent: ScenarioEvent,
dataFieldName: string,
newValue: string
) {
Expand All @@ -726,7 +722,7 @@ export class ScenarioEventListComponent
}

saveDataValueArray(
scenarioEvent: ScenarioEventPlus,
scenarioEvent: ScenarioEvent,
dataFieldName: string,
newValues: string[]
) {
Expand Down Expand Up @@ -826,15 +822,15 @@ export class ScenarioEventListComponent
: {};
}

getRowStyle(scenarioEvent: ScenarioEventPlus) {
getRowStyle(scenarioEvent: ScenarioEvent) {
if (!scenarioEvent || !scenarioEvent.rowMetadata) {
return '';
}
const color = this.getRgbValues(scenarioEvent.rowMetadata);
return this.getStyleFromColor(color);
}

selectNewColor(color: string, incomingScenarioEvent: ScenarioEventPlus) {
selectNewColor(color: string, incomingScenarioEvent: ScenarioEvent) {
const scenarioEvent = { ...incomingScenarioEvent };
let parts = scenarioEvent.rowMetadata
? scenarioEvent.rowMetadata.split(',')
Expand Down Expand Up @@ -975,7 +971,7 @@ export class ScenarioEventListComponent
});
}

rowDataFields(scenarioEvent: ScenarioEventPlus): DataField[] {
rowDataFields(scenarioEvent: ScenarioEvent): DataField[] {
const dataFields = new Array<DataField>();
this.mselDataFields.forEach((df) => {
if (
Expand Down
Loading

0 comments on commit a0a3432

Please sign in to comment.