diff --git a/nezha-fronted/src/assets/stylus/main.scss b/nezha-fronted/src/assets/stylus/main.scss index 005d26793..f85994aca 100644 --- a/nezha-fronted/src/assets/stylus/main.scss +++ b/nezha-fronted/src/assets/stylus/main.scss @@ -444,6 +444,16 @@ li{ .el-textarea__inner { padding: 5px 60px 5px 15px; } +.el-radio__input .el-radio__inner:hover { + border-color: $btn-normal-background-color-active-new; +} +.el-radio__input.is-checked .el-radio__inner { + border-color: $btn-normal-background-color-active-new; + background: $btn-normal-background-color-active-new; +} +.el-radio__input.is-checked+.el-radio__label{ + color: $btn-normal-background-color-active-new;; +} .nz-input-append { position: absolute; right: 8px; diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index ffa05d1bf..f1c501e7a 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -122,15 +122,17 @@ 中文 - - - - - {{$t('overall.changePwd')}} - - - {{$t('overall.signOut')}} - + + + + + + {{$t('overall.changePwd')}} + + + {{$t('overall.signOut')}} + + @@ -511,11 +513,13 @@ }, mounted() { this.$i18n.locale = this.language; - this.initEvent(); - this.getAssetData(); - this.getUserData(); - this.getProjectList(); - this.getLinkData(); + if (sessionStorage.getItem('nz-token')) { + this.initEvent(); + this.getAssetData(); + this.getUserData(); + this.getProjectList(); + this.getLinkData(); + } // 刷新后有高亮 /*let activePath = this.$route.path.slice(1); this.activeIndex = activePath;*/ diff --git a/nezha-fronted/src/components/common/language/cn.js b/nezha-fronted/src/components/common/language/cn.js index 459fe1ae4..3e6154da6 100644 --- a/nezha-fronted/src/components/common/language/cn.js +++ b/nezha-fronted/src/components/common/language/cn.js @@ -93,6 +93,56 @@ const cn = { }, SyncSave:'保存同时更新 Assets' }, + setup:{ + step0:"欢迎", + step1:"数据库", + step2:"Redis", + step3:"系统", + host:"Host", + port:"端口", + language:"语言", + welcome:{ + header:"欢迎使用哪吒安装向导!", + guid:"向导将为您做什么?", + guid_1:"创建基本的配置", + guid_2:"尝试在数据库和Redis设置中查找问题", + toContinue:"继续", + creatFile:"出于安全原因,您需要通过创建文件来验证安装", + createFileTip:"这可以通过执行以下命令来完成", + next:"完成后单击“下一步”按钮." + }, + database:{ + configTitle:'配置数据库连接', + configTip:"请手动创建数据库,并设置连接到此数据库的配置参数,完成后按“下一步”按钮", + }, + redis:{ + configTitle:'配置Redis连接', + configTip:"请设置连接到此redis的配置参数,完成后按“下一步”按钮", + }, + system:{ + configTitle:'系统配置', + configTip:"请输入管理员的用户名和密码,并设置Nezha WEB模块的安装信息,如IP:port" + }, + name:"数据库名称", + username:"用户名", + password:"密码", + alertPath:'Alert API', + alertPrefix:'Alert prefix', + haMode:'HA mode', + haVip:'Virtual IP', + next:"下一步", + back:"返回", + finish:"完成", + invalidDb:"数据库配置可能存在一些错误", + invalidRedis:"Redis的配置可能有一些错误", + invalidPassword:"Redis的密码可能错误", + requirePassword:"Redis可能需要密码", + wait:"配置已保存,请耐心等待生效", + reloadTimeout:'重新启动服务器花了太多时间,安装可能有一些问题', + hadConfig:"已经有人开始配置系统", + invalidCode:"身份验证无效,请按照{page}中的描述继续", + welcomePage:"欢迎页面" + }, webshell: { shellTitle: "本地 Shell", upload: "上传", diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index e77f53fee..611ceb264 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -99,6 +99,56 @@ const en = { SyncSave:'Save&Sync' }, pageSize: '/page', + setup:{ + step0:"Welcome", + step1:"Database", + step2:"Redis", + step3:"System", + host:"Host", + port:"Port", + language:"Language", + welcome:{ + header:"Welcome to Nezha setup wizard!", + guid:"What will the wizard do for you?", + guid_1:"Create a basic configuration", + guid_2:"Tries to find problems within your Database and Redis setup", + toContinue:"To continue", + creatFile:"For security reasons you need to authenticate for the installation by creating the file", + createFileTip:"This can be done by executing the following command", + next:"Click the 'Next' button when you've finished." + }, + database:{ + configTitle:'Configure DB connection', + configTip:"Please create database manually,and set the configuration parameters for connection to this database,Press 'Next' button when done", + }, + redis:{ + configTitle:'Configure Redis connection', + configTip:"Please set the configuration parameters for connection to this redis,Press 'Next' button when done", + }, + system:{ + configTitle:'System configuration', + configTip:"Please enter username and password for administrator ,and set the Nezha WEB module install information,like IP:port" + }, + name:"Database name", + username:"Username", + password:"Password", + alertPath:'Alert API', + alertPrefix:'Alert prefix', + haMode:'HA mode', + haVip:'Virtual IP', + next:"Next", + back:"Back", + finish:"Finish", + invalidDb:"There may be some errors in the configuration of the database", + invalidRedis:"There may be some errors in the configuration of the Redis", + invalidPassword:"Redis's password may be wrong", + requirePassword:"The password may be required by the Redis", + wait:"The configuration has been saved, please wait patiently for it to take effect", + reloadTimeout:'It took too much time to restart the server, there may be some problems when you install', + hadConfig:"Someone has started to configure the system", + invalidCode:"The authentication is invalid ,please follow the description in {page} 'To continue'", + welcomePage:"Welcome page" + }, webshell:{ shellTitle:'Local Shell', upload:'Upload', diff --git a/nezha-fronted/src/components/page/config/setup.vue b/nezha-fronted/src/components/page/config/setup.vue new file mode 100644 index 000000000..99b41f3b1 --- /dev/null +++ b/nezha-fronted/src/components/page/config/setup.vue @@ -0,0 +1,523 @@ + + + + + + + + + + + + + + + + + + + + + {{$t('setup.language')}} + + English + + + 中文 + + + + + + + + + + {{$t('setup.welcome.header')}} + + + + {{$t('setup.welcome.guid')}} + + {{$t('setup.welcome.guid_1')}} + {{$t('setup.welcome.guid_2')}} + + + + + {{$t('setup.welcome.toContinue')}}: + + {{$t('setup.welcome.creatFile')}} '/opt/nezha/nz-web/tmp/nezha.auth'.{{$t('setup.welcome.createFileTip')}}: + + echo -n {{validateCode}} /opt/nezha/nz-web/tmp/nezha.auth + {{$t('setup.welcome.next')}} + + + + + + + + + + + + + + + + + + + + + + + + + {{$t('setup.database.configTitle')}} + + + {{$t('setup.database.configTip')}} + + + + + + + + + + + + + + + + + + + + {{$t('setup.redis.configTitle')}} + + + {{$t('setup.redis.configTip')}} + + + + + + + + + + + + + + + + + + + + + {{$t('setup.system.configTitle')}} + + + {{$t('setup.system.configTip')}} + + + + + + + + {{$t('setup.back')}} + + + {{$t('setup.next')}} + + + {{$t('setup.finish')}} + + + + + + + + + + + + diff --git a/nezha-fronted/src/permission.js b/nezha-fronted/src/permission.js index 70656d6eb..9f08b0792 100644 --- a/nezha-fronted/src/permission.js +++ b/nezha-fronted/src/permission.js @@ -8,7 +8,7 @@ import VueResource from 'vue-resource' Vue.use(VueResource); -const loginWhiteList = ['/login']; // 免登陆白名单 +const loginWhiteList = ['/login','/setup']; // 免登陆白名单 const permissionWhiteList = ['/menu', ...loginWhiteList]; // 权限白名单 router.beforeEach((to, from, next) => { diff --git a/nezha-fronted/src/router/index.js b/nezha-fronted/src/router/index.js index 43555a2ff..6a558e32e 100644 --- a/nezha-fronted/src/router/index.js +++ b/nezha-fronted/src/router/index.js @@ -13,6 +13,10 @@ export default new Router({ path: '/login', component: resolve => require(['../components/common/login.vue'], resolve), }, + { + path: '/setup', + component: resolve => require(['../components/page/config/setup.vue'], resolve), + }, { path: '/', component: resolve => require(['../components/common/home.vue'], resolve),
echo -n {{validateCode}} /opt/nezha/nz-web/tmp/nezha.auth