diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index b68a30613..a54cc74e6 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -1713,6 +1713,18 @@ msgstr "Token错误或失效" msgid "Password not same" msgstr "密码不一致" +#: templates/_nav.html:43 +msgid "Job Center" +msgstr "作业中心" + +#: templates/_nav.html:46 +msgid "Sudo" +msgstr "Sudo管理" + +#: templates/_nav.html:47 +msgid "Cron" +msgstr "Cron管理" + #~ msgid "Admin password" #~ msgstr "管理员密码" diff --git a/apps/ops/models.py b/apps/ops/models.py index 23541a38f..4d2346f37 100644 --- a/apps/ops/models.py +++ b/apps/ops/models.py @@ -394,7 +394,7 @@ root ALL=(ALL:ALL) ALL class CronTable(models.Model): - name = models.CharField(max_length=128, blank=True, null=True, unique=True, verbose_name=_('Runas_Alias'), + name = models.CharField(max_length=128, blank=True, null=True, unique=True, verbose_name=_('Name'), help_text=_("Description of a crontab entry")) month = models.CharField(max_length=128, blank=True, null=True, verbose_name=_('Month'), help_text=_("Month of the year the job should run ( 1-12, *, */2, etc )")) diff --git a/apps/ops/templates/cron/create.html b/apps/ops/templates/cron/create.html new file mode 100644 index 000000000..566549bdf --- /dev/null +++ b/apps/ops/templates/cron/create.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/apps/ops/templates/cron/detail.html b/apps/ops/templates/cron/detail.html new file mode 100644 index 000000000..566549bdf --- /dev/null +++ b/apps/ops/templates/cron/detail.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/apps/ops/templates/cron/list.html b/apps/ops/templates/cron/list.html new file mode 100644 index 000000000..b08a44b53 --- /dev/null +++ b/apps/ops/templates/cron/list.html @@ -0,0 +1,242 @@ +{% extends '_base_list.html' %} +{% load i18n static %} +{% block custom_head_css_js %} +{{ block.super }} + +{% endblock %} +{% block table_search %}{% endblock %} +{% block table_container %} +
{% trans "Import user" %}
+
{% trans "Create user" %}
+ + + + + + + + + + + + + + + +
+
+
{% trans 'Name' %}{% trans 'Username' %}{% trans 'Role' %}{% trans 'User group' %}{% trans 'Asset num' %}{% trans 'Active' %}{% trans 'Action' %}
+
+
+ +
+ +
+
+
+{% include "users/_user_bulk_update_modal.html" %} +{% include "users/_user_import_modal.html" %} +{% endblock %} +{% block content_bottom_left %}{% endblock %} +{% block custom_foot_js %} + + +{% endblock %} + diff --git a/apps/ops/templates/cron/update.html b/apps/ops/templates/cron/update.html new file mode 100644 index 000000000..566549bdf --- /dev/null +++ b/apps/ops/templates/cron/update.html @@ -0,0 +1,10 @@ + + + + + Title + + + + + \ No newline at end of file diff --git a/apps/ops/templates/sudo/list.html b/apps/ops/templates/sudo/list.html index 566549bdf..b08a44b53 100644 --- a/apps/ops/templates/sudo/list.html +++ b/apps/ops/templates/sudo/list.html @@ -1,10 +1,242 @@ - - - - - Title - - +{% extends '_base_list.html' %} +{% load i18n static %} +{% block custom_head_css_js %} +{{ block.super }} + +{% endblock %} +{% block table_search %}{% endblock %} +{% block table_container %} +
{% trans "Import user" %}
+
{% trans "Create user" %}
+ + + + + + + + + + + + + + + +
+
+
{% trans 'Name' %}{% trans 'Username' %}{% trans 'Role' %}{% trans 'User group' %}{% trans 'Asset num' %}{% trans 'Active' %}{% trans 'Action' %}
+
+
+ +
+ +
+
+
+{% include "users/_user_bulk_update_modal.html" %} +{% include "users/_user_import_modal.html" %} +{% endblock %} +{% block content_bottom_left %}{% endblock %} +{% block custom_foot_js %} + + +{% endblock %} - - \ No newline at end of file diff --git a/apps/ops/urls.py b/apps/ops/urls.py index 205abf6d0..2735b1202 100644 --- a/apps/ops/urls.py +++ b/apps/ops/urls.py @@ -6,7 +6,7 @@ from django.conf.urls import url, include from api import views as api_view -import views as mvc_view +import views as page_view app_name = 'ops' @@ -23,10 +23,16 @@ router.register(r'cron', api_view.CronTableViewSet) urlpatterns = [ # Resource Sudo url - url(r'^sudo/list$', mvc_view.SudoListView.as_view(), name='sudo-list'), - url(r'^sudo/create$', mvc_view.SudoCreateView.as_view(), name='sudo-create'), - url(r'^sudo/detail$', mvc_view.SudoDetailView.as_view(), name='sudo-detail'), - url(r'^sudo/update$', mvc_view.SudoUpdateView.as_view(), name='sudo-update'), + url(r'^sudo/list$', page_view.SudoListView.as_view(), name='page-sudo-list'), + url(r'^sudo/create$', page_view.SudoCreateView.as_view(), name='page-sudo-create'), + url(r'^sudo/detail$', page_view.SudoDetailView.as_view(), name='page-sudo-detail'), + url(r'^sudo/update$', page_view.SudoUpdateView.as_view(), name='page-sudo-update'), + + # Resource Cron url + url(r'^cron/list$', page_view.CronListView.as_view(), name='page-cron-list'), + url(r'^cron/create$', page_view.CronCreateView.as_view(), name='page-cron-create'), + url(r'^cron/detail$', page_view.CronDetailView.as_view(), name='page-cron-detail'), + url(r'^cron/update$', page_view.CronUpdateView.as_view(), name='page-cron-update'), ] urlpatterns += [ diff --git a/apps/ops/views.py b/apps/ops/views.py index 6b05b0253..4b312dd2c 100644 --- a/apps/ops/views.py +++ b/apps/ops/views.py @@ -33,3 +33,26 @@ class SudoDetailView(DetailView): context_object_name = 'sudo' template_name = 'sudo/detail.html' + +class CronListView(AdminUserRequiredMixin, ListSudoPrivilegesMixin, ListView): + paginate_by = settings.CONFIG.DISPLAY_PER_PAGE + model = CronTable + context_object_name = 'crons' + template_name = 'sudo/list.html' + + +class CronCreateView(AdminUserRequiredMixin, CreateSudoPrivilegesMixin, CreateView): + model = CronTable + template_name = 'cron/create.html' + + +class CronUpdateView(AdminUserRequiredMixin, UpdateView): + model = CronTable + template_name = 'cron/update.html' + + +class CronDetailView(DetailView): + model = CronTable + context_object_name = 'sudo' + template_name = 'cron/detail.html' + diff --git a/apps/templates/_nav.html b/apps/templates/_nav.html index a0b9e82f8..fb3a47bf7 100644 --- a/apps/templates/_nav.html +++ b/apps/templates/_nav.html @@ -37,6 +37,17 @@ {# #} + +
  • + + {% trans 'Job Center' %} + + +
  • +
  • {% trans 'Audits' %}