From 902c845e8a0c0a2026322de2c0b9bc8bbed1fc17 Mon Sep 17 00:00:00 2001 From: monoid Date: Wed, 13 Oct 2021 17:12:03 +0900 Subject: [PATCH] add commitall api and button --- app.ts | 1 + migrations/initial.ts | 2 +- package.json | 27 +++++++++++-------- src/client/package.json | 1 + src/client/page/difference.tsx | 38 +++++++++++++++++++++++---- src/db/doc.ts | 39 ++++++++++++++++++++++++++- src/db/tag.ts | 2 +- src/db/user.ts | 2 +- src/diff/content_handler.ts | 20 +++++++++----- src/diff/content_list.ts | 48 +++++++++++++++------------------- src/diff/diff.ts | 12 +++++++-- src/diff/router.ts | 23 +++++++++++++++- src/model/doc.ts | 4 +++ src/route/contents.ts | 10 +------ src/types/db.d.ts | 4 +-- 15 files changed, 165 insertions(+), 68 deletions(-) diff --git a/app.ts b/app.ts index 323177e..3aad477 100644 --- a/app.ts +++ b/app.ts @@ -5,6 +5,7 @@ import { getAdminAccessTokenValue,getAdminRefreshTokenValue, accessTokenName, re import { join } from "path"; import { ipcMain } from 'electron'; import { UserAccessor } from "./src/model/mod"; + function registerChannel(cntr: UserAccessor){ ipcMain.handle('reset_password', async(event,username:string,password:string)=>{ const user = await cntr.findUser(username); diff --git a/migrations/initial.ts b/migrations/initial.ts index 36178b6..f3b931e 100644 --- a/migrations/initial.ts +++ b/migrations/initial.ts @@ -1,4 +1,4 @@ -import Knex from 'knex'; +import {Knex} from 'knex'; export async function up(knex:Knex) { await knex.schema.createTable("users",(b)=>{ diff --git a/package.json b/package.json index b9577f0..b0331ba 100644 --- a/package.json +++ b/package.json @@ -6,11 +6,11 @@ "scripts": { "compile": "tsc", "compile:watch": "tsc -w", - "build":"cd src/client && npm run build:prod", - "build:watch":"cd src/client && npm run build:watch", + "build": "cd src/client && npm run build:prod", + "build:watch": "cd src/client && npm run build:watch", "app": "electron build/app.js", - "app:build":"electron-builder", - "app:pack":"electron-builder --dir", + "app:build": "electron-builder", + "app:pack": "electron-builder --dir", "app:build:win64": "electron-builder --win --x64", "app:pack:win64": "electron-builder --win --x64 --dir" }, @@ -21,11 +21,14 @@ "node_modules/**/*", "package.json" ], - "extraFiles":[ + "extraFiles": [ { - "from":"dist/", - "to":"dist/", - "filter":["**/*","!**/*.map"] + "from": "dist/", + "to": "dist/", + "filter": [ + "**/*", + "!**/*.map" + ] }, "index.html" ], @@ -49,24 +52,26 @@ "author": "", "license": "ISC", "dependencies": { + "@louislam/sqlite3": "^6.0.0", "chokidar": "^3.5.1", "jsonschema": "^1.4.0", "jsonwebtoken": "^8.5.1", - "knex": "^0.21.16", + "knex": "^0.95.11", "koa": "^2.13.1", "koa-bodyparser": "^4.3.0", "koa-router": "^10.0.0", "natural-orderby": "^2.0.3", "node-stream-zip": "^1.12.0", - "sqlite3": "^5.0.1" + "sqlite3": "^5.0.2", + "tiny-async-pool": "^1.2.0" }, "devDependencies": { "@types/jsonwebtoken": "^8.5.0", - "@types/knex": "^0.16.1", "@types/koa": "^2.11.6", "@types/koa-bodyparser": "^4.3.0", "@types/koa-router": "^7.4.1", "@types/node": "^14.14.22", + "@types/tiny-async-pool": "^1.0.0", "electron": "^11.2.0", "electron-builder": "^22.9.1", "eslint-plugin-node": "^11.1.0", diff --git a/src/client/package.json b/src/client/package.json index 2696b80..c6bef8c 100644 --- a/src/client/package.json +++ b/src/client/package.json @@ -23,6 +23,7 @@ "dependencies": { "@material-ui/core": "^4.11.2", "@material-ui/icons": "^4.11.2", + "@mui/material": "^5.0.3", "react": "^17.0.1", "react-dom": "^17.0.1", "react-router-dom": "^5.2.0" diff --git a/src/client/page/difference.tsx b/src/client/page/difference.tsx index 00f8f58..9841355 100644 --- a/src/client/page/difference.tsx +++ b/src/client/page/difference.tsx @@ -2,6 +2,7 @@ import React, { useContext, useEffect, useState } from 'react'; import { CommonMenuList, Headline } from "../component/mod"; import { UserContext } from "../state"; import { Box, Grid, Paper, Typography,Button, makeStyles, Theme } from "@material-ui/core"; +import {Stack} from '@mui/material'; const useStyles = makeStyles((theme:Theme)=>({ paper:{ @@ -26,17 +27,25 @@ type FileDifference = { function TypeDifference(prop:{ content:FileDifference, - onCommit:(v:{type:string,path:string})=>void + onCommit:(v:{type:string,path:string})=>void, + onCommitAll:(type:string) => void }){ const classes = useStyles(); const x = prop.content; const [button_disable,set_disable] = useState(false); return ( - {x.type} + + {x.type} + + {x.value.map(y=>( -