├── .gitignore ├── LICENSE ├── README.md ├── backend ├── backend │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── cetus │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── func.py │ ├── models.py │ ├── serializers.py │ ├── tasks.py │ ├── tests.py │ └── views.py ├── install │ ├── docker-compose.yml │ └── mysql │ │ └── my.cnf ├── manage.py ├── requirement.txt ├── shells │ ├── catalog_cetus.py │ ├── cetus_monitor.py │ ├── check_cetus.py │ ├── download_cetus.py │ ├── install_cetus.py │ └── operate_cetus.py └── uwsgi.cnf ├── deploy.sh ├── frontend ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .postcssrc.js ├── .travis.yml ├── build │ ├── build.js │ ├── check-versions.js │ ├── logo.png │ ├── utils.js │ ├── vue-loader.conf.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js ├── config │ ├── dev.env.js │ ├── index.js │ └── prod.env.js ├── docs │ ├── HELP.md │ ├── img │ │ ├── cetus_command.png │ │ ├── cetus_config.png │ │ ├── cetus_fund_params.png │ │ ├── cetus_info.png │ │ ├── cetus_install.png │ │ ├── cetus_list.png │ │ ├── cetus_monitor.png │ │ ├── cetus_task.png │ │ ├── cetus_user.png │ │ └── cetus_vdb.png │ └── lededba.png ├── favicon.ico ├── index.html ├── package.json ├── src │ ├── App.vue │ ├── api │ │ ├── cetus.js │ │ └── login.js │ ├── components │ │ ├── Breadcrumb │ │ │ └── index.vue │ │ ├── Hamburger │ │ │ └── index.vue │ │ └── SvgIcon │ │ │ └── index.vue │ ├── icons │ │ ├── index.js │ │ └── svg │ │ │ ├── 404.svg │ │ │ ├── bug.svg │ │ │ ├── chart.svg │ │ │ ├── clipboard.svg │ │ │ ├── component.svg │ │ │ ├── dashboard.svg │ │ │ ├── documentation.svg │ │ │ ├── drag.svg │ │ │ ├── email.svg │ │ │ ├── example.svg │ │ │ ├── excel.svg │ │ │ ├── eye.svg │ │ │ ├── form.svg │ │ │ ├── icon.svg │ │ │ ├── international.svg │ │ │ ├── language.svg │ │ │ ├── link.svg │ │ │ ├── lock.svg │ │ │ ├── message.svg │ │ │ ├── money.svg │ │ │ ├── password.svg │ │ │ ├── people.svg │ │ │ ├── peoples.svg │ │ │ ├── qq.svg │ │ │ ├── shoppingCard.svg │ │ │ ├── star.svg │ │ │ ├── tab.svg │ │ │ ├── table.svg │ │ │ ├── theme.svg │ │ │ ├── user.svg │ │ │ ├── wechat.svg │ │ │ └── zip.svg │ ├── main.js │ ├── permission.js │ ├── router │ │ └── index.js │ ├── store │ │ ├── getters.js │ │ ├── index.js │ │ └── modules │ │ │ ├── app.js │ │ │ └── user.js │ ├── styles │ │ ├── element-ui.scss │ │ ├── index.scss │ │ ├── mixin.scss │ │ ├── sidebar.scss │ │ ├── transition.scss │ │ └── variables.scss │ ├── utils │ │ ├── auth.js │ │ ├── index.js │ │ ├── request.js │ │ └── validate.js │ └── views │ │ ├── 404.vue │ │ ├── docs │ │ └── index.vue │ │ ├── form │ │ ├── index.vue │ │ └── tasks.vue │ │ ├── item │ │ ├── chart.vue │ │ ├── command.vue │ │ ├── config.vue │ │ ├── index.vue │ │ ├── info.vue │ │ └── monitor.vue │ │ ├── layout │ │ ├── Layout.vue │ │ ├── components │ │ │ ├── AppMain.vue │ │ │ ├── Navbar.vue │ │ │ ├── Sidebar │ │ │ │ ├── Item.vue │ │ │ │ ├── SidebarItem.vue │ │ │ │ └── index.vue │ │ │ └── index.js │ │ └── mixin │ │ │ └── ResizeHandler.js │ │ ├── link │ │ └── index.vue │ │ ├── list │ │ └── index.vue │ │ └── login │ │ └── index.vue └── static │ ├── .gitkeep │ └── tinymce4.7.5 │ ├── langs │ └── zh_CN.js │ ├── plugins │ ├── codesample │ │ └── css │ │ │ └── prism.css │ ├── emoticons │ │ └── img │ │ │ ├── smiley-cool.gif │ │ │ ├── smiley-cry.gif │ │ │ ├── smiley-embarassed.gif │ │ │ ├── smiley-foot-in-mouth.gif │ │ │ ├── smiley-frown.gif │ │ │ ├── smiley-innocent.gif │ │ │ ├── smiley-kiss.gif │ │ │ ├── smiley-laughing.gif │ │ │ ├── smiley-money-mouth.gif │ │ │ ├── smiley-sealed.gif │ │ │ ├── smiley-smile.gif │ │ │ ├── smiley-surprised.gif │ │ │ ├── smiley-tongue-out.gif │ │ │ ├── smiley-undecided.gif │ │ │ ├── smiley-wink.gif │ │ │ └── smiley-yell.gif │ └── visualblocks │ │ └── css │ │ └── visualblocks.css │ ├── skins │ └── lightgray │ │ ├── content.inline.min.css │ │ ├── content.min.css │ │ ├── fonts │ │ ├── tinymce-mobile.woff │ │ ├── tinymce-small.eot │ │ ├── tinymce-small.svg │ │ ├── tinymce-small.ttf │ │ ├── tinymce-small.woff │ │ ├── tinymce.eot │ │ ├── tinymce.svg │ │ ├── tinymce.ttf │ │ └── tinymce.woff │ │ ├── img │ │ ├── anchor.gif │ │ ├── loader.gif │ │ ├── object.gif │ │ └── trans.gif │ │ ├── skin.min.css │ │ └── skin.min.css.map │ └── tinymce.min.js └── supervisor.cnf /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vscode/ 3 | .DS_Store 4 | migrations/ 5 | node_modules/ 6 | dist/ 7 | 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | package-lock.json 12 | *.pyc 13 | *.log 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Mikurula 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Cetus-GUI 2 | 3 | --- 4 | 5 | Cetus-GUI是基于web端的Cetus集群可视化管理系统,能有效的提升部署与管理Cetus集群的效率。 6 | 7 | **本项目当前仅适用于SaltStack环境下使用远程配置库安装配置多Cetus节点的需求。** 8 | 9 | --- 10 | 11 | ### 环境需求 12 | 13 | --- 14 | 15 | 环境要求:SaltStack Latest 16 | 17 | --- 18 | 19 | ### 安装 20 | 21 | --- 22 | 23 | **阅读 [help](./frontend/docs/HELP.md) 文档配置安装。** 24 | 25 | 目前项目支持docker安装与源码安装两种方式,推荐使用docker安装。 26 | 27 | --- 28 | 29 | ### 使用说明 30 | 31 | --- 32 | 33 | * 登陆 34 | 35 | * 项目启动后,直接访问http://localhost:9527(docker安装), http://localhost:9528(源码安装)登陆系统。 36 | * 默认用户名与密码为admin/admin,可在Django端新增用户。 37 | 38 | * 安装Cetus 39 | 40 | ![cetus_install](frontend/docs/img/cetus_install.png) 41 | 42 | 可以在SaltStack环境下的Minion节点安装Cetus,通过安装多节点可以配置Cetus端的负载均衡。 43 | 44 | 提交安装请求后,若安装失败将在任务列表中显示对应log信息。 45 | 46 | * Cetus列表 47 | 48 | ![cetus_list](frontend/docs//img/cetus_list.png) 49 | 50 | 显示所有Cetus运行或安装中的状态,点击查看可以查看Cetus详细信息,点击编辑可以修改Cetus基本信息。 51 | 52 | * Cetus详情 53 | 54 | ![cetus_info](frontend/docs//img/cetus_info.png) 55 | 56 | 支持Cetus信息状态查询,节点的启动、关闭、更新、删除、新增等操作。 57 | 58 | * Cetus配置 59 | 60 | ![cetus_config](frontend/docs//img/cetus_config.png) 61 | 62 | 支持Cetus基础参数的修改,用户与变量信息修改,分片信息修改,重启、更新、删除全部节点等功能。 63 | 64 | * 基础参数修改 65 | 66 | ![cetus_fund_params](frontend/docs//img/cetus_fund_params.png) 67 | 68 | 注意字体加粗的为静态参数,需要手动重启Cetus客户端才能生效。 69 | 70 | * 用户和变量信息修改 71 | 72 | ![cetus_user](frontend/docs//img/cetus_user.png) 73 | 74 | 其中用户名在Cetus端和MySQL端是一致的。密码分为客户端密码和服务端密码两种。 75 | 客户端密码为客户端连接Cetus时的密码,服务端密码为Cetus端连接数据库的密码,两者可以不同。 76 | 新增用户后也需要重启Cetus客户端来使信息生效。 77 | 78 | * 分片信息修改 79 | 80 | ![cetus_vdb](frontend/docs//img/cetus_vdb.png) 81 | 82 | 分片信息可在Cetus为分片版本时修改,具体的配置方式请参考https://github.com/Lede-Inc/cetus/blob/master/doc/cetus-shard-profile.md。 83 | 84 | * Cetus管理命令 85 | 86 | ![cetus_command](frontend/docs//img/cetus_command.png) 87 | 88 | 支持直接在web端执行命令发送到Cetus管理端。 89 | 90 | 具体支持的命令请参考: 91 | 92 | * 读写分离版:https://github.com/Lede-Inc/cetus/blob/master/doc/cetus-rw-admin.md 93 | * 分片版:https://github.com/Lede-Inc/cetus/blob/master/doc/cetus-shard-admin.md 94 | 95 | * Cetus监控 96 | 97 | ![cetus_monitor](frontend/docs//img/cetus_monitor.png) 98 | 99 | Cetus在默认安装完成后会自动部署脚本,每分钟收集一次监控信息。系统默认收集了backends信息,连接数信息,TPS/QPS信息等内容。 100 | 101 | * 任务执行查询 102 | 103 | 由于Master与Minion节点系统环境的不确定性,安装Cetus时会因各种情况报错,我们可以在任务列表中查看失败的任务。 104 | 105 | ![cetus_task](frontend/docs//img/cetus_task.png) 106 | 107 | 我们也可以直接查询应用日志定位问题,如果日志中的信息无法帮你准备定位并解决问题,请联系我们。 108 | 109 | --- 110 | 111 | ### TODO 112 | 113 | --- 114 | 115 | ``` 116 | 本地Cetus监控 117 | ``` 118 | 119 | -------------------------------------------------------------------------------- /backend/backend/__init__.py: -------------------------------------------------------------------------------- 1 | import pymysql 2 | pymysql.install_as_MySQLdb() 3 | -------------------------------------------------------------------------------- /backend/backend/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url, include 2 | from django.contrib import admin 3 | from rest_framework import routers 4 | from rest_framework_jwt.views import obtain_jwt_token 5 | 6 | from cetus import views, tasks 7 | 8 | router = routers.DefaultRouter() 9 | router.register(r'cetus', views.CetusViewSet) 10 | router.register(r'node', views.CetusNodeViewSet) 11 | router.register(r'task', tasks.TaskStatusSet) 12 | 13 | urlpatterns = [ 14 | url(r'^admin/', admin.site.urls), 15 | url(r'^api/', include(router.urls)), 16 | url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), 17 | 18 | url(r'^login/', obtain_jwt_token), 19 | ] 20 | -------------------------------------------------------------------------------- /backend/backend/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for backend project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /backend/cetus/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/backend/cetus/__init__.py -------------------------------------------------------------------------------- /backend/cetus/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /backend/cetus/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CetusConfig(AppConfig): 5 | name = 'cetus' 6 | -------------------------------------------------------------------------------- /backend/cetus/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from datetime import datetime 3 | 4 | 5 | class TbCetusGroupInfo(models.Model): 6 | CETUS_TYPE = ( 7 | ("rw", "读写分离版"), 8 | ("shard", "分片版"), 9 | ) 10 | cetus_name = models.CharField(max_length=20, verbose_name="Cetus名称") 11 | cetus_type = models.CharField(max_length=10, choices=CETUS_TYPE, verbose_name="Cetus类型") 12 | config_db = models.CharField(max_length=20, null=True, verbose_name="配置库库名") 13 | create_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") 14 | update_time = models.DateTimeField(null=True, verbose_name="更新时间") 15 | 16 | 17 | class Meta: 18 | verbose_name = "Cetus服务" 19 | verbose_name_plural = verbose_name 20 | db_table = "tb_cetus_group_info" 21 | 22 | 23 | class TbCetusNodeInfo(models.Model): 24 | group = models.ForeignKey(TbCetusGroupInfo, on_delete=models.CASCADE, verbose_name="节点所属组", related_name='nodes') 25 | salt_id = models.CharField(max_length=50, verbose_name="SALT ID") 26 | service_port = models.IntegerField(verbose_name="服务端口") 27 | admin_port = models.IntegerField(verbose_name="管理端口") 28 | version = models.CharField(max_length=100, null=True, verbose_name="版本") 29 | dir = models.CharField(max_length=200, null=True, verbose_name="路径") 30 | status = models.IntegerField(default=1, verbose_name="节点状态") 31 | create_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") 32 | update_time = models.DateTimeField(null=True, verbose_name="更新时间") 33 | 34 | class Meta: 35 | verbose_name = "Cetus节点" 36 | verbose_name_plural = verbose_name 37 | db_table = "tb_cetus_node_info" 38 | 39 | 40 | -------------------------------------------------------------------------------- /backend/cetus/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from .models import TbCetusGroupInfo, TbCetusNodeInfo 4 | from djcelery.models import TaskState 5 | 6 | 7 | class CetusNodeSerializer(serializers.ModelSerializer): 8 | class Meta: 9 | model = TbCetusNodeInfo 10 | fields = "__all__" 11 | 12 | 13 | class CetusGroupSerializer(serializers.ModelSerializer): 14 | nodes = CetusNodeSerializer(read_only=True, many=True) 15 | 16 | class Meta: 17 | model = TbCetusGroupInfo 18 | fields = "__all__" 19 | 20 | 21 | class TaskStatusSerializer(serializers.ModelSerializer): 22 | class Meta: 23 | model = TaskState 24 | fields = "__all__" 25 | -------------------------------------------------------------------------------- /backend/cetus/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /backend/install/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | cetus_gui_db: 5 | container_name: cetus_gui_db 6 | image: mysql:5.7 7 | volumes: 8 | - ./mysql/:/etc/mysql/conf.d/ 9 | - ./data/:/var/lib/mysql/ 10 | restart: always 11 | ports: 12 | - "3306:3306" 13 | environment: 14 | MYSQL_ROOT_PASSWORD: cetus_password 15 | MYSQL_DATABASE: cetus_gui 16 | MYSQL_USER: cetus 17 | MYSQL_PASSWORD: cetus 18 | cetus_gui_app: 19 | container_name: cetus_gui_app 20 | image: hub.c.163.com/mikuru333/cetus-gui:v0.0.1 21 | restart: always 22 | depends_on: 23 | - cetus_gui_db 24 | ports: 25 | - "9527:80" 26 | - "8300:8000" 27 | - "4505:4505" 28 | - "4506:4506" 29 | stdin_open: true 30 | tty: true -------------------------------------------------------------------------------- /backend/install/mysql/my.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | default-character-set = utf8 3 | 4 | [mysql] 5 | default-character-set = utf8 6 | 7 | [mysqld] 8 | character-set-client-handshake = FALSE 9 | character-set-server = utf8 10 | collation-server = utf8_unicode_ci 11 | init_connect='SET NAMES utf8' -------------------------------------------------------------------------------- /backend/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /backend/requirement.txt: -------------------------------------------------------------------------------- 1 | celery==3.1.26.post2 2 | Django==2.0.11 3 | django-celery==3.2.2 4 | django-cors-middleware==1.3.1 5 | django-filter==2.0.0 6 | djangorestframework==3.8.2 7 | djangorestframework-filter==0.2.2 8 | djangorestframework-jwt==1.11.0 9 | PyMySQL==0.9.2 10 | salt==2018.3.3 11 | urllib3==1.23 12 | uWSGI==2.0.17.1 13 | -------------------------------------------------------------------------------- /backend/shells/cetus_monitor.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | import getopt 6 | import pymysql 7 | import subprocess 8 | 9 | 10 | def help_and_exit(): 11 | print('''Usage: 12 | -h 显示帮助信息 13 | -P 端口 14 | -u 用户 15 | -p 密码 16 | -d 数据库 17 | ''') 18 | sys.exit() 19 | 20 | 21 | def get_cpu_mem(pid): 22 | try: 23 | p = subprocess.Popen("ps aux|grep %s|grep -v 'grep'|awk '{print $3}'" % pid, 24 | shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) 25 | cpu = p.stdout.read().strip() 26 | p = subprocess.Popen("ps aux|grep %s|grep -v 'grep'|awk '{print $6}'" % pid, 27 | shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) 28 | mem = p.stdout.read().strip() 29 | 30 | return bytes.decode(cpu), bytes.decode(mem) 31 | except Exception as e: 32 | print(e) 33 | return 0, 0 34 | 35 | 36 | def main(): 37 | try: 38 | opts, args = getopt.getopt(sys.argv[1:], 39 | 'hP:u:p:', 40 | ['help', 'port=', 'user=', 'passwd=']) 41 | 42 | except getopt.GetoptError as err: 43 | print(err) 44 | help_and_exit() 45 | 46 | for opt, arg in opts: 47 | if opt in ('-h', '--help',): 48 | help_and_exit() 49 | elif opt in ('-P', '--port'): 50 | port = arg 51 | elif opt in ('-u', '--user'): 52 | user = arg 53 | elif opt in ('-p', '--passwd'): 54 | passwd = arg 55 | 56 | try: 57 | db = pymysql.connect(host='127.0.0.1', user=user, passwd=passwd, port=int(port), autocommit=None) 58 | cursor = db.cursor() 59 | except Exception as e: 60 | print(e) 61 | raise Exception('数据库连接失败') 62 | 63 | try: 64 | res_list, pid = list(), str() 65 | 66 | cursor.execute('cetus') 67 | for item in cursor.fetchall(): 68 | if item[1] == 'Startup time': 69 | pid = item[0] 70 | res_list.append(('startup_time', item[2])) 71 | if item[1] == 'Loaded modules': 72 | res_list.append(('modules', item[2])) 73 | if item[1] == 'Idle backend connections': 74 | res_list.append(('idle_conns', item[2])) 75 | if item[1] == 'Used backend connections': 76 | res_list.append(('used_conns', item[2])) 77 | if item[1] == 'Client connections': 78 | res_list.append(('client_conns', item[2])) 79 | if item[1] == 'Query count': 80 | res_list.append(('query_count', item[2])) 81 | if item[1] == 'QPS (1min, 5min, 15min)': 82 | _u = item[2].split(',') 83 | res_list.append(('qps1', _u[0].strip())) 84 | res_list.append(('qps5', _u[1].strip())) 85 | res_list.append(('qps15', _u[2].strip())) 86 | if item[1] == 'TPS (1min, 5min, 15min)': 87 | _u = item[2].split(',') 88 | res_list.append(('tps1', _u[0].strip())) 89 | res_list.append(('tps5', _u[1].strip())) 90 | res_list.append(('tps15', _u[2].strip())) 91 | 92 | backends_list = list() 93 | cursor.execute('select * from backends') 94 | for item in cursor.fetchall(): 95 | backends_list.append(item[2:]) 96 | res_list.append(('backends', str(backends_list))) 97 | 98 | cpu, mem = get_cpu_mem(pid) 99 | res_list.extend([('cpu', cpu), ('mem', mem)]) 100 | 101 | cursor.execute('show status') 102 | for item in cursor.fetchall(): 103 | res_list.append((item[1], item[2])) 104 | 105 | return 0, res_list 106 | 107 | except Exception as e: 108 | print(e) 109 | raise Exception('数据查询失败') 110 | finally: 111 | db.close() 112 | 113 | 114 | if __name__ == '__main__': 115 | ret, msg = main() 116 | print(msg) 117 | sys.exit(ret) 118 | -------------------------------------------------------------------------------- /backend/shells/check_cetus.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import getopt 5 | import sys 6 | import pymysql 7 | 8 | 9 | def help_and_exit(): 10 | print('''Usage: 11 | -h 显示帮助信息 12 | -u 用户 13 | -p 密码 14 | -P 端口 15 | ''') 16 | sys.exit() 17 | 18 | 19 | def main(): 20 | try: 21 | opts, args = getopt.getopt(sys.argv[1:], 22 | 'hu:p:P:', 23 | ['help', 'user=', 'passwd=', 'port=']) 24 | 25 | except getopt.GetoptError as err: 26 | print(err) 27 | help_and_exit() 28 | 29 | for opt, arg in opts: 30 | if opt in ('-h', '--help'): 31 | help_and_exit() 32 | elif opt in ('-u', '--user'): 33 | user = arg 34 | elif opt in ('-p', '--passwd'): 35 | password = arg 36 | elif opt in ('-P', '--port'): 37 | port = arg 38 | 39 | try: 40 | conn = pymysql.connect(host='127.0.0.1', user=user, passwd=password, port=int(port), autocommit=None) 41 | cursor = conn.cursor() 42 | res = cursor.execute('select version') 43 | if res == 1: 44 | return 0, 'success' 45 | except Exception as e: 46 | return 1, e 47 | 48 | 49 | if __name__ == '__main__': 50 | ret, msg = main() 51 | print(ret) 52 | print(msg) 53 | sys.exit(ret) 54 | -------------------------------------------------------------------------------- /backend/shells/download_cetus.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | 3 | import sys 4 | import subprocess 5 | import os 6 | import getopt 7 | import shutil 8 | 9 | 10 | def help_and_exit(): 11 | print('''Usage: 12 | -h 显示帮助信息 13 | -u 下载地址 14 | -t 类型 15 | -r 路径 16 | -v 版本号 17 | ''') 18 | sys.exit() 19 | 20 | 21 | def download_cetus(**kwargs): 22 | try: 23 | shutil.rmtree(kwargs.get('cetus_route'), ignore_errors=True) 24 | p = subprocess.Popen('git clone {cetus_url} {cetus_route}'.format(**kwargs), 25 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 26 | p.communicate() 27 | if os.path.isdir(kwargs.get('cetus_route')): 28 | os.chdir(kwargs.get('cetus_route')) 29 | cmd = 'git log --pretty=format:%ad.%h --date=short -n1;' 30 | if kwargs.get('cetus_version') != 'null': 31 | cmd = 'git checkout {cetus_version};'.format(**kwargs) + cmd 32 | p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 33 | o = bytes.decode(p.communicate()[0]).replace('-', '') 34 | else: 35 | raise Exception('下载失败') 36 | return 0, o 37 | except Exception as e: 38 | print(e) 39 | return 1, e 40 | 41 | 42 | def main(): 43 | try: 44 | opts, args = getopt.getopt(sys.argv[1:], 45 | 'ht:v:u:r:', 46 | ['help', 'type=', 'version=', 'url=', 'route=']) 47 | 48 | except getopt.GetoptError as err: 49 | print(err) 50 | help_and_exit() 51 | 52 | cetus_url = 'https://github.com/Lede-Inc/cetus' 53 | cetus_route = '/tmp/cetus_mirror' 54 | cetus_version = 'null' 55 | cetus_type = 'rw' 56 | for opt, arg in opts: 57 | if opt in ('-h', '--help'): 58 | help_and_exit() 59 | elif opt in ('-t', '--type'): 60 | cetus_type = arg 61 | elif opt in ('-v', '--version'): 62 | cetus_version = arg 63 | elif opt in ('-u', '--url'): 64 | cetus_url = arg 65 | elif opt in ('-r', '--route'): 66 | cetus_route = arg 67 | 68 | code, cetus_version = download_cetus(**locals()) 69 | return code, 'cetus.{cetus_type}.{cetus_version}'.format(**locals()) 70 | 71 | 72 | if __name__ == '__main__': 73 | ret, msg = main() 74 | print(msg) 75 | sys.exit(ret) 76 | -------------------------------------------------------------------------------- /backend/shells/install_cetus.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import subprocess 5 | import sys 6 | import os 7 | import getopt 8 | import socket 9 | import shutil 10 | 11 | 12 | def help_and_exit(): 13 | print('''Usage: 14 | -h 显示帮助信息 15 | -t Cetus类型 16 | -p 服务端口 17 | -a 管理端口 18 | -b 分支 19 | -d Cetus目录 20 | ''') 21 | sys.exit() 22 | 23 | 24 | def check_socket(port_list): 25 | for index in port_list: 26 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 27 | result = sock.connect_ex(('127.0.0.1', int(index))) 28 | sock.close() 29 | if not result: 30 | raise Exception('端口已被占用') 31 | 32 | 33 | def create_environment(user, cetus_path): 34 | try: 35 | os.system('useradd %s' % user) 36 | p = subprocess.Popen('sudo yum install cmake gcc glib2-devel flex mysql-devel gperftools-libs git -y', 37 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 38 | p.communicate() 39 | path = cetus_path[:cetus_path.rfind('/')] + '/logs' 40 | if not os.path.exists(path): 41 | os.makedirs(path) 42 | os.system('chown -R %s:%s %s' % (user, user, path)) 43 | except Exception as e: 44 | print(e) 45 | raise Exception('环境初始化失败') 46 | 47 | 48 | def install_cetus(cetus_type, cetus_route, cetus_path, user): 49 | try: 50 | os.chdir(cetus_route) 51 | cetus_type = 'ON' if cetus_type == 'rw' else 'OFF' 52 | 53 | p = subprocess.Popen('mkdir build && cd build && cmake ../ -DCMAKE_BUILD_TYPE=Debug ' 54 | '-DCMAKE_INSTALL_PREFIX=%s -DSIMPLE_PARSER=%s && make install' % (cetus_path, cetus_type), 55 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 56 | p.communicate() 57 | os.system('chown -R %s:%s %s' % (user, user, cetus_path[:cetus_path.rfind('/')])) 58 | except Exception as e: 59 | print(e) 60 | raise Exception('安装失败') 61 | finally: 62 | shutil.rmtree(cetus_route, ignore_errors=True) 63 | 64 | 65 | def main(): 66 | try: 67 | opts, args = getopt.getopt(sys.argv[1:], 68 | 'ht:s:a:r:p:', 69 | ['help', 'type=', 'service=', 'admin=', 'route=', 'path=']) 70 | except getopt.GetoptError as err: 71 | print(err) 72 | help_and_exit() 73 | 74 | for opt, arg in opts: 75 | if opt in ('-h', '--help'): 76 | help_and_exit() 77 | elif opt in ('-t', '--type'): 78 | cetus_type = arg 79 | elif opt in ('-s', '--service'): 80 | service_port = arg 81 | elif opt in ('-a', '--admin'): 82 | admin_port = arg 83 | elif opt in ('-r', '--route'): 84 | cetus_route = arg 85 | elif opt in ('-p', '--path'): 86 | cetus_path = arg 87 | 88 | try: 89 | check_socket([service_port, admin_port]) 90 | user = 'cetus_%s' % service_port 91 | create_environment(user, cetus_path) 92 | install_cetus(cetus_type, cetus_route, cetus_path, user) 93 | return 0, '安装成功' 94 | 95 | except Exception as e: 96 | print(e) 97 | return 1, e 98 | 99 | 100 | if __name__ == '__main__': 101 | ret, msg = main() 102 | sys.exit(ret) 103 | -------------------------------------------------------------------------------- /backend/shells/operate_cetus.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | import getopt 6 | import os 7 | import subprocess 8 | import pwd 9 | import signal 10 | from threading import Timer 11 | 12 | 13 | def help_and_exit(): 14 | print('''Usage: 15 | -h 显示帮助信息 16 | -u 下载地址 17 | -t 类型 18 | -r 路径 19 | -v 版本号 20 | ''') 21 | sys.exit() 22 | 23 | 24 | def change_user(username): 25 | user_info = pwd.getpwnam(username) 26 | os.setgid(user_info.pw_gid) 27 | os.setuid(user_info.pw_uid) 28 | 29 | 30 | def start_cetus(**kwargs): 31 | try: 32 | os.chdir(kwargs.get('cetus_route')) 33 | change_user(kwargs.get('cetus_owner')) 34 | print('{cetus_route}/bin/cetus --remote-conf-url=' 35 | 'mysql://{user}:{passwd}@{host}:{port}/{database} 1>/dev/null 2>&1'.format(**kwargs)) 36 | 37 | kill = lambda process: process.kill() 38 | p = subprocess.Popen('{cetus_route}/bin/cetus --remote-conf-url=' 39 | 'mysql://{user}:{passwd}@{host}:{port}/{database} &> /dev/null'.format(**kwargs), 40 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 41 | job = Timer(5, kill, [p]) 42 | try: 43 | job.start() 44 | finally: 45 | job.cancel() 46 | 47 | return 0, 'success' 48 | 49 | # if p.returncode == 0: 50 | # return 0, 'success' 51 | # else: 52 | # raise Exception('failure') 53 | except Exception as e: 54 | return 1, e 55 | 56 | 57 | def shutdown_cetus(**kwargs): 58 | return shutdown_abort_cetus(**kwargs) 59 | 60 | 61 | def shutdown_abort_cetus(**kwargs): 62 | try: 63 | pid_path = '%s/%s.pid' % (kwargs.get('cetus_route')[:kwargs.get('cetus_route').rfind('/')], 64 | kwargs.get('cetus_owner')) 65 | if os.path.exists(pid_path): 66 | with open(pid_path, 'r') as f: 67 | pid_list = [int(f.read())] 68 | else: 69 | cmd = 'remote-conf-url.*' + kwargs.get('database') 70 | child = subprocess.Popen(['pgrep', '-f', cmd], 71 | shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 72 | out = child.communicate()[0] 73 | pid_list = [int(pid) for pid in out.split()] 74 | for item in pid_list: 75 | os.kill(item, signal.SIGKILL) 76 | tmp_path = '/tmp/0.0.0.0:' + kwargs.get('admin_port') 77 | os.remove(tmp_path) if os.path.exists(tmp_path) else None 78 | return 0, 'success' 79 | except Exception as e: 80 | return 1, e 81 | 82 | 83 | def restart_cetus(**kwargs): 84 | shutdown_abort_cetus(**kwargs) 85 | return start_cetus(**kwargs) 86 | 87 | 88 | def main(): 89 | try: 90 | opts, args = getopt.getopt(sys.argv[1:], 91 | 't:h:P:u:p:d:r:o:a:', 92 | ['help', 'type=', 'host=', 'port=', 'user=', 'passwd=', 'database=', 'route=', 'owner=', 'admin=']) 93 | 94 | except getopt.GetoptError as err: 95 | print(err) 96 | help_and_exit() 97 | 98 | for opt, arg in opts: 99 | if opt in ('--help',): 100 | help_and_exit() 101 | elif opt in ('-t', '--type'): 102 | operate_type = arg 103 | elif opt in ('-h', '--host'): 104 | host = arg 105 | elif opt in ('-P', '--port'): 106 | port = arg 107 | elif opt in ('-u', '--user'): 108 | user = arg 109 | elif opt in ('-p', '--passwd'): 110 | passwd = arg 111 | elif opt in ('-d', '--database'): 112 | database = arg 113 | elif opt in ('-r', '--route'): 114 | cetus_route = arg 115 | elif opt in ('-o', '--owner'): 116 | cetus_owner = arg 117 | elif opt in ('-a', '--admin'): 118 | admin_port = arg 119 | 120 | if operate_type == 'start': 121 | res = start_cetus(**locals()) 122 | elif operate_type == 'shutdown': 123 | res = shutdown_cetus(**locals()) 124 | elif operate_type == 'restart': 125 | res = restart_cetus(**locals()) 126 | elif operate_type == 'abort': 127 | res = shutdown_abort_cetus(**locals()) 128 | 129 | return res 130 | 131 | 132 | if __name__ == '__main__': 133 | ret, msg = main() 134 | print(msg) 135 | sys.exit(ret) 136 | -------------------------------------------------------------------------------- /backend/uwsgi.cnf: -------------------------------------------------------------------------------- 1 | [uwsgi] 2 | 3 | http=0.0.0.0:8000 4 | wsgi-file=backend/wsgi.py 5 | static-map=/static=static 6 | processes=4 7 | threads=2 8 | 9 | close-on-exec 10 | vacuum=true 11 | master=true -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo yum install -y gcc gcc-c++ python34 python34-devel python34-pip erlang rabbitmq-server nodejs 4 | sudo service rabbitmq-server start 5 | sudo rabbitmqctl start_app 6 | sudo pip3 install virtualenv 7 | sudo pip2 install supervisor 8 | virtualenv -p python3 cetus_env 9 | source cetus_env/bin/activate 10 | mkdir logs 11 | 12 | cd backend/ 13 | pip install -r requirement.txt 14 | python manage.py makemigrations 15 | python manage.py makemigrations cetus 16 | python manage.py migrate 17 | echo "from django.contrib.auth import get_user_model; User = get_user_model(); 18 | User.objects.create_superuser('admin', '', 'admin') if not User.objects.filter(username='admin') else 0;" | python manage.py shell 19 | 20 | cd ../frontend/ 21 | npm install 22 | 23 | cd .. 24 | supervisord -c supervisor.cnf 25 | supervisorctl restart backend beat celerycam cetus frontend monitor 26 | -------------------------------------------------------------------------------- /frontend/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins":["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /frontend/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | insert_final_newline = false 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /frontend/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | src/assets 4 | -------------------------------------------------------------------------------- /frontend/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parserOptions: { 4 | parser: 'babel-eslint', 5 | sourceType: 'module' 6 | }, 7 | env: { 8 | browser: true, 9 | node: true, 10 | es6: true, 11 | }, 12 | extends: ['plugin:vue/recommended', 'eslint:recommended'], 13 | 14 | // add your custom rules here 15 | //it is base on https://github.com/vuejs/eslint-config-vue 16 | rules: { 17 | "vue/max-attributes-per-line": [2, { 18 | "singleline": 10, 19 | "multiline": { 20 | "max": 1, 21 | "allowFirstLine": false 22 | } 23 | }], 24 | "vue/name-property-casing": ["error", "PascalCase"], 25 | 'accessor-pairs': 2, 26 | 'arrow-spacing': [2, { 27 | 'before': true, 28 | 'after': true 29 | }], 30 | 'block-spacing': [2, 'always'], 31 | 'brace-style': [2, '1tbs', { 32 | 'allowSingleLine': true 33 | }], 34 | 'camelcase': [0, { 35 | 'properties': 'always' 36 | }], 37 | 'comma-dangle': [2, 'never'], 38 | 'comma-spacing': [2, { 39 | 'before': false, 40 | 'after': true 41 | }], 42 | 'comma-style': [2, 'last'], 43 | 'constructor-super': 2, 44 | 'curly': [2, 'multi-line'], 45 | 'dot-location': [2, 'property'], 46 | 'eol-last': 2, 47 | 'eqeqeq': [2, 'allow-null'], 48 | 'generator-star-spacing': [2, { 49 | 'before': true, 50 | 'after': true 51 | }], 52 | 'handle-callback-err': [2, '^(err|error)$'], 53 | 'indent': [2, 2, { 54 | 'SwitchCase': 1 55 | }], 56 | 'jsx-quotes': [2, 'prefer-single'], 57 | 'key-spacing': [2, { 58 | 'beforeColon': false, 59 | 'afterColon': true 60 | }], 61 | 'keyword-spacing': [2, { 62 | 'before': true, 63 | 'after': true 64 | }], 65 | 'new-cap': [2, { 66 | 'newIsCap': true, 67 | 'capIsNew': false 68 | }], 69 | 'new-parens': 2, 70 | 'no-array-constructor': 2, 71 | 'no-caller': 2, 72 | 'no-console': 'off', 73 | 'no-class-assign': 2, 74 | 'no-cond-assign': 2, 75 | 'no-const-assign': 2, 76 | 'no-control-regex': 2, 77 | 'no-delete-var': 2, 78 | 'no-dupe-args': 2, 79 | 'no-dupe-class-members': 2, 80 | 'no-dupe-keys': 2, 81 | 'no-duplicate-case': 2, 82 | 'no-empty-character-class': 2, 83 | 'no-empty-pattern': 2, 84 | 'no-eval': 2, 85 | 'no-ex-assign': 2, 86 | 'no-extend-native': 2, 87 | 'no-extra-bind': 2, 88 | 'no-extra-boolean-cast': 2, 89 | 'no-extra-parens': [2, 'functions'], 90 | 'no-fallthrough': 2, 91 | 'no-floating-decimal': 2, 92 | 'no-func-assign': 2, 93 | 'no-implied-eval': 2, 94 | 'no-inner-declarations': [2, 'functions'], 95 | 'no-invalid-regexp': 2, 96 | 'no-irregular-whitespace': 2, 97 | 'no-iterator': 2, 98 | 'no-label-var': 2, 99 | 'no-labels': [2, { 100 | 'allowLoop': false, 101 | 'allowSwitch': false 102 | }], 103 | 'no-lone-blocks': 2, 104 | 'no-mixed-spaces-and-tabs': 2, 105 | 'no-multi-spaces': 2, 106 | 'no-multi-str': 2, 107 | 'no-multiple-empty-lines': [2, { 108 | 'max': 1 109 | }], 110 | 'no-native-reassign': 2, 111 | 'no-negated-in-lhs': 2, 112 | 'no-new-object': 2, 113 | 'no-new-require': 2, 114 | 'no-new-symbol': 2, 115 | 'no-new-wrappers': 2, 116 | 'no-obj-calls': 2, 117 | 'no-octal': 2, 118 | 'no-octal-escape': 2, 119 | 'no-path-concat': 2, 120 | 'no-proto': 2, 121 | 'no-redeclare': 2, 122 | 'no-regex-spaces': 2, 123 | 'no-return-assign': [2, 'except-parens'], 124 | 'no-self-assign': 2, 125 | 'no-self-compare': 2, 126 | 'no-sequences': 2, 127 | 'no-shadow-restricted-names': 2, 128 | 'no-spaced-func': 2, 129 | 'no-sparse-arrays': 2, 130 | 'no-this-before-super': 2, 131 | 'no-throw-literal': 2, 132 | 'no-trailing-spaces': 2, 133 | 'no-undef': 2, 134 | 'no-undef-init': 2, 135 | 'no-unexpected-multiline': 2, 136 | 'no-unmodified-loop-condition': 2, 137 | 'no-unneeded-ternary': [2, { 138 | 'defaultAssignment': false 139 | }], 140 | 'no-unreachable': 2, 141 | 'no-unsafe-finally': 2, 142 | 'no-unused-vars': [2, { 143 | 'vars': 'all', 144 | 'args': 'none' 145 | }], 146 | 'no-useless-call': 2, 147 | 'no-useless-computed-key': 2, 148 | 'no-useless-constructor': 2, 149 | 'no-useless-escape': 0, 150 | 'no-whitespace-before-property': 2, 151 | 'no-with': 2, 152 | 'one-var': [2, { 153 | 'initialized': 'never' 154 | }], 155 | 'operator-linebreak': [2, 'after', { 156 | 'overrides': { 157 | '?': 'before', 158 | ':': 'before' 159 | } 160 | }], 161 | 'padded-blocks': [2, 'never'], 162 | 'quotes': [2, 'single', { 163 | 'avoidEscape': true, 164 | 'allowTemplateLiterals': true 165 | }], 166 | 'semi': [2, 'never'], 167 | 'semi-spacing': [2, { 168 | 'before': false, 169 | 'after': true 170 | }], 171 | 'space-before-blocks': [2, 'always'], 172 | 'space-before-function-paren': [2, 'never'], 173 | 'space-in-parens': [2, 'never'], 174 | 'space-infix-ops': 2, 175 | 'space-unary-ops': [2, { 176 | 'words': true, 177 | 'nonwords': false 178 | }], 179 | 'spaced-comment': [2, 'always', { 180 | 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] 181 | }], 182 | 'template-curly-spacing': [2, 'never'], 183 | 'use-isnan': 2, 184 | 'valid-typeof': 2, 185 | 'wrap-iife': [2, 'any'], 186 | 'yield-star-spacing': [2, 'both'], 187 | 'yoda': [2, 'never'], 188 | 'prefer-const': 2, 189 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 190 | 'object-curly-spacing': [2, 'always', { 191 | objectsInObjects: false 192 | }], 193 | 'array-bracket-spacing': [2, 'never'] 194 | } 195 | } 196 | 197 | -------------------------------------------------------------------------------- /frontend/.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /frontend/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: stable 3 | script: npm run test 4 | notifications: 5 | email: false 6 | -------------------------------------------------------------------------------- /frontend/build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write( 23 | stats.toString({ 24 | colors: true, 25 | modules: false, 26 | children: false, 27 | chunks: false, 28 | chunkModules: false 29 | }) + '\n\n' 30 | ) 31 | 32 | if (stats.hasErrors()) { 33 | console.log(chalk.red(' Build failed with errors.\n')) 34 | process.exit(1) 35 | } 36 | 37 | console.log(chalk.cyan(' Build complete.\n')) 38 | console.log( 39 | chalk.yellow( 40 | ' Tip: built files are meant to be served over an HTTP server.\n' + 41 | " Opening index.html over file:// won't work.\n" 42 | ) 43 | ) 44 | }) 45 | }) 46 | -------------------------------------------------------------------------------- /frontend/build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec(cmd) { 8 | return require('child_process') 9 | .execSync(cmd) 10 | .toString() 11 | .trim() 12 | } 13 | 14 | const versionRequirements = [ 15 | { 16 | name: 'node', 17 | currentVersion: semver.clean(process.version), 18 | versionRequirement: packageConfig.engines.node 19 | } 20 | ] 21 | 22 | if (shell.which('npm')) { 23 | versionRequirements.push({ 24 | name: 'npm', 25 | currentVersion: exec('npm --version'), 26 | versionRequirement: packageConfig.engines.npm 27 | }) 28 | } 29 | 30 | module.exports = function() { 31 | const warnings = [] 32 | 33 | for (let i = 0; i < versionRequirements.length; i++) { 34 | const mod = versionRequirements[i] 35 | 36 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 37 | warnings.push( 38 | mod.name + 39 | ': ' + 40 | chalk.red(mod.currentVersion) + 41 | ' should be ' + 42 | chalk.green(mod.versionRequirement) 43 | ) 44 | } 45 | } 46 | 47 | if (warnings.length) { 48 | console.log('') 49 | console.log( 50 | chalk.yellow( 51 | 'To use this template, you must update following to modules:' 52 | ) 53 | ) 54 | console.log() 55 | 56 | for (let i = 0; i < warnings.length; i++) { 57 | const warning = warnings[i] 58 | console.log(' ' + warning) 59 | } 60 | 61 | console.log() 62 | process.exit(1) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /frontend/build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/build/logo.png -------------------------------------------------------------------------------- /frontend/build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function(_path) { 8 | const assetsSubDirectory = 9 | process.env.NODE_ENV === 'production' 10 | ? config.build.assetsSubDirectory 11 | : config.dev.assetsSubDirectory 12 | 13 | return path.posix.join(assetsSubDirectory, _path) 14 | } 15 | 16 | exports.cssLoaders = function(options) { 17 | options = options || {} 18 | 19 | const cssLoader = { 20 | loader: 'css-loader', 21 | options: { 22 | sourceMap: options.sourceMap 23 | } 24 | } 25 | 26 | const postcssLoader = { 27 | loader: 'postcss-loader', 28 | options: { 29 | sourceMap: options.sourceMap 30 | } 31 | } 32 | 33 | // generate loader string to be used with extract text plugin 34 | function generateLoaders(loader, loaderOptions) { 35 | const loaders = [] 36 | 37 | // Extract CSS when that option is specified 38 | // (which is the case during production build) 39 | if (options.extract) { 40 | loaders.push(MiniCssExtractPlugin.loader) 41 | } else { 42 | loaders.push('vue-style-loader') 43 | } 44 | 45 | loaders.push(cssLoader) 46 | 47 | if (options.usePostCSS) { 48 | loaders.push(postcssLoader) 49 | } 50 | 51 | if (loader) { 52 | loaders.push({ 53 | loader: loader + '-loader', 54 | options: Object.assign({}, loaderOptions, { 55 | sourceMap: options.sourceMap 56 | }) 57 | }) 58 | } 59 | 60 | return loaders 61 | } 62 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 63 | return { 64 | css: generateLoaders(), 65 | postcss: generateLoaders(), 66 | less: generateLoaders('less'), 67 | sass: generateLoaders('sass', { 68 | indentedSyntax: true 69 | }), 70 | scss: generateLoaders('sass'), 71 | stylus: generateLoaders('stylus'), 72 | styl: generateLoaders('stylus') 73 | } 74 | } 75 | 76 | // Generate loaders for standalone style files (outside of .vue) 77 | exports.styleLoaders = function(options) { 78 | const output = [] 79 | const loaders = exports.cssLoaders(options) 80 | 81 | for (const extension in loaders) { 82 | const loader = loaders[extension] 83 | output.push({ 84 | test: new RegExp('\\.' + extension + '$'), 85 | use: loader 86 | }) 87 | } 88 | 89 | return output 90 | } 91 | 92 | exports.createNotifierCallback = () => { 93 | const notifier = require('node-notifier') 94 | 95 | return (severity, errors) => { 96 | if (severity !== 'error') return 97 | 98 | const error = errors[0] 99 | const filename = error.file && error.file.split('!').pop() 100 | 101 | notifier.notify({ 102 | title: packageConfig.name, 103 | message: severity + ': ' + error.name, 104 | subtitle: filename || '', 105 | icon: path.join(__dirname, 'logo.png') 106 | }) 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /frontend/build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | //You can set the vue-loader configuration by yourself. 5 | } 6 | -------------------------------------------------------------------------------- /frontend/build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const { VueLoaderPlugin } = require('vue-loader') 6 | const vueLoaderConfig = require('./vue-loader.conf') 7 | 8 | function resolve(dir) { 9 | return path.join(__dirname, '..', dir) 10 | } 11 | 12 | const createLintingRule = () => ({ 13 | test: /\.(js|vue)$/, 14 | loader: 'eslint-loader', 15 | enforce: 'pre', 16 | include: [resolve('src'), resolve('test')], 17 | options: { 18 | formatter: require('eslint-friendly-formatter'), 19 | emitWarning: !config.dev.showEslintErrorsInOverlay 20 | } 21 | }) 22 | 23 | module.exports = { 24 | context: path.resolve(__dirname, '../'), 25 | entry: { 26 | app: './src/main.js' 27 | }, 28 | output: { 29 | path: config.build.assetsRoot, 30 | filename: '[name].js', 31 | publicPath: 32 | process.env.NODE_ENV === 'production' 33 | ? config.build.assetsPublicPath 34 | : config.dev.assetsPublicPath 35 | }, 36 | resolve: { 37 | extensions: ['.js', '.vue', '.json'], 38 | alias: { 39 | '@': resolve('src') 40 | } 41 | }, 42 | module: { 43 | rules: [ 44 | ...(config.dev.useEslint ? [createLintingRule()] : []), 45 | { 46 | test: /\.vue$/, 47 | loader: 'vue-loader', 48 | options: vueLoaderConfig 49 | }, 50 | { 51 | test: /\.js$/, 52 | loader: 'babel-loader', 53 | include: [ 54 | resolve('src'), 55 | resolve('test'), 56 | resolve('node_modules/webpack-dev-server/client') 57 | ] 58 | }, 59 | { 60 | test: /\.svg$/, 61 | loader: 'svg-sprite-loader', 62 | include: [resolve('src/icons')], 63 | options: { 64 | symbolId: 'icon-[name]' 65 | } 66 | }, 67 | { 68 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 69 | loader: 'url-loader', 70 | exclude: [resolve('src/icons')], 71 | options: { 72 | limit: 10000, 73 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 74 | } 75 | }, 76 | { 77 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 78 | loader: 'url-loader', 79 | options: { 80 | limit: 10000, 81 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 82 | } 83 | }, 84 | { 85 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 86 | loader: 'url-loader', 87 | options: { 88 | limit: 10000, 89 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 90 | } 91 | }, 92 | { 93 | test: /\.md$/, 94 | use: [ 95 | { 96 | loader: 'vue-loader' 97 | }, 98 | { 99 | loader: 'vmark-loader' 100 | } 101 | ] 102 | } 103 | ] 104 | }, 105 | plugins: [new VueLoaderPlugin()], 106 | node: { 107 | // prevent webpack from injecting useless setImmediate polyfill because Vue 108 | // source contains it (although only uses it if it's native). 109 | setImmediate: false, 110 | // prevent webpack from injecting mocks to Node native modules 111 | // that does not make sense for the client 112 | dgram: 'empty', 113 | fs: 'empty', 114 | net: 'empty', 115 | tls: 'empty', 116 | child_process: 'empty' 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /frontend/build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const HtmlWebpackPlugin = require('html-webpack-plugin') 9 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 10 | const portfinder = require('portfinder') 11 | 12 | function resolve(dir) { 13 | return path.join(__dirname, '..', dir) 14 | } 15 | 16 | const HOST = process.env.HOST 17 | const PORT = process.env.PORT && Number(process.env.PORT) 18 | 19 | const devWebpackConfig = merge(baseWebpackConfig, { 20 | mode: 'development', 21 | module: { 22 | rules: utils.styleLoaders({ 23 | sourceMap: config.dev.cssSourceMap, 24 | usePostCSS: true 25 | }) 26 | }, 27 | // cheap-module-eval-source-map is faster for development 28 | devtool: config.dev.devtool, 29 | 30 | // these devServer options should be customized in /config/index.js 31 | devServer: { 32 | clientLogLevel: 'warning', 33 | historyApiFallback: { 34 | rewrites: [ 35 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 36 | ], 37 | }, 38 | hot: true, 39 | contentBase: false, 40 | compress: true, 41 | host: HOST || config.dev.host, 42 | port: PORT || config.dev.port, 43 | open: config.dev.autoOpenBrowser, 44 | overlay: config.dev.errorOverlay 45 | ? { warnings: false, errors: true } 46 | : false, 47 | publicPath: config.dev.assetsPublicPath, 48 | proxy: config.dev.proxyTable, 49 | quiet: true, // necessary for FriendlyErrorsPlugin 50 | watchOptions: { 51 | poll: config.dev.poll 52 | } 53 | }, 54 | plugins: [ 55 | new webpack.DefinePlugin({ 56 | 'process.env': require('../config/dev.env') 57 | }), 58 | new webpack.HotModuleReplacementPlugin(), 59 | // https://github.com/ampedandwired/html-webpack-plugin 60 | new HtmlWebpackPlugin({ 61 | filename: 'index.html', 62 | template: 'index.html', 63 | inject: true, 64 | favicon: resolve('favicon.ico'), 65 | title: 'vue-element-admin' 66 | }) 67 | ] 68 | }) 69 | 70 | module.exports = new Promise((resolve, reject) => { 71 | portfinder.basePort = process.env.PORT || config.dev.port 72 | portfinder.getPort((err, port) => { 73 | if (err) { 74 | reject(err) 75 | } else { 76 | // publish the new Port, necessary for e2e tests 77 | process.env.PORT = port 78 | // add port to devServer config 79 | devWebpackConfig.devServer.port = port 80 | 81 | // Add FriendlyErrorsPlugin 82 | devWebpackConfig.plugins.push( 83 | new FriendlyErrorsPlugin({ 84 | compilationSuccessInfo: { 85 | messages: [ 86 | `Your application is running here: http://${ 87 | devWebpackConfig.devServer.host 88 | }:${port}` 89 | ] 90 | }, 91 | onErrors: config.dev.notifyOnErrors 92 | ? utils.createNotifierCallback() 93 | : undefined 94 | }) 95 | ) 96 | 97 | resolve(devWebpackConfig) 98 | } 99 | }) 100 | }) 101 | -------------------------------------------------------------------------------- /frontend/build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin') 11 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 12 | const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin') 13 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 14 | 15 | function resolve(dir) { 16 | return path.join(__dirname, '..', dir) 17 | } 18 | 19 | const env = require('../config/prod.env') 20 | 21 | // For NamedChunksPlugin 22 | const seen = new Set() 23 | const nameLength = 4 24 | 25 | const webpackConfig = merge(baseWebpackConfig, { 26 | mode: 'production', 27 | module: { 28 | rules: utils.styleLoaders({ 29 | sourceMap: config.build.productionSourceMap, 30 | extract: true, 31 | usePostCSS: true 32 | }) 33 | }, 34 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 35 | output: { 36 | path: config.build.assetsRoot, 37 | filename: utils.assetsPath('js/[name].[chunkhash:8].js'), 38 | chunkFilename: utils.assetsPath('js/[name].[chunkhash:8].js') 39 | }, 40 | plugins: [ 41 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 42 | new webpack.DefinePlugin({ 43 | 'process.env': env 44 | }), 45 | // extract css into its own file 46 | new MiniCssExtractPlugin({ 47 | filename: utils.assetsPath('css/[name].[contenthash:8].css'), 48 | chunkFilename: utils.assetsPath('css/[name].[contenthash:8].css') 49 | }), 50 | // generate dist index.html with correct asset hash for caching. 51 | // you can customize output by editing /index.html 52 | // see https://github.com/ampedandwired/html-webpack-plugin 53 | new HtmlWebpackPlugin({ 54 | filename: config.build.index, 55 | template: 'index.html', 56 | inject: true, 57 | favicon: resolve('favicon.ico'), 58 | title: 'cetus-gui', 59 | minify: { 60 | removeComments: true, 61 | collapseWhitespace: true, 62 | removeAttributeQuotes: true 63 | // more options: 64 | // https://github.com/kangax/html-minifier#options-quick-reference 65 | } 66 | // default sort mode uses toposort which cannot handle cyclic deps 67 | // in certain cases, and in webpack 4, chunk order in HTML doesn't 68 | // matter anyway 69 | }), 70 | new ScriptExtHtmlWebpackPlugin({ 71 | //`runtime` must same as runtimeChunk name. default is `runtime` 72 | inline: /runtime\..*\.js$/ 73 | }), 74 | // keep chunk.id stable when chunk has no name 75 | new webpack.NamedChunksPlugin(chunk => { 76 | if (chunk.name) { 77 | return chunk.name 78 | } 79 | const modules = Array.from(chunk.modulesIterable) 80 | if (modules.length > 1) { 81 | const hash = require('hash-sum') 82 | const joinedHash = hash(modules.map(m => m.id).join('_')) 83 | let len = nameLength 84 | while (seen.has(joinedHash.substr(0, len))) len++ 85 | seen.add(joinedHash.substr(0, len)) 86 | return `chunk-${joinedHash.substr(0, len)}` 87 | } else { 88 | return modules[0].id 89 | } 90 | }), 91 | // keep module.id stable when vender modules does not change 92 | new webpack.HashedModuleIdsPlugin(), 93 | // copy custom static assets 94 | new CopyWebpackPlugin([ 95 | { 96 | from: path.resolve(__dirname, '../static'), 97 | to: config.build.assetsSubDirectory, 98 | ignore: ['.*'] 99 | } 100 | ]) 101 | ], 102 | optimization: { 103 | splitChunks: { 104 | chunks: 'all', 105 | cacheGroups: { 106 | libs: { 107 | name: 'chunk-libs', 108 | test: /[\\/]node_modules[\\/]/, 109 | priority: 10, 110 | chunks: 'initial' // 只打包初始时依赖的第三方 111 | }, 112 | elementUI: { 113 | name: 'chunk-elementUI', // 单独将 elementUI 拆包 114 | priority: 20, // 权重要大于 libs 和 app 不然会被打包进 libs 或者 app 115 | test: /[\\/]node_modules[\\/]element-ui[\\/]/ 116 | } 117 | } 118 | }, 119 | runtimeChunk: 'single', 120 | minimizer: [ 121 | new UglifyJsPlugin({ 122 | uglifyOptions: { 123 | mangle: { 124 | safari10: true 125 | } 126 | }, 127 | sourceMap: config.build.productionSourceMap, 128 | cache: true, 129 | parallel: true 130 | }), 131 | // Compress extracted CSS. We are using this plugin so that possible 132 | // duplicated CSS from different components can be deduped. 133 | new OptimizeCSSAssetsPlugin() 134 | ] 135 | } 136 | }) 137 | 138 | if (config.build.productionGzip) { 139 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 140 | 141 | webpackConfig.plugins.push( 142 | new CompressionWebpackPlugin({ 143 | asset: '[path].gz[query]', 144 | algorithm: 'gzip', 145 | test: new RegExp( 146 | '\\.(' + config.build.productionGzipExtensions.join('|') + ')$' 147 | ), 148 | threshold: 10240, 149 | minRatio: 0.8 150 | }) 151 | ) 152 | } 153 | 154 | if (config.build.generateAnalyzerReport || config.build.bundleAnalyzerReport) { 155 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') 156 | .BundleAnalyzerPlugin 157 | 158 | if (config.build.bundleAnalyzerReport) { 159 | webpackConfig.plugins.push( 160 | new BundleAnalyzerPlugin({ 161 | analyzerPort: 8080, 162 | generateStatsFile: false 163 | }) 164 | ) 165 | } 166 | 167 | if (config.build.generateAnalyzerReport) { 168 | webpackConfig.plugins.push( 169 | new BundleAnalyzerPlugin({ 170 | analyzerMode: 'static', 171 | reportFilename: 'bundle-report.html', 172 | openAnalyzer: false 173 | }) 174 | ) 175 | } 176 | } 177 | 178 | module.exports = webpackConfig 179 | -------------------------------------------------------------------------------- /frontend/config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"', 7 | // BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"', 8 | }) 9 | -------------------------------------------------------------------------------- /frontend/config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.2.6 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | // Paths 10 | assetsSubDirectory: 'static', 11 | assetsPublicPath: '/', 12 | proxyTable: { 13 | '/': { 14 | target:'http://127.0.0.1:8000', 15 | changeOrigin:true, 16 | secure: false, 17 | pathRewrite:{ 18 | '^/api': '/api' 19 | } 20 | } 21 | }, 22 | // Various Dev Server settings 23 | host: 'localhost', // can be overwritten by process.env.HOST 24 | port: 9528, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 25 | // autoOpenBrowser: true, 26 | autoOpenBrowser: false, 27 | errorOverlay: true, 28 | // notifyOnErrors: false, 29 | notifyOnErrors: true, 30 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 31 | 32 | // Use Eslint Loader? 33 | // If true, your code will be linted during bundling and 34 | // linting errors and warnings will be shown in the console. 35 | // useEslint: true, 36 | useEslint: false, 37 | // If true, eslint errors and warnings will also be shown in the error overlay 38 | // in the browser. 39 | showEslintErrorsInOverlay: false, 40 | 41 | /** 42 | * Source Maps 43 | */ 44 | 45 | // https://webpack.js.org/configuration/devtool/#development 46 | devtool: 'cheap-source-map', 47 | 48 | // CSS Sourcemaps off by default because relative paths are "buggy" 49 | // with this option, according to the CSS-Loader README 50 | // (https://github.com/webpack/css-loader#sourcemaps) 51 | // In our experience, they generally work as expected, 52 | // just be aware of this issue when enabling this option. 53 | cssSourceMap: false 54 | }, 55 | 56 | build: { 57 | // Template for index.html 58 | index: path.resolve(__dirname, '../dist/index.html'), 59 | 60 | // Paths 61 | assetsRoot: path.resolve(__dirname, '../dist'), 62 | assetsSubDirectory: 'static', 63 | 64 | /** 65 | * You can set by youself according to actual condition 66 | * You will need to set this if you plan to deploy your site under a sub path, 67 | * for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/, 68 | * then assetsPublicPath should be set to "/bar/". 69 | * In most cases please use '/' !!! 70 | */ 71 | assetsPublicPath: '/', 72 | 73 | /** 74 | * Source Maps 75 | */ 76 | 77 | productionSourceMap: false, 78 | // https://webpack.js.org/configuration/devtool/#production 79 | devtool: 'source-map', 80 | 81 | // Gzip off by default as many popular static hosts such as 82 | // Surge or Netlify already gzip all static assets for you. 83 | // Before setting to `true`, make sure to: 84 | // npm install --save-dev compression-webpack-plugin 85 | productionGzip: false, 86 | productionGzipExtensions: ['js', 'css'], 87 | 88 | // Run the build command with an extra argument to 89 | // View the bundle analyzer report after build finishes: 90 | // `npm run build --report` 91 | // Set to `true` or `false` to always turn it on or off 92 | bundleAnalyzerReport: process.env.npm_config_report || false, 93 | 94 | // `npm run build:prod --generate_report` 95 | generateAnalyzerReport: process.env.npm_config_generate_report || false 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /frontend/config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"', 4 | // BASE_API: '"https://easy-mock.com/mock/5950a2419adc231f356a6636/vue-admin"', 5 | } 6 | -------------------------------------------------------------------------------- /frontend/docs/HELP.md: -------------------------------------------------------------------------------- 1 | ## Cetus-GUI 帮助文档 2 | 3 | --- 4 | 5 | 此文档主要是帮助您解决Cetus-GUI安装和使用过程中可能会出现的问题。 6 | 7 | 目前项目处于测试阶段,希望您在使用时能积极向我们反馈bug和需求,我们将会很快的解决。 8 | 9 | --- 10 | 11 | ### 基础环境配置 12 | 13 | --- 14 | 15 | **所有与项目相关节点**确保有Python3环境。 16 | 17 | **所有节点**确保执行下列命令: 18 | 19 | * sudo yum install gcc gcc-c++ python3-devel python3-pip git 20 | * sudo pip3 install pymysql 21 | 22 | --- 23 | 24 | ### docker部署 25 | 26 | --- 27 | 28 | 此处是docker方式部署的配置方法,适用于简单配置Cetus-GUI环境的方式,源码安装请见源码部署一节。 29 | 30 | #### docker安装 31 | 32 | ``` 33 | # sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine 34 | # sudo yum install -y yum-utils device-mapper-persistent-data lvm2 35 | # sudo yum-config-manager --add-repo https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo 36 | # sudo yum makecache fast 37 | # sudo yum install docker-ce 38 | # sudo pip install -U docker-compose 39 | ``` 40 | 41 | #### 镜像部署 42 | 43 | 部署服务器的3306/4505/4506/8300/9527端口请务必不要占用! 44 | 45 | ``` 46 | # git clone https://github.com/Lede-Inc/Cetus-GUI 47 | # cd Cetus-GUI/backend/install 48 | # docker-compose up -d 49 | ``` 50 | 51 | #### SaltStack安装 52 | 53 | docker节点已经默认安装了salt-master,此处只需安装Minion节点即可,docker节点所在服务器也可以配置为Minion。 54 | 55 | * 安装 56 | 57 | ``` 58 | # sudo yum install https://repo.saltstack.com/py3/redhat/salt-py3-repo-latest-2.el7.noarch.rpm 59 | # sudo yum clean expire-cache 60 | # sudo yum install salt-minion 61 | ``` 62 | 63 | * 配置 64 | 65 | ``` 66 | # sudo vi /etc/salt/minion 67 | 68 | master: Master节点ip,此处填写docker节点所在宿主机的ip即可 69 | id: Minion唯一标识 70 | ``` 71 | 72 | * 启动 73 | 74 | ``` 75 | # sudo service salt-minion start 76 | ``` 77 | 78 | * 测试 79 | 80 | 在镜像内部执行,测试Minion是否配置成功。 81 | 82 | ``` 83 | # salt-key -A -y 84 | # salt-key -L 85 | # salt '*' test.ping 86 | ``` 87 | 88 | #### 网络配置 89 | 90 | 由于网络配置原因,需要修改部分配置信息。 91 | 92 | 为简化说明,我们假设镜像所在节点ip为10.0.0.1,Minion id为Minion1。待安装Cetus节点ip为10.0.0.2,Minion id为Minion2。 93 | 94 | * 镜像内部执行 95 | 96 | ``` 97 | # echo '10.0.0.1 Minion1' >> vi /etc/hosts 98 | # echo '10.0.0.2 Minion2' >> vi /etc/hosts 99 | ``` 100 | 101 | * 所有Minion节点执行 102 | 103 | ``` 104 | # echo '10.0.0.1 cetus_gui_db' >> vi /etc/hosts 105 | ``` 106 | 107 | #### 登陆 108 | 109 | http://localhost:9527 110 | 111 | --- 112 | 113 | ### 源码部署 114 | 115 | --- 116 | 117 | 源码部署适合于对项目进行大规模修改的情况,docker方式部署请跳过这一段。 118 | 119 | #### SaltStack安装 120 | 121 | 项目的应用依赖于配置好的SaltStack环境,请确保环境足够新以支持Python3 API。 122 | 123 | 以下是出现问题时可能的解决方案: 124 | 125 | * 安装 126 | 127 | Master节点: 128 | * 项目当前**必须**与Master节点位于同一个服务器 129 | * 安装流程 130 | * sudo yum install https://repo.saltstack.com/py3/redhat/salt-py3-repo-latest-2.el7.noarch.rpm 131 | * sudo yum clean expire-cache 132 | * sudo yum install salt-master 133 | * sudo yum install salt-minion 134 | 135 | Minion节点: 136 | * Master节点所在服务器也可以配置为Minion 137 | * 安装流程 138 | * sudo yum install https://repo.saltstack.com/py3/redhat/salt-py3-repo-latest-2.el7.noarch.rpm 139 | * sudo yum clean expire-cache 140 | * sudo yum install salt-minion 141 | 142 | * 配置 143 | 144 | Master节点: 145 | * 配置 146 | 147 | ``` 148 | # sudo vi /etc/salt/master 149 | 150 | file_roots: 151 | base: 152 | - $PATH/backend/shells # $PATH指项目所在路径 153 | ``` 154 | 155 | * 启动 156 | * sudo service salt-master start 157 | 158 | Minion节点: 159 | * 配置 160 | 161 | ``` 162 | # sudo vi /etc/salt/minion 163 | 164 | master: Master节点 165 | id: Minion唯一标识 166 | ``` 167 | 168 | * 启动 169 | * sudo service salt-minion start 170 | 171 | * 非root用户启动 172 | 173 | 在启动salt时可以修改启动用户,与整个项目的部署用户保持一致。**这一步是我们用非root用户部署项目时,必须要做的。** 174 | 175 | ``` 176 | # sudo vi /etc/salt/master 177 | 178 | user: user 179 | 180 | # 修改权限 181 | # sudo chown -R user:user /etc/salt /var/cache/salt /var/log/salt /var/run/salt 182 | 183 | # sudo service salt-master restart 184 | ``` 185 | 186 | Minion节点不需要修改,这样可以使发送到Minion的命令仍为root执行。 187 | 188 | * 其他问题 189 | 190 | 如果有salt命令执行时报编码错误,极有可能是调用了Python2下的salt命令,请删除Python2配置环境下的SaltStack并安装Python3版本。 191 | 192 | pip3 install salt 193 | 194 | #### 部署环境 195 | 196 | 部署环境上至少需要Python2和Python3双版本,需要**至少一个MySQL实例来放置项目数据库和Cetus配置数据库**。 197 | 198 | ``` 199 | git clone https://github.com/Lede-Inc/Cetus-GUI 200 | cd Cetus-GUI 201 | 202 | 修改如下配置: 203 | 204 | # Salt默认配置文件 205 | vi /etc/salt/master 206 | file_roots: 207 | base: 208 | - $PROJECT_PATH/Cetus-GUI/backend/shells 209 | 210 | # 修改Django配置文件 211 | vi backend/backend/settings.py 212 | DATABASES = { 213 | # 默认数据库,存放项目和Cetus信息 214 | 'default': { 215 | 'ENGINE': 'django.db.backends.mysql', 216 | 'NAME': 'xxx', 217 | 'USER': 'xxx', 218 | 'PASSWORD': 'xxx', 219 | 'HOST': 'xxx', 220 | 'PORT': xxx, 221 | }, 222 | # 存放Cetus远程配置库信息,可与默认数据库一致 223 | 'catalog': { 224 | 'user': 'xxx', 225 | 'password': 'xxx', 226 | 'host': 'xxx', 227 | 'port': xxx, 228 | } 229 | } 230 | # Cetus源代码路径 231 | CETUS_URL = 'https://github.com/Lede-Inc/cetus' 232 | # RabbitMQ配置端口 233 | BROKER_URL = 'amqp://guest@localhost:5672//' 234 | 235 | 修改后执行: 236 | sh deploy.sh 237 | ``` 238 | 239 | 以下是出现问题时可能的解决方案: 240 | 241 | * 更新项目代码 242 | 243 | ``` 244 | # git pull origin master 245 | # sh deploy.sh 246 | ``` 247 | 248 | * RabbitMQ问题 249 | 250 | * 可参考https://github.com/judasn/Linux-Tutorial/blob/master/markdown-file/RabbitMQ-Install-And-Settings.md 251 | 252 | * 端口占用 253 | 254 | 请确保以下端口未被占用 255 | * Django项目占用8000端口 256 | * Supervisor占用9001端口 257 | * SaltStack占用4505/4056端口 258 | * Vue项目占用9528端口 259 | 260 | * 部署情况查询 261 | 262 | ``` 263 | # supervisorctl 264 | backend RUNNING 265 | beat RUNNING 266 | celerycam RUNNING 267 | cetus RUNNING 268 | frontend RUNNING 269 | monitor RUNNING 270 | ``` 271 | 272 | 若有进程的状态非RUNNING,请查看deploy.sh的执行日志情况。 273 | 274 | #### 登陆 275 | 276 | http://localhost:9528 277 | 278 | --- 279 | 280 | ### 日志管理 281 | 282 | --- 283 | 284 | 在部署应用和安装配置Cetus过程中可能会存在各种报错,有些情况可能无法直接从网页端获取结果或解决方案,需要从后台日志中查询。 285 | 286 | 以下是应用程序和Cetus日志对应的位置。 287 | 288 | * 应用日志 289 | 290 | ``` 291 | cd $PATH/logs # $PATH指项目所在路径(docker的路径为/app) 292 | supervisor_backend.log # Django日志 293 | supervisor_beat.log 294 | supervisor_celerycam.log 295 | supervisor_cetus.log # 后台任务日志 296 | supervisord.log 297 | supervisor_frontend.log 298 | supervisor_monitor.log # Cetus监控日志 299 | ``` 300 | 301 | * Cetus日志 302 | 303 | ``` 304 | cd $CETUS_PATH/logs # $CETUS_PATH指Cetus项目所在路径,默认为/home/cetus_服务端口号 305 | cetus.log # 运行日志 306 | xa.log # XA事务日志 307 | slowquery.log # 慢日志 308 | ``` 309 | -------------------------------------------------------------------------------- /frontend/docs/img/cetus_command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_command.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_config.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_fund_params.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_fund_params.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_info.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_install.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_list.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_monitor.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_task.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_user.png -------------------------------------------------------------------------------- /frontend/docs/img/cetus_vdb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/img/cetus_vdb.png -------------------------------------------------------------------------------- /frontend/docs/lededba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/docs/lededba.png -------------------------------------------------------------------------------- /frontend/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/favicon.ico -------------------------------------------------------------------------------- /frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Cetus GUI 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cetus-gui", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "description": "A Cetus GUI Controller", 6 | "author": "Mikuru ", 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "build": "node build/build.js", 11 | "build:report": "npm_config_report=true npm run build", 12 | "lint": "eslint --ext .js,.vue src", 13 | "test": "npm run lint" 14 | }, 15 | "dependencies": { 16 | "axios": "0.18.0", 17 | "echarts": "4.2.0-rc.2", 18 | "element-ui": "2.4.6", 19 | "js-cookie": "2.2.0", 20 | "normalize.css": "7.0.0", 21 | "nprogress": "0.2.0", 22 | "vue": "2.5.17", 23 | "vue-router": "3.0.1", 24 | "vuex": "3.0.1" 25 | }, 26 | "devDependencies": { 27 | "autoprefixer": "8.5.0", 28 | "babel-core": "6.26.0", 29 | "babel-eslint": "8.2.6", 30 | "babel-helper-vue-jsx-merge-props": "2.0.3", 31 | "babel-loader": "7.1.5", 32 | "babel-plugin-syntax-jsx": "6.18.0", 33 | "babel-plugin-transform-runtime": "6.23.0", 34 | "babel-plugin-transform-vue-jsx": "3.7.0", 35 | "babel-preset-env": "1.7.0", 36 | "babel-preset-stage-2": "6.24.1", 37 | "chalk": "2.4.1", 38 | "copy-webpack-plugin": "4.5.2", 39 | "css-loader": "1.0.0", 40 | "eslint": "4.19.1", 41 | "eslint-friendly-formatter": "4.0.1", 42 | "eslint-loader": "2.0.0", 43 | "eslint-plugin-vue": "4.7.1", 44 | "eventsource-polyfill": "0.9.6", 45 | "file-loader": "1.1.11", 46 | "friendly-errors-webpack-plugin": "1.7.0", 47 | "html-webpack-plugin": "^4.0.0-alpha", 48 | "mini-css-extract-plugin": "0.4.1", 49 | "node-notifier": "5.2.1", 50 | "node-sass": "^4.7.2", 51 | "optimize-css-assets-webpack-plugin": "5.0.0", 52 | "ora": "3.0.0", 53 | "portfinder": "1.0.16", 54 | "postcss-import": "12.0.0", 55 | "postcss-loader": "2.1.6", 56 | "postcss-url": "7.3.2", 57 | "rimraf": "2.6.2", 58 | "sass-loader": "7.0.3", 59 | "script-ext-html-webpack-plugin": "2.0.1", 60 | "semver": "5.5.0", 61 | "shelljs": "0.8.2", 62 | "svg-sprite-loader": "3.8.0", 63 | "uglifyjs-webpack-plugin": "1.2.7", 64 | "url-loader": "1.0.1", 65 | "vmark": "1.0.2", 66 | "vmark-loader": "1.0.0", 67 | "vue-loader": "15.3.0", 68 | "vue-style-loader": "4.1.2", 69 | "vue-template-compiler": "2.5.17", 70 | "webpack": "4.16.5", 71 | "webpack-bundle-analyzer": "2.13.1", 72 | "webpack-cli": "3.1.0", 73 | "webpack-dev-server": "3.1.11", 74 | "webpack-merge": "4.1.4" 75 | }, 76 | "engines": { 77 | "node": ">= 6.0.0", 78 | "npm": ">= 3.0.0" 79 | }, 80 | "browserslist": [ 81 | "> 1%", 82 | "last 2 versions", 83 | "not ie <= 8" 84 | ] 85 | } 86 | -------------------------------------------------------------------------------- /frontend/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 30 | -------------------------------------------------------------------------------- /frontend/src/api/cetus.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function cetusList(query) { 4 | return request({ 5 | url: '/api/cetus/', 6 | method: 'get', 7 | params: query 8 | }) 9 | } 10 | 11 | export function cetusItem(id) { 12 | return request({ 13 | url: `/api/cetus/${id}/`, 14 | method: 'get' 15 | }) 16 | } 17 | 18 | export function updateCetus(id, data) { 19 | return request({ 20 | url: `/api/cetus/${id}/`, 21 | method: 'patch', 22 | data 23 | }) 24 | } 25 | 26 | export function installCetus(data) { 27 | return request({ 28 | url: '/api/cetus/install/', 29 | method: 'post', 30 | data 31 | }) 32 | } 33 | 34 | export function manageCetus(id, data) { 35 | return request({ 36 | url: `/api/cetus/${id}/command/`, 37 | method: 'post', 38 | data 39 | }) 40 | } 41 | 42 | export function paramCetus(id, data) { 43 | return request({ 44 | url: `/api/cetus/${id}/param/`, 45 | method: 'get', 46 | params: data 47 | }) 48 | } 49 | 50 | export function changeParam(id, data) { 51 | return request({ 52 | url: `/api/cetus/${id}/param/`, 53 | method: 'post', 54 | data 55 | }) 56 | } 57 | 58 | export function addCetusNode(data) { 59 | return request({ 60 | url: `/api/node/install/`, 61 | method: 'post', 62 | data 63 | }) 64 | } 65 | 66 | export function upgradeNode(id, data) { 67 | return request({ 68 | url: `/api/node/${id}/upgrade/`, 69 | method: 'post', 70 | data 71 | }) 72 | } 73 | 74 | export function upgradeCetus(id, data) { 75 | return request({ 76 | url: `/api/cetus/${id}/upgrade/`, 77 | method: 'post', 78 | data 79 | }) 80 | } 81 | 82 | export function removeNode(id) { 83 | return request({ 84 | url: `/api/node/${id}/remove/`, 85 | method: 'post' 86 | }) 87 | } 88 | 89 | export function removeCetus(id) { 90 | return request({ 91 | url: `/api/cetus/${id}/remove/`, 92 | method: 'post' 93 | }) 94 | } 95 | 96 | export function operateNode(id, data) { 97 | return request({ 98 | url: `/api/node/${id}/operate/`, 99 | method: 'post', 100 | data 101 | }) 102 | } 103 | 104 | export function operateCetus(id, data) { 105 | return request({ 106 | url: `/api/cetus/${id}/operate/`, 107 | method: 'post', 108 | data 109 | }) 110 | } 111 | 112 | export function monitorNode(id, data) { 113 | return request({ 114 | url: `/api/node/${id}/monitor/`, 115 | method: 'get', 116 | params: data 117 | }) 118 | } 119 | 120 | export function taskStatus(query) { 121 | return request({ 122 | url: `/api/task/`, 123 | method: 'get', 124 | params: query 125 | }) 126 | } 127 | -------------------------------------------------------------------------------- /frontend/src/api/login.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request' 2 | 3 | export function login(username, password) { 4 | return request({ 5 | url: '/login/', 6 | method: 'post', 7 | data: { 8 | username, 9 | password 10 | } 11 | }) 12 | } 13 | 14 | export function logout() { 15 | return request({ 16 | url: '/user/logout', 17 | method: 'post' 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /frontend/src/components/Breadcrumb/index.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 39 | 40 | 52 | -------------------------------------------------------------------------------- /frontend/src/components/Hamburger/index.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 44 | 45 | 59 | -------------------------------------------------------------------------------- /frontend/src/components/SvgIcon/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 34 | 35 | 44 | -------------------------------------------------------------------------------- /frontend/src/icons/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import SvgIcon from '@/components/SvgIcon' // svg组件 3 | 4 | // register globally 5 | Vue.component('svg-icon', SvgIcon) 6 | 7 | const requireAll = requireContext => requireContext.keys().map(requireContext) 8 | const req = require.context('./svg', false, /\.svg$/) 9 | requireAll(req) 10 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/404.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/bug.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/chart.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/clipboard.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/component.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/dashboard.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/documentation.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/drag.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/email.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/example.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/excel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/eye.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/form.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/international.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/language.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/link.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/lock.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/message.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/money.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/password.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/people.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/peoples.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/shoppingCard.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/star.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/tab.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/table.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/theme.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/user.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/wechat.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/icons/svg/zip.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /frontend/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import 'normalize.css/normalize.css' // A modern alternative to CSS resets 4 | 5 | import ElementUI from 'element-ui' 6 | import 'element-ui/lib/theme-chalk/index.css' 7 | import locale from 'element-ui/lib/locale/lang/en' // lang i18n 8 | 9 | import '@/styles/index.scss' // global css 10 | 11 | import App from './App' 12 | import router from './router' 13 | import store from './store' 14 | 15 | import '@/icons' // icon 16 | import '@/permission' // permission control 17 | import * as utils from '@/utils' 18 | 19 | Vue.use(ElementUI, { locale }) 20 | 21 | Object.keys(utils).forEach(key => { 22 | Vue.filter(key, utils[key]) 23 | }) 24 | 25 | Vue.config.productionTip = false 26 | 27 | new Vue({ 28 | el: '#app', 29 | router, 30 | store, 31 | render: h => h(App) 32 | }) 33 | -------------------------------------------------------------------------------- /frontend/src/permission.js: -------------------------------------------------------------------------------- 1 | import router from './router' 2 | // import store from './store' 3 | import NProgress from 'nprogress' // Progress 进度条 4 | import 'nprogress/nprogress.css'// Progress 进度条样式 5 | // import { Message } from 'element-ui' 6 | import { getToken } from '@/utils/auth' // 验权 7 | 8 | const whiteList = ['/login'] // 不重定向白名单 9 | router.beforeEach((to, from, next) => { 10 | NProgress.start() 11 | if (getToken()) { 12 | if (to.path === '/login') { 13 | next({ path: '/' }) 14 | NProgress.done() 15 | } else { 16 | next() 17 | } 18 | } else { 19 | if (whiteList.indexOf(to.path) !== -1) { 20 | next() 21 | } else { 22 | next('/login') 23 | NProgress.done() 24 | } 25 | } 26 | }) 27 | 28 | router.afterEach(() => { 29 | NProgress.done() // 结束Progress 30 | }) 31 | -------------------------------------------------------------------------------- /frontend/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | // in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading; 5 | 6 | Vue.use(Router) 7 | 8 | /* Layout */ 9 | import Layout from '../views/layout/Layout' 10 | 11 | /** 12 | * hidden: true if `hidden:true` will not show in the sidebar(default is false) 13 | * alwaysShow: true if set true, will always show the root menu, whatever its child routes length 14 | * if not set alwaysShow, only more than one route under the children 15 | * it will becomes nested mode, otherwise not show the root menu 16 | * redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb 17 | * name:'router-name' the name is used by (must set!!!) 18 | * meta : { 19 | title: 'title' the name show in submenu and breadcrumb (recommend set) 20 | icon: 'svg-name' the icon show in the sidebar, 21 | } 22 | **/ 23 | export const constantRouterMap = [ 24 | { path: '/login', component: () => import('@/views/login/index'), hidden: true }, 25 | { path: '/404', component: () => import('@/views/404'), hidden: true }, 26 | 27 | { 28 | path: '/', 29 | component: Layout, 30 | redirect: '/cetus', 31 | hidden: true 32 | }, 33 | 34 | { 35 | path: '/cetus', 36 | component: Layout, 37 | children: [ 38 | { 39 | path: '', 40 | name: 'Cetus', 41 | component: () => import('@/views/list/index'), 42 | meta: { title: 'Cetus列表', icon: 'table' } 43 | }, 44 | { 45 | path: '/cetus/:id', 46 | name: 'Item', 47 | component: () => import('@/views/item/index'), 48 | meta: { title: 'Cetus详情', icon: 'table' }, 49 | hidden: true 50 | } 51 | ] 52 | }, 53 | 54 | { 55 | path: '/install', 56 | component: Layout, 57 | children: [ 58 | { 59 | path: 'cetus', 60 | name: 'Install', 61 | component: () => import('@/views/form/index'), 62 | meta: { title: 'Cetus安装', icon: 'clipboard' } 63 | } 64 | ] 65 | }, 66 | 67 | { 68 | path: '/tasks', 69 | component: Layout, 70 | children: [ 71 | { 72 | path: '', 73 | name: 'Tasks', 74 | component: () => import('@/views/form/tasks'), 75 | meta: { title: '任务列表', icon: 'form' } 76 | } 77 | ] 78 | }, 79 | 80 | { 81 | path: '/docs', 82 | component: Layout, 83 | children: [ 84 | { 85 | path: '', 86 | name: 'Docs', 87 | component: () => import('@/views/docs/index'), 88 | meta: { title: '使用说明', icon: 'documentation' } 89 | } 90 | ] 91 | }, 92 | 93 | { 94 | path: '/links', 95 | component: Layout, 96 | children: [ 97 | { 98 | path: '', 99 | name: 'Links', 100 | component: () => import('@/views/link/index'), 101 | meta: { title: '友情链接', icon: 'link' } 102 | } 103 | ] 104 | }, 105 | { path: '*', redirect: '/404', hidden: true } 106 | ] 107 | 108 | export default new Router({ 109 | // mode: 'history', //后端支持可开 110 | scrollBehavior: () => ({ y: 0 }), 111 | routes: constantRouterMap 112 | }) 113 | -------------------------------------------------------------------------------- /frontend/src/store/getters.js: -------------------------------------------------------------------------------- 1 | const getters = { 2 | sidebar: state => state.app.sidebar, 3 | device: state => state.app.device, 4 | token: state => state.user.token, 5 | avatar: state => state.user.avatar, 6 | name: state => state.user.name, 7 | roles: state => state.user.roles 8 | } 9 | export default getters 10 | -------------------------------------------------------------------------------- /frontend/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import app from './modules/app' 4 | import user from './modules/user' 5 | import getters from './getters' 6 | 7 | Vue.use(Vuex) 8 | 9 | const store = new Vuex.Store({ 10 | modules: { 11 | app, 12 | user 13 | }, 14 | getters 15 | }) 16 | 17 | export default store 18 | -------------------------------------------------------------------------------- /frontend/src/store/modules/app.js: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | 3 | const app = { 4 | state: { 5 | sidebar: { 6 | opened: !+Cookies.get('sidebarStatus'), 7 | withoutAnimation: false 8 | }, 9 | device: 'desktop' 10 | }, 11 | mutations: { 12 | TOGGLE_SIDEBAR: state => { 13 | if (state.sidebar.opened) { 14 | Cookies.set('sidebarStatus', 1) 15 | } else { 16 | Cookies.set('sidebarStatus', 0) 17 | } 18 | state.sidebar.opened = !state.sidebar.opened 19 | state.sidebar.withoutAnimation = false 20 | }, 21 | CLOSE_SIDEBAR: (state, withoutAnimation) => { 22 | Cookies.set('sidebarStatus', 1) 23 | state.sidebar.opened = false 24 | state.sidebar.withoutAnimation = withoutAnimation 25 | }, 26 | TOGGLE_DEVICE: (state, device) => { 27 | state.device = device 28 | } 29 | }, 30 | actions: { 31 | ToggleSideBar: ({ commit }) => { 32 | commit('TOGGLE_SIDEBAR') 33 | }, 34 | CloseSideBar({ commit }, { withoutAnimation }) { 35 | commit('CLOSE_SIDEBAR', withoutAnimation) 36 | }, 37 | ToggleDevice({ commit }, device) { 38 | commit('TOGGLE_DEVICE', device) 39 | } 40 | } 41 | } 42 | 43 | export default app 44 | -------------------------------------------------------------------------------- /frontend/src/store/modules/user.js: -------------------------------------------------------------------------------- 1 | import { login, logout } from '@/api/login' 2 | import { getToken, setToken, removeToken, getName } from '@/utils/auth' 3 | import Cookies from "js-cookie"; 4 | 5 | const user = { 6 | state: { 7 | token: getToken(), 8 | name: getName(), 9 | avatar: '', 10 | roles: [] 11 | }, 12 | 13 | mutations: { 14 | SET_TOKEN: (state, token) => { 15 | state.token = token 16 | }, 17 | SET_NAME: (state, name) => { 18 | state.name = name 19 | Cookies.set('name', name) 20 | }, 21 | SET_AVATAR: (state, avatar) => { 22 | state.avatar = avatar 23 | }, 24 | SET_ROLES: (state, roles) => { 25 | state.roles = roles 26 | } 27 | }, 28 | 29 | actions: { 30 | // 登录 31 | Login({ commit }, userInfo) { 32 | const username = userInfo.username.trim() 33 | return new Promise((resolve, reject) => { 34 | login(username, userInfo.password).then(response => { 35 | const data = response.data 36 | setToken(data.token) 37 | commit('SET_TOKEN', data.token) 38 | commit('SET_NAME', username) 39 | resolve() 40 | }).catch(error => { 41 | reject(error) 42 | }) 43 | }) 44 | }, 45 | LogOut({ commit, state }) { 46 | return new Promise((resolve, reject) => { 47 | logout(state.token).then(() => { 48 | commit('SET_TOKEN', '') 49 | commit('SET_ROLES', []) 50 | removeToken() 51 | resolve() 52 | }).catch(error => { 53 | reject(error) 54 | }) 55 | }) 56 | }, 57 | FedLogOut({ commit }) { 58 | return new Promise(resolve => { 59 | commit('SET_TOKEN', '') 60 | removeToken() 61 | resolve() 62 | }) 63 | } 64 | } 65 | } 66 | 67 | export default user 68 | -------------------------------------------------------------------------------- /frontend/src/styles/element-ui.scss: -------------------------------------------------------------------------------- 1 | //to reset element-ui default css 2 | .el-upload { 3 | input[type="file"] { 4 | display: none !important; 5 | } 6 | } 7 | 8 | .el-upload__input { 9 | display: none; 10 | } 11 | 12 | //暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461 13 | .el-dialog { 14 | transform: none; 15 | left: 0; 16 | position: relative; 17 | margin: 0 auto; 18 | } 19 | 20 | //element ui upload 21 | .upload-container { 22 | .el-upload { 23 | width: 100%; 24 | .el-upload-dragger { 25 | width: 100%; 26 | height: 200px; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /frontend/src/styles/index.scss: -------------------------------------------------------------------------------- 1 | @import './variables.scss'; 2 | @import './mixin.scss'; 3 | @import './transition.scss'; 4 | @import './element-ui.scss'; 5 | @import './sidebar.scss'; 6 | 7 | body { 8 | height: 100%; 9 | -moz-osx-font-smoothing: grayscale; 10 | -webkit-font-smoothing: antialiased; 11 | text-rendering: optimizeLegibility; 12 | font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; 13 | } 14 | 15 | label { 16 | font-weight: 700; 17 | } 18 | 19 | html { 20 | height: 100%; 21 | box-sizing: border-box; 22 | } 23 | 24 | #app{ 25 | height: 100%; 26 | } 27 | 28 | *, 29 | *:before, 30 | *:after { 31 | box-sizing: inherit; 32 | } 33 | 34 | a, 35 | a:focus, 36 | a:hover { 37 | cursor: pointer; 38 | color: inherit; 39 | outline: none; 40 | text-decoration: none; 41 | } 42 | 43 | div:focus{ 44 | outline: none; 45 | } 46 | 47 | a:focus, 48 | a:active { 49 | outline: none; 50 | } 51 | 52 | a, 53 | a:focus, 54 | a:hover { 55 | cursor: pointer; 56 | color: inherit; 57 | text-decoration: none; 58 | } 59 | 60 | .clearfix { 61 | &:after { 62 | visibility: hidden; 63 | display: block; 64 | font-size: 0; 65 | content: " "; 66 | clear: both; 67 | height: 0; 68 | } 69 | } 70 | 71 | //main-container全局样式 72 | .app-main{ 73 | min-height: 100%; 74 | } 75 | 76 | .app-container { 77 | padding: 20px; 78 | } 79 | -------------------------------------------------------------------------------- /frontend/src/styles/mixin.scss: -------------------------------------------------------------------------------- 1 | @mixin clearfix { 2 | &:after { 3 | content: ""; 4 | display: table; 5 | clear: both; 6 | } 7 | } 8 | 9 | @mixin scrollBar { 10 | &::-webkit-scrollbar-track-piece { 11 | background: #d3dce6; 12 | } 13 | &::-webkit-scrollbar { 14 | width: 6px; 15 | } 16 | &::-webkit-scrollbar-thumb { 17 | background: #99a9bf; 18 | border-radius: 20px; 19 | } 20 | } 21 | 22 | @mixin relative { 23 | position: relative; 24 | width: 100%; 25 | height: 100%; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /frontend/src/styles/sidebar.scss: -------------------------------------------------------------------------------- 1 | #app { 2 | // 主体区域 3 | .main-container { 4 | min-height: 100%; 5 | transition: margin-left .28s; 6 | margin-left: 180px; 7 | position: relative; 8 | } 9 | // 侧边栏 10 | .sidebar-container { 11 | transition: width 0.28s; 12 | width: 180px !important; 13 | height: 100%; 14 | position: fixed; 15 | font-size: 0px; 16 | top: 0; 17 | bottom: 0; 18 | left: 0; 19 | z-index: 1001; 20 | overflow: hidden; 21 | //reset element-ui css 22 | .horizontal-collapse-transition { 23 | transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; 24 | } 25 | .scrollbar-wrapper { 26 | height: calc(100% + 15px); 27 | .el-scrollbar__view { 28 | height: 100%; 29 | } 30 | } 31 | .is-horizontal { 32 | display: none; 33 | } 34 | a { 35 | display: inline-block; 36 | width: 100%; 37 | overflow: hidden; 38 | } 39 | .svg-icon { 40 | margin-right: 16px; 41 | } 42 | .el-menu { 43 | border: none; 44 | height: 100%; 45 | width: 100% !important; 46 | } 47 | } 48 | .hideSidebar { 49 | .sidebar-container { 50 | width: 36px !important; 51 | } 52 | .main-container { 53 | margin-left: 36px; 54 | } 55 | .submenu-title-noDropdown { 56 | padding-left: 10px !important; 57 | position: relative; 58 | .el-tooltip { 59 | padding: 0 10px !important; 60 | } 61 | } 62 | .el-submenu { 63 | overflow: hidden; 64 | &>.el-submenu__title { 65 | padding-left: 10px !important; 66 | .el-submenu__icon-arrow { 67 | display: none; 68 | } 69 | } 70 | } 71 | .el-menu--collapse { 72 | .el-submenu { 73 | &>.el-submenu__title { 74 | &>span { 75 | height: 0; 76 | width: 0; 77 | overflow: hidden; 78 | visibility: hidden; 79 | display: inline-block; 80 | } 81 | } 82 | } 83 | } 84 | } 85 | .sidebar-container .nest-menu .el-submenu>.el-submenu__title, 86 | .sidebar-container .el-submenu .el-menu-item { 87 | min-width: 180px !important; 88 | background-color: $subMenuBg !important; 89 | &:hover { 90 | background-color: $menuHover !important; 91 | } 92 | } 93 | .el-menu--collapse .el-menu .el-submenu { 94 | min-width: 180px !important; 95 | } 96 | 97 | //适配移动端 98 | .mobile { 99 | .main-container { 100 | margin-left: 0px; 101 | } 102 | .sidebar-container { 103 | transition: transform .28s; 104 | width: 180px !important; 105 | } 106 | &.hideSidebar { 107 | .sidebar-container { 108 | transition-duration: 0.3s; 109 | transform: translate3d(-180px, 0, 0); 110 | } 111 | } 112 | } 113 | .withoutAnimation { 114 | .main-container, 115 | .sidebar-container { 116 | transition: none; 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /frontend/src/styles/transition.scss: -------------------------------------------------------------------------------- 1 | //globl transition css 2 | 3 | /*fade*/ 4 | .fade-enter-active, 5 | .fade-leave-active { 6 | transition: opacity 0.28s; 7 | } 8 | 9 | .fade-enter, 10 | .fade-leave-active { 11 | opacity: 0; 12 | } 13 | 14 | /*fade-transform*/ 15 | .fade-transform-leave-active, 16 | .fade-transform-enter-active { 17 | transition: all .5s; 18 | } 19 | .fade-transform-enter { 20 | opacity: 0; 21 | transform: translateX(-30px); 22 | } 23 | .fade-transform-leave-to { 24 | opacity: 0; 25 | transform: translateX(30px); 26 | } 27 | 28 | /*fade*/ 29 | .breadcrumb-enter-active, 30 | .breadcrumb-leave-active { 31 | transition: all .5s; 32 | } 33 | 34 | .breadcrumb-enter, 35 | .breadcrumb-leave-active { 36 | opacity: 0; 37 | transform: translateX(20px); 38 | } 39 | 40 | .breadcrumb-move { 41 | transition: all .5s; 42 | } 43 | 44 | .breadcrumb-leave-active { 45 | position: absolute; 46 | } 47 | -------------------------------------------------------------------------------- /frontend/src/styles/variables.scss: -------------------------------------------------------------------------------- 1 | //sidebar 2 | $menuBg:#304156; 3 | $subMenuBg:#1f2d3d; 4 | $menuHover:#001528; 5 | -------------------------------------------------------------------------------- /frontend/src/utils/auth.js: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | 3 | const TokenKey = 'Admin-Token' 4 | 5 | export function getToken() { 6 | return Cookies.get(TokenKey) 7 | } 8 | 9 | export function setToken(token) { 10 | return Cookies.set(TokenKey, token) 11 | } 12 | 13 | export function removeToken() { 14 | return Cookies.remove(TokenKey) 15 | } 16 | 17 | export function getName() { 18 | return Cookies.get('name') 19 | } 20 | -------------------------------------------------------------------------------- /frontend/src/utils/index.js: -------------------------------------------------------------------------------- 1 | export function parseTime(time, cFormat) { 2 | 3 | // if (arguments.length === 0) { 4 | // return null 5 | // } 6 | // const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' 7 | // let date 8 | // if (typeof time === 'object') { 9 | // date = time 10 | // } else { 11 | // if (('' + time).length === 10) { 12 | // time = parseInt(time) * 1000 13 | // } 14 | // date = new Date(time) 15 | // } 16 | // const formatObj = { 17 | // y: date.getFullYear(), 18 | // m: date.getMonth() + 1, 19 | // d: date.getDate(), 20 | // h: date.getHours(), 21 | // i: date.getMinutes(), 22 | // s: date.getSeconds(), 23 | // a: date.getDay() 24 | // } 25 | // const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { 26 | // let value = formatObj[key] 27 | // // Note: getDay() returns 0 on Sunday 28 | // if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] } 29 | // if (result.length > 0 && value < 10) { 30 | // value = '0' + value 31 | // } 32 | // return value || 0 33 | // }) 34 | // console.log(time) 35 | // console.log(typeof time) 36 | const time_str = time.substr(0, 19).replace('T', ' ') 37 | return time_str 38 | } 39 | 40 | export function formatTime(time, option) { 41 | time = +time * 1000 42 | const d = new Date(time) 43 | const now = Date.now() 44 | 45 | const diff = (now - d) / 1000 46 | 47 | if (diff < 30) { 48 | return '刚刚' 49 | } else if (diff < 3600) { 50 | // less 1 hour 51 | return Math.ceil(diff / 60) + '分钟前' 52 | } else if (diff < 3600 * 24) { 53 | return Math.ceil(diff / 3600) + '小时前' 54 | } else if (diff < 3600 * 24 * 2) { 55 | return '1天前' 56 | } 57 | if (option) { 58 | return parseTime(time, option) 59 | } else { 60 | return ( 61 | d.getMonth() + 62 | 1 + 63 | '月' + 64 | d.getDate() + 65 | '日' + 66 | d.getHours() + 67 | '时' + 68 | d.getMinutes() + 69 | '分' 70 | ) 71 | } 72 | } 73 | 74 | export function statusFilter(status) { 75 | const statusMap = { 76 | '0': '运行中', 77 | '1': '创建中', 78 | '-1': '关闭', 79 | '-2': '关闭中', 80 | '2': '更新中', 81 | '3': '启动中' 82 | } 83 | return statusMap[status] 84 | } 85 | 86 | export function typeFilter(type) { 87 | const typeMap = { 88 | 'rw': '读写分离版', 89 | 'shard': '分片版' 90 | } 91 | return typeMap[type] 92 | } 93 | -------------------------------------------------------------------------------- /frontend/src/utils/request.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | // import { Message, MessageBox } from 'element-ui' 3 | import { Message } from 'element-ui' 4 | import store from '../store' 5 | 6 | // 创建axios实例 7 | const service = axios.create({ 8 | timeout: 60000 // 请求超时时间 9 | }) 10 | 11 | // request拦截器 12 | service.interceptors.request.use( 13 | config => { 14 | if (store.getters.token) { 15 | config.headers.Authorization = `JWT ${store.getters.token}` 16 | } 17 | return config 18 | }, 19 | error => { 20 | // Do something with request error 21 | console.log(error) // for debug 22 | Promise.reject(error) 23 | } 24 | ) 25 | 26 | // response 拦截器 27 | service.interceptors.response.use( 28 | response => { 29 | return response 30 | // const res = response.data 31 | // if (res.code !== 200) { 32 | // Message({ 33 | // message: res.message, 34 | // type: 'error', 35 | // duration: 5 * 1000 36 | // }) 37 | // 38 | // // 50008:非法的token; 50012:其他客户端登录了; 50014:Token 过期了; 39 | // if (res.code === 50008 || res.code === 50012 || res.code === 50014) { 40 | // MessageBox.confirm( 41 | // '你已被登出,可以取消继续留在该页面,或者重新登录', 42 | // '确定登出', 43 | // { 44 | // confirmButtonText: '重新登录', 45 | // cancelButtonText: '取消', 46 | // type: 'warning' 47 | // } 48 | // ).then(() => { 49 | // store.dispatch('FedLogOut').then(() => { 50 | // location.reload() // 为了重新实例化vue-router对象 避免bug 51 | // }) 52 | // }) 53 | // } 54 | // return Promise.reject('error') 55 | // } else { 56 | // return response.data 57 | // } 58 | }, 59 | error => { 60 | if (error.response.status === 401) { 61 | store.dispatch('FedLogOut').then(() => { 62 | location.reload() 63 | }) 64 | Message({ 65 | message: '登陆超时', 66 | type: 'info' 67 | }) 68 | } 69 | // Message({ 70 | // message: error.response.data, 71 | // type: 'error', 72 | // duration: 5 * 1000 73 | // }) 74 | return Promise.reject(error) 75 | } 76 | ) 77 | 78 | export default service 79 | -------------------------------------------------------------------------------- /frontend/src/utils/validate.js: -------------------------------------------------------------------------------- 1 | export function validateURL(textval) { 2 | const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/ 3 | return urlregex.test(textval) 4 | } 5 | -------------------------------------------------------------------------------- /frontend/src/views/404.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 22 | -------------------------------------------------------------------------------- /frontend/src/views/docs/index.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /frontend/src/views/form/index.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 135 | 136 | 147 | 148 | -------------------------------------------------------------------------------- /frontend/src/views/form/tasks.vue: -------------------------------------------------------------------------------- 1 | 66 | 67 | 126 | 127 | 142 | -------------------------------------------------------------------------------- /frontend/src/views/item/chart.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 141 | -------------------------------------------------------------------------------- /frontend/src/views/item/command.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 92 | 93 | 103 | -------------------------------------------------------------------------------- /frontend/src/views/item/index.vue: -------------------------------------------------------------------------------- 1 | 35 | 79 | 143 | -------------------------------------------------------------------------------- /frontend/src/views/item/monitor.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 69 | 70 | 73 | -------------------------------------------------------------------------------- /frontend/src/views/layout/Layout.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 47 | 48 | 70 | -------------------------------------------------------------------------------- /frontend/src/views/layout/components/AppMain.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 21 | 22 | 30 | -------------------------------------------------------------------------------- /frontend/src/views/layout/components/Navbar.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 57 | 58 | 99 | 100 | -------------------------------------------------------------------------------- /frontend/src/views/layout/components/Sidebar/Item.vue: -------------------------------------------------------------------------------- 1 | 30 | -------------------------------------------------------------------------------- /frontend/src/views/layout/components/Sidebar/SidebarItem.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 97 | -------------------------------------------------------------------------------- /frontend/src/views/layout/components/Sidebar/index.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 36 | -------------------------------------------------------------------------------- /frontend/src/views/layout/components/index.js: -------------------------------------------------------------------------------- 1 | export { default as Navbar } from './Navbar' 2 | export { default as Sidebar } from './Sidebar' 3 | export { default as AppMain } from './AppMain' 4 | -------------------------------------------------------------------------------- /frontend/src/views/layout/mixin/ResizeHandler.js: -------------------------------------------------------------------------------- 1 | import store from '@/store' 2 | 3 | const { body } = document 4 | const WIDTH = 1024 5 | const RATIO = 3 6 | 7 | export default { 8 | watch: { 9 | $route(route) { 10 | if (this.device === 'mobile' && this.sidebar.opened) { 11 | store.dispatch('CloseSideBar', { withoutAnimation: false }) 12 | } 13 | } 14 | }, 15 | beforeMount() { 16 | window.addEventListener('resize', this.resizeHandler) 17 | }, 18 | mounted() { 19 | const isMobile = this.isMobile() 20 | if (isMobile) { 21 | store.dispatch('ToggleDevice', 'mobile') 22 | store.dispatch('CloseSideBar', { withoutAnimation: true }) 23 | } 24 | }, 25 | methods: { 26 | isMobile() { 27 | const rect = body.getBoundingClientRect() 28 | return rect.width - RATIO < WIDTH 29 | }, 30 | resizeHandler() { 31 | if (!document.hidden) { 32 | const isMobile = this.isMobile() 33 | store.dispatch('ToggleDevice', isMobile ? 'mobile' : 'desktop') 34 | 35 | if (isMobile) { 36 | store.dispatch('CloseSideBar', { withoutAnimation: true }) 37 | } 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /frontend/src/views/link/index.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 11 | 12 | 30 | -------------------------------------------------------------------------------- /frontend/src/views/login/index.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 95 | 96 | 129 | 130 | 186 | -------------------------------------------------------------------------------- /frontend/static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/.gitkeep -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/codesample/css/prism.css: -------------------------------------------------------------------------------- 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */ 2 | /** 3 | * prism.js default theme for JavaScript, CSS and HTML 4 | * Based on dabblet (http://dabblet.com) 5 | * @author Lea Verou 6 | */ 7 | 8 | code[class*="language-"], 9 | pre[class*="language-"] { 10 | color: black; 11 | text-shadow: 0 1px white; 12 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 13 | direction: ltr; 14 | text-align: left; 15 | white-space: pre; 16 | word-spacing: normal; 17 | word-break: normal; 18 | word-wrap: normal; 19 | line-height: 1.5; 20 | 21 | -moz-tab-size: 4; 22 | -o-tab-size: 4; 23 | tab-size: 4; 24 | 25 | -webkit-hyphens: none; 26 | -moz-hyphens: none; 27 | -ms-hyphens: none; 28 | hyphens: none; 29 | } 30 | 31 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, 32 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { 33 | text-shadow: none; 34 | background: #b3d4fc; 35 | } 36 | 37 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection, 38 | code[class*="language-"]::selection, code[class*="language-"] ::selection { 39 | text-shadow: none; 40 | background: #b3d4fc; 41 | } 42 | 43 | @media print { 44 | code[class*="language-"], 45 | pre[class*="language-"] { 46 | text-shadow: none; 47 | } 48 | } 49 | 50 | /* Code blocks */ 51 | pre[class*="language-"] { 52 | padding: 1em; 53 | margin: .5em 0; 54 | overflow: auto; 55 | } 56 | 57 | :not(pre) > code[class*="language-"], 58 | pre[class*="language-"] { 59 | background: #f5f2f0; 60 | } 61 | 62 | /* Inline code */ 63 | :not(pre) > code[class*="language-"] { 64 | padding: .1em; 65 | border-radius: .3em; 66 | } 67 | 68 | .token.comment, 69 | .token.prolog, 70 | .token.doctype, 71 | .token.cdata { 72 | color: slategray; 73 | } 74 | 75 | .token.punctuation { 76 | color: #999; 77 | } 78 | 79 | .namespace { 80 | opacity: .7; 81 | } 82 | 83 | .token.property, 84 | .token.tag, 85 | .token.boolean, 86 | .token.number, 87 | .token.constant, 88 | .token.symbol, 89 | .token.deleted { 90 | color: #905; 91 | } 92 | 93 | .token.selector, 94 | .token.attr-name, 95 | .token.string, 96 | .token.char, 97 | .token.builtin, 98 | .token.inserted { 99 | color: #690; 100 | } 101 | 102 | .token.operator, 103 | .token.entity, 104 | .token.url, 105 | .language-css .token.string, 106 | .style .token.string { 107 | color: #a67f59; 108 | background: hsla(0, 0%, 100%, .5); 109 | } 110 | 111 | .token.atrule, 112 | .token.attr-value, 113 | .token.keyword { 114 | color: #07a; 115 | } 116 | 117 | .token.function { 118 | color: #DD4A68; 119 | } 120 | 121 | .token.regex, 122 | .token.important, 123 | .token.variable { 124 | color: #e90; 125 | } 126 | 127 | .token.important, 128 | .token.bold { 129 | font-weight: bold; 130 | } 131 | .token.italic { 132 | font-style: italic; 133 | } 134 | 135 | .token.entity { 136 | cursor: help; 137 | } 138 | 139 | -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-cool.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-cool.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-cry.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-cry.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-embarassed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-embarassed.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-foot-in-mouth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-foot-in-mouth.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-frown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-frown.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-innocent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-innocent.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-kiss.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-kiss.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-laughing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-laughing.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-money-mouth.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-money-mouth.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-sealed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-sealed.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-smile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-smile.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-surprised.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-surprised.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-tongue-out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-tongue-out.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-undecided.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-undecided.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-wink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-wink.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-yell.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/plugins/emoticons/img/smiley-yell.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/plugins/visualblocks/css/visualblocks.css: -------------------------------------------------------------------------------- 1 | .mce-visualblocks p { 2 | padding-top: 10px; 3 | border: 1px dashed #BBB; 4 | margin-left: 3px; 5 | background-image: url(data:image/gif;base64,R0lGODlhCQAJAJEAAAAAAP///7u7u////yH5BAEAAAMALAAAAAAJAAkAAAIQnG+CqCN/mlyvsRUpThG6AgA7); 6 | background-repeat: no-repeat; 7 | } 8 | 9 | .mce-visualblocks h1 { 10 | padding-top: 10px; 11 | border: 1px dashed #BBB; 12 | margin-left: 3px; 13 | background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGu1JuxHoAfRNRW3TWXyF2YiRUAOw==); 14 | background-repeat: no-repeat; 15 | } 16 | 17 | .mce-visualblocks h2 { 18 | padding-top: 10px; 19 | border: 1px dashed #BBB; 20 | margin-left: 3px; 21 | background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8Hybbx4oOuqgTynJd6bGlWg3DkJzoaUAAAOw==); 22 | background-repeat: no-repeat; 23 | } 24 | 25 | .mce-visualblocks h3 { 26 | padding-top: 10px; 27 | border: 1px dashed #BBB; 28 | margin-left: 3px; 29 | background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIZjI8Hybbx4oOuqgTynJf2Ln2NOHpQpmhAAQA7); 30 | background-repeat: no-repeat; 31 | } 32 | 33 | .mce-visualblocks h4 { 34 | padding-top: 10px; 35 | border: 1px dashed #BBB; 36 | margin-left: 3px; 37 | background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxInR0zqeAdhtJlXwV1oCll2HaWgAAOw==); 38 | background-repeat: no-repeat; 39 | } 40 | 41 | .mce-visualblocks h5 { 42 | padding-top: 10px; 43 | border: 1px dashed #BBB; 44 | margin-left: 3px; 45 | background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjane4iq5GlW05GgIkIZUAAAOw==); 46 | background-repeat: no-repeat; 47 | } 48 | 49 | .mce-visualblocks h6 { 50 | padding-top: 10px; 51 | border: 1px dashed #BBB; 52 | margin-left: 3px; 53 | background-image: url(data:image/gif;base64,R0lGODlhDgAKAIABALu7u////yH5BAEAAAEALAAAAAAOAAoAAAIajI8HybbxIoiuwjan04jep1iZ1XRlAo5bVgAAOw==); 54 | background-repeat: no-repeat; 55 | } 56 | 57 | .mce-visualblocks div:not([data-mce-bogus]) { 58 | padding-top: 10px; 59 | border: 1px dashed #BBB; 60 | margin-left: 3px; 61 | background-image: url(data:image/gif;base64,R0lGODlhEgAKAIABALu7u////yH5BAEAAAEALAAAAAASAAoAAAIfjI9poI0cgDywrhuxfbrzDEbQM2Ei5aRjmoySW4pAAQA7); 62 | background-repeat: no-repeat; 63 | } 64 | 65 | .mce-visualblocks section { 66 | padding-top: 10px; 67 | border: 1px dashed #BBB; 68 | margin: 0 0 1em 3px; 69 | background-image: url(data:image/gif;base64,R0lGODlhKAAKAIABALu7u////yH5BAEAAAEALAAAAAAoAAoAAAI5jI+pywcNY3sBWHdNrplytD2ellDeSVbp+GmWqaDqDMepc8t17Y4vBsK5hDyJMcI6KkuYU+jpjLoKADs=); 70 | background-repeat: no-repeat; 71 | } 72 | 73 | .mce-visualblocks article { 74 | padding-top: 10px; 75 | border: 1px dashed #BBB; 76 | margin: 0 0 1em 3px; 77 | background-image: url(data:image/gif;base64,R0lGODlhKgAKAIABALu7u////yH5BAEAAAEALAAAAAAqAAoAAAI6jI+pywkNY3wG0GBvrsd2tXGYSGnfiF7ikpXemTpOiJScasYoDJJrjsG9gkCJ0ag6KhmaIe3pjDYBBQA7); 78 | background-repeat: no-repeat; 79 | } 80 | 81 | .mce-visualblocks blockquote { 82 | padding-top: 10px; 83 | border: 1px dashed #BBB; 84 | background-image: url(data:image/gif;base64,R0lGODlhPgAKAIABALu7u////yH5BAEAAAEALAAAAAA+AAoAAAJPjI+py+0Knpz0xQDyuUhvfoGgIX5iSKZYgq5uNL5q69asZ8s5rrf0yZmpNkJZzFesBTu8TOlDVAabUyatguVhWduud3EyiUk45xhTTgMBBQA7); 85 | background-repeat: no-repeat; 86 | } 87 | 88 | .mce-visualblocks address { 89 | padding-top: 10px; 90 | border: 1px dashed #BBB; 91 | margin: 0 0 1em 3px; 92 | background-image: url(data:image/gif;base64,R0lGODlhLQAKAIABALu7u////yH5BAEAAAEALAAAAAAtAAoAAAI/jI+pywwNozSP1gDyyZcjb3UaRpXkWaXmZW4OqKLhBmLs+K263DkJK7OJeifh7FicKD9A1/IpGdKkyFpNmCkAADs=); 93 | background-repeat: no-repeat; 94 | } 95 | 96 | .mce-visualblocks pre { 97 | padding-top: 10px; 98 | border: 1px dashed #BBB; 99 | margin-left: 3px; 100 | background-image: url(data:image/gif;base64,R0lGODlhFQAKAIABALu7uwAAACH5BAEAAAEALAAAAAAVAAoAAAIjjI+ZoN0cgDwSmnpz1NCueYERhnibZVKLNnbOq8IvKpJtVQAAOw==); 101 | background-repeat: no-repeat; 102 | } 103 | 104 | .mce-visualblocks figure { 105 | padding-top: 10px; 106 | border: 1px dashed #BBB; 107 | margin: 0 0 1em 3px; 108 | background-image: url(data:image/gif;base64,R0lGODlhJAAKAIAAALu7u////yH5BAEAAAEALAAAAAAkAAoAAAI0jI+py+2fwAHUSFvD3RlvG4HIp4nX5JFSpnZUJ6LlrM52OE7uSWosBHScgkSZj7dDKnWAAgA7); 109 | background-repeat: no-repeat; 110 | } 111 | 112 | .mce-visualblocks hgroup { 113 | padding-top: 10px; 114 | border: 1px dashed #BBB; 115 | margin: 0 0 1em 3px; 116 | background-image: url(data:image/gif;base64,R0lGODlhJwAKAIABALu7uwAAACH5BAEAAAEALAAAAAAnAAoAAAI3jI+pywYNI3uB0gpsRtt5fFnfNZaVSYJil4Wo03Hv6Z62uOCgiXH1kZIIJ8NiIxRrAZNMZAtQAAA7); 117 | background-repeat: no-repeat; 118 | } 119 | 120 | .mce-visualblocks aside { 121 | padding-top: 10px; 122 | border: 1px dashed #BBB; 123 | margin: 0 0 1em 3px; 124 | background-image: url(data:image/gif;base64,R0lGODlhHgAKAIABAKqqqv///yH5BAEAAAEALAAAAAAeAAoAAAItjI+pG8APjZOTzgtqy7I3f1yehmQcFY4WKZbqByutmW4aHUd6vfcVbgudgpYCADs=); 125 | background-repeat: no-repeat; 126 | } 127 | 128 | .mce-visualblocks figcaption { 129 | border: 1px dashed #BBB; 130 | } 131 | 132 | .mce-visualblocks ul { 133 | padding-top: 10px; 134 | border: 1px dashed #BBB; 135 | margin: 0 0 1em 3px; 136 | background-image: url(data:image/gif;base64,R0lGODlhDQAKAIAAALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybGuYnqUVSjvw26DzzXiqIDlVwAAOw==); 137 | background-repeat: no-repeat; 138 | } 139 | 140 | .mce-visualblocks ol { 141 | padding-top: 10px; 142 | border: 1px dashed #BBB; 143 | margin: 0 0 1em 3px; 144 | background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybH6HHt0qourxC6CvzXieHyeWQAAOw==); 145 | background-repeat: no-repeat; 146 | } 147 | 148 | .mce-visualblocks dl { 149 | padding-top: 10px; 150 | border: 1px dashed #BBB; 151 | margin: 0 0 1em 3px; 152 | background-image: url(data:image/gif;base64,R0lGODlhDQAKAIABALu7u////yH5BAEAAAEALAAAAAANAAoAAAIXjI8GybEOnmOvUoWznTqeuEjNSCqeGRUAOw==); 153 | background-repeat: no-repeat; 154 | } 155 | -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/content.inline.min.css: -------------------------------------------------------------------------------- 1 | .word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid rgba(208,2,27,0.5);cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#2276d2 !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2276d2}.mce-content-body *[data-mce-selected="inline-boundary"]{background:#bfe6ff}.mce-content-body .mce-item-anchor[data-mce-selected]{background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-content-body hr{cursor:default}.ephox-snooker-resizer-bar{background-color:#2276d2;opacity:0}.ephox-snooker-resizer-cols{cursor:col-resize}.ephox-snooker-resizer-rows{cursor:row-resize}.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging{opacity:.2}.mce-content-body{line-height:1.3} -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/content.min.css: -------------------------------------------------------------------------------- 1 | body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;line-height:1.3;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid rgba(208,2,27,0.5);cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#2276d2 !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2276d2}.mce-content-body *[data-mce-selected="inline-boundary"]{background:#bfe6ff}.mce-content-body .mce-item-anchor[data-mce-selected]{background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-content-body hr{cursor:default}.ephox-snooker-resizer-bar{background-color:#2276d2;opacity:0}.ephox-snooker-resizer-cols{cursor:col-resize}.ephox-snooker-resizer-rows{cursor:row-resize}.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging{opacity:.2} a {color: #1478F0;} 2 | -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-mobile.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-mobile.woff -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.eot -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.ttf -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce-small.woff -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.eot -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.ttf -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/fonts/tinymce.woff -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/img/anchor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/img/anchor.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/img/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/img/loader.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/img/object.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/img/object.gif -------------------------------------------------------------------------------- /frontend/static/tinymce4.7.5/skins/lightgray/img/trans.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lede-Inc/Cetus-GUI/c58dcea37f23d0308170c465c5dee7db7209e7aa/frontend/static/tinymce4.7.5/skins/lightgray/img/trans.gif -------------------------------------------------------------------------------- /supervisor.cnf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | logfile=logs/supervisord.log 3 | logfile_backups=1 4 | stopsignal=QUIT 5 | 6 | [supervisorctl] 7 | 8 | [inet_http_server] 9 | port = 127.0.0.1:9001 10 | 11 | [rpcinterface:supervisor] 12 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 13 | 14 | [program:backend] 15 | directory=backend/ 16 | command=uwsgi --ini uwsgi.cnf 17 | redirect_stderr=true 18 | stdout_logfile=logs/supervisor_backend.log 19 | 20 | [program:cetus] 21 | directory=backend/ 22 | command=python manage.py celery worker -Q cetus -E -n cetus 23 | redirect_stderr=true 24 | stdout_logfile=logs/supervisor_cetus.log 25 | 26 | [program:monitor] 27 | directory=backend/ 28 | command=python manage.py celery worker -Q cetus_monitor -n cetus_monitor 29 | redirect_stderr=true 30 | stdout_logfile=logs/supervisor_monitor.log 31 | 32 | [program:beat] 33 | directory=backend/ 34 | command=python manage.py celery beat 35 | redirect_stderr=true 36 | stdout_logfile=logs/supervisor_beat.log 37 | 38 | [program:celerycam] 39 | directory=backend/ 40 | command=python manage.py celerycam 41 | redirect_stderr=true 42 | stdout_logfile=logs/supervisor_celerycam.log 43 | 44 | [program:frontend] 45 | directory=frontend/ 46 | command=npm run dev 47 | redirect_stderr=true 48 | stdout_logfile=logs/supervisor_frontend.log 49 | --------------------------------------------------------------------------------