Commit e15c9e65 authored by ibuler's avatar ibuler

[Update] 修改小bug

parents 94d65255 e7725e69
...@@ -41,9 +41,6 @@ class AssetCreateForm(OrgModelForm): ...@@ -41,9 +41,6 @@ class AssetCreateForm(OrgModelForm):
'nodes': _("Node"), 'nodes': _("Node"),
} }
help_texts = { help_texts = {
'hostname': '* required',
'ip': '* required',
'port': '* required',
'admin_user': _( 'admin_user': _(
'root or other NOPASSWD sudo privilege user existed in asset,' 'root or other NOPASSWD sudo privilege user existed in asset,'
'If asset is windows or other set any one, more see admin user left menu' 'If asset is windows or other set any one, more see admin user left menu'
...@@ -80,10 +77,6 @@ class AssetUpdateForm(OrgModelForm): ...@@ -80,10 +77,6 @@ class AssetUpdateForm(OrgModelForm):
'nodes': _("Node"), 'nodes': _("Node"),
} }
help_texts = { help_texts = {
'hostname': '* required',
'ip': '* required',
'port': '* required',
'cluster': '* required',
'admin_user': _( 'admin_user': _(
'root or other NOPASSWD sudo privilege user existed in asset,' 'root or other NOPASSWD sudo privilege user existed in asset,'
'If asset is windows or other set any one, more see admin user left menu' 'If asset is windows or other set any one, more see admin user left menu'
...@@ -95,7 +88,7 @@ class AssetUpdateForm(OrgModelForm): ...@@ -95,7 +88,7 @@ class AssetUpdateForm(OrgModelForm):
class AssetBulkUpdateForm(OrgModelForm): class AssetBulkUpdateForm(OrgModelForm):
assets = forms.ModelMultipleChoiceField( assets = forms.ModelMultipleChoiceField(
required=True, help_text='* required', required=True,
label=_('Select assets'), queryset=Asset.objects.all(), label=_('Select assets'), queryset=Asset.objects.all(),
widget=forms.SelectMultiple( widget=forms.SelectMultiple(
attrs={ attrs={
......
...@@ -61,7 +61,3 @@ class GatewayForm(PasswordAndKeyAuthForm, OrgModelForm): ...@@ -61,7 +61,3 @@ class GatewayForm(PasswordAndKeyAuthForm, OrgModelForm):
'name': forms.TextInput(attrs={'placeholder': _('Name')}), 'name': forms.TextInput(attrs={'placeholder': _('Name')}),
'username': forms.TextInput(attrs={'placeholder': _('Username')}), 'username': forms.TextInput(attrs={'placeholder': _('Username')}),
} }
help_texts = {
'name': '* required',
'username': '* required',
}
...@@ -80,10 +80,6 @@ class AdminUserForm(PasswordAndKeyAuthForm): ...@@ -80,10 +80,6 @@ class AdminUserForm(PasswordAndKeyAuthForm):
'name': forms.TextInput(attrs={'placeholder': _('Name')}), 'name': forms.TextInput(attrs={'placeholder': _('Name')}),
'username': forms.TextInput(attrs={'placeholder': _('Username')}), 'username': forms.TextInput(attrs={'placeholder': _('Username')}),
} }
help_texts = {
'name': '* required',
'username': '* required',
}
class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm): class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm):
...@@ -150,7 +146,6 @@ class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm): ...@@ -150,7 +146,6 @@ class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm):
}), }),
} }
help_texts = { help_texts = {
'name': '* required',
'auto_push': _('Auto push system user to asset'), 'auto_push': _('Auto push system user to asset'),
'priority': _('1-100, High level will be using login asset as default, ' 'priority': _('1-100, High level will be using login asset as default, '
'if user was granted more than 2 system user'), 'if user was granted more than 2 system user'),
......
...@@ -45,10 +45,10 @@ class Setting(models.Model): ...@@ -45,10 +45,10 @@ class Setting(models.Model):
def cleaned_value(self): def cleaned_value(self):
try: try:
value = self.value value = self.value
if not isinstance(value, (str, bytes)):
return value
if self.encrypted: if self.encrypted:
value = signer.unsign(value) value = signer.unsign(value)
if not value:
return None
value = json.loads(value) value = json.loads(value)
return value return value
except json.JSONDecodeError: except json.JSONDecodeError:
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
<label class="col-md-2 control-label" for="id_name">{% trans "Name" %}</label> <label class="col-md-2 control-label" for="id_name">{% trans "Name" %}</label>
<div class="col-md-9"> <div class="col-md-9">
<input id="id_name" class="form-control" type="text" name="NAME" value=""> <input id="id_name" class="form-control" type="text" name="NAME" value="">
<div class="help-block">* required</div>
<div id="id_error" style="color: red;"></div> <div id="id_error" style="color: red;"></div>
</div> </div>
</div> </div>
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
<label class="col-md-2 control-label" for="id_name">{% trans "Name" %}</label> <label class="col-md-2 control-label" for="id_name">{% trans "Name" %}</label>
<div class="col-md-9"> <div class="col-md-9">
<input id="id_name" class="form-control" type="text" name="NAME" value=""> <input id="id_name" class="form-control" type="text" name="NAME" value="">
<div class="help-block">* required</div>
<div id="id_error" style="color: red;"></div> <div id="id_error" style="color: red;"></div>
</div> </div>
</div> </div>
......
...@@ -49,7 +49,9 @@ class TreeNode: ...@@ -49,7 +49,9 @@ class TreeNode:
return False return False
elif not self.isParent and other.isParent: elif not self.isParent and other.isParent:
return True return True
return self.id > other.id if self.pId != other.pId:
return self.pId > other.pId
return self.name > other.name
def __eq__(self, other): def __eq__(self, other):
return self.id == other.id return self.id == other.id
......
...@@ -316,7 +316,7 @@ defaults = { ...@@ -316,7 +316,7 @@ defaults = {
'EMAIL_SUFFIX': 'jumpserver.org', 'EMAIL_SUFFIX': 'jumpserver.org',
'TERMINAL_PASSWORD_AUTH': True, 'TERMINAL_PASSWORD_AUTH': True,
'TERMINAL_PUBLIC_KEY_AUTH': True, 'TERMINAL_PUBLIC_KEY_AUTH': True,
'TERMINAL_HEARTBEAT_INTERVAL': 30, 'TERMINAL_HEARTBEAT_INTERVAL': 20,
'TERMINAL_ASSET_LIST_SORT_BY': 'hostname', 'TERMINAL_ASSET_LIST_SORT_BY': 'hostname',
'TERMINAL_ASSET_LIST_PAGE_SIZE': 'auto', 'TERMINAL_ASSET_LIST_PAGE_SIZE': 'auto',
'TERMINAL_SESSION_KEEP_DURATION': 9999, 'TERMINAL_SESSION_KEEP_DURATION': 9999,
......
...@@ -499,8 +499,9 @@ BOOTSTRAP3 = { ...@@ -499,8 +499,9 @@ BOOTSTRAP3 = {
# Field class to use in horizontal forms # Field class to use in horizontal forms
'horizontal_field_class': 'col-md-9', 'horizontal_field_class': 'col-md-9',
# Set placeholder attributes to label if no placeholder is provided # Set placeholder attributes to label if no placeholder is provided
'set_placeholder': True, 'set_placeholder': False,
'success_css_class': '', 'success_css_class': '',
'required_css_class': 'required',
} }
TOKEN_EXPIRATION = CONFIG.TOKEN_EXPIRATION TOKEN_EXPIRATION = CONFIG.TOKEN_EXPIRATION
......
...@@ -168,7 +168,10 @@ class AdHoc(models.Model): ...@@ -168,7 +168,10 @@ class AdHoc(models.Model):
@property @property
def tasks(self): def tasks(self):
try:
return json.loads(self._tasks) return json.loads(self._tasks)
except:
return []
@tasks.setter @tasks.setter
def tasks(self, item): def tasks(self, item):
......
...@@ -186,6 +186,19 @@ ...@@ -186,6 +186,19 @@
</div> </div>
</div> </div>
</div> </div>
{% include 'users/_user_update_pk_modal.html' %} {% endblock %}
{% block custom_foot_js %}
<script>
$(document).ready(function () {
}).on('click', '.celery-task-log', function () {
var history_pk = "{{ object.latest_history.pk }}";
if (!history_pk) {
alert("没有运行历史");
return
}
var url = '{% url 'ops:celery-task-log' pk=DEFAULT_PK %}'.replace('{{ DEFAULT_PK }}', history_pk);
window.open(url, '', 'width=800,height=600,left=400,top=400')
})
</script>
{% endblock %} {% endblock %}
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<a href="{% url 'ops:adhoc-history-detail' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history detail' %} </a> <a href="{% url 'ops:adhoc-history-detail' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history detail' %} </a>
</li> </li>
<li> <li>
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.pk %}','', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Output' %} </a> <a class="text-center celery-task-log" ><i class="fa fa-laptop"></i> {% trans 'Output' %} </a>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -141,4 +141,14 @@ ...@@ -141,4 +141,14 @@
</div> </div>
{% include 'users/_user_update_pk_modal.html' %} {% include 'users/_user_update_pk_modal.html' %}
{% endblock %} {% endblock %}
{% block custom_foot_js %}
<script>
$(document).ready(function () {
}).on('click', '.celery-task-log', function () {
var url = '{% url 'ops:celery-task-log' pk=object.pk %}';
window.open(url, '', 'width=800,height=600,left=400,top=400')
})
</script>
{% endblock %}
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a> <a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
</li> </li>
<li> <li>
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a> <a class="text-center celery-task-log" ><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -78,8 +78,8 @@ ...@@ -78,8 +78,8 @@
{% endblock %} {% endblock %}
{% block custom_foot_js %} {% block custom_foot_js %}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
var options = { var options = {
ele: $('#task-version-list-table'), ele: $('#task-version-list-table'),
buttons: [], buttons: [],
...@@ -124,6 +124,14 @@ ...@@ -124,6 +124,14 @@
{data: "run_as"}, {data: "become"}, {data: "date_created"}, {data: "id"}] {data: "run_as"}, {data: "become"}, {data: "date_created"}, {data: "id"}]
}; };
jumpserver.initDataTable(options); jumpserver.initDataTable(options);
}) }).on('click', '.celery-task-log', function () {
</script> var history_pk = "{{ object.latest_history.pk }}";
if (!history_pk) {
alert("没有运行历史");
return
}
var url = '{% url 'ops:celery-task-log' pk=DEFAULT_PK %}'.replace('{{ DEFAULT_PK }}', history_pk);
window.open(url, '', 'width=800,height=600,left=400,top=400')
})
</script>
{% endblock %} {% endblock %}
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a> <a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
</li> </li>
<li> <li>
<a class="text-center celery-task-log" onclick="window.open("{% url 'ops:celery-task-log' pk=object.latest_history.pk %}",'', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a> <a class="text-center celery-task-log"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -165,4 +165,19 @@ ...@@ -165,4 +165,19 @@
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block custom_foot_js %}
<script>
$(document).ready(function () {
}).on('click', '.celery-task-log', function () {
var history_pk = "{{ object.latest_history.pk }}";
if (!history_pk) {
alert("没有运行历史");
return
}
var url = '{% url 'ops:celery-task-log' pk=DEFAULT_PK %}'.replace('{{ DEFAULT_PK }}', history_pk);
window.open(url, '', 'width=800,height=600,left=400,top=400')
})
</script>
{% endblock %}
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a> <a href="{% url 'ops:task-history' pk=object.pk %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'Run history' %} </a>
</li> </li>
<li> <li>
<a class="text-center celery-task-log" onclick="window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600,left=400,top=400')"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a> <a class="text-center celery-task-log"><i class="fa fa-laptop"></i> {% trans 'Last run output' %} </a>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -148,6 +148,14 @@ function initTable() { ...@@ -148,6 +148,14 @@ function initTable() {
$(document).ready(function () { $(document).ready(function () {
initTable(); initTable();
}).on('click', '.celery-task-log', function () {
var history_pk = "{{ object.latest_history.pk }}";
if (!history_pk) {
alert("没有运行历史");
return
}
var url = '{% url 'ops:celery-task-log' pk=DEFAULT_PK %}'.replace('{{ DEFAULT_PK }}', history_pk);
window.open(url, '', 'width=800,height=600,left=400,top=400')
}) })
</script> </script>
......
...@@ -18,8 +18,7 @@ class GenerateTree: ...@@ -18,8 +18,7 @@ class GenerateTree:
"asset_instance": set("system_user") "asset_instance": set("system_user")
} }
""" """
self.__all_nodes = Node.objects.all() self.__all_nodes = list(Node.objects.all())
self.__node_asset_map = defaultdict(set)
self.nodes = defaultdict(dict) self.nodes = defaultdict(dict)
def add_asset(self, asset, system_users): def add_asset(self, asset, system_users):
......
...@@ -438,4 +438,7 @@ div.dataTables_wrapper div.dataTables_filter { ...@@ -438,4 +438,7 @@ div.dataTables_wrapper div.dataTables_filter {
white-space: nowrap; white-space: nowrap;
} }
.form-group .required .control-label:after {
content:"*";
color:red;
}
...@@ -63,11 +63,6 @@ class UserCreateUpdateForm(OrgModelForm): ...@@ -63,11 +63,6 @@ class UserCreateUpdateForm(OrgModelForm):
'username', 'name', 'email', 'groups', 'wechat', 'username', 'name', 'email', 'groups', 'wechat',
'phone', 'role', 'date_expired', 'comment', 'otp_level' 'phone', 'role', 'date_expired', 'comment', 'otp_level'
] ]
help_texts = {
'username': '* required',
'name': '* required',
'email': '* required',
}
widgets = { widgets = {
'otp_level': forms.RadioSelect(), 'otp_level': forms.RadioSelect(),
'groups': forms.SelectMultiple( 'groups': forms.SelectMultiple(
...@@ -141,11 +136,6 @@ class UserProfileForm(forms.ModelForm): ...@@ -141,11 +136,6 @@ class UserProfileForm(forms.ModelForm):
'username', 'name', 'email', 'username', 'name', 'email',
'wechat', 'phone', 'wechat', 'phone',
] ]
help_texts = {
'username': '* required',
'name': '* required',
'email': '* required',
}
UserProfileForm.verbose_name = _("Profile") UserProfileForm.verbose_name = _("Profile")
...@@ -263,7 +253,6 @@ UserPublicKeyForm.verbose_name = _("Public key") ...@@ -263,7 +253,6 @@ UserPublicKeyForm.verbose_name = _("Public key")
class UserBulkUpdateForm(OrgModelForm): class UserBulkUpdateForm(OrgModelForm):
users = forms.ModelMultipleChoiceField( users = forms.ModelMultipleChoiceField(
required=True, required=True,
help_text='* required',
label=_('Select users'), label=_('Select users'),
queryset=User.objects.all(), queryset=User.objects.all(),
widget=forms.SelectMultiple( widget=forms.SelectMultiple(
...@@ -346,9 +335,6 @@ class UserGroupForm(OrgModelForm): ...@@ -346,9 +335,6 @@ class UserGroupForm(OrgModelForm):
fields = [ fields = [
'name', 'users', 'comment', 'name', 'users', 'comment',
] ]
help_texts = {
'name': '* required'
}
class FileForm(forms.Form): class FileForm(forms.Form):
......
...@@ -78,7 +78,7 @@ class Config: ...@@ -78,7 +78,7 @@ class Config:
REDIS_HOST = '127.0.0.1' REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379 REDIS_PORT = 6379
# REDIS_PASSWORD = '' # REDIS_PASSWORD = ''
# REDIS_DB_CELERY_BROKER = 3 # REDIS_DB_CELERY = 3
# REDIS_DB_CACHE = 4 # REDIS_DB_CACHE = 4
# Use OpenID authorization # Use OpenID authorization
......
libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk python-dev openssl libssl-dev libldap2-dev libsasl2-dev sqlite libkrb5-dev sshpass libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk python-dev openssl libssl-dev libldap2-dev libsasl2-dev sqlite libkrb5-dev sshpass libmysqlclient-dev
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment