Compare commits

..

1 Commits

Author SHA1 Message Date
xue jiahao
e362c80e98 show domain page for all user
1. show ドメイン管理
2. hide ドメイン適用
3. force redirect to domain page if user no domain exist
2024-11-06 21:56:14 +08:00
16 changed files with 85 additions and 367 deletions

4
.gitignore vendored
View File

@@ -1,7 +1,3 @@
.vscode .vscode
.mypy_cache .mypy_cache
docker-stack.yml docker-stack.yml
backend/pyvenv.cfg
backend/Include/
backend/Scripts/

View File

@@ -1,5 +1,4 @@
from fastapi import Query, Request,Depends, APIRouter, UploadFile,HTTPException,File from fastapi import Query, Request,Depends, APIRouter, UploadFile,HTTPException,File
from app.core.operation import log_operation
from app.db import Base,engine from app.db import Base,engine
from app.db.session import get_db from app.db.session import get_db
from app.db.crud import * from app.db.crud import *
@@ -8,69 +7,8 @@ from typing import List, Optional
from app.core.auth import get_current_active_user,get_current_user from app.core.auth import get_current_active_user,get_current_user
from app.core.apiexception import APIException from app.core.apiexception import APIException
import httpx
import app.core.config as config
platform_router = r = APIRouter() platform_router = r = APIRouter()
@r.get(
"/apps",
response_model=List[AppList],
response_model_exclude_none=True,
)
async def apps_list(
request: Request,
user = Depends(get_current_user),
db=Depends(get_db),
):
try:
platformapps = get_apps(db)
domain = get_activedomain(db, user.id)
kintoneevn = config.KINTONE_ENV(domain)
headers={config.API_V1_AUTH_KEY:kintoneevn.API_V1_AUTH_VALUE}
url = f"{kintoneevn.BASE_URL}{config.API_V1_STR}/apps.json"
offset = 0
limit = 100
all_apps = []
while True:
r = httpx.get(f"{url}?limit={limit}&offset={offset}", headers=headers)
json_data = r.json()
apps = json_data.get("apps",[])
all_apps.extend(apps)
if len(apps)<limit:
break
offset += limit
tempapps = platformapps.copy()
for papp in tempapps:
exist = False
for kapp in all_apps:
if kapp['appId'] == papp.appid:
exist = True
break
if not exist:
platformapps.remove(papp)
return platformapps
except Exception as e:
raise APIException('platform:apps',request.url._url,f"Error occurred while get apps:",e)
@r.post("/apps", response_model=AppList, response_model_exclude_none=True)
async def apps_update(
request: Request,
app: AppVersion,
user=Depends(get_current_user),
db=Depends(get_db),
):
try:
return update_appversion(db, app,user.id)
except Exception as e:
raise APIException('platform:apps',request.url._url,f"Error occurred while get create app :",e)
@r.get( @r.get(
"/appsettings/{id}", "/appsettings/{id}",
response_model=App, response_model=App,
@@ -191,7 +129,7 @@ async def flow_list(
try: try:
domain = get_activedomain(db, user.id) domain = get_activedomain(db, user.id)
print("domain=>",domain) print("domain=>",domain)
flows = get_flows_by_app(db, domain.url, appid) flows = get_flows_by_app(db, domain.id, appid)
return flows return flows
except Exception as e: except Exception as e:
raise APIException('platform:flow',request.url._url,f"Error occurred while get flow by appid:",e) raise APIException('platform:flow',request.url._url,f"Error occurred while get flow by appid:",e)
@@ -206,7 +144,7 @@ async def flow_create(
): ):
try: try:
domain = get_activedomain(db, user.id) domain = get_activedomain(db, user.id)
return create_flow(db, domain.url, flow) return create_flow(db, domain.id, flow)
except Exception as e: except Exception as e:
raise APIException('platform:flow',request.url._url,f"Error occurred while create flow:",e) raise APIException('platform:flow',request.url._url,f"Error occurred while create flow:",e)

View File

@@ -5,7 +5,7 @@ import base64
PROJECT_NAME = "KintoneAppBuilder" PROJECT_NAME = "KintoneAppBuilder"
#SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/dev" #SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/dev"
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://kabAdmin:P%40ssw0rd!@kintonetooldb.postgres.database.azure.com/dev_v2" SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/postgres"
#SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/test" #SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@kintonetooldb.postgres.database.azure.com/test"
#SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@ktune-prod-db.postgres.database.azure.com/postgres" #SQLALCHEMY_DATABASE_URI = "postgres://kabAdmin:P@ssw0rd!@ktune-prod-db.postgres.database.azure.com/postgres"
API_V1_STR = "/k/v1" API_V1_STR = "/k/v1"

View File

@@ -69,46 +69,6 @@ def edit_user(
db.refresh(db_user) db.refresh(db_user)
return db_user return db_user
def get_apps(
db: Session
) -> t.List[schemas.AppList]:
return db.query(models.App).all()
def update_appversion(db: Session, appedit: schemas.AppVersion,userid:int):
app = db.query(models.App).filter(and_(models.App.domainurl == appedit.domainurl,models.App.appid == appedit.appid)).first()
if app:
app.version = app.version + 1
db_app = app
appver = app.version
else:
appver = 1
db_app = models.App(
domainurl = appedit.domainurl,
appid=appedit.appid,
appname=appedit.appname,
version = 1,
updateuser= userid
)
db.add(db_app)
flows = db.query(models.Flow).filter(and_(models.Flow.domainurl == appedit.domainurl,models.App.appid == appedit.appid))
for flow in flows:
db_flowhistory = models.FlowHistory(
flowid = flow.flowid,
appid = flow.appid,
eventid = flow.eventid,
domainurl = flow.domainurl,
name = flow.name,
content = flow.content,
createuser = userid,
version = appver
)
db.add(db_flowhistory)
db.commit()
db.refresh(db_app)
return db_app
def get_appsetting(db: Session, id: int): def get_appsetting(db: Session, id: int):
app = db.query(models.AppSetting).get(id) app = db.query(models.AppSetting).get(id)
@@ -165,12 +125,12 @@ def get_actions(db: Session):
return actions return actions
def create_flow(db: Session, domainurl: str, flow: schemas.FlowBase): def create_flow(db: Session, domainid: int, flow: schemas.FlowBase):
db_flow = models.Flow( db_flow = models.Flow(
flowid=flow.flowid, flowid=flow.flowid,
appid=flow.appid, appid=flow.appid,
eventid=flow.eventid, eventid=flow.eventid,
domainurl=domainurl, domainid=domainid,
name=flow.name, name=flow.name,
content=flow.content content=flow.content
) )
@@ -217,8 +177,8 @@ def get_flow(db: Session, flowid: str):
raise HTTPException(status_code=404, detail="Data not found") raise HTTPException(status_code=404, detail="Data not found")
return flow return flow
def get_flows_by_app(db: Session,domainurl: str, appid: str): def get_flows_by_app(db: Session, domainid: int, appid: str):
flows = db.query(models.Flow).filter(and_(models.Flow.domainurl == domainurl,models.Flow.appid == appid)).all() flows = db.query(models.Flow).filter(and_(models.Flow.domainid == domainid,models.Flow.appid == appid)).all()
if not flows: if not flows:
raise Exception("Data not found") raise Exception("Data not found")
return flows return flows

View File

@@ -1,6 +1,5 @@
from sqlalchemy import Boolean, Column, Integer, String, DateTime,ForeignKey from sqlalchemy import Boolean, Column, Integer, String, DateTime,ForeignKey
from sqlalchemy.ext.declarative import as_declarative from sqlalchemy.ext.declarative import as_declarative
from sqlalchemy.orm import relationship
from datetime import datetime from datetime import datetime
from app.core.security import chacha20Decrypt from app.core.security import chacha20Decrypt
@@ -21,16 +20,6 @@ class User(Base):
is_active = Column(Boolean, default=True) is_active = Column(Boolean, default=True)
is_superuser = Column(Boolean, default=False) is_superuser = Column(Boolean, default=False)
class App(Base):
__tablename__ = "app"
domainurl = Column(String(200), nullable=False)
appname = Column(String(200), nullable=False)
appid = Column(String(100), index=True, nullable=False)
version = Column(Integer)
updateuser = Column(Integer,ForeignKey("user.id"))
user = relationship('User')
class AppSetting(Base): class AppSetting(Base):
__tablename__ = "appsetting" __tablename__ = "appsetting"
@@ -62,22 +51,10 @@ class Flow(Base):
flowid = Column(String(100), index=True, nullable=False) flowid = Column(String(100), index=True, nullable=False)
appid = Column(String(100), index=True, nullable=False) appid = Column(String(100), index=True, nullable=False)
eventid = Column(String(100), index=True, nullable=False) eventid = Column(String(100), index=True, nullable=False)
domainurl = Column(String(200)) domainid = Column(Integer,ForeignKey("domain.id"))
name = Column(String(200)) name = Column(String(200))
content = Column(String) content = Column(String)
class FlowHistory(Base):
__tablename__ = "flowhistory"
flowid = Column(String(100), index=True, nullable=False)
appid = Column(String(100), index=True, nullable=False)
eventid = Column(String(100), index=True, nullable=False)
domainurl = Column(String(200))
name = Column(String(200))
content = Column(String)
createuser = Column(Integer,ForeignKey("user.id"))
version = Column(Integer)
class Tenant(Base): class Tenant(Base):
__tablename__ = "tenant" __tablename__ = "tenant"
@@ -131,17 +108,6 @@ class ErrorLog(Base):
location = Column(String(500)) location = Column(String(500))
content = Column(String(5000)) content = Column(String(5000))
class OperationLog(Base):
__tablename__ = "operationlog"
tenantid = Column(String(100))
domainurl = Column(String(200))
userid = Column(Integer,ForeignKey("user.id"))
operation = Column(String(200))
function = Column(String(200))
detail = Column(String(200))
user = relationship('User')
class KintoneFormat(Base): class KintoneFormat(Base):
__tablename__ = "kintoneformat" __tablename__ = "kintoneformat"

View File

@@ -28,21 +28,21 @@ class UserCreate(UserBase):
is_active:bool is_active:bool
is_superuser:bool is_superuser:bool
class ConfigDict: class Config:
orm_mode = True orm_mode = True
class UserEdit(UserBase): class UserEdit(UserBase):
password: t.Optional[str] = None password: t.Optional[str] = None
class ConfigDict: class Config:
orm_mode = True orm_mode = True
class User(UserBase): class User(UserBase):
id: int id: int
class ConfigDict: class Config:
orm_mode = True orm_mode = True
@@ -50,17 +50,6 @@ class Token(BaseModel):
access_token: str access_token: str
token_type: str token_type: str
class AppList(Base):
domainurl: str
appname: str
appid:str
version:int
user:UserOut
class AppVersion(BaseModel):
domainurl: str
appname: str
appid:str
class TokenData(BaseModel): class TokenData(BaseModel):
id:int = 0 id:int = 0
@@ -79,7 +68,7 @@ class AppBase(BaseModel):
class App(AppBase): class App(AppBase):
id: int id: int
class ConfigDict: class Config:
orm_mode = True orm_mode = True
@@ -90,7 +79,7 @@ class Kintone(BaseModel):
desc: str = None desc: str = None
content: str = None content: str = None
class ConfigDict: class Config:
orm_mode = True orm_mode = True
class Action(BaseModel): class Action(BaseModel):
@@ -103,7 +92,7 @@ class Action(BaseModel):
categoryid: int = None categoryid: int = None
nosort: int nosort: int
categoryname : str =None categoryname : str =None
class ConfigDict: class Config:
orm_mode = True orm_mode = True
class FlowBase(BaseModel): class FlowBase(BaseModel):
@@ -118,11 +107,11 @@ class Flow(Base):
flowid: str flowid: str
appid: str appid: str
eventid: str eventid: str
domainurl: str domainid: int
name: str = None name: str = None
content: str = None content: str = None
class ConfigDict: class Config:
orm_mode = True orm_mode = True
class DomainBase(BaseModel): class DomainBase(BaseModel):
@@ -144,7 +133,7 @@ class Domain(Base):
url: str url: str
kintoneuser: str kintoneuser: str
kintonepwd: str kintonepwd: str
class ConfigDict: class Config:
orm_mode = True orm_mode = True
class Event(Base): class Event(Base):
@@ -156,7 +145,7 @@ class Event(Base):
mobile: bool mobile: bool
eventgroup: bool eventgroup: bool
class ConfigDict: class Config:
orm_mode = True orm_mode = True
class ErrorCreate(BaseModel): class ErrorCreate(BaseModel):

Binary file not shown.

View File

@@ -4,6 +4,7 @@
tag="a" tag="a"
:target="target?target:'_blank'" :target="target?target:'_blank'"
:href="link" :href="link"
:disable="disable"
v-if="!isSeparator" v-if="!isSeparator"
> >
<q-item-section <q-item-section
@@ -33,6 +34,7 @@ export interface EssentialLinkProps {
icon?: string; icon?: string;
isSeparator?: boolean; isSeparator?: boolean;
target?:string; target?:string;
disable?:boolean;
} }
withDefaults(defineProps<EssentialLinkProps>(), { withDefaults(defineProps<EssentialLinkProps>(), {
caption: '', caption: '',

View File

@@ -7,14 +7,18 @@
<q-icon v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px" <q-icon v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px"
class="q-mr-sm"> class="q-mr-sm">
</q-icon> </q-icon>
<div class="no-wrap" :class="getSelectedClass(prop.node)">{{ prop.node.label }}</div> <div class="no-wrap"
: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-start no-wrap event-node">
<div class="no-wrap" :class="getSelectedClass(prop.node)">{{ prop.node.label }}</div> <div class="no-wrap"
:class="selectedEvent && prop.node.eventId === selectedEvent.eventId ? 'selected-node' : ''"
>{{ 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" <q-icon name="add_circle" color="primary" size="16px" class="q-mr-sm"
@click="addChangeEvent(prop.node)"></q-icon> @click="addChangeEvent(prop.node)"></q-icon>
@@ -23,7 +27,7 @@
<template v-slot:header-DELETABLE="prop"> <template v-slot:header-DELETABLE="prop">
<div class="row col items-start event-node" @click="onSelected(prop.node)"> <div class="row col items-start event-node" @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 v-if="prop.node.eventId" name="play_circle" :color="prop.node.hasFlow ? 'green' : 'grey'" size="16px" class="q-mr-sm" />
<div class="no-wrap" :class="getSelectedClass(prop.node)">{{ prop.node.label }}</div> <div class="no-wrap" :class="selectedEvent && prop.node.eventId === selectedEvent.eventId ? 'selected-node' : ''" >{{ prop.node.label}}</div>
<q-space></q-space> <q-space></q-space>
<q-icon name="delete_forever" color="negative" size="16px" @click="deleteEvent(prop.node)"></q-icon> <q-icon name="delete_forever" color="negative" size="16px" @click="deleteEvent(prop.node)"></q-icon>
</div> </div>
@@ -76,11 +80,6 @@ export default defineComponent({
const isFieldChange = (node: IKintoneEventNode) => { const isFieldChange = (node: IKintoneEventNode) => {
return node.header == 'EVENT' && node.eventId.indexOf(".change.") > -1; return node.header == 'EVENT' && node.eventId.indexOf(".change.") > -1;
} }
const getSelectedClass = (node: IKintoneEventNode) => {
return store.selectedEvent && node.eventId === store.selectedEvent.eventId ? 'selected-node' : '';
};
//フィールド値変更イベント追加 //フィールド値変更イベント追加
const closeDg = (val: string) => { const closeDg = (val: string) => {
if (val == 'OK') { if (val == 'OK') {
@@ -133,7 +132,7 @@ export default defineComponent({
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;
// if(isFieldChange(node)){ // if(isFieldChange(node)){
// screenName=nodeLabel; // screenName=nodeLabel;
@@ -160,7 +159,6 @@ export default defineComponent({
tree, tree,
showDialog, showDialog,
isFieldChange, isFieldChange,
getSelectedClass,
onSelected, onSelected,
selectedEvent, selectedEvent,
addChangeEvent, addChangeEvent,

View File

@@ -22,6 +22,8 @@
<div v-if="isAdmin()"> <div v-if="isAdmin()">
<EssentialLink v-for="link in adminLinks" :key="link.title" v-bind="link" /> <EssentialLink v-for="link in adminLinks" :key="link.title" v-bind="link" />
</div> </div>
<EssentialLink v-for="link in domainLinks" :key="link.title" v-bind="link" />
</q-list> </q-list>
</q-drawer> </q-drawer>
@@ -32,7 +34,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted } from 'vue'; import { onMounted, computed } from 'vue';
import EssentialLink, { EssentialLinkProps } from 'components/EssentialLink.vue'; import EssentialLink, { EssentialLinkProps } from 'components/EssentialLink.vue';
import DomainSelector from 'components/DomainSelector.vue'; import DomainSelector from 'components/DomainSelector.vue';
import { useAuthStore } from 'stores/useAuthStore'; import { useAuthStore } from 'stores/useAuthStore';
@@ -45,21 +47,16 @@ const essentialLinks: EssentialLinkProps[] = [
caption: '設計書から導入する', caption: '設計書から導入する',
icon: 'home', icon: 'home',
link: '/', link: '/',
target: '_self' target: '_self',
disable: !authStore.hasDomain,
}, },
// {
// title: 'フローエディター',
// caption: 'イベントを設定する',
// icon: 'account_tree',
// link: '/#/FlowChart',
// target: '_self'
// },
{ {
title: 'アプリ管理', title: 'フローエディター',
caption: 'アプリを管理する', caption: 'イベントを設定する',
icon: 'widgets', icon: 'account_tree',
link: '/#/app', link: '/#/FlowChart',
target: '_self' target: '_self',
disable: !authStore.hasDomain,
}, },
// { // {
// title: '条件エディター', // title: '条件エディター',
@@ -90,58 +87,23 @@ const essentialLinks: EssentialLinkProps[] = [
// link:'https://cybozu.dev/ja/kintone/docs/', // link:'https://cybozu.dev/ja/kintone/docs/',
// icon:'help_outline' // icon:'help_outline'
// }, // },
];
const domainLinks: EssentialLinkProps[] = [
{
title: 'ドメイン管理',
caption: 'kintoneのドメイン設定',
icon: 'domain',
link: '/#/domain',
target: '_self'
},
// { // {
// title:'', // title: 'ドメイン適用',
// isSeparator:true // caption: 'ユーザー使用可能なドメインの設定',
// icon: 'assignment_ind',
// link: '/#/userDomain',
// target: '_self'
// }, // },
// {
// title: 'Docs',
// caption: 'quasar.dev',
// icon: 'school',
// link: 'https://quasar.dev'
// },
// {
// title: 'Icons',
// caption: 'Material Icons',
// icon: 'insert_emoticon',
// link: 'https://fonts.google.com/icons?selected=Material+Icons:insert_emoticon:'
// },
// {
// title: 'Github',
// caption: 'github.com/quasarframework',
// icon: 'code',
// link: 'https://github.com/quasarframework'
// },
// {
// title: 'Discord Chat Channel',
// caption: 'chat.quasar.dev',
// icon: 'chat',
// link: 'https://chat.quasar.dev'
// },
// {
// title: 'Forum',
// caption: 'forum.quasar.dev',
// icon: 'record_voice_over',
// link: 'https://forum.quasar.dev'
// },
// {
// title: 'Twitter',
// caption: '@quasarframework',
// icon: 'rss_feed',
// link: 'https://twitter.quasar.dev'
// },
// {
// title: 'Facebook',
// caption: '@QuasarFramework',
// icon: 'public',
// link: 'https://facebook.quasar.dev'
// },
// {
// title: 'Quasar Awesome',
// caption: 'Community Quasar projects',
// icon: 'favorite',
// link: 'https://awesome.quasar.dev'
// }
]; ];
const adminLinks: EssentialLinkProps[] = [ const adminLinks: EssentialLinkProps[] = [
@@ -152,20 +114,6 @@ const adminLinks: EssentialLinkProps[] = [
link: '/#/user', link: '/#/user',
target: '_self' target: '_self'
}, },
{
title: 'ドメイン管理',
caption: 'kintoneのドメイン設定',
icon: 'domain',
link: '/#/domain',
target: '_self'
},
{
title: 'ドメイン適用',
caption: 'ユーザー使用可能なドメインの設定',
icon: 'assignment_ind',
link: '/#/userDomain',
target: '_self'
},
] ]
const version = process.env.version; const version = process.env.version;

View File

@@ -1,93 +0,0 @@
<template>
<div class="q-pa-md">
<div class="q-gutter-sm row items-start">
<q-breadcrumbs>
<q-breadcrumbs-el icon="widgets" label="アプリ管理" />
</q-breadcrumbs>
</div>
<q-table title="Treats" :rows="rows" :columns="columns" row-key="id" :filter="filter" :loading="loading" :pagination="pagination">
<template v-slot:top>
<q-btn disabled color="primary" :disable="loading" label="新規" @click="addRow" />
<q-space />
<q-input borderless dense filled debounce="300" v-model="filter" placeholder="検索">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</template>
<template v-slot:body-cell-actions="p">
<q-td :props="p">
<q-btn-group flat>
<q-btn flat color="primary" padding="xs" size="1em" icon="edit_note" @click="editFlow(p.row)" />
<q-btn disabled flat color="primary" padding="xs" size="1em" icon="history" @click="showHistory(p.row)" />
<q-btn disabled flat color="negative" padding="xs" size="1em" icon="delete_outline" @click="removeRow(p.row)" />
</q-btn-group>
</q-td>
</template>
</q-table>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, reactive } from 'vue';
import { api } from 'boot/axios';
import { useAuthStore } from 'stores/useAuthStore';
import { useFlowEditorStore } from 'stores/flowEditor';
import { router } from 'src/router';
const authStore = useAuthStore();
const columns = [
{ name: 'id', label: 'アプリID', field: 'id', align: 'left', sortable: true },
{ name: 'name', label: 'アプリ名', field: 'name', align: 'left', sortable: true },
{ name: 'url', label: 'URL', field: 'url', align: 'left', sortable: true },
{ name: 'user', label: 'ログイン名', field: 'user', align: 'left', },
{ name: 'version', label: 'バージョン', field: 'version', align: 'left', },
{ name: 'actions', label: '操作', field: 'actions' }
];
const pagination = ref({ sortBy: 'id', descending: true, rowsPerPage: 20 });
const loading = ref(false);
const filter = ref('');
const rows = ref([]);
const store = useFlowEditorStore();
const tenantid = ref(authStore.currentDomain.id);
const getApps = async () => {
loading.value = true;
const result = await api.get('api/apps');
rows.value = result.data.map((item) => {
return { id: item.appid, name: item.appname, url: item.domainurl, user: item.user.email, version: item.version }
});
loading.value = false;
}
onMounted(async () => {
await getApps();
})
const addRow = () => {
return
}
const removeRow = (row) => {
return
}
const showHistory = (row) => {
return
}
const editFlow = (row) => {
store.setApp({
appId: row.id,
name: row.name
});
router.push('/FlowChart');
};
</script>

View File

@@ -290,8 +290,20 @@ const onSaveAllFlow= async ()=>{
} }
const fetchData = async () => { const fetchData = async () => {
await store.loadFlow();
drawerLeft.value = true; drawerLeft.value = true;
if (store.appInfo === undefined) return;
const flowCtrl = new FlowCtrl();
const actionFlows = await flowCtrl.getFlows(store.appInfo?.appId);
if (actionFlows && actionFlows.length > 0) {
store.setFlows(actionFlows);
}
if (actionFlows && actionFlows.length == 1) {
store.selectFlow(actionFlows[0]);
}
const root = actionFlows[0].getRoot();
if (root) {
store.setActiveNode(root);
}
} }
const onClearFilter=()=>{ const onClearFilter=()=>{

View File

@@ -47,6 +47,13 @@ export default route(function (/* { store, ssrContext } */) {
authStore.returnUrl = to.fullPath; authStore.returnUrl = to.fullPath;
return '/login'; return '/login';
} }
// redirect to domain setting page if no domain exist
const domainPages = [...publicPages, '/domain'];
if (!authStore.hasDomain && !domainPages.includes(to.path)) {
authStore.returnUrl = to.fullPath;
return '/domain';
}
}); });
return routerInstance; return routerInstance;
}); });

View File

@@ -27,7 +27,6 @@ const routes: RouteRecordRaw[] = [
{ path: 'domain', component: () => import('pages/TenantDomain.vue') }, { path: 'domain', component: () => import('pages/TenantDomain.vue') },
{ path: 'userdomain', component: () => import('pages/UserDomain.vue')}, { path: 'userdomain', component: () => import('pages/UserDomain.vue')},
{ path: 'user', component: () => import('pages/UserManagement.vue')}, { path: 'user', component: () => import('pages/UserManagement.vue')},
{ path: 'app', component: () => import('pages/AppManagement.vue')},
{ path: 'condition', component: () => import('pages/conditionPage.vue') } { path: 'condition', component: () => import('pages/conditionPage.vue') }
], ],
}, },

View File

@@ -65,8 +65,6 @@ export const useFlowEditorStore = defineStore('flowEditor', {
if(flow!==undefined){ if(flow!==undefined){
const eventId = flow.getRoot()?.name; const eventId = flow.getRoot()?.name;
this.selectedEvent=this.eventTree.findEventById(eventId) as IKintoneEvent; this.selectedEvent=this.eventTree.findEventById(eventId) as IKintoneEvent;
} else {
this.selectedEvent = undefined;
} }
}, },
setActiveNode(node: IActionNode) { setActiveNode(node: IActionNode) {
@@ -88,8 +86,8 @@ export const useFlowEditorStore = defineStore('flowEditor', {
//eventTreeにバンドする //eventTreeにバンドする
this.eventTree.bindFlows(actionFlows); this.eventTree.bindFlows(actionFlows);
if (actionFlows === undefined || actionFlows.length === 0) { if (actionFlows === undefined || actionFlows.length === 0) {
this.setFlows([]); this.flows = [];
this.selectFlow(undefined); this.selectedFlow = undefined;
this.expandedScreen =[]; this.expandedScreen =[];
return; return;
} }
@@ -97,11 +95,6 @@ export const useFlowEditorStore = defineStore('flowEditor', {
if (actionFlows && actionFlows.length > 0) { if (actionFlows && actionFlows.length > 0) {
this.selectFlow(actionFlows[0]); this.selectFlow(actionFlows[0]);
} }
const root = actionFlows[0].getRoot();
if (root) {
this.setActiveNode(root);
}
const expandEventIds = actionFlows.map((flow) => flow.getRoot()?.name); const expandEventIds = actionFlows.map((flow) => flow.getRoot()?.name);
const expandScreens:string[]=[]; const expandScreens:string[]=[];
expandEventIds.forEach((eventid)=>{ expandEventIds.forEach((eventid)=>{

View File

@@ -33,6 +33,9 @@ export const useAuthStore = defineStore('auth', {
toggleLeftDrawer(): boolean { toggleLeftDrawer(): boolean {
return this.LeftDrawer; return this.LeftDrawer;
}, },
hasDomain(): boolean {
return this.currentDomain.id === null;
}
}, },
actions: { actions: {
toggleLeftMenu() { toggleLeftMenu() {
@@ -60,11 +63,11 @@ export const useAuthStore = defineStore('auth', {
} }
}, },
async getCurrentDomain(): Promise<IDomainInfo> { async getCurrentDomain(): Promise<IDomainInfo> {
const activedomain = await api.get(`api/activedomain`); const activedomain = (await api.get(`api/activedomain`))?.data;
return { return {
id: activedomain.data.id, id: activedomain?.id,
domainName: activedomain.data.name, domainName: activedomain?.name,
kintoneUrl: activedomain.data.url, kintoneUrl: activedomain?.url,
}; };
}, },
async getUserDomains(): Promise<IDomainInfo[]> { async getUserDomains(): Promise<IDomainInfo[]> {