diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.html b/src/app/workflow-spec-list/workflow-spec-list.component.html
index 262152c..1281613 100644
--- a/src/app/workflow-spec-list/workflow-spec-list.component.html
+++ b/src/app/workflow-spec-list/workflow-spec-list.component.html
@@ -114,7 +114,7 @@
mat-mini-fab
title="Move up"
color="primary"
- (click)="editCategoryDisplayOrder(cat, cat.id, 'up')"
+ (click)="editCategoryDisplayOrder(cat.id, 'up')"
>
arrow_upward
@@ -123,7 +123,7 @@
mat-mini-fab
title="Move down"
color="primary"
- (click)="editCategoryDisplayOrder(cat, cat.id, 'down')"
+ (click)="editCategoryDisplayOrder(cat.id, 'down')"
>
arrow_downward
diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts
index a97ce38..bfc753a 100644
--- a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts
+++ b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts
@@ -391,24 +391,29 @@ describe('WorkflowSpecListComponent', () => {
});
+ /**
+ * Deprecated - removed reorder and ability to directly edit display order
+ *
it('should edit category display order', () => {
- const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
+ // const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
const _updateCatDisplayOrdersSpy = spyOn((component as any), '_updateCatDisplayOrders').and.stub();
component.editCategoryDisplayOrder(2, -1, mockWorkflowSpecCategories);
- expect(_reorderSpy).toHaveBeenCalled();
+ // expect(_reorderSpy).toHaveBeenCalled();
expect(_updateCatDisplayOrdersSpy).toHaveBeenCalled();
});
+
it('should edit workflow spec display order', () => {
- const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
+ // const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
const _updateSpecDisplayOrdersSpy = spyOn((component as any), '_updateSpecDisplayOrders').and.stub();
component.editSpecDisplayOrder('few_things', -1, mockWorkflowSpecs);
- expect(_reorderSpy).toHaveBeenCalled();
+ // expect(_reorderSpy).toHaveBeenCalled();
expect(_updateSpecDisplayOrdersSpy).toHaveBeenCalled();
});
+
it('should reorder categories', () => {
const snackBarSpy = spyOn((component as any).snackBar, 'open').and.stub();
const moveUpSpy = spyOn(component, 'moveUp').and.callThrough();
@@ -437,6 +442,7 @@ describe('WorkflowSpecListComponent', () => {
expect(moveDownSpy).toHaveBeenCalled();
});
+
it('should reorder specs', () => {
const snackBarSpy = spyOn((component as any).snackBar, 'open').and.stub();
const moveUpSpy = spyOn(component, 'moveUp').and.callThrough();
@@ -468,23 +474,24 @@ describe('WorkflowSpecListComponent', () => {
expect(moveUpSpy).not.toHaveBeenCalled();
expect(moveDownSpy).toHaveBeenCalled();
});
+ */
it('should update all category display orders', () => {
- const _loadWorkflowSpecCategoriesSpy = spyOn((component as any), '_loadWorkflowSpecCategories').and.stub();
- (component as any)._updateCatDisplayOrders(mockWorkflowSpecCategories);
+ const editCategoryDisplayOrderSpy = spyOn((component as any), 'editCategoryDisplayOrder').and.stub();
- mockWorkflowSpecCategories.forEach((spec, i) => {
- const req = httpMock.expectOne(`apiRoot/workflow-specification-category/${spec.id}`);
+ mockWorkflowSpecCategories.forEach((cat, i) => {
+ let results = { param: 'direction', value: 'down' };
+ const req = httpMock.expectOne(`apiRoot/workflow-specification-category/${cat.id}/reorder?${results.param}=${results.value}`);
expect(req.request.method).toEqual('PUT');
req.flush(mockWorkflowSpecCategories[i]);
});
- expect(_loadWorkflowSpecCategoriesSpy).toHaveBeenCalled();
+ expect(editCategoryDisplayOrderSpy).toHaveBeenCalled();
});
+ /**
it('should update all spec display orders', () => {
const _loadWorkflowSpecCategoriesSpy = spyOn((component as any), '_loadWorkflowSpecCategories').and.stub();
- (component as any)._updateSpecDisplayOrders(mockWorkflowSpecs);
mockWorkflowSpecs.forEach((spec, i) => {
const req = httpMock.expectOne(`apiRoot/workflow-specification/${spec.id}`);
@@ -494,6 +501,7 @@ describe('WorkflowSpecListComponent', () => {
expect(_loadWorkflowSpecCategoriesSpy).toHaveBeenCalled();
});
+ */
diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.ts b/src/app/workflow-spec-list/workflow-spec-list.component.ts
index be09dc9..1b5fa76 100644
--- a/src/app/workflow-spec-list/workflow-spec-list.component.ts
+++ b/src/app/workflow-spec-list/workflow-spec-list.component.ts
@@ -7,8 +7,8 @@ import {
ApiErrorsComponent,
ApiService,
isNumberDefined,
- moveArrayElementDown,
- moveArrayElementUp,
+ // moveArrayElementDown,
+ // moveArrayElementUp,
WorkflowSpec,
WorkflowSpecCategory,
} from 'sartography-workflow-lib';
@@ -52,8 +52,8 @@ export class WorkflowSpecListComponent implements OnInit {
selectedCat: WorkflowSpecCategory;
workflowSpecsByCategory: WorkflowSpecCategoryGroup[] = [];
categories: WorkflowSpecCategory[];
- moveUp = moveArrayElementUp;
- moveDown = moveArrayElementDown;
+ // moveUp = moveArrayElementUp;
+ // moveDown = moveArrayElementDown;
searchField: FormControl;
constructor(
@@ -222,12 +222,9 @@ export class WorkflowSpecListComponent implements OnInit {
});
}
- editCategoryDisplayOrder(cat: WorkflowSpecCategoryGroup, catId: number, direction: string) {
+ editCategoryDisplayOrder(catId: number, direction: string) {
this.api.reorderWorkflowCategory(catId, direction).subscribe(cat_change => {
- console.log('wfsbcat: ', this.workflowSpecsByCategory);
- console.log('this.categories', this.categories);
- console.log('changed is ', cat_change);
- // this.workflowSpecsByCategory = cat_change;
+ this.workflowSpecsByCategory = cat_change;
});
}