@@ -21,6 +21,7 @@ import {
2121 applyDeltasPruned
2222} from '@/components/cylc/gscan/deltas'
2323import DeltasCallback from '@/services/callbacks'
24+ import { clear } from '@/components/cylc/gscan/index'
2425
2526/**
2627 * Provisional GScan callback until https://github.com/cylc/cylc-ui/pull/736
@@ -29,37 +30,41 @@ import DeltasCallback from '@/services/callbacks'
2930class GScanCallback extends DeltasCallback {
3031 constructor ( ) {
3132 super ( )
32- this . workflows = null
33+ this . lookup = null
34+ this . gscan = null
3335 }
3436
3537 before ( deltas , store , errors ) {
36- this . workflows = Object . assign ( { } , store . state . workflows . workflows )
38+ // If it were TS, we would use a ReadOnly type here...
39+ this . lookup = store . state . workflows . lookup
40+ const gscan = store . state . gscan . gscan
41+ this . gscan = Object . assign ( { } , gscan )
3742 }
3843
3944 tearDown ( store , errors ) {
40- store . commit ( 'workflows/SET_WORKFLOWS' , { } )
41- this . workflows = null
45+ clear ( this . gscan )
46+ store . commit ( 'gscan/SET_GSCAN' , this . gscan )
47+ this . lookup = null
48+ this . gscan = null
4249 }
4350
4451 onAdded ( added , store , errors ) {
45- this . workflows = Object . assign ( this . workflows , store . state . workflows . workflows )
46- const results = applyDeltasAdded ( added , this . workflows )
52+ const results = applyDeltasAdded ( added , this . gscan , { } )
4753 errors . push ( ...results . errors )
4854 }
4955
5056 onUpdated ( updated , store , errors ) {
51- const results = applyDeltasUpdated ( updated , this . workflows )
57+ const results = applyDeltasUpdated ( updated , this . gscan , { } )
5258 errors . push ( ...results . errors )
5359 }
5460
5561 onPruned ( pruned , store , errors ) {
56- this . workflows = Object . assign ( this . workflows , store . state . workflows . workflows )
57- const results = applyDeltasPruned ( pruned , this . workflows )
62+ const results = applyDeltasPruned ( pruned , this . gscan , { } )
5863 errors . push ( ...results . errors )
5964 }
6065
6166 commit ( store , errors ) {
62- store . commit ( 'workflows/SET_WORKFLOWS ' , this . workflows )
67+ store . commit ( 'gscan/SET_GSCAN ' , this . gscan )
6368 }
6469}
6570
0 commit comments