backend bug fix

This commit is contained in:
2023-11-13 22:03:45 +09:00
parent 55181f2c57
commit 5fb8fe53bb
9 changed files with 162 additions and 196 deletions

View File

@@ -7,6 +7,7 @@ import httpx
import deepdiff import deepdiff
import app.core.config as config import app.core.config as config
import os import os
from pathlib import Path
from app.db.session import SessionLocal from app.db.session import SessionLocal
from app.db.crud import get_flows_by_app,get_activedomain from app.db.crud import get_flows_by_app,get_activedomain
from app.core.auth import get_current_active_user,get_current_user from app.core.auth import get_current_active_user,get_current_user
@@ -228,6 +229,8 @@ def getkintoneorgs(c:config.KINTONE_ENV):
return r.json() return r.json()
def uploadkintonefiles(file,c:config.KINTONE_ENV): def uploadkintonefiles(file,c:config.KINTONE_ENV):
if (file.endswith('alc_runtime.js') and config.DEPLOY_MODE == "DEV"):
return {'fileKey':file}
upload_files = {'file': open(file,'rb')} upload_files = {'file': open(file,'rb')}
headers={config.API_V1_AUTH_KEY:c.API_V1_AUTH_VALUE} headers={config.API_V1_AUTH_KEY:c.API_V1_AUTH_VALUE}
data ={'name':'file','filename':os.path.basename(file)} data ={'name':'file','filename':os.path.basename(file)}
@@ -264,7 +267,11 @@ def createappjs(app):
for flow in flows: for flow in flows:
content[flow.eventid] = {'flowid':flow.flowid,'name':flow.name,'content':flow.content} content[flow.eventid] = {'flowid':flow.flowid,'name':flow.name,'content':flow.content}
js = 'const alcflow=' + json.dumps(content) js = 'const alcflow=' + json.dumps(content)
fpath = os.path.join("Temp",f"alc_setting_{app}.js") scriptdir = Path(__file__).resolve().parent
rootdir = scriptdir.parent.parent.parent.parent
fpath = os.path.join(rootdir,"Temp",f"alc_setting_{app}.js")
print(rootdir)
print(fpath)
with open(fpath,'w') as file: with open(fpath,'w') as file:
file.write(js) file.write(js)
return fpath return fpath
@@ -524,4 +531,5 @@ async def createjstokintone(app:str,env = Depends(getkintoneenv)):
deoployappfromkintone(app,appjscs["revision"],env) deoployappfromkintone(app,appjscs["revision"],env)
return appjscs return appjscs
except Exception as e: except Exception as e:
print(str(e))
raise HTTPException(status_code=400, detail=f"Error occurred : {str(e)}") raise HTTPException(status_code=400, detail=f"Error occurred : {str(e)}")

View File

