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 app.core.config as config
import os
from pathlib import Path
from app.db.session import SessionLocal
from app.db.crud import get_flows_by_app,get_activedomain
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()
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')}
headers={config.API_V1_AUTH_KEY:c.API_V1_AUTH_VALUE}
data ={'name':'file','filename':os.path.basename(file)}
@@ -264,7 +267,11 @@ def createappjs(app):
for flow in flows:
content[flow.eventid] = {'flowid':flow.flowid,'name':flow.name,'content':flow.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:
file.write(js)
return fpath
@@ -524,4 +531,5 @@ async def createjstokintone(app:str,env = Depends(getkintoneenv)):
deoployappfromkintone(app,appjscs["revision"],env)
return appjscs
except Exception as e:
print(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",
"description": "Kintoneアプリの自動生成とデプロイを支援ツールです",
"productName": "Kintone App Builder",
"productName": "Kintone Automate",
"author": "maxiaozhe@alicorns.co.jp <maxiaozhe@alicorns.co.jp>",
"private": true,
"scripts": {
@@ -10,7 +10,9 @@
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore",
"test": "echo \"No test specified\" && exit 0",
"dev": "quasar dev",
"build": "quasar build"
"build": "set \"SOURCE_MAP=false\" && quasar build",
"build:dev":"set \"SOURCE_MAP=true\" && quasar build"
},
"dependencies": {
"@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 { Notify } = require('quasar');
const version = package.version;
const productName=package.productName;
console.log(process.env);
module.exports = configure(function (/* ctx */) {
return {
eslint: {
@@ -49,7 +51,6 @@ module.exports = configure(function (/* ctx */) {
// 'themify',
// 'line-awesome',
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
'roboto-font', // 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'],
node: 'node16'
},
sourcemap:process.env.SOURCE_MAP === 'true',
vueRouterMode: 'hash', // available values: 'hash', 'history'
// vueRouterBase,
@@ -70,7 +72,7 @@ module.exports = configure(function (/* ctx */) {
// publicPath: '/',
// analyze: true,
env: { ...dotenv, version },
env: { ...dotenv, version ,productName},
// rawDefine: {}
// ignorePublicFolder: true,
// minify: false,

View File

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

View File

@@ -1,15 +1,7 @@
<template>
<div class="q-pa-md">
<q-table
title="Treats"
:rows="rows"
:columns="columns"
row-key="id"
selection="single"
:filter="filter"
:loading="loading"
v-model:selected="selected"
>
<q-table title="Treats" :rows="rows" :columns="columns" row-key="id" selection="single" :filter="filter"
:loading="loading" v-model:selected="selected">
<template v-slot:top>
<q-btn color="primary" :disable="loading" label="新規" @click="addRow" />
@@ -54,8 +46,8 @@
</q-form>
</q-card-section>
<q-card-actions align="right" class="text-primary">
<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="Save" type="submit" color="primary" @click="onSubmit" />
<q-btn label="Cancel" type="cancel" color="primary" flat class="q-ml-sm" @click="closeDg()" />
</q-card-actions>
</q-card>
@@ -70,7 +62,7 @@
<q-card-actions align="right">
<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>
</q-dialog>
@@ -79,12 +71,11 @@
</template>
<script setup lang="ts">
import { ref,onMounted, reactive} from 'vue';
import { useQuasar } from 'quasar'
import { ref, onMounted, reactive } from 'vue';
import { api } from 'boot/axios';
const columns = [
{ name: 'id'},
{ name: 'id' },
{
name: 'tenantid',
required: true,
@@ -95,131 +86,121 @@ const columns = [
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: 'password', label: 'Password', field: 'password' }
]
];
const loading = ref(false)
const filter = ref('')
const rows = reactive([])
const show = ref(false);
const confirm = ref(false);
const selected = ref([])
const tenantid = ref('')
const name = ref('')
const url =ref('')
const isPwd =ref(true)
const kintoneuser =ref('')
const kintonepwd =ref('')
const loading = ref(false);
const filter = ref('');
const rows = ref([]);
const show = ref(false);
const confirm = ref(false);
const selected = ref([]);
const tenantid = ref('');
const name = ref('');
const url = ref('');
const isPwd = ref(true);
const kintoneuser = ref('');
const kintonepwd = ref('');
const $q = useQuasar()
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; });
let editId = ref(0);
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 addRow = () => {
editId.value
show.value = true;
}
const deleteDomain = () => {
api.delete(`api/domain/${editId.value}`).then(() => {
getDomain();
})
editId.value = 0;
selected.value = [];
};
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;
}
const editRow = () => {
if (selected.value.length === 0) {
return;
}
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();
}
const deleteDomain = () => {
api.delete(`api/domain/${editId.value}`).then(() =>{
getDomain();
})
editId.value = 0;
selected.value=[];
};
const editRow = () => {
if(selected.value.length === 0)
{
return;
}
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;
const onSubmit = () => {
if (editId.value !== 0) {
api.put(`api/domain`, {
'id': editId.value,
'tenantid': tenantid.value,
'name': name.value,
'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 onSubmit = () => {
if(editId.value !== 0)
{
api.put(`api/domain`,{
'id': editId.value,
'tenantid': tenantid.value,
'name': name.value,
'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;
}
const onReset = () => {
name.value = '';
url.value = '';
kintoneuser.value = '';
kintonepwd.value = '';
isPwd.value = true;
editId.value = 0;
}
</script>

View File

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

View File

@@ -14,9 +14,9 @@ const routes: RouteRecordRaw[] = [
{ path: 'ruleEditor', component: () => import('pages/RuleEditor.vue') },
{ path: 'test', component: () => import('pages/testQursar.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: 'flowEditor2', component: () => import('pages/FlowChart.vue') },
{ path: 'FlowChart', component: () => import('pages/FlowChart.vue') },
{ path: 'flowChart2', component: () => import('pages/FlowEditorPage2.vue') },
{ path: 'right', component: () => import('pages/testRight.vue') },
{ path: 'domain', component: () => import('pages/TenantDomain.vue') },

View File

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