From 5fb8fe53bb3578d051d07d7ad644c5cc9b0383b5 Mon Sep 17 00:00:00 2001 From: "maxiaozhe@alicorns.co.jp" Date: Mon, 13 Nov 2023 22:03:45 +0900 Subject: [PATCH] backend bug fix --- backend/app/api/api_v1/routers/kintone.py | 10 +- frontend/package.json | 8 +- frontend/public/web.config | 8 + frontend/quasar.config.js | 6 +- frontend/src/layouts/MainLayout.vue | 19 +- frontend/src/pages/TenantDomain.vue | 237 ++++++++++------------ frontend/src/pages/UserDomain.vue | 36 ++-- frontend/src/router/routes.ts | 4 +- sample.json | 30 +-- 9 files changed, 162 insertions(+), 196 deletions(-) create mode 100644 frontend/public/web.config diff --git a/backend/app/api/api_v1/routers/kintone.py b/backend/app/api/api_v1/routers/kintone.py index e060c09..e46057a 100644 --- a/backend/app/api/api_v1/routers/kintone.py +++ b/backend/app/api/api_v1/routers/kintone.py @@ -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)}") diff --git a/frontend/package.json b/frontend/package.json index ccf24e6..eed35cf 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -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 ", "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", diff --git a/frontend/public/web.config b/frontend/public/web.config new file mode 100644 index 0000000..3d8d44f --- /dev/null +++ b/frontend/public/web.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/frontend/quasar.config.js b/frontend/quasar.config.js index bcb0fcd..c592fdc 100644 --- a/frontend/quasar.config.js +++ b/frontend/quasar.config.js @@ -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, diff --git a/frontend/src/layouts/MainLayout.vue b/frontend/src/layouts/MainLayout.vue index b8ce327..ddfd120 100644 --- a/frontend/src/layouts/MainLayout.vue +++ b/frontend/src/layouts/MainLayout.vue @@ -11,8 +11,8 @@ @click="toggleLeftDrawer" /> - Kintone App Builder - V{{ env.version }} + {{ productName }} + V{{ version }} @@ -28,7 +28,7 @@ - Essential Links + 関連リンク
- + diff --git a/frontend/src/pages/UserDomain.vue b/frontend/src/pages/UserDomain.vue index 35a8f5d..4e2fe36 100644 --- a/frontend/src/pages/UserDomain.vue +++ b/frontend/src/pages/UserDomain.vue @@ -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) =>{ diff --git a/frontend/src/router/routes.ts b/frontend/src/router/routes.ts index 77aeab2..1d7e1ea 100644 --- a/frontend/src/router/routes.ts +++ b/frontend/src/router/routes.ts @@ -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') }, diff --git a/sample.json b/sample.json index 1974cc3..47bef0d 100644 --- a/sample.json +++ b/sample.json @@ -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": "エラーメッセージを入力してください" } } ] \ No newline at end of file