Skip to content

Commit

Permalink
fix: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
LeezQ committed Aug 2, 2022
1 parent 9206279 commit abdf388
Show file tree
Hide file tree
Showing 19 changed files with 179 additions and 141 deletions.
32 changes: 16 additions & 16 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"name": "laf-web",
"version": "0.1.0",
"license": "MIT",
"bugs": {
"url": "https://github.com/labring/laf/issues"
},
"keywords": [
"laf.js",
"cloudfunction",
"serverless",
"element-ui",
"less-api"
],
"engines": {
"node": ">=16",
"npm": ">= 6.0.0"
},
"scripts": {
"build": "vite build",
"dev": "vite --port 3333 --open",
Expand Down Expand Up @@ -67,21 +82,6 @@
"> 1%",
"last 2 versions"
],
"bugs": {
"url": "https://github.com/labring/laf/issues"
},
"engines": {
"node": ">=16",
"npm": ">= 6.0.0"
},
"keywords": [
"laf.js",
"cloudfunction",
"serverless",
"element-ui",
"less-api"
],
"license": "MIT",
"lint-staged": {
"src/**/*.{js,vue}": [
"eslint --fix",
Expand All @@ -91,4 +91,4 @@
"eslintConfig": {
"extends": "@antfu"
}
}
}
2 changes: 1 addition & 1 deletion packages/web/src/api/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export async function exportApplication(appid: string) {
* @param {File} file
* @returns
*/
export async function importApplication(appid: string, file: string | Blob) {
export async function importApplication(appid: string, file: string | Blob): Promise<any> {
const form = new FormData()
form.append('file', file)
const res = await request({
Expand Down
31 changes: 15 additions & 16 deletions packages/web/src/components/JsonEditor/rule.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
<template>
<div class="json-editor">
<div ref="jsonEditor" class="editor" :style="{minHeight: `${minHeight}px`}" />
</div>
</template>

<script>
import * as monaco from 'monaco-editor'
import { rules_schemas } from '@/components/JsonEditor/schemas'
// configure the JSON language support with schemas and schema associations
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
schemas: rules_schemas
schemas: rules_schemas,
})
export default {
name: 'RuleJsonEditor',
/* eslint-disable vue/require-prop-types */
props: ['value', 'lineNumbers', 'mode', 'dark', 'height', 'fontsize'],
data() {
return {
editor: false
editor: false,
}
},
computed: {
minHeight() {
return this.height || 150
}
},
},
watch: {
value(value) {
const editorValue = this.editor.getValue()
if (value !== editorValue) {
if (value !== editorValue)
this.editor.setValue(JSON.stringify(this.value, null, 2))
}
}
},
},
mounted() {
this.editor = monaco.editor.create(this.$refs.jsonEditor, {
Expand All @@ -48,7 +41,7 @@ export default {
fontWeight: 'bold',
cursorBlinking: 'expand',
smoothScrolling: true,
renderWhitespace: 'selection'
renderWhitespace: 'selection',
})
this.editor.onDidChangeModelContent((e) => {
Expand All @@ -61,11 +54,17 @@ export default {
methods: {
getValue() {
return this.editor.getValue()
}
}
},
},
}
</script>

<template>
<div class="json-editor">
<div ref="jsonEditor" class="editor" :style="{ minHeight: `${minHeight}px` }" />
</div>
</template>

<style lang="scss" scoped>
.json-editor {
width: 100%;
Expand Down
77 changes: 38 additions & 39 deletions packages/web/src/components/JsonEditor/schemas.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export const rules_schemas = [
{
uri: 'http://less/permission.json', // id of the first schema
Expand All @@ -7,87 +6,87 @@ export const rules_schemas = [
type: 'object',
properties: {
read: {
$ref: 'http://less/permission-config.json'
$ref: 'http://less/permission-config.json',
},
update: {
$ref: 'http://less/permission-config-for-data.json'
$ref: 'http://less/permission-config-for-data.json',
},
add: {
$ref: 'http://less/permission-config-for-data.json'
$ref: 'http://less/permission-config-for-data.json',
},
remove: {
$ref: 'http://less/permission-config.json'
$ref: 'http://less/permission-config.json',
},
count: {
$ref: 'http://less/permission-config.json'
$ref: 'http://less/permission-config.json',
},
'$schema': {
$ref: 'http://less/data.schema.json'
}
}
}
$schema: {
$ref: 'http://less/data.schema.json',
},
},
},
},
{
uri: 'http://less/permission-config.json', // id of the second schema
schema: {
type: ['boolean', 'string', 'object'],
properties: {
condition: {
type: ['string', 'boolean']
type: ['string', 'boolean'],
},
cond: {
type: ['string', 'boolean']
type: ['string', 'boolean'],
},
query: {
$ref: 'http://less/data.schema.json'
$ref: 'http://less/data.schema.json',
},
multi: {
type: ['boolean', 'string']
}
}
}
type: ['boolean', 'string'],
},
},
},
},
{
uri: 'http://less/permission-config-for-data.json', // id of the second schema
schema: {
type: ['boolean', 'string', 'object'],
properties: {
condition: {
type: ['string', 'boolean']
type: ['string', 'boolean'],
},
cond: {
type: ['string', 'boolean']
type: ['string', 'boolean'],
},
query: {
$ref: 'http://less/data.schema.json'
$ref: 'http://less/data.schema.json',
},
data: {
$ref: 'http://less/data.schema.json'
$ref: 'http://less/data.schema.json',
},
multi: {
type: ['boolean', 'string']
}
}
}
type: ['boolean', 'string'],
},
},
},
},
{
uri: 'http://less/data.schema.json', // id of the second schema
schema: {
type: ['object', 'boolean', 'string'],
patternProperties: {
'.*': {
$ref: 'http://less/constraints.json'
}
}
}
$ref: 'http://less/constraints.json',
},
},
},
},
{
uri: 'http://less/constraints.json', // id of the second schema
schema: {
type: 'object',
properties: {
condition: {
type: ['string', 'boolean']
type: ['string', 'boolean'],
},
required: { type: 'boolean' },
default: { type: ['string', 'boolean', 'number', 'array', 'object'] },
Expand All @@ -96,21 +95,21 @@ export const rules_schemas = [
type: 'array',
items: [
{ type: 'number' },
{ type: 'number' }
]
{ type: 'number' },
],
},
length: {
type: 'array',
items: [
{ type: 'integer' },
{ type: 'integer' }
]
{ type: 'integer' },
],
},
in: { type: 'array' },
match: { type: 'string' },
exists: { type: 'string' },
notExists: { type: 'string' }
}
}
}
notExists: { type: 'string' },
},
},
},
]
2 changes: 1 addition & 1 deletion packages/web/src/layout/TopBarLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TopBar from './components/TopBar.vue'
<template>
<el-container fixed top-0 bottom-0 left-0 right-0>
<el-header relative z-5 style="--el-header-padding: 0;">
<top-bar />
<TopBar />
</el-header>

