Skip to content

Commit

Permalink
fix(type): fix app & account date/objectid type; fix styles;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Dec 7, 2021
1 parent e2a6559 commit 8ba0761
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 30 deletions.
16 changes: 8 additions & 8 deletions packages/system-client/src/views/application/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{{ getRuntimeMemory(scope.row) }} M
</template>
</el-table-column>
<el-table-column label="服务启停" align="center" width="200" class-name="small-padding">
<el-table-column label="服务启停" align="center" width="300" class-name="small-padding">
<template slot-scope="{row}">
<el-button v-if="row.status !== 'running'" :loading="serviceLoading" plain type="success" size="mini" @click="startApp(row)">
启动
Expand All @@ -63,17 +63,17 @@
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" min-width="100">
<el-table-column label="创建时间" align="center" min-width="120">
<template slot-scope="{row}">
<span v-if="row.created_at">{{ row.created_at | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="300" class-name="small-padding">
<el-table-column fixed="right" label="操作" align="center" width="280" class-name="small-padding">
<template slot-scope="{row}">
<el-tooltip :content="row.status !== 'running' ? '请在开发前启动服务!' : '编写云函数、查看日志、管理数据库、文件、成员协作等'" effect="light" placement="top">
<el-button type="success" size="mini" :disabled="row.status !== 'running'" @click="toDetail(row)">
开发管理
开发
</el-button>
</el-tooltip>
<el-button type="default" size="mini" @click="exportApp(row)">
Expand Down Expand Up @@ -127,7 +127,7 @@
{{ getRuntimeMemory(scope.row) }} M
</template>
</el-table-column>
<el-table-column label="服务启停" align="center" width="200" class-name="small-padding">
<el-table-column label="服务启停" align="center" width="300" class-name="small-padding">
<template slot-scope="{row}">
<el-button v-if="row.status !== 'running'" :loading="serviceLoading" plain type="success" size="mini" @click="startApp(row)">
启动
Expand All @@ -147,17 +147,17 @@
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" min-width="100">
<el-table-column label="创建时间" align="center" min-width="120">
<template slot-scope="{row}">
<span v-if="row.created_at">{{ row.created_at | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" width="300" class-name="small-padding">
<el-table-column fixed="right" label="操作" align="center" width="280" class-name="small-padding">
<template slot-scope="{row}">
<el-tooltip :content="row.status !== 'running' ? '请在开发前启动服务!' : '编写云函数、查看日志、管理数据库、文件、成员协作等'" effect="light" placement="top">
<el-button type="success" size="mini" :disabled="row.status !== 'running'" @click="toDetail(row)">
开发管理
开发
</el-button>
</el-tooltip>
<el-button type="default" size="mini" @click="exportApp(row)">
Expand Down
10 changes: 5 additions & 5 deletions packages/system-client/src/views/cloudfunction/logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
highlight-current-row
style="width: 100%;"
>
<el-table-column label="RequestId" prop="id" align="center" width="240">
<el-table-column label="RequestId" prop="id" align="center" width="260">
<template slot-scope="{row}">
<span>{{ row.requestId }}</span>
</template>
</el-table-column>
<el-table-column label="函数名" width="160" align="center">
<el-table-column label="函数名" min-width="200" align="center">
<template slot-scope="{row}">
<el-tag type="primary">{{ row.func_name }}</el-tag>
</template>
Expand All @@ -40,7 +40,7 @@
<span class="link-type">{{ row.func_id }}</span>
</template>
</el-table-column>
<el-table-column label="执行用时" min-width="100" align="center">
<el-table-column label="执行用时" width="100" align="center">
<template slot-scope="{row}">
<span v-if="row.time_usage" class="link-type">{{ row.time_usage }}ms</span>
<span v-else>-</span>
Expand All @@ -52,11 +52,11 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="调用者ID" class-name="status-col" width="240">
<!-- <el-table-column label="调用者ID" class-name="status-col" width="240">
<template slot-scope="{row}">
{{ row.created_by || '-' }}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width">
<template slot-scope="{row}">
<el-button type="info" size="mini" @click="handleShowDetail(row)">
Expand Down
6 changes: 3 additions & 3 deletions packages/system-server/src/api/application.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-08-28 22:00:45
* @LastEditTime: 2021-12-07 09:48:05
* @LastEditTime: 2021-12-07 13:50:40
* @Description: Application APIs
*/

Expand Down Expand Up @@ -56,8 +56,8 @@ export interface ApplicationStruct {
roles: string[]
created_at: number
}[]
created_at?: number
updated_at?: number
created_at?: Date
updated_at?: Date
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/system-server/src/router/account/edit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-07-30 10:30:29
* @LastEditTime: 2021-10-08 01:00:56
* @LastEditTime: 2021-12-07 13:54:45
* @Description:
*/

Expand Down Expand Up @@ -33,7 +33,7 @@ export async function handleEdit(req: Request, res: Response) {

// update account
const data = {
updated_at: Date.now()
updated_at: new Date()
}

// update avatar if provided
Expand Down
6 changes: 3 additions & 3 deletions packages/system-server/src/router/account/signup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-07-30 10:30:29
* @LastEditTime: 2021-10-08 01:02:45
* @LastEditTime: 2021-12-07 13:54:20
* @Description:
*/

Expand Down Expand Up @@ -43,8 +43,8 @@ export async function handleSignUp(req: Request, res: Response) {
},
name: name,
password: hashPassword(password),
created_at: Date.now(),
updated_at: Date.now()
created_at: new Date(),
updated_at: new Date()
})

return res.send({
Expand Down
7 changes: 4 additions & 3 deletions packages/system-server/src/router/application/create.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-08-31 15:00:04
* @LastEditTime: 2021-11-17 18:17:46
* @LastEditTime: 2021-12-07 13:57:21
* @Description:
*/

import * as assert from 'assert'
import { Request, Response } from 'express'
import { ObjectId } from 'mongodb'
import { getAccountById } from '../../api/account'
import { ApplicationStruct, createApplicationDb, generateAppid, getApplicationByAppid, getMyApplications } from '../../api/application'
import Config from '../../config'
Expand Down Expand Up @@ -43,10 +44,10 @@ export async function handleCreateApplication(req: Request, res: Response) {
const db_user = db_name
const db_password = generatePassword(32, true, false)

const now = Date.now()
const now = new Date()
const data: ApplicationStruct = {
name: app_name,
created_by: uid,
created_by: new ObjectId(uid),
appid: appid,
status: 'created',
collaborators: [],
Expand Down
13 changes: 9 additions & 4 deletions packages/system-server/src/router/application/update.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-08-31 15:00:04
* @LastEditTime: 2021-10-08 01:30:06
* @LastEditTime: 2021-12-07 13:55:45
* @Description:
*/

import { Request, Response } from 'express'
import { getApplicationByAppid } from '../../api/application'
import { ApplicationStruct, getApplicationByAppid } from '../../api/application'
import { checkPermission } from '../../api/permission'
import { Constants } from '../../constants'
import { DatabaseAgent } from '../../lib/db-agent'
Expand Down Expand Up @@ -35,10 +35,15 @@ export async function handleUpdateApplication(req: Request, res: Response) {
const body = req.body
if (!body.name) return res.status(422).send('name cannot be empty')

const ret = await db.collection(Constants.cn.applications)
const ret = await db.collection<ApplicationStruct>(Constants.cn.applications)
.updateOne(
{ appid: app.appid },
{ $set: { name: body.name } }
{
$set: {
name: body.name,
updated_at: new Date()
}
}
)

return res.send({
Expand Down
5 changes: 3 additions & 2 deletions packages/system-server/src/router/policy/create.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-09-03 23:19:36
* @LastEditTime: 2021-10-08 01:45:27
* @LastEditTime: 2021-12-07 13:37:40
* @Description:
*/

import { Request, Response } from 'express'
import { ObjectId } from 'mongodb'
import { ApplicationStruct } from '../../api/application'
import { checkPermission } from '../../api/permission'
import { Constants } from '../../constants'
Expand Down Expand Up @@ -50,7 +51,7 @@ export async function handleCreatePolicy(req: Request, res: Response) {
hash: hashFunctionCode(JSON.stringify(body.rules)),
created_at: Date.now(),
updated_at: Date.now(),
created_by: uid,
created_by: new ObjectId(uid),
appid: app.appid
}

Expand Down

0 comments on commit 8ba0761

Please sign in to comment.