Compare commits
1 Commits
feature-de
...
feature-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
700fa24868 |
@@ -1,48 +1,55 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <div class="q-pa-md q-gutter-sm"> -->
|
<!-- <div class="q-pa-md q-gutter-sm"> -->
|
||||||
<q-tree
|
<q-tree :nodes="store.eventTree.screens" node-key="eventId" children-key="events" no-connectors
|
||||||
:nodes="store.eventTree.screens"
|
v-model:expanded="store.expandedScreen" :dense="true" :ref="tree">
|
||||||
node-key="eventId"
|
|
||||||
children-key="events"
|
|
||||||
no-connectors
|
|
||||||
v-model:expanded="store.expandedScreen"
|
|
||||||
:dense="true"
|
|
||||||
:ref="tree"
|
|
||||||
>
|
|
||||||
<template v-slot:header-EVENT="prop">
|
<template v-slot:header-EVENT="prop">
|
||||||
<div class="row col items-start no-wrap event-node" @click="onSelected(prop.node)">
|
<div :ref="prop.node.eventId" class="row col items-center no-wrap event-node">
|
||||||
<q-icon v-if="prop.node.eventId"
|
<q-icon v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px"
|
||||||
name="play_circle"
|
class="q-mr-sm">
|
||||||
:color="prop.node.hasFlow?'green':'grey'"
|
|
||||||
size="16px" class="q-mr-sm">
|
|
||||||
</q-icon>
|
</q-icon>
|
||||||
<div class="no-wrap" :class="selectedEvent && prop.node.eventId===selectedEvent.eventId?'selected-node':''">{{ prop.node.label }}</div>
|
<div class="no-wrap" @click="onSelected(prop.node)"
|
||||||
|
:class="selectedEvent && prop.node.eventId === selectedEvent.eventId ? 'selected-node' : ''">{{
|
||||||
|
prop.node.label }}</div>
|
||||||
<q-space></q-space>
|
<q-space></q-space>
|
||||||
<!-- <q-icon v-if="prop.node.hasFlow" name="delete" color="negative" size="16px" class="q-mr-sm"></q-icon> -->
|
<!-- <q-icon v-if="prop.node.hasFlow" name="delete" color="negative" size="16px" class="q-mr-sm"></q-icon> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:header-CHANGE="prop">
|
<template v-slot:header-CHANGE="prop">
|
||||||
<div class="row col items-start no-wrap event-node" >
|
<div class="row col items-center no-wrap event-node">
|
||||||
<div class="no-wrap">{{ prop.node.label }}</div>
|
<div class="no-wrap">{{ prop.node.label }}</div>
|
||||||
<q-space></q-space>
|
<q-space></q-space>
|
||||||
<q-icon name="add_circle" color="primary" size="16px" class="q-mr-sm" @click="addChangeEvent(prop.node)"></q-icon>
|
<q-icon name="add_circle" color="primary" size="16px" class="q-mr-sm"
|
||||||
|
@click="addChangeEvent(prop.node)"></q-icon>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-slot:header-DELETABLE="prop">
|
||||||
|
<div class="row col items-center event-node">
|
||||||
|
<div class="row col items-center" @click="onSelected(prop.node)">
|
||||||
|
<q-icon v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px"
|
||||||
|
class="q-mr-sm">
|
||||||
|
</q-icon>
|
||||||
|
<div>{{ prop.node.label }}</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<q-btn class="q-mr-sm delete-btn" flat fab-mini icon="delete_forever" padding="none" color="negative"
|
||||||
|
@click="deleteEvent(prop.node)"></q-btn>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-tree>
|
</q-tree>
|
||||||
<show-dialog v-model:visible="showDialog" name="フィールド選択" @close="closeDg" widht="400px">
|
<show-dialog v-model:visible="showDialog" name="フィールド選択" @close="closeDg">
|
||||||
<field-select ref="appDg" name="フィールド" type="single" :appId="store.appInfo?.appId"></field-select>
|
<field-select ref="appDg" name="フィールド" type="single" :appId="store.appInfo?.appId"></field-select>
|
||||||
</show-dialog>
|
</show-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, computed, ref } from 'vue';
|
|
||||||
import { IKintoneEvent ,IKintoneEventGroup, IKintoneEventNode, kintoneEvent} from '../../types/KintoneEvents';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
|
||||||
import { ActionFlow, ActionNode, RootAction } from 'src/types/ActionTypes';
|
|
||||||
import ShowDialog from '../ShowDialog.vue';
|
|
||||||
import FieldSelect from '../FieldSelect.vue';
|
|
||||||
import { QTree } from 'quasar';
|
import { QTree } from 'quasar';
|
||||||
|
import { ActionFlow, RootAction } from 'src/types/ActionTypes';
|
||||||
|
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||||
|
import { defineComponent, ref } from 'vue';
|
||||||
|
import { IKintoneEvent, IKintoneEventGroup, IKintoneEventNode } from '../../types/KintoneEvents';
|
||||||
|
import FieldSelect from '../FieldSelect.vue';
|
||||||
|
import ShowDialog from '../ShowDialog.vue';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'EventTree',
|
name: 'EventTree',
|
||||||
components: {
|
components: {
|
||||||
@@ -72,12 +79,12 @@ export default defineComponent({
|
|||||||
if (store.eventTree.findEventById(eventid)) {
|
if (store.eventTree.findEventById(eventid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedChangeEvent.value?.events.push(
|
selectedChangeEvent.value?.events.push({
|
||||||
new kintoneEvent(
|
eventId: eventid,
|
||||||
field.label,
|
label: field.name,
|
||||||
eventid,
|
parentId: selectedChangeEvent.value.eventId,
|
||||||
selectedChangeEvent.value.eventId)
|
header: 'DELETABLE'
|
||||||
);
|
});
|
||||||
tree.value?.expanded?.push(selectedChangeEvent.value.eventId);
|
tree.value?.expanded?.push(selectedChangeEvent.value.eventId);
|
||||||
tree.value?.expandAll();
|
tree.value?.expandAll();
|
||||||
}
|
}
|
||||||
@@ -89,6 +96,17 @@ export default defineComponent({
|
|||||||
selectedChangeEvent.value = node;
|
selectedChangeEvent.value = node;
|
||||||
showDialog.value = true;
|
showDialog.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deleteEvent = (node: IKintoneEvent) => {
|
||||||
|
if (!node.eventId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
store.deleteStoreEventAndFlow(node);
|
||||||
|
store.selectFlow(undefined)
|
||||||
|
console.log(store.selectedFlow);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const onSelected = (node: IKintoneEvent) => {
|
const onSelected = (node: IKintoneEvent) => {
|
||||||
if (!node.eventId) {
|
if (!node.eventId) {
|
||||||
return;
|
return;
|
||||||
@@ -98,6 +116,7 @@ export default defineComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const screen = store.eventTree.findEventById(node.parentId);
|
const screen = store.eventTree.findEventById(node.parentId);
|
||||||
|
|
||||||
let flow = store.findFlowByEventId(node.eventId);
|
let flow = store.findFlowByEventId(node.eventId);
|
||||||
let screenName = screen !== null ? screen.label : "";
|
let screenName = screen !== null ? screen.label : "";
|
||||||
let nodeLabel = node.label;
|
let nodeLabel = node.label;
|
||||||
@@ -105,6 +124,7 @@ export default defineComponent({
|
|||||||
// screenName=nodeLabel;
|
// screenName=nodeLabel;
|
||||||
// nodeLabel=`${node.label}の値を変更したとき`;
|
// nodeLabel=`${node.label}の値を変更したとき`;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (flow !== undefined && flow !== null) {
|
if (flow !== undefined && flow !== null) {
|
||||||
store.selectFlow(flow);
|
store.selectFlow(flow);
|
||||||
} else {
|
} else {
|
||||||
@@ -125,6 +145,7 @@ export default defineComponent({
|
|||||||
onSelected,
|
onSelected,
|
||||||
selectedEvent,
|
selectedEvent,
|
||||||
addChangeEvent,
|
addChangeEvent,
|
||||||
|
deleteEvent,
|
||||||
closeDg,
|
closeDg,
|
||||||
store
|
store
|
||||||
}
|
}
|
||||||
@@ -136,16 +157,21 @@ export default defineComponent({
|
|||||||
flex-wrap: nowarp;
|
flex-wrap: nowarp;
|
||||||
text-wrap: nowarp;
|
text-wrap: nowarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-node {
|
.event-node {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-node {
|
.selected-node {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
font-weight: bolder;
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-node:hover {
|
.event-node:hover {
|
||||||
background-color: $light-blue-1;
|
background-color: $light-blue-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
import { ActionFlow } from 'src/types/ActionTypes';
|
import { ActionFlow } from 'src/types/ActionTypes';
|
||||||
|
|
||||||
export class FlowCtrl
|
export class FlowCtrl {
|
||||||
{
|
async getFlows(appId: string): Promise<ActionFlow[]> {
|
||||||
|
|
||||||
async getFlows(appId:string):Promise<ActionFlow[]>
|
|
||||||
{
|
|
||||||
const flows: ActionFlow[] = [];
|
const flows: ActionFlow[] = [];
|
||||||
try {
|
try {
|
||||||
const result = await api.get(`api/flows/${appId}`);
|
const result = await api.get(`api/flows/${appId}`);
|
||||||
@@ -24,10 +21,9 @@ export class FlowCtrl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async SaveFlow(jsonData:any):Promise<boolean>
|
async SaveFlow(jsonData: any): Promise<boolean> {
|
||||||
{
|
|
||||||
const result = await api.post('api/flow', jsonData);
|
const result = await api.post('api/flow', jsonData);
|
||||||
console.info(result.data)
|
console.info(result.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -35,10 +31,19 @@ export class FlowCtrl
|
|||||||
* @param jsonData
|
* @param jsonData
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async UpdateFlow(jsonData:any):Promise<boolean>
|
async UpdateFlow(jsonData: any): Promise<boolean> {
|
||||||
{
|
|
||||||
const result = await api.put('api/flow/' + jsonData.flowid, jsonData);
|
const result = await api.put('api/flow/' + jsonData.flowid, jsonData);
|
||||||
console.info(result.data)
|
console.info(result.data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* フローを消去する
|
||||||
|
* @param flowId
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
async DeleteFlow(flowId: string): Promise<boolean> {
|
||||||
|
const result = await api.delete('api/flow/' + flowId);
|
||||||
|
console.info(result.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -46,12 +51,9 @@ export class FlowCtrl
|
|||||||
* @param appid
|
* @param appid
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async depoly(appid:string):Promise<boolean>
|
async depoly(appid: string): Promise<boolean> {
|
||||||
{
|
|
||||||
const result = await api.post(`api/v1/createjstokintone?app=${appid}`);
|
const result = await api.post(`api/v1/createjstokintone?app=${appid}`);
|
||||||
console.info(result.data);
|
console.info(result.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</q-drawer>
|
</q-drawer>
|
||||||
</div>
|
</div>
|
||||||
<q-btn flat dense round
|
<q-btn flat dense round :icon="drawerLeft ? 'keyboard_double_arrow_left' : 'keyboard_double_arrow_right'"
|
||||||
:icon="drawerLeft?'keyboard_double_arrow_left':'keyboard_double_arrow_right'"
|
:style="[drawerLeft ? { 'left': '300px' } : { 'left': '0px' }]" @click="drawerLeft = !drawerLeft"
|
||||||
:style="[drawerLeft?{'left':'300px'}:{'left':'0px'}]"
|
class="expand" />
|
||||||
@click="drawerLeft=!drawerLeft" class="expand" />
|
|
||||||
<div class="q-pa-md q-gutter-sm" :style="{ minWidth: minPanelWidth }">
|
<div class="q-pa-md q-gutter-sm" :style="{ minWidth: minPanelWidth }">
|
||||||
<div class="flowchart" v-if="store.currentFlow" :style="[drawerLeft ? { paddingLeft: '300px' } : {}]">
|
<div class="flowchart" v-if="store.currentFlow" :style="[drawerLeft ? { paddingLeft: '300px' } : {}]">
|
||||||
<node-item v-if="rootNode !== undefined" :key="rootNode.id" :isSelected="rootNode === store.activeNode"
|
<node-item v-if="rootNode !== undefined" :key="rootNode.id" :isSelected="rootNode === store.activeNode"
|
||||||
@@ -195,7 +194,22 @@ const onDeploy = async () => {
|
|||||||
|
|
||||||
const onSaveFlow = async () => {
|
const onSaveFlow = async () => {
|
||||||
const targetFlow = store.selectedFlow;
|
const targetFlow = store.selectedFlow;
|
||||||
|
|
||||||
|
const deleteFlows = () => {
|
||||||
|
$q.notify({
|
||||||
|
type: 'positive',
|
||||||
|
caption: "通知",
|
||||||
|
message: `削除 ${store.deleteFlowIds.length} イベント`
|
||||||
|
});
|
||||||
|
store.deletebackendFlow();
|
||||||
|
}
|
||||||
|
|
||||||
if (targetFlow === undefined) {
|
if (targetFlow === undefined) {
|
||||||
|
if (store.deleteFlowIds.length > 0) {
|
||||||
|
deleteFlows();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$q.notify({
|
$q.notify({
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
caption: "エラー",
|
caption: "エラー",
|
||||||
@@ -204,6 +218,9 @@ const onSaveFlow = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
if (store.deleteFlowIds.length > 0) {
|
||||||
|
deleteFlows();
|
||||||
|
}
|
||||||
saveLoading.value = true;
|
saveLoading.value = true;
|
||||||
await store.saveFlow(targetFlow);
|
await store.saveFlow(targetFlow);
|
||||||
saveLoading.value = false;
|
saveLoading.value = false;
|
||||||
@@ -265,6 +282,7 @@ onMounted(() => {
|
|||||||
top: 50px;
|
top: 50px;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.expand {
|
.expand {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ export interface FlowEditorState{
|
|||||||
eventTree: KintoneEventManager;
|
eventTree: KintoneEventManager;
|
||||||
selectedEvent: IKintoneEvent | undefined;
|
selectedEvent: IKintoneEvent | undefined;
|
||||||
expandedScreen: any[];
|
expandedScreen: any[];
|
||||||
|
deleteFlowIds: string[];
|
||||||
}
|
}
|
||||||
const flowCtrl = new FlowCtrl();
|
const flowCtrl = new FlowCtrl();
|
||||||
const eventTree = new KintoneEventManager();
|
const eventTree = new KintoneEventManager();
|
||||||
export const useFlowEditorStore = defineStore("flowEditor",{
|
export const useFlowEditorStore = defineStore('flowEditor', {
|
||||||
state: (): FlowEditorState => ({
|
state: (): FlowEditorState => ({
|
||||||
flowNames1: '',
|
flowNames1: '',
|
||||||
appInfo: undefined,
|
appInfo: undefined,
|
||||||
@@ -24,7 +25,8 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
activeNode: undefined,
|
activeNode: undefined,
|
||||||
eventTree: eventTree,
|
eventTree: eventTree,
|
||||||
selectedEvent: undefined,
|
selectedEvent: undefined,
|
||||||
expandedScreen:[]
|
expandedScreen: [],
|
||||||
|
deleteFlowIds: [],
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
/**
|
/**
|
||||||
@@ -43,17 +45,29 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
return (eventId: string) => {
|
return (eventId: string) => {
|
||||||
return state.flows?.find((flow) => {
|
return state.flows?.find((flow) => {
|
||||||
const root = flow.getRoot();
|
const root = flow.getRoot();
|
||||||
return root?.name===eventId
|
return root?.name === eventId;
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
|
findEventById(state) {
|
||||||
|
return (eventId: string) => {
|
||||||
|
return state.eventTree.findEventById(eventId);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
findEventFrist(state) {
|
||||||
|
return () => {
|
||||||
|
return state.eventTree.findEventFrist();
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
setFlows(flows: IActionFlow[]) {
|
setFlows(flows: IActionFlow[]) {
|
||||||
this.flows = flows;
|
this.flows = flows;
|
||||||
},
|
},
|
||||||
selectFlow(flow:IActionFlow){
|
selectFlow(flow: IActionFlow | undefined) {
|
||||||
this.selectedFlow = flow;
|
this.selectedFlow = flow;
|
||||||
},
|
},
|
||||||
setActiveNode(node: IActionNode) {
|
setActiveNode(node: IActionNode) {
|
||||||
@@ -62,6 +76,12 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
setApp(app: AppInfo) {
|
setApp(app: AppInfo) {
|
||||||
this.appInfo = app;
|
this.appInfo = app;
|
||||||
},
|
},
|
||||||
|
addDeleteFlowId(flowId: string) {
|
||||||
|
this.deleteFlowIds.push(flowId);
|
||||||
|
},
|
||||||
|
clearDeleteFlowIds() {
|
||||||
|
this.deleteFlowIds = [];
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* DBからフルーを保存する
|
* DBからフルーを保存する
|
||||||
* @returns
|
* @returns
|
||||||
@@ -80,7 +100,7 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
if (actionFlows && actionFlows.length > 0) {
|
if (actionFlows && actionFlows.length > 0) {
|
||||||
this.selectFlow(actionFlows[0]);
|
this.selectFlow(actionFlows[0]);
|
||||||
}
|
}
|
||||||
const expandNames = actionFlows.map(flow=>flow.getRoot()?.title);
|
const expandNames = actionFlows.map((flow) => flow.getRoot()?.title);
|
||||||
// const expandName =actionFlows[0].getRoot()?.title;
|
// const expandName =actionFlows[0].getRoot()?.title;
|
||||||
this.expandedScreen = expandNames;
|
this.expandedScreen = expandNames;
|
||||||
},
|
},
|
||||||
@@ -95,8 +115,8 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
appid: this.appInfo?.appId,
|
appid: this.appInfo?.appId,
|
||||||
eventid: root?.name,
|
eventid: root?.name,
|
||||||
name: root?.subTitle,
|
name: root?.subTitle,
|
||||||
content: JSON.stringify(flow)
|
content: JSON.stringify(flow),
|
||||||
}
|
};
|
||||||
|
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
return await flowCtrl.SaveFlow(jsonData);
|
return await flowCtrl.SaveFlow(jsonData);
|
||||||
@@ -104,6 +124,33 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
return await flowCtrl.UpdateFlow(jsonData);
|
return await flowCtrl.UpdateFlow(jsonData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async deletebackendFlow() {
|
||||||
|
const deletePromises = Object.values(this.deleteFlowIds).map((flowId) =>
|
||||||
|
flowCtrl.DeleteFlow(flowId)
|
||||||
|
);
|
||||||
|
await Promise.all(deletePromises);
|
||||||
|
this.clearDeleteFlowIds();
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteStoreEventAndFlow(event: IKintoneEvent) {
|
||||||
|
const store = useFlowEditorStore();
|
||||||
|
if (event.flowData) {
|
||||||
|
const flow = event.flowData;
|
||||||
|
if (flow.id === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('delete flow', flow);
|
||||||
|
|
||||||
|
this.addDeleteFlowId(flow.id);
|
||||||
|
eventTree.deleteEvent(event, store);
|
||||||
|
if(this.flows){
|
||||||
|
this.flows = this.flows.filter((f) => f.id !== flow.id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
eventTree.deleteEvent(event, store);
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* デプロイする
|
* デプロイする
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +159,6 @@ export const useFlowEditorStore = defineStore("flowEditor",{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return await flowCtrl.depoly(this.appInfo?.appId);
|
return await flowCtrl.depoly(this.appInfo?.appId);
|
||||||
}
|
},
|
||||||
|
},
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useFlowEditorStore } from 'src/stores/flowEditor';
|
||||||
import { IActionFlow } from './ActionTypes';
|
import { IActionFlow } from './ActionTypes';
|
||||||
export interface IKintoneEventNode {
|
export interface IKintoneEventNode {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -15,18 +16,15 @@ export interface IKintoneEventGroup extends IKintoneEventNode {
|
|||||||
events: IKintoneEventNode[];
|
events: IKintoneEventNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class kintoneEvent implements IKintoneEvent {
|
export class kintoneEvent implements IKintoneEvent {
|
||||||
eventId: string;
|
eventId: string;
|
||||||
parentId: string;
|
parentId: string;
|
||||||
get hasFlow(): boolean {
|
get hasFlow(): boolean {
|
||||||
return this.flowData!==undefined && this.flowData.actionNodes.length>1
|
return this.flowData !== undefined && this.flowData.actionNodes.length > 1;
|
||||||
};
|
}
|
||||||
flowData?: IActionFlow | undefined;
|
flowData?: IActionFlow | undefined;
|
||||||
label: string;
|
label: string;
|
||||||
get header():string{
|
header = 'EVENT';
|
||||||
return "EVENT";
|
|
||||||
}
|
|
||||||
constructor(label: string, eventId: string, parentId: string) {
|
constructor(label: string, eventId: string, parentId: string) {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
@@ -40,9 +38,14 @@ export class kintoneEventGroup implements IKintoneEventGroup{
|
|||||||
label: string;
|
label: string;
|
||||||
events: IKintoneEventNode[];
|
events: IKintoneEventNode[];
|
||||||
get header(): string {
|
get header(): string {
|
||||||
return "EVENTGROUP";
|
return 'EVENTGROUP';
|
||||||
}
|
}
|
||||||
constructor(eventId:string,label:string,events:IKintoneEventNode[],parentId:string){
|
constructor(
|
||||||
|
eventId: string,
|
||||||
|
label: string,
|
||||||
|
events: IKintoneEventNode[],
|
||||||
|
parentId: string
|
||||||
|
) {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
@@ -50,16 +53,20 @@ export class kintoneEventGroup implements IKintoneEventGroup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class kintoneEventForChange implements IKintoneEventGroup {
|
export class kintoneEventForChange implements IKintoneEventGroup {
|
||||||
eventId: string;
|
eventId: string;
|
||||||
parentId: string;
|
parentId: string;
|
||||||
label: string;
|
label: string;
|
||||||
events: IKintoneEventNode[];
|
events: IKintoneEventNode[];
|
||||||
get header(): string {
|
get header(): string {
|
||||||
return "CHANGE";
|
return 'CHANGE';
|
||||||
}
|
}
|
||||||
constructor(eventId:string,label:string,events:IKintoneEventNode[],parentId:string){
|
constructor(
|
||||||
|
eventId: string,
|
||||||
|
label: string,
|
||||||
|
events: IKintoneEventNode[],
|
||||||
|
parentId: string
|
||||||
|
) {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
@@ -67,8 +74,6 @@ export class kintoneEventForChange implements IKintoneEventGroup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class KintoneEventManager {
|
export class KintoneEventManager {
|
||||||
public screens: IKintoneEventGroup[];
|
public screens: IKintoneEventGroup[];
|
||||||
|
|
||||||
@@ -80,24 +85,38 @@ export class KintoneEventManager {
|
|||||||
this.screens = this.getKintoneEvents();
|
this.screens = this.getKintoneEvents();
|
||||||
for (const flow of flows) {
|
for (const flow of flows) {
|
||||||
const eventId = flow.getRoot()?.name;
|
const eventId = flow.getRoot()?.name;
|
||||||
|
console.log('eventId:', eventId);
|
||||||
if (eventId !== undefined) {
|
if (eventId !== undefined) {
|
||||||
const eventNode = this.findEventById(eventId);
|
const eventNode = this.findEventById(eventId);
|
||||||
if(eventNode!==null && eventNode.header==="EVENT"){
|
if (eventNode !== null && eventNode.header === 'EVENT') {
|
||||||
const event = eventNode as kintoneEvent;
|
const event = eventNode as kintoneEvent;
|
||||||
event.flowData = flow;
|
event.flowData = flow;
|
||||||
} else {
|
} else {
|
||||||
//EventGroupのIDを取得
|
//EventGroupのIDを取得
|
||||||
const lastIndex = eventId.lastIndexOf(".");
|
const lastIndex = eventId.lastIndexOf('.');
|
||||||
const groupId = eventId.substring(0, lastIndex);
|
const groupId = eventId.substring(0, lastIndex);
|
||||||
const eventNode = this.findEventById(groupId);
|
const eventNode = this.findEventById(groupId);
|
||||||
if(eventNode && (eventNode.header==="EVENTGROUP" || eventNode.header==="CHANGE")){
|
if (
|
||||||
|
eventNode &&
|
||||||
|
(eventNode.header === 'EVENTGROUP' || eventNode.header === 'CHANGE')
|
||||||
|
) {
|
||||||
const groupEvent = eventNode as kintoneEventGroup;
|
const groupEvent = eventNode as kintoneEventGroup;
|
||||||
const newEvent =new kintoneEvent(
|
console.log('label:', flow.getRoot()?.subTitle);
|
||||||
flow.getRoot()?.subTitle || "",
|
|
||||||
eventId,
|
const newEvent = {
|
||||||
groupEvent.parentId
|
label: flow.getRoot()?.subTitle || '',
|
||||||
);
|
eventId: eventId,
|
||||||
newEvent.flowData=flow;
|
parentId: groupId,
|
||||||
|
header: 'DELETABLE',
|
||||||
|
hasFlow: true,
|
||||||
|
flowData: flow,
|
||||||
|
};
|
||||||
|
|
||||||
|
// new kintoneEvent(
|
||||||
|
// flow.getRoot()?.subTitle || '',
|
||||||
|
// eventId,
|
||||||
|
// groupEvent.parentId
|
||||||
|
// );
|
||||||
groupEvent.events.push(newEvent);
|
groupEvent.events.push(newEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,19 +124,25 @@ export class KintoneEventManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public findEventFrist() {
|
||||||
|
return this.findEventById('app.record.create.show') as IKintoneEvent;
|
||||||
|
}
|
||||||
|
|
||||||
public findEventById(eventId: string): IKintoneEventNode | null {
|
public findEventById(eventId: string): IKintoneEventNode | null {
|
||||||
const screen = this.findScreen(eventId);
|
const screen = this.findScreen(eventId);
|
||||||
if(screen) {return screen;}
|
if (screen) {
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
for (const screen of this.screens) {
|
for (const screen of this.screens) {
|
||||||
for (const event of screen.events) {
|
for (const event of screen.events) {
|
||||||
if (event.eventId === eventId) {
|
if (event.eventId === eventId) {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
if(event.header==="EVENTGROUP"||event.header==="CHANGE"){
|
if (event.header === 'EVENTGROUP' || event.header === 'CHANGE') {
|
||||||
const eventGroup = event as IKintoneEventGroup;
|
const eventGroup = event as IKintoneEventGroup;
|
||||||
const targetEvent = eventGroup.events.find((ev) => {
|
const targetEvent = eventGroup.events.find((ev) => {
|
||||||
return ev.eventId === eventId;
|
return ev.eventId === eventId;
|
||||||
})
|
});
|
||||||
if (targetEvent) {
|
if (targetEvent) {
|
||||||
return targetEvent;
|
return targetEvent;
|
||||||
}
|
}
|
||||||
@@ -128,39 +153,169 @@ export class KintoneEventManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public findScreen(eventId: string): IKintoneEventGroup | undefined {
|
public findScreen(eventId: string): IKintoneEventGroup | undefined {
|
||||||
return this.screens.find(screen=>screen.eventId==eventId);
|
return this.screens.find((screen) => screen.eventId == eventId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public deleteEvent(
|
||||||
|
event: kintoneEvent,
|
||||||
|
store: ReturnType<typeof useFlowEditorStore>
|
||||||
|
) {
|
||||||
|
if (event.header !== 'DELETABLE') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parent = store.findEventById(event.parentId);
|
||||||
|
if (parent?.header !== 'CHANGE' && parent?.header !== 'EVENTGROUP') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const realParent = parent as kintoneEventForChange;
|
||||||
|
|
||||||
|
const index = realParent.events.findIndex(
|
||||||
|
(e) => e.eventId === event.eventId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (index !== -1) {
|
||||||
|
realParent.events.splice(index, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getKintoneEvents(): IKintoneEventGroup[] {
|
public getKintoneEvents(): IKintoneEventGroup[] {
|
||||||
return [
|
return [
|
||||||
new kintoneEventGroup("app.record.create","レコード追加画面",[
|
new kintoneEventGroup(
|
||||||
new kintoneEvent('レコード追加画面を表示した後','app.record.create.show',"app.record.create"),
|
'app.record.create',
|
||||||
new kintoneEvent('保存をクリックしたとき','app.record.create.submit',"app.record.create"),
|
'レコード追加画面',
|
||||||
new kintoneEvent('保存が成功したとき','app.record.create.submit.success',"app.record.create"),
|
[
|
||||||
new kintoneEventForChange('app.record.create.change','フィールドの値を変更したとき',[],"app.record.create"),
|
new kintoneEvent(
|
||||||
new kintoneEventGroup('app.record.create.show.customButtonClick','ボタンをクリックした時',[],"app.record.create")
|
'レコード追加画面を表示した後',
|
||||||
],""),
|
'app.record.create.show',
|
||||||
new kintoneEventGroup("app.record.detail","レコード詳細画面",[
|
'app.record.create'
|
||||||
new kintoneEvent('レコード詳細画面を表示した後','app.record.detail.show',"app.record.detail"),
|
),
|
||||||
new kintoneEvent('レコードを削除するとき','app.record.detail.delete.submit',"app.record.detail"),
|
new kintoneEvent(
|
||||||
new kintoneEvent('プロセス管理のアクションを実行したとき','app.record.detail.process.proceed',"app.record.detail"),
|
'保存をクリックしたとき',
|
||||||
new kintoneEventGroup('app.record.detail.show.customButtonClick','ボタンをクリックした時',[],"app.record.detail"),
|
'app.record.create.submit',
|
||||||
],""),
|
'app.record.create'
|
||||||
new kintoneEventGroup("app.record.edit","レコード編集画面",[
|
),
|
||||||
new kintoneEvent('レコード編集画面を表示した後','app.record.edit.show',"app.record.edit"),
|
new kintoneEvent(
|
||||||
new kintoneEvent('保存をクリックしたとき','app.record.edit.submit',"app.record.edit"),
|
'保存が成功したとき',
|
||||||
new kintoneEvent('保存が成功したとき','app.record.edit.submit.success',"app.record.edit"),
|
'app.record.create.submit.success',
|
||||||
new kintoneEventForChange('app.record.edit.change','フィールドの値を変更したとき',[],"app.record.edit"),
|
'app.record.create'
|
||||||
new kintoneEventGroup('app.record.edit.show.customButtonClick','ボタンをクリックした時',[],"app.record.edit"),
|
),
|
||||||
],""),
|
new kintoneEventForChange(
|
||||||
new kintoneEventGroup("app.record.index","レコード一覧画面",[
|
'app.record.create.change',
|
||||||
new kintoneEvent('一覧画面を表示した後', 'app.record.index.show',"app.record.index"),
|
'フィールドの値を変更したとき',
|
||||||
new kintoneEvent('インライン編集を開始したとき','app.record.index.edit.show',"app.record.index"),
|
[],
|
||||||
new kintoneEvent('インライン編集の【保存】をクリックしたとき','app.record.index.edit.submit',"app.record.index"),
|
'app.record.create'
|
||||||
new kintoneEvent('インライン編集の保存が成功したとき', 'app.record.index.edit.submit.success',"app.record.index"),
|
),
|
||||||
new kintoneEventForChange('app.record.index.edit.change','インライン編集のフィールド値を変更したとき' ,[],"app.record.index"),
|
new kintoneEventGroup(
|
||||||
new kintoneEventGroup('app.record.detail.show.customButtonClick','ボタンをクリックした時',[],"app.record.index"),
|
'app.record.create.show.customButtonClick',
|
||||||
],"")
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.create'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.detail',
|
||||||
|
'レコード詳細画面',
|
||||||
|
[
|
||||||
|
new kintoneEvent(
|
||||||
|
'レコード詳細画面を表示した後',
|
||||||
|
'app.record.detail.show',
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'レコードを削除するとき',
|
||||||
|
'app.record.detail.delete.submit',
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'プロセス管理のアクションを実行したとき',
|
||||||
|
'app.record.detail.process.proceed',
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.detail.show.customButtonClick',
|
||||||
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.detail'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.edit',
|
||||||
|
'レコード編集画面',
|
||||||
|
[
|
||||||
|
new kintoneEvent(
|
||||||
|
'レコード編集画面を表示した後',
|
||||||
|
'app.record.edit.show',
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'保存をクリックしたとき',
|
||||||
|
'app.record.edit.submit',
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'保存が成功したとき',
|
||||||
|
'app.record.edit.submit.success',
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEventForChange(
|
||||||
|
'app.record.edit.change',
|
||||||
|
'フィールドの値を変更したとき',
|
||||||
|
[],
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.edit.show.customButtonClick',
|
||||||
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.edit'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.index',
|
||||||
|
'レコード一覧画面',
|
||||||
|
[
|
||||||
|
new kintoneEvent(
|
||||||
|
'一覧画面を表示した後',
|
||||||
|
'app.record.index.show',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'インライン編集を開始したとき',
|
||||||
|
'app.record.index.edit.show',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'インライン編集の【保存】をクリックしたとき',
|
||||||
|
'app.record.index.edit.submit',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEvent(
|
||||||
|
'インライン編集の保存が成功したとき',
|
||||||
|
'app.record.index.edit.submit.success',
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEventForChange(
|
||||||
|
'app.record.index.edit.change',
|
||||||
|
'インライン編集のフィールド値を変更したとき',
|
||||||
|
[],
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
new kintoneEventGroup(
|
||||||
|
'app.record.detail.show.customButtonClick',
|
||||||
|
'ボタンをクリックした時',
|
||||||
|
[],
|
||||||
|
'app.record.index'
|
||||||
|
),
|
||||||
|
],
|
||||||
|
''
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user