Compare commits
43 Commits
maxz-dev
...
mvp_featur
| Author | SHA1 | Date | |
|---|---|---|---|
| 76457b6667 | |||
| e1f2afa942 | |||
| 8d5dff60f1 | |||
| 461cd26690 | |||
| 4c6b2ea844 | |||
| 418f45f997 | |||
| 51ebe99d1c | |||
| 2f1f8a60fc | |||
| 64795a80c7 | |||
| 94a17073dd | |||
| 7f7d625fdd | |||
| 6902079866 | |||
| 6aa057e590 | |||
| 2721cd60d1 | |||
| 1f8d079d4d | |||
|
|
f34dec1054 | ||
|
|
01b64f1aba | ||
|
|
3367ada343 | ||
|
|
f4ea3eaccb | ||
|
|
4adb8401d6 | ||
| df59bff6ae | |||
| 3ae685a0e2 | |||
|
|
fce56e43c3 | ||
|
|
42618602f4 | ||
| c1e50736e8 | |||
|
|
e02131846b | ||
|
|
2c3b27d9de | ||
|
|
6ccc833f7d | ||
|
|
a0ecc2eee3 | ||
| 59e6d33656 | |||
| b641c729c2 | |||
| 142cdcda38 | |||
| fc2669dabf | |||
| 8e095b51e3 | |||
| ff03490209 | |||
| 40cd9998d0 | |||
| 063a5af822 | |||
|
|
6a06c71104 | ||
|
|
100d8de54f | ||
|
|
7c667660c0 | ||
|
|
4eb56372a5 | ||
|
|
16edd398be | ||
|
|
4e08159e6d |
@@ -2,7 +2,8 @@ from fastapi import Request,Depends, APIRouter, UploadFile,HTTPException,File
|
||||
from app.db import Base,engine
|
||||
from app.db.session import get_db
|
||||
from app.db.crud import *
|
||||
from app.db.schemas import AppBase, AppEdit, App,Kintone
|
||||
from app.db.schemas import *
|
||||
from typing import List
|
||||
|
||||
platform_router = r = APIRouter()
|
||||
|
||||
@@ -64,4 +65,122 @@ async def kintone_data(
|
||||
db=Depends(get_db),
|
||||
):
|
||||
kintone = get_kintones(db, type)
|
||||
return kintone
|
||||
return kintone
|
||||
|
||||
@r.get(
|
||||
"/actions",
|
||||
response_model=t.List[Action],
|
||||
response_model_exclude={"id"},
|
||||
response_model_exclude_none=True,
|
||||
)
|
||||
async def action_data(
|
||||
request: Request,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
actions = get_actions(db)
|
||||
return actions
|
||||
|
||||
@r.get(
|
||||
"/flow/{flowid}",
|
||||
response_model=Flow,
|
||||
response_model_exclude_none=True,
|
||||
)
|
||||
async def flow_details(
|
||||
request: Request,
|
||||
flowid: str,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
app = get_flow(db, flowid)
|
||||
return app
|
||||
|
||||
|
||||
@r.get(
|
||||
"/flows/{appid}",
|
||||
response_model=List[Flow],
|
||||
response_model_exclude_none=True,
|
||||
)
|
||||
async def flow_list(
|
||||
request: Request,
|
||||
appid: str,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
flows = get_flows_by_app(db, appid)
|
||||
return flows
|
||||
|
||||
|
||||
@r.post("/flow", response_model=Flow, response_model_exclude_none=True)
|
||||
async def flow_create(
|
||||
request: Request,
|
||||
flow: FlowBase,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
return create_flow(db, flow)
|
||||
|
||||
|
||||
@r.put(
|
||||
"/flow/{flowid}", response_model=Flow, response_model_exclude_none=True
|
||||
)
|
||||
async def flow_edit(
|
||||
request: Request,
|
||||
flow: FlowBase,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
return edit_flow(db, flow)
|
||||
|
||||
|
||||
@r.delete(
|
||||
"/flow/{flowid}", response_model=Flow, response_model_exclude_none=True
|
||||
)
|
||||
async def flow_delete(
|
||||
request: Request,
|
||||
flowid: str,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
|
||||
return delete_flow(db, flowid)
|
||||
|
||||
@r.get(
|
||||
"/domain/{userid}",
|
||||
response_model=List[Domain],
|
||||
response_model_exclude_none=True,
|
||||
)
|
||||
async def domain_details(
|
||||
request: Request,
|
||||
userid: str,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
domains = get_domain(db, userid)
|
||||
return domains
|
||||
|
||||
|
||||
@r.post("/domain", response_model=Domain, response_model_exclude_none=True)
|
||||
async def domain_create(
|
||||
request: Request,
|
||||
domain: DomainBase,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
return create_domain(db, domain)
|
||||
|
||||
|
||||
@r.put(
|
||||
"/domain", response_model=Domain, response_model_exclude_none=True
|
||||
)
|
||||
async def domain_edit(
|
||||
request: Request,
|
||||
domain: DomainBase,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
return edit_domain(db, domain)
|
||||
|
||||
|
||||
@r.delete(
|
||||
"/domain/{userid}/{id}", response_model=Domain, response_model_exclude_none=True
|
||||
)
|
||||
async def domain_delete(
|
||||
request: Request,
|
||||
userid: int,
|
||||
id: int,
|
||||
db=Depends(get_db),
|
||||
):
|
||||
|
||||
return delete_domain(db, userid,id)
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
|
||||
PROJECT_NAME = "KintoneAppBuilder"
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = "mssql+pymssql://maxz64@maxzdb:m@xz1205@maxzdb.database.windows.net/alloc"
|
||||
SQLALCHEMY_DATABASE_URI = "postgres://maxz64:m@xz1205@alicornkintone.postgres.database.azure.com/postgres"
|
||||
|
||||
BASE_URL = "https://mfu07rkgnb7c.cybozu.com"
|
||||
|
||||
|
||||
@@ -115,4 +115,113 @@ def get_kintones(db: Session, type: int):
|
||||
kintones = db.query(models.Kintone).filter(models.Kintone.type == type).all()
|
||||
if not kintones:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return kintones
|
||||
return kintones
|
||||
|
||||
def get_actions(db: Session):
|
||||
actions = db.query(models.Action).all()
|
||||
if not actions:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return actions
|
||||
|
||||
|
||||
def create_flow(db: Session, flow: schemas.FlowBase):
|
||||
db_flow = models.Flow(
|
||||
flowid=flow.flowid,
|
||||
appid=flow.appid,
|
||||
eventid=flow.eventid,
|
||||
name=flow.name,
|
||||
content=flow.content
|
||||
)
|
||||
db.add(db_flow)
|
||||
db.commit()
|
||||
db.refresh(db_flow)
|
||||
return db_flow
|
||||
|
||||
def delete_flow(db: Session, flowid: str):
|
||||
flow = get_flow(db, flowid)
|
||||
if not flow:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Flow not found")
|
||||
db.delete(flow)
|
||||
db.commit()
|
||||
return flow
|
||||
|
||||
|
||||
def edit_flow(
|
||||
db: Session, flow: schemas.FlowBase
|
||||
) -> schemas.Flow:
|
||||
db_flow = get_flow(db, flow.flowid)
|
||||
if not db_flow:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Flow not found")
|
||||
update_data = flow.dict(exclude_unset=True)
|
||||
|
||||
for key, value in update_data.items():
|
||||
setattr(db_flow, key, value)
|
||||
|
||||
db.add(db_flow)
|
||||
db.commit()
|
||||
db.refresh(db_flow)
|
||||
return db_flow
|
||||
|
||||
|
||||
def get_flows(db: Session, flowid: str):
|
||||
flows = db.query(models.Flow).all()
|
||||
if not flows:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return flows
|
||||
|
||||
def get_flow(db: Session, flowid: str):
|
||||
flow = db.query(models.Flow).filter(models.Flow.flowid == flowid).first()
|
||||
if not flow:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return flow
|
||||
|
||||
def get_flows_by_app(db: Session, appid: str):
|
||||
flows = db.query(models.Flow).filter(models.Flow.appid == appid).all()
|
||||
if not flows:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return flows
|
||||
|
||||
def create_domain(db: Session, domain: schemas.DomainBase):
|
||||
db_domain = models.UserDomain(
|
||||
userid=domain.userid,
|
||||
name=domain.name,
|
||||
url=domain.url,
|
||||
kintoneuser=domain.kintoneuser,
|
||||
kintonepwd=domain.kintonepwd
|
||||
)
|
||||
db.add(db_domain)
|
||||
db.commit()
|
||||
db.refresh(db_domain)
|
||||
return db_domain
|
||||
|
||||
def delete_domain(db: Session, userid: int,id: int):
|
||||
db_domain = db.query(models.UserDomain).get(id)
|
||||
if not db_domain or db_domain.userid != userid:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Domain not found")
|
||||
db.delete(db_domain)
|
||||
db.commit()
|
||||
return db_domain
|
||||
|
||||
|
||||
def edit_domain(
|
||||
db: Session, domain: schemas.DomainBase
|
||||
) -> schemas.Domain:
|
||||
db_domain = db.query(models.UserDomain).get(domain.id)
|
||||
if not db_domain or db_domain.userid != domain.userid:
|
||||
raise HTTPException(status.HTTP_404_NOT_FOUND, detail="Domain not found")
|
||||
update_data = domain.dict(exclude_unset=True)
|
||||
|
||||
for key, value in update_data.items():
|
||||
if(key != "id"):
|
||||
setattr(db_domain, key, value)
|
||||
|
||||
db.add(db_domain)
|
||||
db.commit()
|
||||
db.refresh(db_domain)
|
||||
return db_domain
|
||||
|
||||
def get_domain(db: Session, userid: str):
|
||||
domains = db.query(models.UserDomain).filter(models.UserDomain.userid == userid).all()
|
||||
if not domains:
|
||||
raise HTTPException(status_code=404, detail="Data not found")
|
||||
return domains
|
||||
@@ -1,12 +1,16 @@
|
||||
from sqlalchemy import Boolean, Column, Integer, String
|
||||
|
||||
from .session import Base
|
||||
from sqlalchemy import Boolean, Column, Integer, String, DateTime,ForeignKey
|
||||
from sqlalchemy.ext.declarative import as_declarative
|
||||
from datetime import datetime
|
||||
|
||||
@as_declarative()
|
||||
class Base:
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
create_time = Column(DateTime, default=datetime.now)
|
||||
update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now)
|
||||
|
||||
class User(Base):
|
||||
__tablename__ = "user"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
email = Column(String(50), unique=True, index=True, nullable=False)
|
||||
first_name = Column(String(100))
|
||||
last_name = Column(String(100))
|
||||
@@ -17,15 +21,41 @@ class User(Base):
|
||||
class AppSetting(Base):
|
||||
__tablename__ = "appsetting"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
appid = Column(String(100), index=True, nullable=False)
|
||||
setting = Column(String(1000))
|
||||
|
||||
class Kintone(Base):
|
||||
__tablename__ = "kintone"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
type = Column(Integer, index=True, nullable=False)
|
||||
name = Column(String(100), nullable=False)
|
||||
desc = Column(String)
|
||||
content = Column(String)
|
||||
content = Column(String)
|
||||
|
||||
class Action(Base):
|
||||
__tablename__ = "action"
|
||||
|
||||
name = Column(String(100), index=True, nullable=False)
|
||||
title = Column(String(200))
|
||||
subtitle = Column(String(500))
|
||||
outputpoints = Column(String)
|
||||
property = Column(String)
|
||||
|
||||
class Flow(Base):
|
||||
__tablename__ = "flow"
|
||||
|
||||
flowid = Column(String(100), index=True, nullable=False)
|
||||
appid = Column(String(100), index=True, nullable=False)
|
||||
eventid = Column(String(100), index=True, nullable=False)
|
||||
name = Column(String(200))
|
||||
content = Column(String)
|
||||
|
||||
class UserDomain(Base):
|
||||
__tablename__ = "userdomain"
|
||||
|
||||
userid = Column(Integer,ForeignKey("user.id"))
|
||||
name = Column(String(100), nullable=False)
|
||||
url = Column(String(200), nullable=False)
|
||||
kintoneuser = Column(String(100), nullable=False)
|
||||
kintonepwd = Column(String(100), nullable=False)
|
||||
active = Column(Boolean, default=False)
|
||||
@@ -1,7 +1,12 @@
|
||||
from pydantic import BaseModel
|
||||
from datetime import datetime
|
||||
import typing as t
|
||||
|
||||
|
||||
class Base(BaseModel):
|
||||
create_time: datetime
|
||||
update_time: datetime
|
||||
|
||||
class UserBase(BaseModel):
|
||||
email: str
|
||||
is_active: bool = True
|
||||
@@ -67,5 +72,55 @@ class Kintone(BaseModel):
|
||||
desc: str = None
|
||||
content: str = None
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
class Action(BaseModel):
|
||||
id: int
|
||||
name: str = None
|
||||
title: str = None
|
||||
subtitle: str = None
|
||||
outputpoints: str = None
|
||||
property: str = None
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
class FlowBase(BaseModel):
|
||||
flowid: str
|
||||
appid: str
|
||||
eventid: str
|
||||
name: str = None
|
||||
content: str = None
|
||||
|
||||
class Flow(Base):
|
||||
id: int
|
||||
flowid: str
|
||||
appid: str
|
||||
eventid: str
|
||||
name: str = None
|
||||
content: str = None
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
class DomainBase(BaseModel):
|
||||
id: int
|
||||
userid: int
|
||||
name: str
|
||||
url: str
|
||||
kintoneuser: str
|
||||
kintonepwd: str
|
||||
active:bool = False
|
||||
|
||||
class Domain(Base):
|
||||
id: int
|
||||
userid: str
|
||||
name: str
|
||||
url: str
|
||||
kintoneuser: str
|
||||
kintonepwd: str
|
||||
active:bool
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
@@ -20,4 +20,5 @@ pyjwt==1.7.1
|
||||
pandas==2.0.3
|
||||
openpyxl==3.1.2
|
||||
deepdiff==6.3.1
|
||||
pymssql==2.2.7
|
||||
pymssql==2.2.7
|
||||
psycopg2==2.9.8
|
||||
BIN
document/kintone開発自動化ツール UIデザイン案.pptx
Normal file
BIN
document/kintone開発自動化ツール UIデザイン案.pptx
Normal file
Binary file not shown.
3
frontend/.gitignore
vendored
3
frontend/.gitignore
vendored
@@ -35,3 +35,6 @@ yarn-error.log*
|
||||
|
||||
# local .env files
|
||||
.env.local*
|
||||
|
||||
# pnpm
|
||||
pnpm-lock.yaml
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="ja-jp">
|
||||
<head>
|
||||
<title><%= productName %></title>
|
||||
|
||||
|
||||
72
frontend/package-lock.json
generated
72
frontend/package-lock.json
generated
@@ -10,13 +10,16 @@
|
||||
"dependencies": {
|
||||
"@quasar/extras": "^1.16.4",
|
||||
"axios": "^1.4.0",
|
||||
"pinia": "^2.1.6",
|
||||
"quasar": "^2.6.0",
|
||||
"uuid": "^9.0.0",
|
||||
"vue": "^3.0.0",
|
||||
"vue-router": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@quasar/app-vite": "^1.3.0",
|
||||
"@types/node": "^12.20.21",
|
||||
"@types/uuid": "^9.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
||||
"@typescript-eslint/parser": "^5.10.0",
|
||||
"autoprefixer": "^10.4.2",
|
||||
@@ -28,8 +31,9 @@
|
||||
"typescript": "^4.5.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18 || ^16 || ^14.19",
|
||||
"node": "^20 ||^18 || ^16 || ^14.19",
|
||||
"npm": ">= 6.13.4",
|
||||
"pnpm": ">=8.6.0",
|
||||
"yarn": ">= 1.21.1"
|
||||
}
|
||||
},
|
||||
@@ -544,6 +548,12 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "9.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.3.tgz",
|
||||
"integrity": "sha512-taHQQH/3ZyI3zP8M/puluDEIEvtQHVYcC6y3N8ijFtAd28+Ey/G4sg1u2gB01S8MwybLOKAp9/yCMu/uR5l3Ug==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "5.61.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.61.0.tgz",
|
||||
@@ -4070,6 +4080,56 @@
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/pinia": {
|
||||
"version": "2.1.6",
|
||||
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.1.6.tgz",
|
||||
"integrity": "sha512-bIU6QuE5qZviMmct5XwCesXelb5VavdOWKWaB17ggk++NUwQWWbP5YnsONTk3b752QkW9sACiR81rorpeOMSvQ==",
|
||||
"dependencies": {
|
||||
"@vue/devtools-api": "^6.5.0",
|
||||
"vue-demi": ">=0.14.5"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/posva"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/composition-api": "^1.4.0",
|
||||
"typescript": ">=4.4.4",
|
||||
"vue": "^2.6.14 || ^3.3.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vue/composition-api": {
|
||||
"optional": true
|
||||
},
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pinia/node_modules/vue-demi": {
|
||||
"version": "0.14.6",
|
||||
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz",
|
||||
"integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==",
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"vue-demi-fix": "bin/vue-demi-fix.js",
|
||||
"vue-demi-switch": "bin/vue-demi-switch.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/antfu"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/composition-api": "^1.0.0-rc.1",
|
||||
"vue": "^3.0.0-0 || ^2.6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@vue/composition-api": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.25",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.25.tgz",
|
||||
@@ -4946,7 +5006,7 @@
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -5045,6 +5105,14 @@
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
|
||||
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
|
||||
@@ -15,13 +15,16 @@
|
||||
"dependencies": {
|
||||
"@quasar/extras": "^1.16.4",
|
||||
"axios": "^1.4.0",
|
||||
"pinia": "^2.1.6",
|
||||
"quasar": "^2.6.0",
|
||||
"uuid": "^9.0.0",
|
||||
"vue": "^3.0.0",
|
||||
"vue-router": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@quasar/app-vite": "^1.3.0",
|
||||
"@types/node": "^12.20.21",
|
||||
"@types/uuid": "^9.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
||||
"@typescript-eslint/parser": "^5.10.0",
|
||||
"autoprefixer": "^10.4.2",
|
||||
@@ -33,8 +36,9 @@
|
||||
"typescript": "^4.5.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18 || ^16 || ^14.19",
|
||||
"node": "^20 ||^18 || ^16 || ^14.19",
|
||||
"npm": ">= 6.13.4",
|
||||
"yarn": ">= 1.21.1"
|
||||
"yarn": ">= 1.21.1",
|
||||
"pnpm": ">=8.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<template>
|
||||
<div class="q-pa-md">
|
||||
<q-table :title="name+'一覧'" row-key="name" :selection="type" v-model:selected="selected" :columns="columns" :rows="rows" />
|
||||
<q-table row-key="name" :selection="type" v-model:selected="selected" :columns="columns" :rows="rows"
|
||||
class="action-table"
|
||||
flat bordered
|
||||
virtual-scroll
|
||||
:pagination="pagination"
|
||||
:rows-per-page-options="[0]"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -17,11 +23,11 @@ export default {
|
||||
const columns = [
|
||||
{ name: 'name', required: true,label: 'アクション名',align: 'left',field: 'name',sortable: true},
|
||||
{ name: 'desc', align: 'left', label: '説明', field: 'desc', sortable: true },
|
||||
{ name: 'content', label: '内容', field: 'content', sortable: true }
|
||||
// { name: 'content', label: '内容', field: 'content', sortable: true }
|
||||
]
|
||||
const rows = reactive([])
|
||||
onMounted(async () => {
|
||||
await api.get('http://127.0.0.1:8000/api/kintone/2').then(res =>{
|
||||
await api.get('http://127.0.0.1:8000/api/kintone/1').then(res =>{
|
||||
res.data.forEach((item) =>
|
||||
{
|
||||
rows.push({name:item.name,desc:item.desc,content:item.content});
|
||||
@@ -33,8 +39,16 @@ export default {
|
||||
columns,
|
||||
rows,
|
||||
selected: ref([]),
|
||||
pagination:ref({
|
||||
rowsPerPage:0
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.action-table{
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ref,onMounted,reactive } from 'vue'
|
||||
import { api } from 'boot/axios';
|
||||
|
||||
export default {
|
||||
name: 'appSelect',
|
||||
name: 'AppSelect',
|
||||
props: {
|
||||
name: String,
|
||||
type: String
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export interface Rule{
|
||||
id:number;
|
||||
name:string;
|
||||
condtion:CondtionTree
|
||||
}
|
||||
|
||||
export interface CondtionTree{
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'showDialog',
|
||||
name: 'ShowDialog',
|
||||
props: {
|
||||
name:String,
|
||||
visible: Boolean,
|
||||
|
||||
29
frontend/src/components/flowEditor/left/ControlPanelC.vue
Normal file
29
frontend/src/components/flowEditor/left/ControlPanelC.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div class="q-py-md">
|
||||
<q-tree
|
||||
no-connectors
|
||||
selected-color="primary"
|
||||
default-expand-all
|
||||
:nodes="LeftDataBus.root"
|
||||
v-model:selected="flowNames1"
|
||||
node-key="label"
|
||||
>
|
||||
</q-tree>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
LeftDataBus,
|
||||
setControlPanelE,
|
||||
} from 'components/flowEditor/left/DataBus';
|
||||
import { ref } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||
|
||||
// 应该在page中用网络请求获取值并初始化组件
|
||||
// 然后在page中执行setControlPane设置databus
|
||||
const store = useFlowEditorStore();
|
||||
const { flowNames1 } = storeToRefs(store);
|
||||
setControlPanelE();
|
||||
</script>
|
||||
72
frontend/src/components/flowEditor/left/DataBus.ts
Normal file
72
frontend/src/components/flowEditor/left/DataBus.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { reactive } from 'vue'
|
||||
|
||||
export const LeftDataBus = reactive<LeftData>({})
|
||||
|
||||
const defaultData = {
|
||||
root: [
|
||||
{
|
||||
label: 'レコードを追加画面',
|
||||
children: [
|
||||
{
|
||||
label: '追加画面表示した時',
|
||||
header: 'rg',
|
||||
value: '1-1',
|
||||
group: 'g1',
|
||||
children: []
|
||||
},
|
||||
{
|
||||
label: '保存をクリックした時',
|
||||
header: 'rg',
|
||||
value: '1-2',
|
||||
group: 'g1',
|
||||
children: []
|
||||
},
|
||||
{
|
||||
label: '保存成功した時',
|
||||
header: 'rg',
|
||||
value: '1-3',
|
||||
group: 'g1',
|
||||
children: []
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'レコード編集画面',
|
||||
},
|
||||
{
|
||||
label: 'レコード詳細画面',
|
||||
},
|
||||
{
|
||||
label: 'レコード一覧画面',
|
||||
},
|
||||
],
|
||||
data: new Map([['g1', '1-1']])
|
||||
}
|
||||
|
||||
export const setControlPanel = (rootData: LeftData) => {
|
||||
const { root: dr, data: dd } = defaultData
|
||||
LeftDataBus.title = rootData.title
|
||||
LeftDataBus.root = rootData.root ?? dr
|
||||
LeftDataBus.data = rootData.data ?? dd
|
||||
}
|
||||
|
||||
export const setControlPanelE = () => {
|
||||
const { root: dr, data: dd } = defaultData
|
||||
// LeftDataBus.title = rootData.title
|
||||
LeftDataBus.root = dr
|
||||
LeftDataBus.data = dd
|
||||
}
|
||||
|
||||
export interface LeftData {
|
||||
title?: string
|
||||
root?: ControlPanelData[]
|
||||
data?: Map<string, string>
|
||||
}
|
||||
|
||||
export interface ControlPanelData {
|
||||
label: string,
|
||||
header?: string,
|
||||
value?: string,
|
||||
group?: string,
|
||||
children?: ControlPanelData[]
|
||||
}
|
||||
42
frontend/src/components/flowEditor/left/ItemSelector.vue
Normal file
42
frontend/src/components/flowEditor/left/ItemSelector.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div
|
||||
class="row"
|
||||
style="
|
||||
border-radius: 2px;
|
||||
box-shadow: rgba(255, 255, 255, 0.1) 0px 0px 0px 1px inset,
|
||||
rgba(0, 0, 0, 0.3) 0px 0px 0px 1px;
|
||||
"
|
||||
>
|
||||
<q-icon
|
||||
class="self-center q-ma-sm"
|
||||
name="widgets"
|
||||
color="grey-9"
|
||||
style="font-size: 2em"
|
||||
/>
|
||||
|
||||
<div class="col-7 self-center ellipsis">
|
||||
{{ actName }}
|
||||
</div>
|
||||
|
||||
<div class="self-center">
|
||||
<q-btn
|
||||
outline
|
||||
dense
|
||||
label="変 更"
|
||||
padding="none sm"
|
||||
color="primary"
|
||||
></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue';
|
||||
|
||||
export default {
|
||||
props: ['actName'],
|
||||
setup(props) {
|
||||
const actName = computed(() => props.actName);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
85
frontend/src/components/left/AppSelector.vue
Normal file
85
frontend/src/components/left/AppSelector.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div
|
||||
class="row"
|
||||
style="
|
||||
border-radius: 2px;
|
||||
box-shadow: rgba(255, 255, 255, 0.1) 0px 0px 0px 1px inset,
|
||||
rgba(0, 0, 0, 0.3) 0px 0px 0px 1px;
|
||||
">
|
||||
<q-icon
|
||||
class="self-center q-ma-sm"
|
||||
name="widgets"
|
||||
color="grey-9"
|
||||
style="font-size: 2em"
|
||||
/>
|
||||
<div class="col-7 self-center ellipsis">
|
||||
{{ selectedApp.name }}
|
||||
</div>
|
||||
<div class="self-center">
|
||||
<q-btn
|
||||
outline
|
||||
dense
|
||||
label="変 更"
|
||||
padding="none sm"
|
||||
color="primary"
|
||||
@click="showAppDialog"
|
||||
></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<ShowDialog v-model:visible="showSelectApp" name="アプリ" @close="closeDg">
|
||||
<AppSelect ref="appDg" name="アプリ" type="single"></AppSelect>
|
||||
</ShowDialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent,ref } from 'vue';
|
||||
import {AppInfo} from '../../types/ActionTypes'
|
||||
import ShowDialog from '../../components/ShowDialog.vue';
|
||||
import AppSelect from '../../components/AppSelect.vue';
|
||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||
export default defineComponent({
|
||||
name: 'AppSelector',
|
||||
emits:[
|
||||
"appSelected"
|
||||
],
|
||||
components:{
|
||||
AppSelect,
|
||||
ShowDialog
|
||||
},
|
||||
setup(props, context) {
|
||||
|
||||
const store = useFlowEditorStore();
|
||||
const appDg = ref();
|
||||
const showSelectApp=ref(false);
|
||||
const selectedApp =ref<AppInfo>({
|
||||
appId:"",
|
||||
name:"",
|
||||
});
|
||||
const closeDg=(val :any)=>{
|
||||
showSelectApp.value=false;
|
||||
console.log("Dialog closed->",val);
|
||||
if (val == 'OK') {
|
||||
const data = appDg.value.selected[0];
|
||||
console.log(data);
|
||||
selectedApp.value={
|
||||
appId:data.id ,
|
||||
name:data.name
|
||||
};
|
||||
store.setApp(selectedApp.value);
|
||||
store.setFlow();
|
||||
}
|
||||
}
|
||||
const showAppDialog=()=>{
|
||||
showSelectApp.value=true;
|
||||
}
|
||||
return {
|
||||
store,
|
||||
selectedApp,
|
||||
showSelectApp,
|
||||
showAppDialog,
|
||||
closeDg,
|
||||
appDg
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
72
frontend/src/components/left/EventTree.vue
Normal file
72
frontend/src/components/left/EventTree.vue
Normal file
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<div class="q-pa-md q-gutter-sm">
|
||||
<q-tree
|
||||
:nodes="eventTree.screens"
|
||||
node-key="label"
|
||||
children-key="events"
|
||||
no-connectors
|
||||
v-model:expanded="expanded"
|
||||
:dense="true"
|
||||
>
|
||||
<template v-slot:default-header="prop">
|
||||
<div class="row col items-start no-wrap 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>
|
||||
<div class="no-wrap" :class="selectedEvent && prop.node.eventId===selectedEvent.eventId?'selected-node':''">{{ prop.node.label }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</q-tree>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, ref } from 'vue';
|
||||
import { kintoneEvents,KintoneEvent } from '../../types/KintoneEvents';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||
export default defineComponent({
|
||||
name: 'EventTree',
|
||||
setup(props, context) {
|
||||
const store = useFlowEditorStore();
|
||||
const eventTree=ref(kintoneEvents);
|
||||
const selectedFlow = store.currentFlow;
|
||||
|
||||
const expanded=ref([
|
||||
selectedFlow?.getRoot()?.title
|
||||
]);
|
||||
const selectedEvent = ref<KintoneEvent|null>(null);
|
||||
const onSelected=(node:KintoneEvent)=>{
|
||||
if(!node.eventId){
|
||||
return;
|
||||
}
|
||||
selectedEvent.value=node;
|
||||
}
|
||||
return {
|
||||
eventTree,
|
||||
expanded,
|
||||
onSelected,
|
||||
selectedEvent,
|
||||
store
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.nowrap{
|
||||
flex-wrap:nowarp;
|
||||
text-wrap:nowarp;
|
||||
}
|
||||
.event-node{
|
||||
cursor:pointer;
|
||||
}
|
||||
.selected-node{
|
||||
color: $primary;
|
||||
font-weight: bolder;
|
||||
}
|
||||
.event-node:hover{
|
||||
background-color: $light-blue-1;
|
||||
}
|
||||
</style>
|
||||
@@ -1,107 +1,186 @@
|
||||
<template>
|
||||
<div class="row justify-center" :style="{marginLeft:node.inputPoint!==''?'240px':''}">
|
||||
<div class="row justify-center" :style="{ marginLeft: node.inputPoint !== '' ? '240px' : '' }" >
|
||||
<div class="row">
|
||||
<q-card class="action-node" :class="{'root-node':node.isRoot,'text-white':node.isRoot}" :square="false">
|
||||
<q-card-section>
|
||||
<div class="text-h6">{{ node.title }}</div>
|
||||
<q-card class="action-node" :class="nodeStyle" :square="false" @click="onNodeClick" >
|
||||
<q-toolbar class="col" >
|
||||
<div class="text-subtitle2">{{ node.subTitle }}</div>
|
||||
<q-space></q-space>
|
||||
<q-btn flat round dense icon="more_horiz" size="sm" >
|
||||
<q-menu auto-close anchor="top right">
|
||||
<q-list>
|
||||
<q-item clickable v-if="!isRoot" @click="onEditNode">
|
||||
<q-item-section avatar><q-icon name="edit" ></q-icon></q-item-section>
|
||||
<q-item-section >編集する</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable v-if="!isRoot" @click="onDeleteNode">
|
||||
<q-item-section avatar><q-icon name="delete" ></q-icon></q-item-section>
|
||||
<q-item-section>削除する</q-item-section>
|
||||
</q-item>
|
||||
<q-item clickable @click="onDeleteAllNode">
|
||||
<q-item-section avatar><q-icon name="delete_sweep" ></q-icon></q-item-section>
|
||||
<q-item-section >以下すべて削除する</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-toolbar>
|
||||
<q-separator />
|
||||
<q-card-section>
|
||||
<div class="text-h7">{{ node.title }}</div>
|
||||
</q-card-section>
|
||||
<template v-if="hasBranch">
|
||||
<q-separator />
|
||||
<q-card-actions align="around">
|
||||
<q-btn flat v-for="(point,index) in node.outputPoints" :key="index">
|
||||
{{ point }}
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
<q-separator />
|
||||
<q-card-actions align="around">
|
||||
<q-btn flat v-for="(point, index) in node.outputPoints" :key="index">
|
||||
{{ point }}
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</template>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="hasBranch">
|
||||
<div class="row justify-center" :style="{marginLeft:node.inputPoint!==''?'240px':''}">
|
||||
<div v-for="(point,index) in node.outputPoints" :key="index">
|
||||
<node-line :action-node="node" :mode="getMode(point)" @addNode="addNode" :input-point="point" ></node-line>
|
||||
<div class="row justify-center" :style="{ marginLeft: node.inputPoint !== '' ? '240px' : '' }">
|
||||
<div v-for="(point, index) in node.outputPoints" :key="index">
|
||||
<node-line :action-node="node" :mode="getMode(point)" @addNode="addNode" :input-point="point"></node-line>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="!hasBranch">
|
||||
<div class="row justify-center" :style="{marginLeft:node.inputPoint!==''?'240px':''}">
|
||||
<div class="row justify-center" :style="{ marginLeft: node.inputPoint !== '' ? '240px' : '' }">
|
||||
<node-line :action-node="node" :mode="getMode('')" @addNode="addNode" input-point=""></node-line>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {defineComponent,computed} from 'vue';
|
||||
import {IActionNode } from '../../types/ActionTypes';
|
||||
import NodeLine,{Direction} from '../main/NodeLine.vue';
|
||||
export default defineComponent({
|
||||
name: 'NodeItem',
|
||||
components: {
|
||||
NodeLine
|
||||
},
|
||||
props: {
|
||||
actionNode:{
|
||||
type:Object as ()=>IActionNode,
|
||||
required:true
|
||||
import { defineComponent, computed, ref } from 'vue';
|
||||
import { IActionNode } from '../../types/ActionTypes';
|
||||
import NodeLine, { Direction } from '../main/NodeLine.vue';
|
||||
export default defineComponent({
|
||||
name: 'NodeItem',
|
||||
components: {
|
||||
NodeLine
|
||||
},
|
||||
props: {
|
||||
actionNode: {
|
||||
type: Object as () => IActionNode,
|
||||
required: true
|
||||
},
|
||||
isSelected: {
|
||||
type: Boolean
|
||||
}
|
||||
},
|
||||
emits: [
|
||||
'addNode',
|
||||
"nodeSelected",
|
||||
"nodeEdit",
|
||||
"deleteNode",
|
||||
"deleteAllNextNodes",
|
||||
],
|
||||
setup(props, context) {
|
||||
const hasBranch = computed(() => props.actionNode.outputPoints.length > 0);
|
||||
const nodeStyle = computed(() => {
|
||||
return {
|
||||
'root-node': props.actionNode.isRoot,
|
||||
'text-white': props.actionNode.isRoot,
|
||||
'selected': props.isSelected && !props.actionNode.isRoot
|
||||
};
|
||||
});
|
||||
const getMode = (point: string) => {
|
||||
if (point === '' || props.actionNode.outputPoints.length === 0) {
|
||||
return Direction.Default;
|
||||
}
|
||||
if (point === props.actionNode.outputPoints[0]) {
|
||||
if (props.actionNode.nextNodeIds.get(point)) {
|
||||
return Direction.Left;
|
||||
} else {
|
||||
return Direction.LeftNotNext;
|
||||
}
|
||||
},
|
||||
emits: [
|
||||
'addNode'
|
||||
],
|
||||
setup(props,context){
|
||||
const hasBranch = computed(() => props.actionNode.outputPoints.length > 0);
|
||||
const getMode =(point:string)=>{
|
||||
if(point==='' || props.actionNode.outputPoints.length===0){
|
||||
return Direction.Default;
|
||||
}
|
||||
if(point===props.actionNode.outputPoints[0]){
|
||||
if(props.actionNode.nextNodes.get(point)){
|
||||
return Direction.Left;
|
||||
}else{
|
||||
return Direction.LeftNotNext;
|
||||
}
|
||||
}else{
|
||||
if(props.actionNode.nextNodes.get(point)){
|
||||
return Direction.Right;
|
||||
}else{
|
||||
return Direction.RightNotNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
const addNode=(point:string)=>{
|
||||
context.emit('addNode',props.actionNode,point);
|
||||
}
|
||||
return {
|
||||
node:props.actionNode,
|
||||
hasBranch,
|
||||
isRoot:props.actionNode.isRoot,
|
||||
getMode,
|
||||
addNode
|
||||
} else {
|
||||
if (props.actionNode.nextNodeIds.get(point)) {
|
||||
return Direction.Right;
|
||||
} else {
|
||||
return Direction.RightNotNext;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* アクションノード追加イベントを
|
||||
* @param point 入力ポイント
|
||||
*/
|
||||
const addNode = (point: string) => {
|
||||
context.emit('addNode', props.actionNode, point);
|
||||
}
|
||||
/**
|
||||
* ノード選択状態
|
||||
*/
|
||||
const onNodeClick = () => {
|
||||
context.emit('nodeSelected', props.actionNode);
|
||||
}
|
||||
|
||||
const onEditNode=()=>{
|
||||
context.emit('nodeEdit', props.actionNode);
|
||||
}
|
||||
/**
|
||||
* ノードを削除する
|
||||
*/
|
||||
const onDeleteNode=()=>{
|
||||
context.emit('deleteNode', props.actionNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* ノードの以下すべて削除する
|
||||
*/
|
||||
const onDeleteAllNode=()=>{
|
||||
context.emit('deleteAllNextNodes', props.actionNode);
|
||||
}
|
||||
return {
|
||||
node: props.actionNode,
|
||||
isRoot: props.actionNode.isRoot,
|
||||
hasBranch,
|
||||
nodeStyle,
|
||||
getMode,
|
||||
addNode,
|
||||
onNodeClick,
|
||||
onEditNode,
|
||||
onDeleteNode,
|
||||
onDeleteAllNode
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.action-node{
|
||||
min-width:250px !important;
|
||||
.action-node {
|
||||
min-width: 300px !important;
|
||||
}
|
||||
.line{
|
||||
height:20px;
|
||||
|
||||
.line {
|
||||
height: 20px;
|
||||
}
|
||||
.line:after{
|
||||
content:'';
|
||||
background-color:$blue-7;
|
||||
display:block;
|
||||
width:3px;
|
||||
|
||||
.line:after {
|
||||
content: '';
|
||||
background-color: $blue-7;
|
||||
display: block;
|
||||
width: 3px;
|
||||
}
|
||||
.add-icon{
|
||||
|
||||
.add-icon {
|
||||
font-size: 2em;
|
||||
color:$blue-7;
|
||||
color: $blue-7;
|
||||
}
|
||||
.root-node{
|
||||
background-color:$blue-7;
|
||||
|
||||
.root-node {
|
||||
background-color: $blue-7;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.action-node:not(.root-node):hover{
|
||||
background-color: $light-blue-1;
|
||||
}
|
||||
|
||||
.selected{
|
||||
background-color: $yellow-1;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<div>
|
||||
<svg class="node-line">
|
||||
<polyline :points="points.linePoints" class="line" ></polyline>
|
||||
<text class="add-icon" @click="addNode(node)" :x="points.iconPoint.x" :y="points.iconPoint.y" font-family="Arial" font-size="25" text-anchor="middle" dy=".3em" style="cursor: pointer;" >
|
||||
<text class="add-icon" @click="addNode(node)" :x="points.iconPoint.x" :y="points.iconPoint.y" font-family="Arial" font-size="25"
|
||||
text-anchor="middle" dy=".3em" style="cursor: pointer;" >
|
||||
⊕
|
||||
</text>
|
||||
</svg>
|
||||
@@ -69,6 +70,7 @@ export default defineComponent({
|
||||
const addNode=(prveNode:IActionNode)=>{
|
||||
context.emit('addNode',props.inputPoint);
|
||||
}
|
||||
|
||||
return {
|
||||
node: props.actionNode,
|
||||
hasBranch,
|
||||
@@ -91,9 +93,17 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
.add-icon {
|
||||
stroke: $blue-7;
|
||||
fill: $blue-7;
|
||||
stroke: $blue-8;
|
||||
fill: $blue-8;
|
||||
font-family: Arial;
|
||||
pointer-events: all;
|
||||
font-size: 2.0em;
|
||||
}
|
||||
|
||||
.add-icon:hover{
|
||||
stroke: $blue-8;
|
||||
fill:$blue-8;
|
||||
font-weight: bold;
|
||||
font-size: 2.4em;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</template>
|
||||
</q-input>
|
||||
<show-dialog v-model:visible="show" name="フィールド一覧" @close="closeDg">
|
||||
<field-select ref="appDg" name="フィールド" type="single" :appId="1"></field-select>
|
||||
<field-select ref="appDg" name="フィールド" type="single" :appId="store.appInfo?.appId"></field-select>
|
||||
</show-dialog>
|
||||
</template>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { defineComponent, ref ,watchEffect} from 'vue';
|
||||
import ShowDialog from '../ShowDialog.vue';
|
||||
import FieldSelect from '../FieldSelect.vue';
|
||||
|
||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||
export default defineComponent({
|
||||
name: 'FieldInput',
|
||||
components: {
|
||||
@@ -35,6 +35,7 @@ export default defineComponent({
|
||||
const appDg = ref();
|
||||
const show = ref(false);
|
||||
const selectedField = ref(props.modelValue);
|
||||
const store = useFlowEditorStore();
|
||||
|
||||
const showDg = () => {
|
||||
show.value = true;
|
||||
@@ -51,6 +52,7 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
return {
|
||||
store,
|
||||
appDg,
|
||||
show,
|
||||
showDg,
|
||||
|
||||
45
frontend/src/components/right/PropertyList.vue
Normal file
45
frontend/src/components/right/PropertyList.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-for="(item, index) in properties" :key="index">
|
||||
<component :is="item.component" v-bind="item.props" v-model="item.props.modelValue"></component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
/**
|
||||
* プロパティ属性設定生成する
|
||||
*/
|
||||
import { PropType, defineComponent,ref } from 'vue';
|
||||
import InputText from '../right/InputText.vue';
|
||||
import SelectBox from '../right/SelectBox.vue';
|
||||
import DatePicker from '../right/DatePicker.vue';
|
||||
import FieldInput from '../right/FieldInput.vue';
|
||||
import { IActionNode,IActionProperty } from 'src/types/ActionTypes';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PropertyList',
|
||||
components: {
|
||||
InputText,
|
||||
SelectBox,
|
||||
DatePicker,
|
||||
FieldInput
|
||||
},
|
||||
props: {
|
||||
nodeProps: {
|
||||
type: Object as PropType<Array<IActionProperty>>,
|
||||
required: true,
|
||||
},
|
||||
jsonValue:{
|
||||
type: Object,
|
||||
required: false,
|
||||
}
|
||||
},
|
||||
setup(props, context) {
|
||||
const properties=ref(props.nodeProps)
|
||||
return {
|
||||
properties
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
80
frontend/src/components/right/PropertyPanel.vue
Normal file
80
frontend/src/components/right/PropertyPanel.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div class="q-pa-md q-gutter-sm">
|
||||
<q-drawer
|
||||
side="right"
|
||||
:show-if-above="false"
|
||||
bordered
|
||||
:width="301"
|
||||
:breakpoint="500"
|
||||
class="bg-grey-3"
|
||||
:model-value="showPanel"
|
||||
elevated
|
||||
overlay
|
||||
>
|
||||
<q-card class="column full-height" style="width: 300px">
|
||||
<q-card-section>
|
||||
<div class="text-h6">プロパティ</div>
|
||||
</q-card-section>
|
||||
<q-card-section class="col q-pt-none">
|
||||
<property-list :node-props="actionProps" v-if="showPanel" ></property-list>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions align="right" class="bg-white text-teal">
|
||||
<q-btn flat label="Save" @click="save"/>
|
||||
<q-btn flat label="Cancel" @click="cancel" />
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { reactive, ref,defineComponent, defineProps,PropType ,watchEffect} from 'vue'
|
||||
import PropertyList from 'components/right/PropertyList.vue';
|
||||
import { IActionNode } from 'src/types/ActionTypes';
|
||||
export default defineComponent({
|
||||
name: 'PropertyPanel',
|
||||
components: {
|
||||
PropertyList
|
||||
},
|
||||
props: {
|
||||
actionNode:{
|
||||
type:Object as PropType<IActionNode>,
|
||||
required:true
|
||||
},
|
||||
drawerRight:{
|
||||
type:Boolean,
|
||||
required:true
|
||||
}
|
||||
},
|
||||
emits: [
|
||||
"update:drawerRight"
|
||||
],
|
||||
setup(props,{emit}) {
|
||||
const showPanel =ref(props.drawerRight);
|
||||
const actionProps =ref(props.actionNode.actionProps);
|
||||
watchEffect(() => {
|
||||
showPanel.value = props.drawerRight;
|
||||
actionProps.value= props.actionNode.actionProps;
|
||||
});
|
||||
|
||||
const cancel = async() =>{
|
||||
showPanel.value = false;
|
||||
emit("update:drawerRight",false )
|
||||
}
|
||||
|
||||
const save = async () =>{
|
||||
showPanel.value=false;
|
||||
emit("update:drawerRight",false )
|
||||
}
|
||||
|
||||
return {
|
||||
cancel,
|
||||
save,
|
||||
actionProps,
|
||||
showPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
</style>
|
||||
21
frontend/src/control/auth.ts
Normal file
21
frontend/src/control/auth.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { api } from 'boot/axios';
|
||||
|
||||
export class Auth
|
||||
{
|
||||
async login(user:string,pwd:string):Promise<boolean>
|
||||
{
|
||||
const params = new URLSearchParams();
|
||||
params.append('username', user);
|
||||
params.append('password', pwd);
|
||||
try{
|
||||
const result = await api.post(`http://127.0.0.1:8000/api/token`,params);
|
||||
console.info(result);
|
||||
localStorage.setItem('Token', result.data.access_token);
|
||||
return true;
|
||||
}catch(e)
|
||||
{
|
||||
console.info(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
frontend/src/control/flowctrl.ts
Normal file
37
frontend/src/control/flowctrl.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { api } from 'boot/axios';
|
||||
import { ActionFlow } from 'src/types/ActionTypes';
|
||||
|
||||
export class FlowCtrl
|
||||
{
|
||||
|
||||
async getFlows(appId:string):Promise<ActionFlow[]>
|
||||
{
|
||||
const result = await api.get(`http://127.0.0.1:8000/api/flows/${appId}`);
|
||||
//console.info(result.data);
|
||||
if(!result.data || !Array.isArray(result.data)){
|
||||
return [];
|
||||
}
|
||||
const flows:ActionFlow[]=[];
|
||||
for(const flow of result.data){
|
||||
flows.push(ActionFlow.fromJSON(flow.content));
|
||||
}
|
||||
return flows;
|
||||
}
|
||||
|
||||
async SaveFlow(jsonData:any):Promise<boolean>
|
||||
{
|
||||
const result = await api.post('http://127.0.0.1:8000/api/flow',jsonData);
|
||||
console.info(result.data)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
async UpdateFlow(jsonData:any):Promise<boolean>
|
||||
{
|
||||
const result = await api.put('http://127.0.0.1:8000/api/flow/' + jsonData.flowid,jsonData);
|
||||
console.info(result.data)
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
Kintone App Builder
|
||||
<q-badge align="top" outline>V{{ env.version }}</q-badge>
|
||||
</q-toolbar-title>
|
||||
<q-btn flat round dense icon="logout" @click="authStore.logout()"/>
|
||||
</q-toolbar>
|
||||
|
||||
</q-header>
|
||||
|
||||
<q-drawer
|
||||
@@ -46,6 +48,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import EssentialLink, { EssentialLinkProps } from 'components/EssentialLink.vue';
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const essentialLinks: EssentialLinkProps[] = [
|
||||
{
|
||||
@@ -56,10 +61,17 @@ const essentialLinks: EssentialLinkProps[] = [
|
||||
target:'_self'
|
||||
},
|
||||
{
|
||||
title: 'ルールエディター',
|
||||
caption: 'rule',
|
||||
icon: 'rule',
|
||||
link: '/#/ruleEditor',
|
||||
title: 'フローエディター',
|
||||
caption: 'flowChart',
|
||||
icon: 'account_tree',
|
||||
link: '/#/flowEditor2',
|
||||
target:'_self'
|
||||
},
|
||||
{
|
||||
title: 'FlowEditor',
|
||||
caption: 'FlowEditor',
|
||||
icon: 'account_tree',
|
||||
link: '/#/flowEditor',
|
||||
target:'_self'
|
||||
},
|
||||
{
|
||||
|
||||
160
frontend/src/pages/FlowChart.vue
Normal file
160
frontend/src/pages/FlowChart.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<div class="q-pa-md q-gutter-sm event-tree">
|
||||
<q-drawer
|
||||
side="left"
|
||||
overlay
|
||||
bordered
|
||||
v-model="drawerLeft"
|
||||
:show-if-above="false"
|
||||
elevated
|
||||
>
|
||||
<!-- <q-card class="column full-height" style="width: 300px">
|
||||
<q-card-section> -->
|
||||
|
||||
<div class="flex-center fixd-top" >
|
||||
<AppSelector />
|
||||
</div>
|
||||
|
||||
<!-- </q-card-section> -->
|
||||
<q-separator />
|
||||
<!-- <q-card-section> -->
|
||||
<div class="flex-center">
|
||||
<EventTree />
|
||||
</div>
|
||||
<!-- </q-card-section> -->
|
||||
<!-- </q-card> -->
|
||||
</q-drawer>
|
||||
</div>
|
||||
|
||||
<q-page>
|
||||
<div class="q-pa-md q-gutter-sm">
|
||||
<div class="flowchart" v-if="store.currentFlow">
|
||||
<node-item v-for="(node,) in store.currentFlow.actionNodes" :key="node.id"
|
||||
:isSelected="node===state.activeNode" :actionNode="node"
|
||||
@addNode="addNode"
|
||||
@nodeSelected="onNodeSelected"
|
||||
@nodeEdit="onNodeEdit"
|
||||
@deleteNode="onDeleteNode"
|
||||
@deleteAllNextNodes="onDeleteAllNextNodes"
|
||||
></node-item>
|
||||
</div>
|
||||
</div>
|
||||
</q-page>
|
||||
<PropertyPanel :actionNode="state.activeNode" v-model:drawerRight="drawerRight"></PropertyPanel>
|
||||
<ShowDialog v-model:visible="showAddAction" name="アクション" @close="closeDg">
|
||||
<action-select ref="appDg" name="model" type="single"></action-select>
|
||||
</ShowDialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref,reactive,computed,onMounted} from 'vue';
|
||||
import {IActionNode, ActionNode, IActionFlow, ActionFlow,RootAction, IActionProperty } from 'src/types/ActionTypes';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||
import NodeItem from 'src/components/main/NodeItem.vue';
|
||||
import ShowDialog from 'components/ShowDialog.vue';
|
||||
import ActionSelect from 'components/ActionSelect.vue';
|
||||
import PropertyPanel from 'components/right/PropertyPanel.vue';
|
||||
import AppSelector from 'components/left/AppSelector.vue';
|
||||
import EventTree from 'components/left/EventTree.vue';
|
||||
import {FlowCtrl } from '../control/flowctrl';
|
||||
const drawerLeft = ref(true);
|
||||
|
||||
const store = useFlowEditorStore();
|
||||
// ref関数を使ってtemplateとバインド
|
||||
const state=reactive({
|
||||
activeNode:{
|
||||
id:""
|
||||
},
|
||||
})
|
||||
const appDg = ref();
|
||||
const prevNodeIfo=ref({
|
||||
prevNode:{} as IActionNode,
|
||||
inputPoint:""
|
||||
});
|
||||
const refFlow = ref<ActionFlow|null>(null);
|
||||
const showAddAction=ref(false);
|
||||
const drawerRight=ref(false);
|
||||
const model=ref("");
|
||||
const addActionNode=(action:IActionNode)=>{
|
||||
// refFlow.value?.actionNodes.push(action);
|
||||
store.currentFlow?.actionNodes.push(action);
|
||||
}
|
||||
|
||||
const addNode=(node:IActionNode,inputPoint:string)=>{
|
||||
showAddAction.value=true;
|
||||
prevNodeIfo.value.prevNode=node;
|
||||
prevNodeIfo.value.inputPoint=inputPoint;
|
||||
}
|
||||
|
||||
const onNodeSelected=(node:IActionNode)=>{
|
||||
//右パネルが開いている場合、自動閉じる
|
||||
if(drawerRight.value && state.activeNode.id!==node.id){
|
||||
drawerRight.value=false;
|
||||
}
|
||||
state.activeNode = node;
|
||||
}
|
||||
|
||||
const onNodeEdit=(node:IActionNode)=>{
|
||||
state.activeNode = node;
|
||||
drawerRight.value=true;
|
||||
}
|
||||
|
||||
const onDeleteNode=(node:IActionNode)=>{
|
||||
if(!store.currentFlow) return;
|
||||
store.currentFlow?.removeNode(node);
|
||||
}
|
||||
|
||||
const onDeleteAllNextNodes=(node:IActionNode)=>{
|
||||
if(!store.currentFlow) return;
|
||||
store.currentFlow?.removeAllNext(node.id);
|
||||
}
|
||||
const closeDg=(val :any)=>{
|
||||
console.log("Dialog closed->",val);
|
||||
if (val == 'OK') {
|
||||
const data = appDg.value.selected[0];
|
||||
const actionProps=JSON.parse(data.content);
|
||||
const action = new ActionNode(data.name,data.desc,"",[],actionProps);
|
||||
store.currentFlow?.addNode(action, prevNodeIfo.value.prevNode,prevNodeIfo.value.inputPoint);
|
||||
}
|
||||
}
|
||||
|
||||
const fetchData= async ()=>{
|
||||
const flowCtrl = new FlowCtrl();
|
||||
if(store.appInfo===undefined) return;
|
||||
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]);
|
||||
}
|
||||
refFlow.value=actionFlows[0];
|
||||
const root =refFlow.value.getRoot();
|
||||
if(root){
|
||||
state.activeNode=root;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flowchart{
|
||||
padding-top: 10px;
|
||||
}
|
||||
.flow-toolbar{
|
||||
opacity: 50%;
|
||||
}
|
||||
.flow-container{
|
||||
height: 91.5dvb;
|
||||
overflow: hidden;
|
||||
}
|
||||
.event-tree .q-drawer {
|
||||
top:50px;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
@@ -1,31 +1,66 @@
|
||||
<template>
|
||||
<q-page>
|
||||
|
||||
<div class="flowchart">
|
||||
<node-item v-for="(node,index) in refFlow.actionNodes" :key="index" :actionNode="node" @addNode="addNode"></node-item>
|
||||
<node-item v-for="(node,) in refFlow.actionNodes" :key="node.id"
|
||||
:isSelected="node===state.activeNode" :actionNode="node"
|
||||
@addNode="addNode"
|
||||
@nodeSelected="onNodeSelected"
|
||||
@nodeEdit="onNodeEdit"
|
||||
@deleteNode="onDeleteNode"
|
||||
@deleteAllNextNodes="onDeleteAllNextNodes"
|
||||
></node-item>
|
||||
</div>
|
||||
</q-page>
|
||||
<PropertyPanel :actionNode="state.activeNode" v-model:drawerRight="drawerRight"></PropertyPanel>
|
||||
<show-dialog v-model:visible="showAddAction" name="アクション" @close="closeDg">
|
||||
<action-select ref="appDg" name="アクション" type="single"></action-select>
|
||||
</show-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref} from 'vue';
|
||||
import {IActionNode, ActionNode, IActionFlow, ActionFlow,RootAction } from 'src/types/ActionTypes';
|
||||
import {ref,reactive,computed} from 'vue';
|
||||
import {IActionNode, ActionNode, IActionFlow, ActionFlow,RootAction, IActionProperty } from 'src/types/ActionTypes';
|
||||
import NodeItem from 'src/components/main/NodeItem.vue';
|
||||
import ShowDialog from 'components/ShowDialog.vue';
|
||||
import ActionSelect from 'components/ActionSelect.vue';
|
||||
import PropertyPanel from 'components/right/PropertyPanel.vue';
|
||||
|
||||
const rootAction:RootAction =new RootAction("app.record.create.submit","レコード追加画面","保存するとき");
|
||||
const actionFlow: ActionFlow = new ActionFlow(rootAction);
|
||||
actionFlow.addNode(new ActionNode('自動採番','文書番号を自動採番する',''));
|
||||
|
||||
const rootNode:RootAction =new RootAction("app.record.create.submit","レコード追加画面","保存するとき");
|
||||
const actionFlow: ActionFlow = new ActionFlow(rootNode);
|
||||
const saibanProps:IActionProperty[]=[{
|
||||
component:"InputText",
|
||||
props:{
|
||||
displayName:"フォーマット",
|
||||
modelValue:"",
|
||||
name:"format",
|
||||
placeholder:"フォーマットを入力してください",
|
||||
}
|
||||
},{
|
||||
component:"FieldInput",
|
||||
props:{
|
||||
displayName:"採番項目",
|
||||
modelValue:"",
|
||||
name:"field",
|
||||
placeholder:"採番項目を選択してください",
|
||||
}
|
||||
}];
|
||||
|
||||
actionFlow.addNode(new ActionNode('自動採番','文書番号を自動採番する','',[],saibanProps));
|
||||
actionFlow.addNode(new ActionNode('入力データ取得','電話番号を取得する',''));
|
||||
const branchNode = actionFlow.addNode(new ActionNode('条件分岐','電話番号入力形式チャック','',['はい','いいえ'] ));
|
||||
// actionFlow.addNode(new ActionNode('入力データ取得','住所を取得する',''),branchNode,'はい');
|
||||
actionFlow.addNode(new ActionNode('エラー表示','エラー表示して保存しない',''),branchNode,'いいえ' );
|
||||
|
||||
// ref関数を使ってtemplateとバインド
|
||||
const state=reactive({
|
||||
activeNode:rootNode,
|
||||
})
|
||||
|
||||
const refFlow = ref(actionFlow);
|
||||
const showAddAction=ref(false);
|
||||
const drawerRight=ref(false);
|
||||
|
||||
const addActionNode=(action:IActionNode)=>{
|
||||
refFlow.value.actionNodes.push(action);
|
||||
@@ -34,6 +69,30 @@ const addActionNode=(action:IActionNode)=>{
|
||||
const addNode=(node:IActionNode,inputPoint:string)=>{
|
||||
showAddAction.value=true;
|
||||
}
|
||||
|
||||
const onNodeSelected=(node:IActionNode)=>{
|
||||
//右パネルが開いている場合、自動閉じる
|
||||
if(drawerRight.value && state.activeNode.id!==node.id){
|
||||
drawerRight.value=false;
|
||||
}
|
||||
state.activeNode = node;
|
||||
}
|
||||
|
||||
const onNodeEdit=(node:IActionNode)=>{
|
||||
state.activeNode = node;
|
||||
drawerRight.value=true;
|
||||
}
|
||||
|
||||
const onDeleteNode=(node:IActionNode)=>{
|
||||
refFlow.value.removeNode(node);
|
||||
}
|
||||
|
||||
const onDeleteAllNextNodes=(node:IActionNode)=>{
|
||||
refFlow.value.removeAllNext(node.id);
|
||||
}
|
||||
const closeDg=(val :any)=>{
|
||||
console.log("Dialog closed->",val);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
122
frontend/src/pages/FlowEditorPage.vue
Normal file
122
frontend/src/pages/FlowEditorPage.vue
Normal file
@@ -0,0 +1,122 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="q-ma-md">
|
||||
<div class="q-gutter-xs row items-start">
|
||||
<q-breadcrumbs class="q-pt-xs q-mr-sm" active-color="black">
|
||||
<q-breadcrumbs-el icon="home" />
|
||||
<q-breadcrumbs-el :label="actName" />
|
||||
<q-breadcrumbs-el
|
||||
v-for="flowName in flowNames"
|
||||
:key="flowName"
|
||||
:label="flowName"
|
||||
/>
|
||||
|
||||
<q-breadcrumbs-el :label="flowNames1" />
|
||||
</q-breadcrumbs>
|
||||
<q-separator vertical class="q-mr-xs" />
|
||||
<q-btn
|
||||
unelevated
|
||||
class="q-py-sm"
|
||||
padding="none md none sm"
|
||||
color="blue-1"
|
||||
text-color="primary"
|
||||
size="md"
|
||||
@click="drawerLeft = !drawerLeft"
|
||||
label="変 更"
|
||||
icon="expand_more"
|
||||
dense
|
||||
/>
|
||||
|
||||
<q-space />
|
||||
<q-btn
|
||||
class="q-px-sm q-mr-sm"
|
||||
color="white"
|
||||
size="sm"
|
||||
text-color="black"
|
||||
label="キャンセル"
|
||||
dense
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
class="q-px-sm"
|
||||
color="primary"
|
||||
size="sm"
|
||||
label="保存する"
|
||||
dense
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-layout
|
||||
container
|
||||
style="height: 91.5dvb"
|
||||
class="shadow-2 rounded-borders"
|
||||
>
|
||||
<q-drawer side="left" overlay bordered v-model="drawerLeft">
|
||||
<div class="q-pa-sm fixed-right">
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
icon="close"
|
||||
@click="drawerLeft = !drawerLeft"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="q-mt-lg q-pa-sm">
|
||||
<q-card-section>
|
||||
<div class="flex-center">
|
||||
<div class="row q-pl-md">
|
||||
<p class="text-h6">アクション選択</p>
|
||||
</div>
|
||||
<ItemSelector :actName="actName" />
|
||||
</div>
|
||||
</q-card-section>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="q-mt-md q-pa-sm">
|
||||
<q-card-section>
|
||||
<p class="text-h6 q-pl-md q-mb-none">フロー選択</p>
|
||||
<ControlPanel />
|
||||
</q-card-section>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<div class="q-pa-sm">
|
||||
<q-btn
|
||||
flat
|
||||
color="primary"
|
||||
size="md"
|
||||
@click="drawerLeft = !drawerLeft"
|
||||
label="ジャンプ"
|
||||
dense
|
||||
/>
|
||||
</div>
|
||||
</q-card-actions>
|
||||
</q-drawer>
|
||||
|
||||
<FlowChartTest />
|
||||
</q-layout>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import FlowChartTest from 'pages/FlowChartTest.vue';
|
||||
import ControlPanel from 'components/flowEditor/left/ControlPanelC.vue';
|
||||
import ItemSelector from 'components/flowEditor/left/ItemSelector.vue';
|
||||
import { ref } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||
|
||||
const actName = ref('勤怠管理 - 4');
|
||||
const flowNames = ref(['レコードを追加画面', '保存をクリックした時']);
|
||||
|
||||
const drawerLeft = ref(false);
|
||||
const store = useFlowEditorStore();
|
||||
const { flowNames1 } = storeToRefs(store);
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="sass"></style>
|
||||
117
frontend/src/pages/FlowEditorPage2.vue
Normal file
117
frontend/src/pages/FlowEditorPage2.vue
Normal file
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<div >
|
||||
<div class="q-ma-md">
|
||||
<div class="q-gutter-xs row items-start">
|
||||
<q-btn
|
||||
size="md"
|
||||
@click="drawerLeft = !drawerLeft"
|
||||
icon="keyboard_double_arrow_right"
|
||||
round
|
||||
/>
|
||||
|
||||
<q-space />
|
||||
<q-btn
|
||||
color="white"
|
||||
size="sm"
|
||||
text-color="black"
|
||||
label="キャンセル"
|
||||
dense
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
class="q-px-sm"
|
||||
color="primary"
|
||||
size="sm"
|
||||
label="保存する"
|
||||
@click="save()"
|
||||
dense
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-layout
|
||||
container
|
||||
class="flow-container shadow-2 rounded-borders"
|
||||
>
|
||||
<q-drawer side="left" overlay bordered v-model="drawerLeft">
|
||||
<div class="q-pa-sm fixed-right">
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="primary"
|
||||
icon="close"
|
||||
@click="drawerLeft = !drawerLeft"
|
||||
/>
|
||||
</div>
|
||||
<div class="q-mt-lg q-pa-sm">
|
||||
<q-card-section>
|
||||
<div class="flex-center">
|
||||
<ItemSelector />
|
||||
</div>
|
||||
</q-card-section>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div class="q-mt-md q-pa-sm">
|
||||
<q-card-section>
|
||||
<ControlPanel />
|
||||
</q-card-section>
|
||||
</div>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<div class="q-pa-sm">
|
||||
<q-btn
|
||||
flat
|
||||
color="primary"
|
||||
size="md"
|
||||
@click="drawerLeft = !drawerLeft"
|
||||
label="ジャンプ"
|
||||
dense
|
||||
/>
|
||||
</div>
|
||||
</q-card-actions>
|
||||
</q-drawer>
|
||||
|
||||
<FlowChartTest />
|
||||
</q-layout>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import FlowChartTest from 'pages/FlowChartTest.vue';
|
||||
import ControlPanel from 'components/flowEditor/left/ControlPanelC.vue';
|
||||
import ItemSelector from 'components/flowEditor/left/ItemSelector.vue';
|
||||
import { ref } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||
import { FlowCtrl } from '../control/flowctrl'
|
||||
|
||||
const flowCtrl = new FlowCtrl();
|
||||
const actName = ref('勤怠管理 - 4');
|
||||
|
||||
const drawerLeft = ref(false);
|
||||
const store = useFlowEditorStore();
|
||||
const { flowNames1 } = storeToRefs(store);
|
||||
let isNew = ref(true);
|
||||
|
||||
const save = () =>{
|
||||
|
||||
if(isNew.value)
|
||||
{
|
||||
flowCtrl.SaveFlow({appid:'1',flowid:'flow123',eventid:'event123',name:'test',content:'[]'});
|
||||
isNew.value = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
flowCtrl.UpdateFlow({appid:'1',flowid:'flow123',eventid:'event123',name:'test',content:'[{"a":"b"}]'});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.flow-toolbar{
|
||||
opacity: 50%;
|
||||
}
|
||||
.flow-container{
|
||||
height: calc(91.5dvb - 50px);
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
100
frontend/src/pages/LoginPage.vue
Normal file
100
frontend/src/pages/LoginPage.vue
Normal file
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<q-layout view="lHh Lpr fff">
|
||||
<q-page-container>
|
||||
<q-page class="window-height window-width row justify-center items-center">
|
||||
<div class="column q-pa-lg">
|
||||
<div class="row">
|
||||
<q-card square class="shadow-24" style="width:400px;height:540px;">
|
||||
<q-card-section class="bg-primary">
|
||||
<h4 class="text-h5 text-white q-my-md">{{ title}}</h4>
|
||||
|
||||
</q-card-section>
|
||||
<q-card-section>
|
||||
<q-form class="q-px-sm q-pt-xl" ref="loginForm">
|
||||
<q-input square clearable v-model="email" type="email" lazy-rules
|
||||
:rules="[required,isEmail,short]" label="メール">
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="email" />
|
||||
</template>
|
||||
</q-input>
|
||||
<q-input square clearable v-model="password" :type="passwordFieldType" lazy-rules
|
||||
:rules="[required, short]" label="パスワード">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="lock" />
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<q-icon :name="visibilityIcon" @click="switchVisibility" class="cursor-pointer" />
|
||||
</template>
|
||||
</q-input>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions class="q-px-lg">
|
||||
<q-btn unelevated size="lg" color="secondary" @click="submit" class="full-width text-white"
|
||||
:label="btnLabel" />
|
||||
</q-card-actions>
|
||||
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</q-page>
|
||||
</q-page-container>
|
||||
</q-layout>>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useQuasar } from 'quasar'
|
||||
// import { useRouter } from 'vue-router';
|
||||
import { ref } from 'vue';
|
||||
// import { Auth } from '../control/auth'
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
const authStore = useAuthStore();
|
||||
const $q = useQuasar()
|
||||
const loginForm = ref(null);
|
||||
let title = ref('ログイン');
|
||||
let email = ref('');
|
||||
let password = ref('');
|
||||
let visibility = ref(false);
|
||||
let passwordFieldType = ref('password');
|
||||
let visibilityIcon = ref('visibility');
|
||||
let btnLabel = ref('ログイン');
|
||||
const required = (val:string) => {
|
||||
return (val && val.length > 0 || '必須項目')
|
||||
}
|
||||
const isEmail = (val:string) => {
|
||||
const emailPattern = /^(?=[a-zA-Z0-9@._%+-]{6,254}$)[a-zA-Z0-9._%+-]{1,64}@(?:[a-zA-Z0-9-]{1,63}\.){1,8}[a-zA-Z]{2,63}$/
|
||||
return (emailPattern.test(val) || '無効なメールアドレス')
|
||||
}
|
||||
const short = (val:string) => {
|
||||
return (val && val.length > 3 || '値が短く過ぎる')
|
||||
}
|
||||
const switchVisibility = () => {
|
||||
visibility.value = !visibility.value
|
||||
passwordFieldType.value = visibility.value ? 'text' : 'password'
|
||||
visibilityIcon.value = visibility.value ? 'visibility_off' : 'visibility'
|
||||
}
|
||||
const submit = () =>{
|
||||
authStore.login(email.value,password.value).then((result)=>{
|
||||
if(result)
|
||||
{
|
||||
$q.notify({
|
||||
icon: 'done',
|
||||
color: 'positive',
|
||||
message: 'ログイン成功'
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
$q.notify({
|
||||
icon: 'error',
|
||||
color: 'negative',
|
||||
message: 'ログイン失敗'
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
354
frontend/src/pages/UserDomain.vue
Normal file
354
frontend/src/pages/UserDomain.vue
Normal file
@@ -0,0 +1,354 @@
|
||||
<!-- <template>
|
||||
<div class="q-pa-md" style="max-width: 400px">
|
||||
|
||||
<q-form
|
||||
@submit="onSubmit"
|
||||
@reset="onReset"
|
||||
class="q-gutter-md"
|
||||
>
|
||||
<q-input
|
||||
filled
|
||||
v-model="name"
|
||||
label="Your name *"
|
||||
hint="Kintone envirment name"
|
||||
lazy-rules
|
||||
:rules="[ val => val && val.length > 0 || 'Please type something']"
|
||||
/>
|
||||
|
||||
<q-input
|
||||
filled type="url"
|
||||
v-model="url"
|
||||
label="Kintone url"
|
||||
hint="Kintone domain address"
|
||||
lazy-rules
|
||||
:rules="[ val => val && val.length > 0,isDomain || 'Please type something']"
|
||||
/>
|
||||
|
||||
<q-input
|
||||
filled
|
||||
v-model="username"
|
||||
label="Login user "
|
||||
hint="Kintone user name"
|
||||
lazy-rules
|
||||
:rules="[ val => val && val.length > 0 || 'Please type something']"
|
||||
/>
|
||||
|
||||
<q-input v-model="password" filled :type="isPwd ? 'password' : 'text'" hint="Password with toggle" label="User password">
|
||||
<template v-slot:append>
|
||||
<q-icon
|
||||
:name="isPwd ? 'visibility_off' : 'visibility'"
|
||||
class="cursor-pointer"
|
||||
@click="isPwd = !isPwd"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-toggle v-model="accept" label="Active Domain" />
|
||||
|
||||
<div>
|
||||
<q-btn label="Submit" type="submit" color="primary"/>
|
||||
<q-btn label="Reset" type="reset" color="primary" flat class="q-ml-sm" />
|
||||
</div>
|
||||
</q-form>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { useQuasar } from 'quasar'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup () {
|
||||
const $q = useQuasar()
|
||||
|
||||
const name = ref(null)
|
||||
const age = ref(null)
|
||||
const accept = ref(false)
|
||||
const isPwd =ref(true)
|
||||
|
||||
return {
|
||||
name,
|
||||
age,
|
||||
accept,
|
||||
isPwd,
|
||||
isDomain(val) {
|
||||
const domainPattern = /^https?\/\/:([a-zA-Z] +\.){1}([a-zA-Z]+)\.([a-zA-Z]+)$/;
|
||||
return (domainPattern.test(val) || '無効なURL')
|
||||
},
|
||||
|
||||
onSubmit () {
|
||||
if (accept.value !== true) {
|
||||
$q.notify({
|
||||
color: 'red-5',
|
||||
textColor: 'white',
|
||||
icon: 'warning',
|
||||
message: 'You need to accept the license and terms first'
|
||||
})
|
||||
}
|
||||
else {
|
||||
$q.notify({
|
||||
color: 'green-4',
|
||||
textColor: 'white',
|
||||
icon: 'cloud_done',
|
||||
message: 'Submitted'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onReset () {
|
||||
name.value = null
|
||||
age.value = null
|
||||
accept.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script> -->
|
||||
|
||||
|
||||
<template>
|
||||
<div class="q-pa-md">
|
||||
<q-table grid grid-header title="Domain" selection="single" :rows="rows" :columns="columns" v-model:selected="selected" row-key="name" :filter="filter" hide-header>
|
||||
<template v-slot:top>
|
||||
<div class="q-pa-md q-gutter-sm">
|
||||
<q-btn color="primary" size="sm" label=" 新規 " @click="newDomain()" dense />
|
||||
</div>
|
||||
<q-space />
|
||||
<q-input borderless dense debounce="300" v-model="filter" placeholder="Search">
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
</template>
|
||||
</q-input>
|
||||
</template>
|
||||
<template v-slot:item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4">
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<div class="q-table__grid-item-row">
|
||||
<div class="q-table__grid-item-title">Name</div>
|
||||
<div class="q-table__grid-item-value">{{ props.row.name }}</div>
|
||||
</div>
|
||||
<div class="q-table__grid-item-row">
|
||||
<div class="q-table__grid-item-title">Domain</div>
|
||||
<div class="q-table__grid-item-value">{{ props.row.url }}</div>
|
||||
</div>
|
||||
<div class="q-table__grid-item-row">
|
||||
<div class="q-table__grid-item-title">Account</div>
|
||||
<div class="q-table__grid-item-value">{{ props.row.kintoneuser }}</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
<q-card-actions align="right">
|
||||
<q-btn flat @click = "editDomain(props.row)">編集</q-btn>
|
||||
<q-btn flat @click = "deleteConfirm(props.row)">削除</q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
</q-table>
|
||||
|
||||
<q-dialog :model-value="show" persistent>
|
||||
<q-card style="min-width: 400px">
|
||||
<q-card-section>
|
||||
<div class="text-h6">Kintone Account</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section class="q-pt-none">
|
||||
<q-form class="q-gutter-md">
|
||||
<q-input filled v-model="name" label="Your name *" hint="Kintone envirment name" lazy-rules
|
||||
:rules="[val => val && val.length > 0 || 'Please type something']" />
|
||||
|
||||
<q-input filled type="url" v-model="url" label="Kintone url" hint="Kintone domain address" lazy-rules
|
||||
:rules="[val => val && val.length > 0, isDomain || 'Please type something']" />
|
||||
|
||||
<q-input filled v-model="kintoneuser" label="Login user " hint="Kintone user name" lazy-rules
|
||||
:rules="[val => val && val.length > 0 || 'Please type something']" />
|
||||
|
||||
<q-input v-model="kintonepwd" filled :type="isPwd ? 'password' : 'text'" hint="Password with toggle"
|
||||
label="User password">
|
||||
<template v-slot:append>
|
||||
<q-icon :name="isPwd ? 'visibility_off' : 'visibility'" class="cursor-pointer" @click="isPwd = !isPwd" />
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-toggle v-model="active" label="Active Domain" />
|
||||
</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-card-actions>
|
||||
</q-card>
|
||||
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog v-model="confirm" persistent>
|
||||
<q-card>
|
||||
<q-card-section class="row items-center">
|
||||
<q-avatar icon="confirm" color="primary" text-color="white" />
|
||||
<span class="q-ml-sm">削除してもよろしいですか?</span>
|
||||
</q-card-section>
|
||||
|
||||
<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-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useQuasar } from 'quasar'
|
||||
import { ref, onMounted, reactive } from 'vue'
|
||||
import { api } from 'boot/axios';
|
||||
|
||||
|
||||
const $q = useQuasar()
|
||||
|
||||
const selected = ref([])
|
||||
const name = ref('')
|
||||
const active = ref(false)
|
||||
const isPwd =ref(true)
|
||||
const url =ref('')
|
||||
const kintoneuser =ref('')
|
||||
const kintonepwd =ref('')
|
||||
|
||||
const show = ref(false);
|
||||
const confirm = ref(false)
|
||||
|
||||
let editId = ref(0);
|
||||
|
||||
const columns = [
|
||||
{ name: 'id'},
|
||||
{
|
||||
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: 'kintoneuser', label: 'User', field: 'kintoneuser', sortable: true },
|
||||
{ name: 'kintonepwd' }
|
||||
]
|
||||
|
||||
const rows = reactive([])
|
||||
|
||||
const newDomain = () => {
|
||||
editId.value = 0;
|
||||
show.value = true;
|
||||
};
|
||||
|
||||
const editDomain = (row:object) => {
|
||||
editId.value = row.id;
|
||||
name.value = row.name;
|
||||
url.value = row.url;
|
||||
kintoneuser.value = row.kintoneuser;
|
||||
kintonepwd.value = row.kintonepwd;
|
||||
isPwd.value = true;
|
||||
active.value = false;
|
||||
show.value = true;
|
||||
};
|
||||
|
||||
const deleteConfirm = (row:object) => {
|
||||
confirm.value = true;
|
||||
editId.value = row.id;
|
||||
};
|
||||
|
||||
const deleteDomain = () => {
|
||||
api.delete(`http://127.0.0.1:8000/api/domain/1/`+ editId.value).then(() =>{
|
||||
getDomain();
|
||||
})
|
||||
editId.value = 0;
|
||||
};
|
||||
|
||||
const closeDg = () => {
|
||||
show.value = false;
|
||||
onReset();
|
||||
};
|
||||
const getDomain = () => {
|
||||
api.get(`http://127.0.0.1:8000/api/domain/1`).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 });
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
onMounted(() => {
|
||||
getDomain();
|
||||
})
|
||||
|
||||
const isDomain = (val) =>{
|
||||
// const domainPattern = /^https\/\/:([a-zA-Z] +\.){1}([a-zA-Z]+)\.([a-zA-Z]+)$/;
|
||||
// return (domainPattern.test(val) || '無効なURL')
|
||||
return true;
|
||||
};
|
||||
|
||||
const onSubmit = () =>{
|
||||
if(editId.value !== 0)
|
||||
{
|
||||
api.put(`http://127.0.0.1:8000/api/domain`,{
|
||||
'id': editId.value,
|
||||
'userid': 1,
|
||||
'name': name.value,
|
||||
'url': url.value,
|
||||
'kintoneuser': kintoneuser.value,
|
||||
'kintonepwd': kintonepwd.value,
|
||||
'active': active.value
|
||||
}).then(() =>{
|
||||
getDomain();
|
||||
closeDg();
|
||||
onReset();
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
api.post(`http://127.0.0.1:8000/api/domain`,{
|
||||
'id': 0,
|
||||
'userid': 1,
|
||||
'name': name.value,
|
||||
'url': url.value,
|
||||
'kintoneuser': kintoneuser.value,
|
||||
'kintonepwd': kintonepwd.value,
|
||||
'active': active.value
|
||||
}).then(() =>{
|
||||
getDomain();
|
||||
closeDg();
|
||||
onReset();
|
||||
})
|
||||
}
|
||||
// if (accept.value !== true) {
|
||||
// $q.notify({
|
||||
// color: 'red-5',
|
||||
// textColor: 'white',
|
||||
// icon: 'warning',
|
||||
// message: 'You need to accept the license and terms first'
|
||||
// })
|
||||
// }
|
||||
// else {
|
||||
// $q.notify({
|
||||
// color: 'green-4',
|
||||
// textColor: 'white',
|
||||
// icon: 'cloud_done',
|
||||
// message: 'Submitted'
|
||||
// })
|
||||
// }
|
||||
};
|
||||
|
||||
const onReset = () => {
|
||||
name.value = '';
|
||||
url.value = '';
|
||||
kintoneuser.value = '';
|
||||
kintonepwd.value ='';
|
||||
isPwd.value = true;
|
||||
active.value = false;
|
||||
editId.value = 0;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<div class="text-h6">プロパティ</div>
|
||||
</q-card-section>
|
||||
|
||||
|
||||
<q-card-section class="col q-pt-none">
|
||||
<ActionProperty :jsonData="jsonData" :jsonValue="jsonValue"/>
|
||||
</q-card-section>
|
||||
|
||||
101
frontend/src/pages/testRight.vue
Normal file
101
frontend/src/pages/testRight.vue
Normal file
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<div class="q-pa-md q-gutter-sm">
|
||||
<q-btn label="プロパティ" icon="keyboard_arrow_right" color="primary" @click="drawerRight = !drawerRight" />
|
||||
<!-- <q-btn label="Readプロパティ" icon="keyboard_arrow_right" color="primary" @click="write('right')" /> -->
|
||||
<q-drawer
|
||||
side="right"
|
||||
v-model="drawerRight"
|
||||
show-if-above
|
||||
bordered
|
||||
:width="301"
|
||||
:breakpoint="500"
|
||||
class="bg-grey-3"
|
||||
>
|
||||
<q-card class="column full-height" style="width: 300px">
|
||||
<q-card-section>
|
||||
<div class="text-h6">プロパティ</div>
|
||||
</q-card-section>
|
||||
|
||||
|
||||
<q-card-section class="col q-pt-none">
|
||||
<ActionProperty :jsonData="jsonData" :jsonValue="jsonValue" v-if="drawerRight"/>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions align="right" class="bg-white text-teal">
|
||||
<q-btn flat label="Save" @click="save"/>
|
||||
<q-btn flat label="Cancel" @click="cancel" />
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import ActionProperty from 'components/right/ActionProperty.vue';
|
||||
const drawerRight = ref(false);
|
||||
const jsonData = {
|
||||
elements: [
|
||||
{
|
||||
component: 'InputText',
|
||||
props: {
|
||||
name:'1',
|
||||
placeholder: 'Enter some text',
|
||||
modelValue: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'SelectBox',
|
||||
props: {
|
||||
name:'2',
|
||||
placeholder: 'Choose an option',
|
||||
modelValue: '',
|
||||
options: [
|
||||
'option1',
|
||||
'option2',
|
||||
'option3'
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
props: {
|
||||
name:'3',
|
||||
placeholder: 'Choose a date',
|
||||
modelValue: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'FieldInput',
|
||||
props: {
|
||||
name:'4',
|
||||
placeholder: 'Choose a field',
|
||||
modelValue: '',
|
||||
},
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
let jsonValue = {
|
||||
1:'abc',
|
||||
2:'option2',
|
||||
3:'2023/09/04',
|
||||
4:'6666'
|
||||
};
|
||||
|
||||
const cancel = async() =>{
|
||||
drawerRight.value = false;
|
||||
}
|
||||
|
||||
const save = async () =>{
|
||||
|
||||
jsonData.elements.forEach(property => {
|
||||
if(jsonValue != undefined)
|
||||
{
|
||||
jsonValue[property.props.name] = property.props.modelValue;
|
||||
}
|
||||
});
|
||||
console.log(jsonValue);
|
||||
drawerRight.value=false;
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from 'vue-router';
|
||||
|
||||
import routes from './routes';
|
||||
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
/*
|
||||
* If not building with SSR mode, you can
|
||||
* directly export the Router instantiation;
|
||||
@@ -17,20 +17,57 @@ import routes from './routes';
|
||||
* with the Router instance.
|
||||
*/
|
||||
|
||||
// export default route(function (/* { store, ssrContext } */) {
|
||||
// const createHistory = process.env.SERVER
|
||||
// ? createMemoryHistory
|
||||
// : (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory);
|
||||
|
||||
// const Router = createRouter({
|
||||
// scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
// routes,
|
||||
|
||||
// // Leave this as is and make changes in quasar.conf.js instead!
|
||||
// // quasar.conf.js -> build -> vueRouterMode
|
||||
// // quasar.conf.js -> build -> publicPath
|
||||
// history: createHistory(process.env.VUE_ROUTER_BASE),
|
||||
// });
|
||||
|
||||
// return Router;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
const createHistory = process.env.SERVER
|
||||
? createMemoryHistory
|
||||
: (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory);
|
||||
|
||||
export const Router = createRouter({
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
routes,
|
||||
|
||||
// Leave this as is and make changes in quasar.conf.js instead!
|
||||
// quasar.conf.js -> build -> vueRouterMode
|
||||
// quasar.conf.js -> build -> publicPath
|
||||
history: createHistory(process.env.VUE_ROUTER_BASE),
|
||||
});
|
||||
|
||||
export default route(function (/* { store, ssrContext } */) {
|
||||
const createHistory = process.env.SERVER
|
||||
? createMemoryHistory
|
||||
: (process.env.VUE_ROUTER_MODE === 'history' ? createWebHistory : createWebHashHistory);
|
||||
return Router;
|
||||
});
|
||||
|
||||
const Router = createRouter({
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
routes,
|
||||
Router.beforeEach(async (to) => {
|
||||
// clear alert on route change
|
||||
//const alertStore = useAlertStore();
|
||||
//alertStore.clear();
|
||||
|
||||
// Leave this as is and make changes in quasar.conf.js instead!
|
||||
// quasar.conf.js -> build -> vueRouterMode
|
||||
// quasar.conf.js -> build -> publicPath
|
||||
history: createHistory(process.env.VUE_ROUTER_BASE),
|
||||
});
|
||||
// redirect to login page if not logged in and trying to access a restricted page
|
||||
const publicPages = ['/login'];
|
||||
const authRequired = !publicPages.includes(to.path);
|
||||
const authStore = useAuthStore();
|
||||
|
||||
return Router;
|
||||
if (authRequired && !authStore.token) {
|
||||
authStore.returnUrl = to.fullPath;
|
||||
return '/login';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('pages/LoginPage.vue')
|
||||
},
|
||||
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('layouts/MainLayout.vue'),
|
||||
@@ -9,7 +14,12 @@ 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: 'flowchart', component: () => import('pages/FlowChartTest.vue') },
|
||||
{ path: 'flowEditor', component: () => import('pages/FlowEditorPage.vue') },
|
||||
{ path: 'flowEditor2', component: () => import('pages/FlowChart.vue') },
|
||||
{ path: 'flowChart2', component: () => import('pages/FlowEditorPage2.vue') },
|
||||
{ path: 'right', component: () => import('pages/testRight.vue') },
|
||||
{ path: 'domain', component: () => import('pages/UserDomain.vue') }
|
||||
],
|
||||
},
|
||||
// Always leave this as last one,
|
||||
|
||||
47
frontend/src/stores/flowEditor.ts
Normal file
47
frontend/src/stores/flowEditor.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ActionFlow,AppInfo } from 'src/types/ActionTypes';
|
||||
import {FlowCtrl } from '../control/flowCtrl';
|
||||
|
||||
export interface FlowEditorState{
|
||||
flowNames1:string;
|
||||
appInfo?:AppInfo;
|
||||
flows?:ActionFlow[];
|
||||
selectedFlow?:ActionFlow|undefined;
|
||||
}
|
||||
const flowCtrl=new FlowCtrl();
|
||||
export const useFlowEditorStore = defineStore("flowEditor",{
|
||||
state: ():FlowEditorState => ({
|
||||
flowNames1: '',
|
||||
appInfo:undefined,
|
||||
flows:undefined,
|
||||
selectedFlow:undefined
|
||||
}),
|
||||
getters: {
|
||||
currentFlow():ActionFlow|undefined{
|
||||
return this.selectedFlow;
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
setFlows(flows:ActionFlow[]){
|
||||
this.flows=flows;
|
||||
},
|
||||
selectFlow(flow:ActionFlow){
|
||||
this.selectedFlow=flow;
|
||||
},
|
||||
setApp(app:AppInfo){
|
||||
this.appInfo=app;
|
||||
},
|
||||
async setFlow(){
|
||||
if(this.appInfo===undefined) return;
|
||||
const actionFlows = await flowCtrl.getFlows(this.appInfo?.appId);
|
||||
if(actionFlows && actionFlows.length>0){
|
||||
this.setFlows(actionFlows);
|
||||
}
|
||||
if(actionFlows && actionFlows.length==1){
|
||||
this.selectFlow(actionFlows[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
32
frontend/src/stores/index.ts
Normal file
32
frontend/src/stores/index.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { store } from 'quasar/wrappers'
|
||||
import { createPinia } from 'pinia'
|
||||
import { Router } from 'vue-router';
|
||||
|
||||
/*
|
||||
* When adding new properties to stores, you should also
|
||||
* extend the `PiniaCustomProperties` interface.
|
||||
* @see https://pinia.vuejs.org/core-concepts/plugins.html#typing-new-store-properties
|
||||
*/
|
||||
declare module 'pinia' {
|
||||
export interface PiniaCustomProperties {
|
||||
readonly router: Router;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If not building with SSR mode, you can
|
||||
* directly export the Store instantiation;
|
||||
*
|
||||
* The function below can be async too; either use
|
||||
* async/await or return a Promise which resolves
|
||||
* with the Store instance.
|
||||
*/
|
||||
|
||||
export default store((/* { ssrContext } */) => {
|
||||
const pinia = createPinia()
|
||||
|
||||
// You can add Pinia plugins here
|
||||
// pinia.use(SomePiniaPlugin)
|
||||
|
||||
return pinia
|
||||
})
|
||||
10
frontend/src/stores/store-flag.d.ts
vendored
Normal file
10
frontend/src/stores/store-flag.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/* eslint-disable */
|
||||
// THIS FEATURE-FLAG FILE IS AUTOGENERATED,
|
||||
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
|
||||
import "quasar/dist/types/feature-flag";
|
||||
|
||||
declare module "quasar/dist/types/feature-flag" {
|
||||
interface QuasarFeatureFlags {
|
||||
store: true;
|
||||
}
|
||||
}
|
||||
19
frontend/src/stores/testStore.ts
Normal file
19
frontend/src/stores/testStore.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useCounterStore = defineStore('counter', {
|
||||
state: () => ({
|
||||
counter: 0
|
||||
}),
|
||||
|
||||
getters: {
|
||||
doubleCount (state) {
|
||||
return state.counter * 2;
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
increment () {
|
||||
this.counter++;
|
||||
}
|
||||
}
|
||||
});
|
||||
36
frontend/src/stores/useAuthStore.ts
Normal file
36
frontend/src/stores/useAuthStore.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { api } from 'boot/axios';
|
||||
import { Router } from '../router';
|
||||
|
||||
|
||||
export const useAuthStore = defineStore({
|
||||
id: 'auth',
|
||||
state: () => ({
|
||||
token: localStorage.getItem('token'),
|
||||
returnUrl: ''
|
||||
}),
|
||||
actions: {
|
||||
async login(username:string, password:string) {
|
||||
const params = new URLSearchParams();
|
||||
params.append('username', username);
|
||||
params.append('password', password);
|
||||
try{
|
||||
const result = await api.post(`http://127.0.0.1:8000/api/token`,params);
|
||||
console.info(result);
|
||||
this.token =result.data.access_token;
|
||||
localStorage.setItem('token', result.data.access_token);
|
||||
Router.push(this.returnUrl || '/');
|
||||
return true;
|
||||
}catch(e)
|
||||
{
|
||||
console.info(e);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
logout() {
|
||||
this.token = null;
|
||||
localStorage.removeItem('token');
|
||||
Router.push('/login');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,7 +1,18 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
/**
|
||||
* アクションのプロパティ定義
|
||||
* アプリ情報
|
||||
*/
|
||||
interface IActionProperty {
|
||||
export interface AppInfo {
|
||||
appId:string;
|
||||
code?:string;
|
||||
name:string;
|
||||
description?:string;
|
||||
}
|
||||
|
||||
/**
|
||||
* アクションのプロパティ定義
|
||||
*/
|
||||
export interface IActionProperty {
|
||||
component: string;
|
||||
props: {
|
||||
//プロパティ名
|
||||
@@ -31,13 +42,14 @@ export interface IActionNode{
|
||||
actionProps:Array<IActionProperty>;
|
||||
//アクションのプロパティ設定値抽出
|
||||
ActionValue:object
|
||||
prevNode?: IActionNode;
|
||||
nextNodes:Map<string,IActionNode>;
|
||||
prevNodeId?: string;
|
||||
nextNodeIds: Map<string, string>;
|
||||
}
|
||||
/**
|
||||
* アクションフローの定義
|
||||
*/
|
||||
export interface IActionFlow {
|
||||
id:string;
|
||||
actionNodes:Array<IActionNode>
|
||||
}
|
||||
|
||||
@@ -57,7 +69,7 @@ class ActionProperty implements IActionProperty {
|
||||
};
|
||||
|
||||
static defaultProperty():IActionProperty{
|
||||
return new ActionProperty("InputText","displayName","表示名","表示を入力してください","");
|
||||
return new ActionProperty('InputText','displayName','表示名','表示を入力してください','');
|
||||
};
|
||||
|
||||
constructor(
|
||||
@@ -75,8 +87,6 @@ class ActionProperty implements IActionProperty {
|
||||
modelValue: modelValue
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -104,16 +114,16 @@ export class ActionNode implements IActionNode {
|
||||
});
|
||||
return propValue;
|
||||
};
|
||||
prevNode?: IActionNode;
|
||||
nextNodes:Map<string,IActionNode>;
|
||||
prevNodeId?: string;
|
||||
nextNodeIds: Map<string, string>;
|
||||
constructor(
|
||||
name: string,
|
||||
title:string,
|
||||
inputPoint:string,
|
||||
outputPoint: Array<string> = [],
|
||||
actionProps: Array<IActionProperty> =[ActionProperty.defaultProperty()]
|
||||
actionProps: Array<IActionProperty> =[ActionProperty.defaultProperty()],
|
||||
) {
|
||||
this.id='';
|
||||
this.id=uuidv4();
|
||||
this.name = name;
|
||||
this.title=title;
|
||||
this.inputPoint=inputPoint;
|
||||
@@ -125,7 +135,7 @@ export class ActionNode implements IActionNode {
|
||||
if(prop===undefined){
|
||||
this.actionProps.unshift(defProp);
|
||||
}
|
||||
this.nextNodes=new Map();
|
||||
this.nextNodeIds=new Map<string,string>();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -143,14 +153,14 @@ export class RootAction implements IActionNode {
|
||||
isRoot: boolean;
|
||||
actionProps: Array<IActionProperty>;
|
||||
ActionValue:object;
|
||||
prevNode?: IActionNode=undefined;
|
||||
nextNodes:Map<string,IActionNode>;
|
||||
prevNodeId?: string = undefined;
|
||||
nextNodeIds: Map<string, string>;
|
||||
constructor(
|
||||
name: string,
|
||||
title:string,
|
||||
subTitle:string,
|
||||
) {
|
||||
this.id='';
|
||||
this.id=uuidv4();
|
||||
this.name = name;
|
||||
this.title=title;
|
||||
this.subTitle=subTitle;
|
||||
@@ -159,7 +169,7 @@ export class RootAction implements IActionNode {
|
||||
this.isRoot = true;
|
||||
this.actionProps=[];
|
||||
this.ActionValue={};
|
||||
this.nextNodes=new Map();
|
||||
this.nextNodeIds=new Map<string,string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,16 +177,15 @@ export class RootAction implements IActionNode {
|
||||
* アクションフローの定義
|
||||
*/
|
||||
export class ActionFlow implements IActionFlow {
|
||||
nextId:number;
|
||||
id:string;
|
||||
actionNodes:Array<IActionNode>;
|
||||
constructor(actionNodes:Array<IActionNode>|RootAction){
|
||||
this.nextId=0;
|
||||
|
||||
if(actionNodes instanceof Array){
|
||||
this.actionNodes=actionNodes;
|
||||
}else{
|
||||
this.actionNodes=[actionNodes];
|
||||
}
|
||||
this.id=uuidv4();
|
||||
}
|
||||
/**
|
||||
* ノードを追加する
|
||||
@@ -192,60 +201,206 @@ export class ActionFlow implements IActionFlow {
|
||||
prevNode?:IActionNode,
|
||||
inputPoint?:string):IActionNode
|
||||
{
|
||||
newNode.id = this.generateId();
|
||||
if(inputPoint!==undefined){
|
||||
newNode.inputPoint=inputPoint;
|
||||
}
|
||||
if(prevNode!==undefined){
|
||||
newNode.prevNode=prevNode;
|
||||
const nextNodes = prevNode.nextNodes;
|
||||
if(nextNodes!==undefined && nextNodes.size>0){
|
||||
const nextNode=inputPoint!==undefined?nextNodes.get(inputPoint):nextNodes.get('');
|
||||
if(nextNode ){
|
||||
nextNode.prevNode=newNode;
|
||||
if(newNode.outputPoints.length>0){
|
||||
if(!newNode.outputPoints.some((point)=>point==nextNode.inputPoint)){
|
||||
nextNode.inputPoint=newNode.outputPoints[0];
|
||||
}
|
||||
}else{
|
||||
nextNode.inputPoint='';
|
||||
}
|
||||
newNode.nextNodes.set(nextNode.inputPoint,nextNode);
|
||||
}
|
||||
}
|
||||
prevNode.nextNodes.set(inputPoint?inputPoint:'',newNode);
|
||||
this.connectNodes(prevNode,newNode,inputPoint||'');
|
||||
}else{
|
||||
prevNode=this.actionNodes[this.actionNodes.length-1];
|
||||
prevNode.nextNodes.set(inputPoint?inputPoint:'',newNode);
|
||||
newNode.prevNode=prevNode;
|
||||
this.connectNodes(prevNode,newNode,inputPoint||'');
|
||||
}
|
||||
const index=this.actionNodes.findIndex(node=>node.id===prevNode?.id)
|
||||
if(index>=0){
|
||||
this.actionNodes.splice(index+1,0,newNode);
|
||||
}else{
|
||||
this.actionNodes.push(newNode);
|
||||
}
|
||||
this.actionNodes.push(newNode);
|
||||
return newNode;
|
||||
}
|
||||
/**
|
||||
* ノードを削除する
|
||||
* @param delNode
|
||||
*/
|
||||
removeNode(delNode:IActionNode){
|
||||
const prevNode = delNode;
|
||||
const nextNode = this.findNextNode(delNode);
|
||||
if(nextNode!==undefined){
|
||||
nextNode.prevNode=prevNode;
|
||||
nextNode.inputPoint=delNode.inputPoint;
|
||||
removeNode(targetNode :IActionNode):boolean{
|
||||
if (!targetNode ) {
|
||||
return false;
|
||||
}
|
||||
if(targetNode.isRoot){
|
||||
return false;
|
||||
}
|
||||
this.disconnectFromPrevNode(targetNode);
|
||||
this.reconnectOrRemoveNextNodes(targetNode);
|
||||
this.removeFromActionNodes(targetNode.id);
|
||||
return true;
|
||||
}
|
||||
/***
|
||||
* 目標ノードの次のノードを全部削除する
|
||||
*/
|
||||
removeAllNext(targetNodeId :string){
|
||||
if (!targetNodeId || targetNodeId==='') {
|
||||
return false;
|
||||
}
|
||||
const targetNode=this.findNodeById(targetNodeId);
|
||||
if(!targetNode){
|
||||
return false;
|
||||
}
|
||||
if(targetNode.nextNodeIds.size==0){
|
||||
return false;
|
||||
}
|
||||
for (const [, id] of targetNode.nextNodeIds) {
|
||||
this.removeAllNext(id);
|
||||
this.removeFromActionNodes(id);
|
||||
}
|
||||
}
|
||||
|
||||
// 断开与前一个节点的连接
|
||||
disconnectFromPrevNode(targetNode: IActionNode): void {
|
||||
const prevNodeId = targetNode.prevNodeId;
|
||||
if (prevNodeId) {
|
||||
const prevNode = this.findNodeById(prevNodeId);
|
||||
if (prevNode) {
|
||||
for (const [key, value] of prevNode.nextNodeIds) {
|
||||
if (value === targetNode.id) {
|
||||
prevNode.nextNodeIds.delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 次のノードを探す
|
||||
* @param delNode
|
||||
*/
|
||||
findNextNode(targetNode: IActionNode):ActionNode|undefined {
|
||||
return this.actionNodes.find((node)=>node.prevNode===targetNode);
|
||||
}
|
||||
|
||||
// 从 actionNodes 数组中移除节点
|
||||
private removeFromActionNodes(targetNodeId: string): void {
|
||||
const index = this.actionNodes.findIndex(node => node.id === targetNodeId);
|
||||
if (index > -1) {
|
||||
this.actionNodes.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ノード削除時、前のノードと次のノードを接続する
|
||||
* @param targetNode
|
||||
*/
|
||||
reconnectOrRemoveNextNodes(targetNode: IActionNode): void {
|
||||
if(!targetNode || !targetNode.prevNodeId ){
|
||||
return;
|
||||
}
|
||||
//前のノードを取得
|
||||
const prevNode = this.findNodeById(targetNode.prevNodeId);
|
||||
if(!prevNode) return;
|
||||
//次のノード取得
|
||||
const nextNodeIds = targetNode.nextNodeIds;
|
||||
if(nextNodeIds.size==0){
|
||||
return;
|
||||
}
|
||||
//次のノード一つの場合
|
||||
if(nextNodeIds.size==1){
|
||||
const nextNodeId = nextNodeIds.get('');
|
||||
if(!nextNodeId) return;
|
||||
const nextNode = this.findNodeById(nextNodeId) ;
|
||||
if(!nextNode) return;
|
||||
nextNode.prevNodeId=prevNode.id;
|
||||
prevNode.nextNodeIds.set(targetNode.inputPoint||'',nextNodeId);
|
||||
return;
|
||||
}
|
||||
//二つ以上の場合
|
||||
for(const [point,nextid] of nextNodeIds){
|
||||
const nextNode = this.findNodeById(nextid);
|
||||
if(!nextNode) return;
|
||||
if(!this.connectNodes(prevNode,nextNode,point)){
|
||||
this.removeAllNext(nextid);
|
||||
this.removeFromActionNodes(nextid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 二つノードを接続する
|
||||
* @param prevNode
|
||||
* @param nextNodeId
|
||||
* @param point
|
||||
* @returns
|
||||
*/
|
||||
connectNodes(prevNode:IActionNode,nextNode:IActionNode,point:string):boolean{
|
||||
if(!prevNode || !nextNode){
|
||||
return false;
|
||||
}
|
||||
if(!nextNode) return false;
|
||||
prevNode.nextNodeIds.set(point,nextNode.id);
|
||||
nextNode.prevNodeId=prevNode.id;
|
||||
nextNode.inputPoint=point;
|
||||
return true;
|
||||
}
|
||||
|
||||
generateId():string{
|
||||
const no = this.nextId++;
|
||||
return no.toString().padStart(10,'0');
|
||||
resetNodeRelation(prevNode: IActionNode, newNode: IActionNode, inputPoint?: string) {
|
||||
// 设置新节点和前节点的关联
|
||||
prevNode.nextNodeIds.set(inputPoint || '', newNode.id);
|
||||
newNode.prevNodeId = prevNode.id;
|
||||
// 保存前节点原有的后节点ID
|
||||
const originalNextNodeId = prevNode.nextNodeIds.get(inputPoint || '');
|
||||
this.setNewNodeNextId(newNode,originalNextNodeId,inputPoint);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 後ノードと新ノードの関連付け
|
||||
* @param newNode
|
||||
* @param originalNextNodeId
|
||||
* @param inputPoint
|
||||
*/
|
||||
private setNewNodeNextId(newNode: IActionNode, originalNextNodeId: string | undefined, inputPoint?: string) {
|
||||
// 如果原先的后节点存在
|
||||
if (originalNextNodeId) {
|
||||
// 检查新节点的 outputPoints 是否包含该 inputPoint
|
||||
if (newNode.outputPoints.includes(inputPoint || '')) {
|
||||
newNode.nextNodeIds.set(inputPoint || '', originalNextNodeId);
|
||||
} else {
|
||||
// 如果不包含,选择新节点的一个 outputPoint
|
||||
const alternativeOutputPoint = newNode.outputPoints.length > 0 ? newNode.outputPoints[0] : '';
|
||||
newNode.nextNodeIds.set(alternativeOutputPoint, originalNextNodeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* IDでActionNodeを取得する
|
||||
*/
|
||||
findNodeById(id: string): IActionNode | undefined {
|
||||
return this.actionNodes.find((node) => node.id === id);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
id:this.id,
|
||||
actionNodes: this.actionNodes.map(node => {
|
||||
const { nextNodeIds, ...rest } = node;
|
||||
return {
|
||||
...rest,
|
||||
nextNodeIds: Array.from(nextNodeIds.entries())
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
getRoot():IActionNode|undefined{
|
||||
return this.actionNodes.find(node=>node.isRoot)
|
||||
}
|
||||
|
||||
static fromJSON(json: string): ActionFlow {
|
||||
const parsedObject = JSON.parse(json);
|
||||
|
||||
const actionNodes = parsedObject.actionNodes.map((node: any) => {
|
||||
const nodeClass = !node.isRoot? new ActionNode(node.name,node.title,node.inputPoint,node.outputPoint,node.actionProps)
|
||||
:new RootAction(node.name,node.title,node.subTitle);
|
||||
nodeClass.nextNodeIds=new Map(node.nextNodeIds);
|
||||
nodeClass.prevNodeId=node.prevNodeId;
|
||||
return nodeClass;
|
||||
});
|
||||
const actionFlow = new ActionFlow(actionNodes);
|
||||
actionFlow.id=parsedObject.id;
|
||||
return actionFlow;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
138
frontend/src/types/KintoneEvents.ts
Normal file
138
frontend/src/types/KintoneEvents.ts
Normal file
@@ -0,0 +1,138 @@
|
||||
import {IActionFlow} from './ActionTypes';
|
||||
export interface TreeNode {
|
||||
label: string;
|
||||
}
|
||||
|
||||
export interface KintoneEvent extends TreeNode {
|
||||
eventId: string;
|
||||
hasFlow: boolean;
|
||||
flowData?: IActionFlow;
|
||||
}
|
||||
|
||||
export interface KintoneScreen extends TreeNode {
|
||||
label: string;
|
||||
events: KintoneEvent[];
|
||||
}
|
||||
|
||||
|
||||
export class KintoneEventManager {
|
||||
public screens: KintoneScreen[];
|
||||
|
||||
constructor(screens: KintoneScreen[]) {
|
||||
this.screens = screens;
|
||||
}
|
||||
|
||||
public findEventById(eventId: string): KintoneEvent | null {
|
||||
for (const screen of this.screens) {
|
||||
for (const event of screen.events) {
|
||||
if (event.eventId === eventId) {
|
||||
return event;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export const kintoneEvents:KintoneEventManager = new KintoneEventManager([
|
||||
{
|
||||
label:"レコード追加画面",
|
||||
events:[
|
||||
{
|
||||
label:"レコード追加画面を表示した後",
|
||||
eventId:"app.record.create.show",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"保存をクリックしたとき",
|
||||
eventId:"app.record.create.submit",
|
||||
hasFlow:true
|
||||
},
|
||||
{
|
||||
label:"保存が成功したとき",
|
||||
eventId:"app.record.create.submit.success ",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"フィールドの値を変更したとき",
|
||||
eventId:"app.record.create.change",
|
||||
hasFlow:false
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label:"レコード詳細画面",
|
||||
events:[
|
||||
{
|
||||
label:"レコード詳細画面を表示した後",
|
||||
eventId:"app.record.detail.show",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"レコードを削除するとき",
|
||||
eventId:"app.record.detail.delete.submit",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"プロセス管理のアクションを実行したとき",
|
||||
eventId:"app.record.detail.process.proceed",
|
||||
hasFlow:false
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label:"レコード編集画面",
|
||||
events:[
|
||||
{
|
||||
label:"レコード編集画面を表示した後",
|
||||
eventId:"app.record.edit.show",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"保存をクリックしたとき",
|
||||
eventId:"app.record.edit.submit",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"保存が成功したとき",
|
||||
eventId:"app.record.edit.submit.success",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"フィールドの値を変更したとき",
|
||||
eventId:"app.record.edit.change",
|
||||
hasFlow:false
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label:"レコード一覧画面",
|
||||
events:[
|
||||
{
|
||||
label:"一覧画面を表示した後",
|
||||
eventId:"app.record.index.show",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"インライン編集を開始したとき",
|
||||
eventId:"app.record.index.edit.show",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"インライン編集のフィールド値を変更したとき",
|
||||
eventId:"app.record.index.edit.change",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"インライン編集の【保存】をクリックしたとき",
|
||||
eventId:"app.record.index.edit.submit",
|
||||
hasFlow:false
|
||||
},
|
||||
{
|
||||
label:"インライン編集の保存が成功したとき",
|
||||
eventId:"app.record.index.edit.submit.success",
|
||||
hasFlow:false
|
||||
},
|
||||
]
|
||||
}
|
||||
]);
|
||||
@@ -278,6 +278,11 @@
|
||||
"@types/mime" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/uuid@^9.0.3":
|
||||
version "9.0.3"
|
||||
resolved "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.3.tgz"
|
||||
integrity sha512-taHQQH/3ZyI3zP8M/puluDEIEvtQHVYcC6y3N8ijFtAd28+Ey/G4sg1u2gB01S8MwybLOKAp9/yCMu/uR5l3Ug==
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^5.10.0":
|
||||
version "5.61.0"
|
||||
resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.61.0.tgz"
|
||||
@@ -2144,6 +2149,14 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.1:
|
||||
resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz"
|
||||
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
|
||||
|
||||
pinia@^2.0.0, pinia@^2.1.6:
|
||||
version "2.1.6"
|
||||
resolved "https://registry.npmjs.org/pinia/-/pinia-2.1.6.tgz"
|
||||
integrity sha512-bIU6QuE5qZviMmct5XwCesXelb5VavdOWKWaB17ggk++NUwQWWbP5YnsONTk3b752QkW9sACiR81rorpeOMSvQ==
|
||||
dependencies:
|
||||
"@vue/devtools-api" "^6.5.0"
|
||||
vue-demi ">=0.14.5"
|
||||
|
||||
postcss-selector-parser@^6.0.9:
|
||||
version "6.0.13"
|
||||
resolved "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz"
|
||||
@@ -2657,7 +2670,7 @@ type-is@~1.6.18:
|
||||
media-typer "0.3.0"
|
||||
mime-types "~2.1.24"
|
||||
|
||||
typescript@^4.5.4, "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta":
|
||||
typescript@^4.5.4, "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta", typescript@>=4.4.4:
|
||||
version "4.9.5"
|
||||
resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz"
|
||||
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
|
||||
@@ -2707,6 +2720,11 @@ utils-merge@1.0.1:
|
||||
resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz"
|
||||
integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==
|
||||
|
||||
uuid@^9.0.0:
|
||||
version "9.0.0"
|
||||
resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz"
|
||||
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
|
||||
|
||||
vary@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
|
||||
@@ -2724,6 +2742,11 @@ vary@~1.1.2:
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
vue-demi@>=0.14.5:
|
||||
version "0.14.6"
|
||||
resolved "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz"
|
||||
integrity sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==
|
||||
|
||||
vue-eslint-parser@^9.3.0:
|
||||
version "9.3.1"
|
||||
resolved "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.3.1.tgz"
|
||||
@@ -2744,7 +2767,7 @@ vue-router@^4.0.0, vue-router@^4.0.12:
|
||||
dependencies:
|
||||
"@vue/devtools-api" "^6.5.0"
|
||||
|
||||
vue@^3.0.0, vue@^3.2.0, vue@^3.2.25, vue@^3.2.29, vue@3.3.4:
|
||||
"vue@^2.6.14 || ^3.3.0", vue@^3.0.0, "vue@^3.0.0-0 || ^2.6.0", vue@^3.2.0, vue@^3.2.25, vue@^3.2.29, vue@3.3.4:
|
||||
version "3.3.4"
|
||||
resolved "https://registry.npmjs.org/vue/-/vue-3.3.4.tgz"
|
||||
integrity sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==
|
||||
|
||||
138
sample.json
Normal file
138
sample.json
Normal file
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"id": "681ecde3-4439-4210-9fdf-424c6af98f09",
|
||||
"actionNodes": [
|
||||
{
|
||||
"id": "34dfd32e-ba1a-440f-bb46-a8a1999109cd",
|
||||
"name": "app.record.create.submit",
|
||||
"title": "レコード追加画面",
|
||||
"subTitle": "保存するとき",
|
||||
"inputPoint": "",
|
||||
"outputPoints": [],
|
||||
"isRoot": true,
|
||||
"actionProps": [],
|
||||
"ActionValue": {},
|
||||
"nextNodeIds": [
|
||||
[
|
||||
"",
|
||||
"ce07775d-9729-4516-a88c-78ee8f2f851e"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "ce07775d-9729-4516-a88c-78ee8f2f851e",
|
||||
"name": "自動採番",
|
||||
"title": "文書番号を自動採番する",
|
||||
"inputPoint": "",
|
||||
"outputPoints": [],
|
||||
"actionProps": [
|
||||
{
|
||||
"component": "InputText",
|
||||
"props": {
|
||||
"name": "displayName",
|
||||
"displayName": "文書番号を自動採番する",
|
||||
"placeholder": "表示を入力してください",
|
||||
"modelValue": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": "InputText",
|
||||
"props": {
|
||||
"displayName": "フォーマット",
|
||||
"modelValue": "",
|
||||
"name": "format",
|
||||
"placeholder": "フォーマットを入力してください"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": "FieldInput",
|
||||
"props": {
|
||||
"displayName": "採番項目",
|
||||
"modelValue": "",
|
||||
"name": "field",
|
||||
"placeholder": "採番項目を選択してください"
|
||||
}
|
||||
}
|
||||
],
|
||||
"prevNodeId": "34dfd32e-ba1a-440f-bb46-a8a1999109cd",
|
||||
"nextNodeIds": [
|
||||
[
|
||||
"",
|
||||
"0d18c3c9-abee-44e5-83eb-82074316219b"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "0d18c3c9-abee-44e5-83eb-82074316219b",
|
||||
"name": "入力データ取得",
|
||||
"title": "電話番号を取得する",
|
||||
"inputPoint": "",
|
||||
"outputPoints": [],
|
||||
"actionProps": [
|
||||
{
|
||||
"component": "InputText",
|
||||
"props": {
|
||||
"name": "displayName",
|
||||
"displayName": "表示名",
|
||||
"placeholder": "表示を入力してください",
|
||||
"modelValue": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"prevNodeId": "ce07775d-9729-4516-a88c-78ee8f2f851e",
|
||||
"nextNodeIds": [
|
||||
[
|
||||
"",
|
||||
"399d7c04-5345-4bf6-8da3-d745df554524"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "399d7c04-5345-4bf6-8da3-d745df554524",
|
||||
"name": "条件分岐",
|
||||
"title": "電話番号入力形式チャック",
|
||||
"inputPoint": "",
|
||||
"outputPoints": [
|
||||
"はい",
|
||||
"いいえ"
|
||||
],
|
||||
"actionProps": [
|
||||
{
|
||||
"component": "InputText",
|
||||
"props": {
|
||||
"name": "displayName",
|
||||
"displayName": "表示名",
|
||||
"placeholder": "表示を入力してください",
|
||||
"modelValue": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"prevNodeId": "0d18c3c9-abee-44e5-83eb-82074316219b",
|
||||
"nextNodeIds": [
|
||||
[
|
||||
"いいえ",
|
||||
"8173e6bc-3fa2-4403-b973-9368884e2dfa"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "8173e6bc-3fa2-4403-b973-9368884e2dfa",
|
||||
"name": "エラー表示",
|
||||
"title": "エラー表示して保存しない",
|
||||
"inputPoint": "いいえ",
|
||||
"outputPoints": [],
|
||||
"actionProps": [
|
||||
{
|
||||
"component": "InputText",
|
||||
"props": {
|
||||
"name": "displayName",
|
||||
"displayName": "表示名",
|
||||
"placeholder": "表示を入力してください",
|
||||
"modelValue": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"prevNodeId": "399d7c04-5345-4bf6-8da3-d745df554524",
|
||||
"nextNodeIds": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user