🚨 Eslint规则更新
This commit is contained in:
parent
e333fa5aa3
commit
9f40aeddf5
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"cSpell.ignoreWords": [
|
||||
"Onekey"
|
||||
]
|
||||
}
|
@ -28,6 +28,9 @@ module.exports = {
|
||||
quotes: ['error', 'single'], // 引号:single单引 double双引
|
||||
semi: ['error', 'never'], // 结尾分号:never禁止 always必须
|
||||
'comma-dangle': ['error', 'never'], // 对象拖尾逗号
|
||||
'space-before-blocks': ['error', 'always'],
|
||||
'space-in-parens': ['error', 'never'],
|
||||
'keyword-spacing': ['error', { 'before': true, 'after': true }],
|
||||
'no-redeclare': ['error', { builtinGlobals: true }], // 禁止重复对象声明
|
||||
'no-multi-assign': 0,
|
||||
'no-restricted-globals': 0,
|
||||
|
@ -57,7 +57,7 @@ function sendEmail({ service, user, pass }, title, content) {
|
||||
async function asyncSendNotice(noticeAction, title, content) {
|
||||
try {
|
||||
let sw = await getNotifySwByType(noticeAction) // 获取对应动作的通知开关
|
||||
console.log(noticeAction, sw)
|
||||
console.log('notify swtich: ', noticeAction, sw)
|
||||
if (!sw) return
|
||||
let notifyConfig = await readNotifyConfig()
|
||||
let { type } = notifyConfig
|
||||
|
@ -34,8 +34,10 @@ module.exports = {
|
||||
'vue/singleline-html-element-content-newline': 0,
|
||||
|
||||
// js
|
||||
'space-before-blocks': ['error', 'always',],
|
||||
'space-in-parens': ['error', 'never',],
|
||||
'keyword-spacing': ['error', { 'before': true, 'after': true },],
|
||||
'no-async-promise-executor': 0,
|
||||
'comma-dangle': 0,
|
||||
'import/no-extraneous-dependencies': 0,
|
||||
'no-console': 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
|
@ -100,6 +100,7 @@ const rules = reactive({
|
||||
})
|
||||
|
||||
const handleLogin = () => {
|
||||
console.log(loginForm)
|
||||
loginFormRefs.value.validate().then(() => {
|
||||
let { jwtExpires, loginName, pwd } = loginForm
|
||||
jwtExpires = isSession.value ? '12h' : `${ jwtExpires }h`
|
||||
@ -124,7 +125,7 @@ const handleLogin = () => {
|
||||
.then(async () => {
|
||||
$router.push('/setting')
|
||||
})
|
||||
} else{
|
||||
} else {
|
||||
$router.push('/')
|
||||
}
|
||||
})
|
||||
|
@ -53,7 +53,7 @@
|
||||
<el-table-column label="操作">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="!row.pendding"
|
||||
v-if="!row.pending"
|
||||
v-show="row.id !== 'own'"
|
||||
:loading="row.loading"
|
||||
type="danger"
|
||||
@ -174,7 +174,7 @@ const loading = ref(false)
|
||||
const formVisible = ref(false)
|
||||
const socket = ref(null)
|
||||
let recordList = ref([])
|
||||
let penddingRecord = ref([])
|
||||
let pendingRecord = ref([])
|
||||
let checkAll = ref(false)
|
||||
let indeterminate = ref(false)
|
||||
const updateFormRef = ref(null)
|
||||
@ -194,13 +194,13 @@ let isExecuting = computed(() => timeRemaining.value > 0)
|
||||
const hasConfigHostList = computed(() => hostList.value.filter(item => item.isConfig))
|
||||
|
||||
const tableData = computed(() => {
|
||||
return penddingRecord.value.concat(recordList.value).map(item => {
|
||||
return pendingRecord.value.concat(recordList.value).map(item => {
|
||||
item.loading = false
|
||||
return item
|
||||
})
|
||||
})
|
||||
const expandRows = computed(() => {
|
||||
let rows = tableData.value.filter(item => item.pendding).map(item => item.id)
|
||||
let rows = tableData.value.filter(item => item.pending).map(item => item.id)
|
||||
return rows
|
||||
})
|
||||
|
||||
@ -240,7 +240,7 @@ const createExecShell = (hosts = [], command = 'ls', timeout = 60) => {
|
||||
console.log('onekey socket已连接:', socket.value.id)
|
||||
|
||||
socket.value.on('ready', () => {
|
||||
penddingRecord.value = [] // 每轮执行前清空
|
||||
pendingRecord.value = [] // 每轮执行前清空
|
||||
})
|
||||
|
||||
socket.value.emit('create', { hosts, token: token.value, command, timeout })
|
||||
@ -249,8 +249,8 @@ const createExecShell = (hosts = [], command = 'ls', timeout = 60) => {
|
||||
loading.value = false
|
||||
if (Array.isArray(result) && result.length > 0) {
|
||||
// console.log('output', result)
|
||||
result = result.map(item => ({ ...item, pendding: true }))
|
||||
penddingRecord.value = result
|
||||
result = result.map(item => ({ ...item, pending: true }))
|
||||
pendingRecord.value = result
|
||||
nextTick(() => {
|
||||
document.querySelectorAll('.detail_content_box').forEach(container => {
|
||||
container.scrollTop = container.scrollHeight
|
||||
@ -267,8 +267,8 @@ const createExecShell = (hosts = [], command = 'ls', timeout = 60) => {
|
||||
})
|
||||
if (Array.isArray(result) && result.length > 0) {
|
||||
// console.log('output', result)
|
||||
result = result.map(item => ({ ...item, pendding: true }))
|
||||
penddingRecord.value = result
|
||||
result = result.map(item => ({ ...item, pending: true }))
|
||||
pendingRecord.value = result
|
||||
}
|
||||
})
|
||||
socket.value.on('create_fail', (reason) => {
|
||||
@ -374,7 +374,7 @@ function execOnekey() {
|
||||
if (hosts.length === 0) {
|
||||
return $message.error('请选择主机')
|
||||
}
|
||||
await getOnekeyRecord() // 获取新纪录前会清空 penddingRecord,所以需要获取一次最新的list
|
||||
await getOnekeyRecord() // 获取新纪录前会清空 pendingRecord,所以需要获取一次最新的list
|
||||
createExecShell(hosts, command, timeout)
|
||||
formVisible.value = false
|
||||
})
|
||||
@ -399,7 +399,7 @@ const handleRemoveAll = async () => {
|
||||
})
|
||||
.then(async () => {
|
||||
await $api.deleteOnekeyRecord('ALL')
|
||||
penddingRecord.value = []
|
||||
pendingRecord.value = []
|
||||
await getOnekeyRecord()
|
||||
$message.success('success')
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user