<el-main style="--el-main-padding: 0;" bg-light>
Expand Down
6 changes: 3 additions & 3 deletions packages/web/src/layout/components/ResetPassword.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { ElForm } from 'element-plus'
import { ElForm } from 'element-plus'
import { resetPassword } from '~/api/user'
import { useUserStore } from '~/store'
import { passwordField, requiredField } from '~/utils/form'
Expand Down Expand Up @@ -48,7 +48,7 @@ defineExpose({ open, close })

<template>
<el-dialog ref="dialogEl" v-model="dialogVisible" destroy-on-close append-to-body :close-on-click-modal="false" :close-on-press-escape="false" title="重置密码">
<el-form ref="formEl" label-position="top" :model="formData">
<ElForm ref="formEl" label-position="top" :model="formData">
<el-form-item
:label="$t('layout.components.reset-password.form.new-password')"
prop="password"
Expand Down Expand Up @@ -79,7 +79,7 @@ defineExpose({ open, close })
auto-complete="off"
/>
</el-form-item>
</el-form>
</ElForm>
<template #footer>
<el-button type="primary" @click="submitForm">
{{ $t('utils.form.submit') }}
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/layout/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import UserMenu from './UserMenu.vue'
<LogoGithub />
</el-icon>
</a>
<language-menu />
<user-menu />
<LanguageMenu />
<UserMenu />
</el-space>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/layout/components/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const logOut = async () => {
<el-dropdown-item @click="open">
{{ $t('layout.topbar.user.reset-password') }}
</el-dropdown-item>
<reset-password :ref="setRef" />
<ResetPassword :ref="setRef" />
</common-opener>
<el-dropdown-item @click="logOut">
{{ $t('layout.topbar.user.logout') }}
Expand Down
12 changes: 6 additions & 6 deletions packages/web/src/pages/app/[appid]/cloudfunction/logs/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ function setTagViewTitle() {
<!-- 数据检索区 -->
<div class="filter-container mb-24px">
<el-input
v-model="listQuery.keyword" placeholder="Request ID" style="width: 320px; margin-right: 10px"
class="filter-item" @keyup.enter="handleFilter"
v-model="listQuery.keyword" placeholder="Request ID" style="width: 320px; margin-right: 10px"
class="filter-item" @keyup.enter="handleFilter"
/>
<el-button class="filter-item" type="primary" icon="Search" @click="handleFilter">
搜索
Expand Down Expand Up @@ -126,8 +126,8 @@ function setTagViewTitle() {
<el-table-column label="创建时间" width="180" align="center">
<template #default="{ row }">
<span v-if="row.created_at">{{
$filters.formatTime(row.created_at)
}}</span>
$filters.formatTime(row.created_at)
}}</span>
<span v-else>-</span>
</template>
</el-table-column>
Expand All @@ -147,8 +147,8 @@ function setTagViewTitle() {

<!-- 分页 -->
<el-pagination
v-model:currentPage="listQuery.page" class="mt-24px" :page-size="listQuery.limit" background
layout="->, total, prev, pager, next" :total="total" @size-change="getList" @current-change="getList"
v-model:currentPage="listQuery.page" class="mt-24px" :page-size="listQuery.limit" background
layout="->, total, prev, pager, next" :total="total" @size-change="getList" @current-change="getList"
/>

<!-- 日志详情对话框 -->
Expand Down
7 changes: 3 additions & 4 deletions packages/web/src/pages/app/[appid]/collaborate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,11 @@ async function handleDelete(row: any) {
if (res.error) {
ElMessage.error(`出错了:${res.error}`)
} else {
}
else {
ElMessage.success('操作成功')
loadCollaborators()
}
}
onMounted(async () => {
Expand All @@ -140,7 +139,7 @@ onMounted(async () => {
<el-table-column align="center" label="用户名">
<template #default="{ row }">
<span v-if="row.user && row.user.username">{{
row.user.username
row.user.username
}}</span>
<span v-else>-</span>
</template>
Expand Down
Loading

0 comments on commit abdf388

Please sign in to comment.