perf: update loader

This commit is contained in:
ibuler 2024-10-15 13:58:56 +08:00
parent d775ffa501
commit d90aba37cf
9 changed files with 112 additions and 36 deletions

View File

@ -2,37 +2,70 @@
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta content="0" http-equiv="Expires">
<meta content="no-cache" http-equiv="Pragma">
<meta content="no-cache" http-equiv="Cache-control">
<meta content="no-cache" http-equiv="Cache">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title><%= webpackConfig.name %></title>
<link rel="stylesheet" href="<%= BASE_URL %>theme/element-ui.css">
<link href="<%= BASE_URL %>theme/element-ui.css" rel="stylesheet">
<style>
#loading {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: white;
z-index: 9999;
}
.spinner {
width: 50px;
height: 50px;
border: 5px solid rgba(0, 0, 0, 0.1);
border-radius: 50%;
border-top-color: #3498db;
animation: spin 1s infinite linear;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<noscript>
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<script>
window.onload = function() {
if (location.pathname === '/') {
location.pathname = '/ui/'
}
const pathname = window.location.pathname
if (pathname.startsWith('/core')) {
return
}
if(pathname.indexOf('/ui') === -1) {
window.location.href = window.location.origin + '/ui/#' + pathname
}
if (pathname.startsWith('/ui/#/chat')) {
window.location.href = window.location.origin + pathname
}
window.onload = function () {
if (location.pathname === '/') {
location.pathname = '/ui/'
}
const pathname = window.location.pathname
if (pathname.startsWith('/core')) {
return
}
if (pathname.indexOf('/ui') === -1) {
window.location.href = window.location.origin + '/ui/#' + pathname
}
if (pathname.startsWith('/ui/#/chat')) {
window.location.href = window.location.origin + pathname
}
}
</script>
<div id="app"></div>
<div id="app">
</div>
<div id="loading">
<div class="spinner"></div>
</div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@ -92,6 +92,15 @@ new Vue({
i18n,
router,
store,
mounted() {
// 移除加载页面
const loadingElement = document.getElementById('loading')
if (loadingElement) {
setTimeout(() => {
loadingElement.style.display = 'none'
}, 500)
}
},
render: h => h(App)
})

View File

@ -21,8 +21,7 @@ export default [
component: () => import('@/views/accounts/AccountDiscover/index.vue'),
name: 'AccountDiscoverList',
meta: {
menuTitle: i18n.t('GatherAccounts'),
title: i18n.t('AccountDiscoverTaskList'),
title: i18n.t('DiscoverAccounts'),
// activeMenu: '/console/accounts/automations',
permissions: ['accounts.view_gatheredaccount']
}

View File

@ -0,0 +1,13 @@
<script>
export default {
name: 'AccountChangeDashboard'
}
</script>
<template>
<h1>账号改密汇总</h1>
</template>
<style scoped>
</style>

View File

@ -24,7 +24,8 @@ export default {
interval: 24,
accounts: [],
secret_type: 'password',
secret_strategy: 'specific'
secret_strategy: 'specific',
ssh_key_change_strategy: 'set_jms'
},
url: '/api/v1/accounts/change-secret-automations/',
encryptedFields: ['secret'],
@ -41,7 +42,8 @@ export default {
],
[this.$t('Automations'), ['params']],
[this.$t('Periodic'), ['is_periodic', 'interval', 'crontab']],
[this.$t('Other'), ['is_active', 'recipients', 'comment']]
[this.$t('Notification'), ['recipients']],
[this.$t('Other'), ['is_active', 'comment']]
],
fieldsMeta: {
...getChangeSecretFields(),

View File

@ -1,5 +1,5 @@
import i18n from '@/i18n/i18n'
import { PasswordRule, TagInput, UpdateToken } from '@/components/Form/FormFields'
import { PasswordRule, Select2, TagInput, UpdateToken } from '@/components/Form/FormFields'
import { crontab, interval, is_periodic } from '../../accounts/const'
export const getChangeSecretFields = () => {
@ -49,8 +49,22 @@ export const getChangeSecretFields = () => {
label: i18n.t('PasswordRule'),
hidden: ({ secret_strategy, secret_type }) => (secret_strategy === 'specific' || secret_type !== 'password')
},
recipients: {
label: i18n.t('Recipient'),
pre_notify: {
label: i18n.t('Pre Recipient'),
component: Select2,
el: {
value: [],
ajax: {
url: '/api/v1/users/users/?fields_size=mini',
transformOption: (item) => {
return { label: item.name + '(' + item.username + ')', value: item.id }
}
}
}
},
post_notify: {
label: i18n.t('Post Recipient'),
component: Select2,
el: {
value: [],
ajax: {

View File

@ -16,10 +16,9 @@ export default {
activeMenu: 'AccountChangeSecretList',
submenu: [
{
title: this.$t('AccountChangeSecret'),
name: 'AccountChangeSecretList',
hidden: () => !this.$hasPerm('accounts.view_changesecretautomation'),
component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretList.vue')
title: this.$t('Overview'),
name: 'AccountChangeDashboard',
component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeDashboard.vue')
},
{
title: this.$t('ExecutionList'),
@ -28,6 +27,12 @@ export default {
component: () => import(
'@/views/accounts/AccountChangeSecret/AccountChangeSecretDetail/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue'
)
},
{
title: this.$t('AccountChangeSecret'),
name: 'AccountChangeSecretList',
hidden: () => !this.$hasPerm('accounts.view_changesecretautomation'),
component: () => import('@/views/accounts/AccountChangeSecret/AccountChangeSecretList.vue')
}
]
}

View File

@ -15,8 +15,9 @@ export default {
return {
fields: [
[this.$t('Basic'), ['name', 'nodes', 'assets']],
[this.$t('发现配置'), ['is_sync_account', 'recipients']],
[this.$t('Periodic'), ['is_periodic', 'crontab', 'interval']],
[this.$t('Other'), ['is_sync_account', 'is_active', 'recipients', 'comment']]
[this.$t('Other'), ['is_active', 'comment']]
],
url: '/api/v1/accounts/gather-account-automations/',
hasDetailInMsg: false,

View File

@ -38,9 +38,9 @@ export default {
},
{
id: 'gather_account',
display_name: this.$t('GatherAccounts'),
display_name: this.$t('DiscoverAccounts'),
name: 'AccountDiscoverList',
comment: this.$t('GatherAccountsHelpText'),
comment: this.$t('DiscoverAccountsHelpText'),
icon: 'gather-account',
edition: 'enterprise',
tags: ['ansible']