@@ -1,8 +1,8 @@
{ {
"name": "kintone-app-builder", "name": "kintone-automate",
"version": "0.2.0", "version": "0.2.0",
"description": "Kintoneアプリの自動生成とデプロイを支援ツールです", "description": "Kintoneアプリの自動生成とデプロイを支援ツールです",
"productName": "Kintone App Builder", "productName": "Kintone Automate",
"author": "maxiaozhe@alicorns.co.jp <maxiaozhe@alicorns.co.jp>", "author": "maxiaozhe@alicorns.co.jp <maxiaozhe@alicorns.co.jp>",
"private": true, "private": true,
"scripts": { "scripts": {
@@ -10,7 +10,9 @@
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore", "format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore",
"test": "echo \"No test specified\" && exit 0", "test": "echo \"No test specified\" && exit 0",
"dev": "quasar dev", "dev": "quasar dev",
"build": "quasar build" "build": "set \"SOURCE_MAP=false\" && quasar build",
"build:dev":"set \"SOURCE_MAP=true\" && quasar build"
}, },
"dependencies": { "dependencies": {
"@quasar/extras": "^1.16.4", "@quasar/extras": "^1.16.4",

View File

@@ -0,0 +1,8 @@
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
</configuration>

View File

@@ -14,6 +14,8 @@ const dotenv = require('dotenv').config().parsed;
const package = require('./package.json'); const package = require('./package.json');
const { Notify } = require('quasar'); const { Notify } = require('quasar');
const version = package.version; const version = package.version;
const productName=package.productName;
console.log(process.env);
module.exports = configure(function (/* ctx */) { module.exports = configure(function (/* ctx */) {
return { return {
eslint: { eslint: {
@@ -49,7 +51,6 @@ module.exports = configure(function (/* ctx */) {
// 'themify', // 'themify',
// 'line-awesome', // 'line-awesome',
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both! // 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
'roboto-font', // optional, you are not bound to it 'roboto-font', // optional, you are not bound to it
'material-icons', // optional, you are not bound to it 'material-icons', // optional, you are not bound to it
], ],
@@ -60,6 +61,7 @@ module.exports = configure(function (/* ctx */) {
browser: ['es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1'], browser: ['es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1'],
node: 'node16' node: 'node16'
}, },
sourcemap:process.env.SOURCE_MAP === 'true',
vueRouterMode: 'hash', // available values: 'hash', 'history' vueRouterMode: 'hash', // available values: 'hash', 'history'
// vueRouterBase, // vueRouterBase,
@@ -70,7 +72,7 @@ module.exports = configure(function (/* ctx */) {
// publicPath: '/', // publicPath: '/',
// analyze: true, // analyze: true,
env: { ...dotenv, version }, env: { ...dotenv, version ,productName},
// rawDefine: {} // rawDefine: {}
// ignorePublicFolder: true, // ignorePublicFolder: true,
// minify: false, // minify: false,

View File

@@ -11,8 +11,8 @@
@click="toggleLeftDrawer" @click="toggleLeftDrawer"
/> />
<q-toolbar-title> <q-toolbar-title>
Kintone App Builder {{ productName }}
<q-badge align="top" outline>V{{ env.version }}</q-badge> <q-badge align="top" outline>V{{ version }}</q-badge>
</q-toolbar-title> </q-toolbar-title>
<domain-selector></domain-selector> <domain-selector></domain-selector>
<q-btn flat round dense icon="logout" @click="authStore.logout()"/> <q-btn flat round dense icon="logout" @click="authStore.logout()"/>
@@ -28,7 +28,7 @@
<q-item-label <q-item-label
header header
> >
Essential Links 関連リンク
</q-item-label> </q-item-label>
<EssentialLink <EssentialLink
@@ -65,14 +65,7 @@ const essentialLinks: EssentialLinkProps[] = [
title: 'フローエディター', title: 'フローエディター',
caption: 'flowChart', caption: 'flowChart',
icon: 'account_tree', icon: 'account_tree',
link: '/#/flowEditor2', link: '/#/FlowChart',
target:'_self'
},
{
title: 'FlowEditor',
caption: 'FlowEditor',
icon: 'account_tree',
link: '/#/flowEditor',
target:'_self' target:'_self'
}, },
{ {
@@ -152,8 +145,8 @@ const essentialLinks: EssentialLinkProps[] = [
]; ];
const leftDrawerOpen = ref(false) const leftDrawerOpen = ref(false)
const version = process.env.version;
const env=process.env; const productName = process.env.productName;
function toggleLeftDrawer() { function toggleLeftDrawer() {
leftDrawerOpen.value = !leftDrawerOpen.value leftDrawerOpen.value = !leftDrawerOpen.value

View File

@@ -1,15 +1,7 @@
<template> <template>
<div class="q-pa-md"> <div class="q-pa-md">
<q-table <q-table title="Treats" :rows="rows" :columns="columns" row-key="id" selection="single" :filter="filter"
title="Treats" :loading="loading" v-model:selected="selected">
:rows="rows"
:columns="columns"
row-key="id"
selection="single"
:filter="filter"
:loading="loading"
v-model:selected="selected"
>
<template v-slot:top> <template v-slot:top>
<q-btn color="primary" :disable="loading" label="新規" @click="addRow" /> <q-btn color="primary" :disable="loading" label="新規" @click="addRow" />
@@ -54,8 +46,8 @@
</q-form> </q-form>
</q-card-section> </q-card-section>
<q-card-actions align="right" class="text-primary"> <q-card-actions align="right" class="text-primary">
<q-btn label="Save" type="submit" color="primary" @click="onSubmit"/> <q-btn label="Save" type="submit" color="primary" @click="onSubmit" />
<q-btn label="Cancel" type="cancel" color="primary" flat class="q-ml-sm" @click="closeDg()"/> <q-btn label="Cancel" type="cancel" color="primary" flat class="q-ml-sm" @click="closeDg()" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
@@ -70,7 +62,7 @@
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn flat label="Cancel" color="primary" v-close-popup /> <q-btn flat label="Cancel" color="primary" v-close-popup />
<q-btn flat label="OK" color="primary" v-close-popup @click = "deleteDomain()"/> <q-btn flat label="OK" color="primary" v-close-popup @click="deleteDomain()" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
@@ -79,12 +71,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref,onMounted, reactive} from 'vue'; import { ref, onMounted, reactive } from 'vue';
import { useQuasar } from 'quasar'
import { api } from 'boot/axios'; import { api } from 'boot/axios';
const columns = [ const columns = [
{ name: 'id'}, { name: 'id' },
{ {
name: 'tenantid', name: 'tenantid',
required: true, required: true,
@@ -95,131 +86,121 @@ const columns = [
sortable: true sortable: true
}, },
{ name: 'name', align: 'center', label: 'Name', field: 'name', sortable: true }, { name: 'name', align: 'center', label: 'Name', field: 'name', sortable: true },
{ name: 'url', align: 'left',label: 'URL', field: 'url', sortable: true }, { name: 'url', align: 'left', label: 'URL', field: 'url', sortable: true },
{ name: 'user', label: 'Account', field: 'user' }, { name: 'user', label: 'Account', field: 'user' },
{ name: 'password', label: 'Password', field: 'password' } { name: 'password', label: 'Password', field: 'password' }
] ];
const loading = ref(false) const loading = ref(false);
const filter = ref('') const filter = ref('');
const rows = reactive([]) const rows = ref([]);
const show = ref(false); const show = ref(false);
const confirm = ref(false); const confirm = ref(false);
const selected = ref([]) const selected = ref([]);
const tenantid = ref('') const tenantid = ref('');
const name = ref('') const name = ref('');
const url =ref('') const url = ref('');
const isPwd =ref(true) const isPwd = ref(true);
const kintoneuser =ref('') const kintoneuser = ref('');
const kintonepwd =ref('') const kintonepwd = ref('');
const $q = useQuasar() let editId = ref(0);
let editId = ref(0);
const getDomain = () => {
loading.value = true;
api.get(`api/domains/testtenant`).then(res => {
rows.length = 0;
res.data.forEach((item) => {
rows.push({ id:item.id,tenantid: item.tenantid,name: item.name, url: item.url, user: item.kintoneuser, password: item.kintonepwd });
}
)
}).finally(()=>{ loading.value = false; });
const getDomain = async () => {
loading.value = true;
const result= await api.get(`api/domains/1`);
rows.value= result.data.map((item)=>{
return { id: item.id, tenantid: item.tenantid, name: item.name, url: item.url, user: item.kintoneuser, password: item.kintonepwd }
});
loading.value = false;
} }
onMounted(() => {
getDomain(); onMounted(async () => {
await getDomain();
}) })
// emulate fetching data from server
const addRow = () => {
editId.value
show.value = true;
}
const removeRow = () => {
//loading.value = true
confirm.value = true;
let row = JSON.parse(JSON.stringify(selected.value[0]));
if (selected.value.length === 0) {
return;
}
editId.value = row.id;
}
// emulate fetching data from server const deleteDomain = () => {
const addRow = () => { api.delete(`api/domain/${editId.value}`).then(() => {
editId.value getDomain();
show.value = true; })
} editId.value = 0;
selected.value = [];
};
const removeRow = () => { const editRow = () => {
//loading.value = true if (selected.value.length === 0) {
confirm.value = true; return;
let row = JSON.parse(JSON.stringify(selected.value[0])); }
if(selected.value.length === 0) let row = JSON.parse(JSON.stringify(selected.value[0]));
{ editId.value = row.id;
return; tenantid.value = row.tenantid;
} name.value = row.name;
editId.value = row.id; url.value = row.url;
} kintoneuser.value = row.user;
kintonepwd.value = row.password;
isPwd.value = true;
show.value = true;
};
const closeDg = () => {
show.value = false;
onReset();
}
const deleteDomain = () => { const onSubmit = () => {
api.delete(`api/domain/${editId.value}`).then(() =>{ if (editId.value !== 0) {
getDomain(); api.put(`api/domain`, {
}) 'id': editId.value,
editId.value = 0; 'tenantid': tenantid.value,
selected.value=[]; 'name': name.value,
}; 'url': url.value,
'kintoneuser': kintoneuser.value,
const editRow = () => { 'kintonepwd': kintonepwd.value
if(selected.value.length === 0) }).then(() => {
{ getDomain();
return; closeDg();
}
let row = JSON.parse(JSON.stringify(selected.value[0]));
editId.value = row.id;
tenantid.value = row.tenantid;
name.value = row.name;
url.value = row.url;
kintoneuser.value = row.user;
kintonepwd.value = row.password;
isPwd.value = true;
show.value = true;
};
const closeDg = () => {
show.value = false;
onReset(); onReset();
} })
}
else {
api.post(`api/domain`, {
'id': 0,
'tenantid': tenantid.value,
'name': name.value,
'url': url.value,
'kintoneuser': kintoneuser.value,
'kintonepwd': kintonepwd.value
}).then(() => {
getDomain();
closeDg();
onReset();
})
}
selected.value = [];
}
const onSubmit = () => { const onReset = () => {
if(editId.value !== 0) name.value = '';
{ url.value = '';
api.put(`api/domain`,{ kintoneuser.value = '';
'id': editId.value, kintonepwd.value = '';
'tenantid': tenantid.value, isPwd.value = true;
'name': name.value, editId.value = 0;
'url': url.value, }
'kintoneuser': kintoneuser.value,
'kintonepwd': kintonepwd.value
}).then(() =>{
getDomain();
closeDg();
onReset();
})
}
else
{
api.post(`api/domain`,{
'id': 0,
'tenantid': tenantid.value,
'name': name.value,
'url': url.value,
'kintoneuser': kintoneuser.value,
'kintonepwd': kintonepwd.value
}).then(() =>{
getDomain();
closeDg();
onReset();
})
}
selected.value=[];
}
const onReset = () => {
name.value = '';
url.value = '';
kintoneuser.value = '';
kintonepwd.value ='';
isPwd.value = true;
editId.value = 0;
}
</script> </script>

View File

@@ -179,6 +179,7 @@ import { useAuthStore } from 'stores/useAuthStore';
const authStore = useAuthStore(); const authStore = useAuthStore();
import { api } from 'boot/axios'; import { api } from 'boot/axios';
import { domain } from 'process';
const $q = useQuasar() const $q = useQuasar()
@@ -193,21 +194,14 @@ let activedomainid = ref(0);
const columns = [ const columns = [
{ name: 'id'}, { name: 'id'},
{ {name: 'name',required: true,label: 'Name',align: 'left',field: 'name',sortable: true},
name: 'name',
required: true,
label: 'Name',
align: 'left',
field: row => row.name,
sortable: true
},
{ name: 'url', align: 'center', label: 'Domain', field: 'url', sortable: true }, { name: 'url', align: 'center', label: 'Domain', field: 'url', sortable: true },
{ name: 'kintoneuser', label: 'User', field: 'kintoneuser', sortable: true }, { name: 'kintoneuser', label: 'User', field: 'kintoneuser', sortable: true },
{ name: 'kintonepwd' }, { name: 'kintonepwd' },
{ name: 'active', field: 'active'} { name: 'active', field: 'active'}
] ]
const rows = reactive([]) const rows = ref([] as any[]);
const isActive = (id:number) =>{ const isActive = (id:number) =>{
if(id == activedomainid.value) if(id == activedomainid.value)
@@ -252,21 +246,17 @@ const closeDg = (val:string) => {
} }
}; };
const getDomain = () => { const getDomain = async () => {
api.get(`api/activedomain`).then(res => { const resp = await api.get(`api/activedomain`);
activedomainid.value = res.data.id; activedomainid.value = resp.data.id;
authStore.changedomain(res.data.name); const domainResult = await api.get(`api/domain`);
}); const domains = domainResult.data as any[];
api.get(`api/domain`).then(res => { rows.value=domains.map((item)=>{
rows.length = 0; return { id:item.id,name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd}
res.data.forEach((item) => { });
rows.push({ id:item.id,name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd});
}
)
});
} }
onMounted(() => { onMounted(async () => {
getDomain(); await getDomain();
}) })
const isDomain = (val) =>{ const isDomain = (val) =>{

View File

@@ -14,9 +14,9 @@ const routes: RouteRecordRaw[] = [
{ path: 'ruleEditor', component: () => import('pages/RuleEditor.vue') }, { path: 'ruleEditor', component: () => import('pages/RuleEditor.vue') },
{ path: 'test', component: () => import('pages/testQursar.vue') }, { path: 'test', component: () => import('pages/testQursar.vue') },
{ path: 'flow', component: () => import('pages/testFlow.vue') }, { path: 'flow', component: () => import('pages/testFlow.vue') },
{ path: 'flowchart', component: () => import('pages/FlowChartTest.vue') }, { path: 'FlowChartTest', component: () => import('pages/FlowChartTest.vue') },
{ path: 'flowEditor', component: () => import('pages/FlowEditorPage.vue') }, { path: 'flowEditor', component: () => import('pages/FlowEditorPage.vue') },
{ path: 'flowEditor2', component: () => import('pages/FlowChart.vue') }, { path: 'FlowChart', component: () => import('pages/FlowChart.vue') },
{ path: 'flowChart2', component: () => import('pages/FlowEditorPage2.vue') }, { path: 'flowChart2', component: () => import('pages/FlowEditorPage2.vue') },
{ path: 'right', component: () => import('pages/testRight.vue') }, { path: 'right', component: () => import('pages/testRight.vue') },
{ path: 'domain', component: () => import('pages/TenantDomain.vue') }, { path: 'domain', component: () => import('pages/TenantDomain.vue') },

View File

@@ -2,37 +2,19 @@
{ {
"component": "FieldInput", "component": "FieldInput",
"props": { "props": {
"displayName": "採番項目", "displayName": "フィールド",
"modelValue": {}, "modelValue": {},
"name": "field", "name": "field",
"placeholder": "採番項目を選択してください" "placeholder": "必須項目を選択してください"
} }
}, },
{ {
"component": "InputText", "component": "MuiltInputText",
"props": { "props": {
"displayName": "フォーマット", "displayName": "エラーメッセージ",
"modelValue": "", "modelValue": "",
"name": "format", "name": "message",
"placeholder": "数値書式文字列を指定します" "placeholder": "エラーメッセージを入力してください"
}
},
{
"component": "InputText",
"props": {
"displayName": "前につける文字列",
"modelValue": "",
"name": "prefix",
"placeholder": "前につける文字列を入力してください"
}
},
{
"component": "InputText",
"props": {
"displayName": "後ろにつける文字列",
"modelValue": "",
"name": "suffix",
"placeholder": "後ろにつける文字列を入力してください"
} }
} }
] ]