すべてフローの一括保存機能追加
This commit is contained in:
@@ -16,7 +16,27 @@
|
|||||||
<div class="flex-center fixed-bottom bg-grey-3 q-pa-md row ">
|
<div class="flex-center fixed-bottom bg-grey-3 q-pa-md row ">
|
||||||
<q-btn color="secondary" glossy label="デプロイ" @click="onDeploy" icon="sync" :loading="deployLoading" />
|
<q-btn color="secondary" glossy label="デプロイ" @click="onDeploy" icon="sync" :loading="deployLoading" />
|
||||||
<q-space></q-space>
|
<q-space></q-space>
|
||||||
<q-btn color="primary" label="保存" @click="onSaveFlow" icon="save" :loading="saveLoading" />
|
<q-btn-dropdown color="primary" label="保存" icon="save" :loading="saveLoading" >
|
||||||
|
<q-list>
|
||||||
|
<q-item clickable v-close-popup @click="onSaveFlow">
|
||||||
|
<q-item-section avatar >
|
||||||
|
<q-icon name="save" color="primary"></q-icon>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label>選択中フローの保存</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
|
||||||
|
<q-item clickable v-close-popup @click="onSaveAllFlow">
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="collections_bookmark" color="accent"></q-icon>
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>
|
||||||
|
<q-item-label>一括保存</q-item-label>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</q-btn-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</q-drawer>
|
</q-drawer>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,10 +99,7 @@ const showAddAction = ref(false);
|
|||||||
const drawerRight = ref(false);
|
const drawerRight = ref(false);
|
||||||
const filter=ref("");
|
const filter=ref("");
|
||||||
const model = ref("");
|
const model = ref("");
|
||||||
const addActionNode = (action: IActionNode) => {
|
|
||||||
// refFlow.value?.actionNodes.push(action);
|
|
||||||
store.currentFlow?.actionNodes.push(action);
|
|
||||||
}
|
|
||||||
const rootNode = computed(()=>{
|
const rootNode = computed(()=>{
|
||||||
return store.currentFlow?.getRoot();
|
return store.currentFlow?.getRoot();
|
||||||
});
|
});
|
||||||
@@ -205,7 +222,7 @@ const onSaveFlow = async () => {
|
|||||||
$q.notify({
|
$q.notify({
|
||||||
type: 'negative',
|
type: 'negative',
|
||||||
caption: 'エラー',
|
caption: 'エラー',
|
||||||
message: `編集中のフローがありません。`
|
message: `選択中のフローがありません。`
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -227,7 +244,40 @@ const onSaveFlow = async () => {
|
|||||||
message: `${targetFlow.getRoot()?.subTitle}のフローの設定の保存が失敗しました。`
|
message: `${targetFlow.getRoot()?.subTitle}のフローの設定の保存が失敗しました。`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* すべてフローの設定を保存する
|
||||||
|
*/
|
||||||
|
const onSaveAllFlow= async ()=>{
|
||||||
|
try{
|
||||||
|
const targetFlows = store.eventTree.findAllFlows();
|
||||||
|
if (!targetFlows || targetFlows.length === 0 ) {
|
||||||
|
$q.notify({
|
||||||
|
type: 'negative',
|
||||||
|
caption: 'エラー',
|
||||||
|
message: `設定されたフローがありません。`
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
saveLoading.value = true;
|
||||||
|
for(const flow of targetFlows ){
|
||||||
|
await store.saveFlow(flow);
|
||||||
|
$q.notify({
|
||||||
|
type: 'positive',
|
||||||
|
caption: "通知",
|
||||||
|
message: `${flow.getRoot()?.subTitle}のフロー設定を保存しました。`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
saveLoading.value = false;
|
||||||
|
}catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
saveLoading.value = false;
|
||||||
|
$q.notify({
|
||||||
|
type: 'negative',
|
||||||
|
caption: "エラー",
|
||||||
|
message: `フローの設定の保存が失敗しました。`
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
|||||||
@@ -138,6 +138,31 @@ export class KintoneEventManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public findAllFlows():IActionFlow[]{
|
||||||
|
const flows:IActionFlow[]=[];
|
||||||
|
for (const screen of this.screens) {
|
||||||
|
for (const event of screen.events) {
|
||||||
|
if (event.header === "EVENT") {
|
||||||
|
const eventNode = event as IKintoneEvent;
|
||||||
|
if(eventNode.flowData!==undefined){
|
||||||
|
flows.push(eventNode.flowData);
|
||||||
|
}
|
||||||
|
}else if (event.header === 'EVENTGROUP' || event.header === 'CHANGE') {
|
||||||
|
const eventGroup = event as IKintoneEventGroup;
|
||||||
|
const targetEvent = eventGroup.events.find((ev) => {
|
||||||
|
if (ev.header === "EVENT") {
|
||||||
|
const eventNode = ev as IKintoneEvent;
|
||||||
|
if(eventNode.flowData!==undefined){
|
||||||
|
flows.push(eventNode.flowData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flows;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user