</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">41</context>
+ <context context-type="linenumber">48</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">52</context>
+ <context context-type="linenumber">59</context>
</context-group>
</trans-unit>
<trans-unit id="6338800642797811873" datatype="html">
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">40</context>
+ <context context-type="linenumber">47</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">49</context>
+ <context context-type="linenumber">56</context>
</context-group>
</trans-unit>
<trans-unit id="9124347207158517893" datatype="html">
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">30</context>
+ <context context-type="linenumber">34</context>
</context-group>
</trans-unit>
<trans-unit id="4348351765075925931" datatype="html">
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">42</context>
+ <context context-type="linenumber">49</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">57</context>
+ <context context-type="linenumber">64</context>
</context-group>
</trans-unit>
<trans-unit id="595732867213154214" datatype="html">
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">30</context>
+ <context context-type="linenumber">34</context>
</context-group>
</trans-unit>
<trans-unit id="6751234988479444294" datatype="html">
<source>No workflows defined.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.html</context>
- <context context-type="linenumber">66</context>
+ <context context-type="linenumber">73</context>
</context-group>
</trans-unit>
<trans-unit id="4200688335642457098" datatype="html">
<context context-type="linenumber">128</context>
</context-group>
</trans-unit>
+ <trans-unit id="5459159218551862653" datatype="html">
+ <source>Enabled workflow</source>
+ <context-group purpose="location">
+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
+ <context context-type="linenumber">139</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="6035681056091592756" datatype="html">
+ <source>Disabled workflow</source>
+ <context-group purpose="location">
+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
+ <context context-type="linenumber">140</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="1376040678213338380" datatype="html">
+ <source>Error toggling workflow.</source>
+ <context-group purpose="location">
+ <context context-type="sourcefile">src/app/components/manage/workflows/workflows.component.ts</context>
+ <context context-type="linenumber">146</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="2649252321173430744" datatype="html">
<source>Not Found</source>
<context-group purpose="location">
<li class="list-group-item">
<div class="row">
<div class="col" i18n>Name</div>
- <div class="col d-none d-sm-block" i18n>Sort order</div>
+ <div class="col d-none d-sm-flex" i18n>Sort order</div>
<div class="col" i18n>Status</div>
- <div class="col d-none d-sm-block" i18n>Triggers</div>
+ <div class="col d-none d-sm-flex" i18n>Triggers</div>
<div class="col" i18n>Actions</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editWorkflow(workflow)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.Workflow)">{{workflow.name}}</button></div>
- <div class="col d-flex align-items-center d-none d-sm-block"><code>{{workflow.order}}</code></div>
- <div class="col d-flex align-items-center"><code> @if(workflow.enabled) { <ng-container i18n>Enabled</ng-container> } @else { <span i18n class="text-muted">Disabled</span> }</code></div>
- <div class="col d-flex align-items-center d-none d-sm-block">{{getTypesList(workflow)}}</div>
+ <div class="col d-flex align-items-center d-none d-sm-flex"><code>{{workflow.order}}</code></div>
+ <div class="col d-flex align-items-center">
+ <div class="form-check form-switch mb-0">
+ <input #inputField type="checkbox" class="form-check-input cursor-pointer" [id]="workflow.id+'_enable'" [(ngModel)]="workflow.enabled" (change)="onWorkflowEnableToggled(workflow)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.Workflow }">
+ <label class="form-check-label cursor-pointer" [for]="workflow.id+'_enable'">
+ <code> @if(workflow.enabled) { <ng-container i18n>Enabled</ng-container> } @else { <span i18n class="text-muted">Disabled</span> }</code>
+ </label>
+ </div>
+ </div>
+ <div class="col d-flex align-items-center d-none d-sm-flex">{{getTypesList(workflow)}}</div>
<div class="col">
<div class="btn-group d-block d-sm-none">
editDialog.confirmClicked.emit()
expect(reloadSpy).toHaveBeenCalled()
})
+
+ it('should update workflow when enable is toggled', () => {
+ const patchSpy = jest.spyOn(workflowService, 'patch')
+ const toggleInput = fixture.debugElement.query(
+ By.css('input[type="checkbox"]')
+ )
+ const toastErrorSpy = jest.spyOn(toastService, 'showError')
+ const toastInfoSpy = jest.spyOn(toastService, 'showInfo')
+ // fail first
+ patchSpy.mockReturnValueOnce(
+ throwError(() => new Error('Error getting config'))
+ )
+ toggleInput.nativeElement.click()
+ expect(patchSpy).toHaveBeenCalled()
+ expect(toastErrorSpy).toHaveBeenCalled()
+ // succeed second
+ patchSpy.mockReturnValueOnce(of(workflows[0]))
+ toggleInput.nativeElement.click()
+ patchSpy.mockReturnValueOnce(of({ ...workflows[0], enabled: false }))
+ toggleInput.nativeElement.click()
+ expect(patchSpy).toHaveBeenCalled()
+ expect(toastInfoSpy).toHaveBeenCalled()
+ })
})