floweditorの動き修正
This commit is contained in:
@@ -1,32 +1,54 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ActionFlow,AppInfo } from 'src/types/ActionTypes';
|
||||
import {FlowCtrl } from '../control/flowCtrl';
|
||||
import { AppInfo ,IActionFlow} from 'src/types/ActionTypes';
|
||||
import { kintoneEvents,IKintoneEvent,KintoneEventManager } from 'src/types/KintoneEvents';
|
||||
import {FlowCtrl } from '../control/flowctrl';
|
||||
|
||||
export interface FlowEditorState{
|
||||
flowNames1:string;
|
||||
appInfo?:AppInfo;
|
||||
flows?:ActionFlow[];
|
||||
selectedFlow?:ActionFlow|undefined;
|
||||
flows?:IActionFlow[];
|
||||
selectedFlow?:IActionFlow|undefined;
|
||||
eventTree:KintoneEventManager;
|
||||
selectedEvent:IKintoneEvent|undefined;
|
||||
}
|
||||
const flowCtrl=new FlowCtrl();
|
||||
export const useFlowEditorStore = defineStore("flowEditor",{
|
||||
state: ():FlowEditorState => ({
|
||||
flowNames1: '',
|
||||
appInfo:undefined,
|
||||
flows:undefined,
|
||||
selectedFlow:undefined
|
||||
flows:[],
|
||||
selectedFlow:undefined,
|
||||
eventTree:kintoneEvents,
|
||||
selectedEvent:undefined
|
||||
}),
|
||||
getters: {
|
||||
currentFlow():ActionFlow|undefined{
|
||||
/**
|
||||
*
|
||||
* @returns 現在編集しているフロー
|
||||
*/
|
||||
currentFlow():IActionFlow|undefined{
|
||||
return this.selectedFlow;
|
||||
},
|
||||
/**
|
||||
* KintoneイベントIDから、バンドしているフローを検索する
|
||||
* @param state
|
||||
* @returns
|
||||
*/
|
||||
findFlowByEventId(state){
|
||||
return (eventId:string)=>{
|
||||
return state.flows?.find((flow)=>{
|
||||
const root=flow.getRoot();
|
||||
return root?.name===eventId
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
setFlows(flows:ActionFlow[]){
|
||||
setFlows(flows:IActionFlow[]){
|
||||
this.flows=flows;
|
||||
},
|
||||
selectFlow(flow:ActionFlow){
|
||||
selectFlow(flow:IActionFlow){
|
||||
this.selectedFlow=flow;
|
||||
},
|
||||
setApp(app:AppInfo){
|
||||
@@ -35,6 +57,8 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
||||
async setFlow(){
|
||||
if(this.appInfo===undefined) return;
|
||||
const actionFlows = await flowCtrl.getFlows(this.appInfo?.appId);
|
||||
//eventTreeにバンドする
|
||||
this.eventTree.bindFlows(actionFlows);
|
||||
if(actionFlows && actionFlows.length>0){
|
||||
this.setFlows(actionFlows);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user