mirror of https://github.com/jumpserver/jumpserver
perf: labels 支持颜色
parent
0b65e3ffda
commit
050ddc88f2
|
@ -113,7 +113,10 @@ class LabelRelatedField(serializers.RelatedField):
|
|||
def to_representation(self, value):
|
||||
if value is None:
|
||||
return value
|
||||
return str(value.label)
|
||||
label = value.label
|
||||
if not label:
|
||||
return None
|
||||
return {'id': label.id, 'name': label.name, 'value': label.value, 'color': label.color}
|
||||
|
||||
def to_internal_value(self, data):
|
||||
from labels.models import LabeledResource, Label
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
"Aliyun": "Alibaba cloud",
|
||||
"All": "All",
|
||||
"AllAccountTip": "All accounts already added on the asset",
|
||||
"AllAccounts": "All",
|
||||
"AllAccounts": "Existing accounts",
|
||||
"AllClickRead": "Mark all as read",
|
||||
"AllMembers": "All members",
|
||||
"AllowInvalidCert": "Ignore certificate check",
|
||||
|
@ -379,6 +379,7 @@
|
|||
"DefaultDatabase": "Default database",
|
||||
"DefaultPort": "Default port",
|
||||
"Delete": "Delete",
|
||||
"WeekAdd": "Weekly add",
|
||||
"DeleteConfirmMessage": "Deletion is irreversible, do you wish to continue?",
|
||||
"DeleteErrorMsg": "Delete failed",
|
||||
"DeleteNode": "Delete node",
|
||||
|
@ -656,7 +657,7 @@
|
|||
"LoginSSHKeySetting": "Login SSH Key",
|
||||
"LoginSucceeded": "Login successful",
|
||||
"LoginTitleTip": "Note: it will be displayed on the enterprise edition user ssh login koko login page (e.g.: welcome to use jumpserver open source bastion)",
|
||||
"LoginUserRanking": "Login account ranking",
|
||||
"LoginUserRanking": "Login user ranking",
|
||||
"LoginUserToday": "Users logged today",
|
||||
"LoginUsers": "Active account",
|
||||
"LogoIndexTip": "Tip: it will be displayed in the upper left corner of the page (recommended image size: 185px*55px)",
|
||||
|
@ -670,7 +671,7 @@
|
|||
"MFAOfUserFirstLoginUserGuidePage": "In order to protect your and the company's security, please carefully safeguard important sensitive information such as your account, password, and key (for example, set a complex password, and enable multi-factor authentication) <br/> personal information such as email, mobile number, and wechat are only used for user authentication and platform internal message notifications.",
|
||||
"MailRecipient": "Email recipient",
|
||||
"MailSend": "Sending",
|
||||
"ManualAccount": "Manual accounts",
|
||||
"ManualAccount": "Manual account",
|
||||
"ManualAccountTip": "Manual input of username/password upon login",
|
||||
"ManyChoose": "Select multiple",
|
||||
"MarkAsRead": "Mark as read",
|
||||
|
@ -861,7 +862,7 @@
|
|||
"QuickJob": "Adhoc",
|
||||
"QuickUpdate": "Quick update",
|
||||
"Radius": "Radius",
|
||||
"Ranking": "Ranking",
|
||||
"Ranking": "Rank",
|
||||
"RazorNotSupport": "Rdp client session, monitoring not supported",
|
||||
"ReLogin": "Login again",
|
||||
"ReLoginTitle": "Current third-party login user (cas/saml), not bound to mfa and does not support password verification, please login again.",
|
||||
|
@ -971,8 +972,8 @@
|
|||
"SSHPort": "SSH Port",
|
||||
"SSHSecretKey": "SSH Key",
|
||||
"SafeCommand": "Secure command",
|
||||
"SameAccount": "Same",
|
||||
"SameAccountTip": "Accounts with the same username as authorized users",
|
||||
"SameAccount": "Same account",
|
||||
"SameAccountTip": "Account with the same username as authorized users",
|
||||
"SameTypeAccountTip": "An account with the same username and key type already exists",
|
||||
"Saturday": "Sat",
|
||||
"Save": "Save",
|
||||
|
@ -1059,7 +1060,7 @@
|
|||
"SourceIP": "Source address",
|
||||
"SourcePort": "Source port",
|
||||
"Spec": "Specific",
|
||||
"SpecAccount": "Specified",
|
||||
"SpecAccount": "Specified accounts",
|
||||
"SpecAccountTip": "Specify username to choose authorized account",
|
||||
"SpecialSymbol": "Special char",
|
||||
"SpecificInfo": "Special information",
|
||||
|
|
|
@ -674,7 +674,7 @@
|
|||
"MenuAccounts": "账号管理",
|
||||
"MenuAcls": "访问控制",
|
||||
"MenuAssets": "资产管理",
|
||||
"MenuMore": "更多...",
|
||||
"MenuMore": "其它",
|
||||
"MenuPermissions": "授权管理",
|
||||
"MenuUsers": "用户管理",
|
||||
"Message": "消息",
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# Generated by Django 4.1.13 on 2024-06-04 03:50
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("labels", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="label",
|
||||
name="color",
|
||||
field=models.CharField(
|
||||
blank=True, default="", max_length=32, verbose_name="Color"
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="labeledresource",
|
||||
name="label",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="labeled_resources",
|
||||
to="labels.label",
|
||||
verbose_name="Tag",
|
||||
),
|
||||
),
|
||||
]
|
|
@ -11,6 +11,9 @@ class Label(JMSOrgBaseModel):
|
|||
name = models.CharField(max_length=64, verbose_name=_("Name"), db_index=True)
|
||||
value = models.CharField(max_length=64, unique=False, verbose_name=_("Value"))
|
||||
internal = models.BooleanField(default=False, verbose_name=_("Internal"))
|
||||
color = models.CharField(
|
||||
max_length=32, default="", blank=True, verbose_name=_("Color")
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = [("name", "value", "org_id")]
|
||||
|
|
|
@ -14,8 +14,8 @@ class LabelSerializer(BulkOrgResourceModelSerializer):
|
|||
class Meta:
|
||||
model = Label
|
||||
fields = [
|
||||
'id', 'name', 'value', 'res_count', 'comment',
|
||||
'date_created', 'date_updated'
|
||||
'id', 'name', 'value', 'color', 'res_count',
|
||||
'comment', 'date_created', 'date_updated'
|
||||
]
|
||||
read_only_fields = ('date_created', 'date_updated', 'res_count')
|
||||
extra_kwargs = {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
# Generated by Django 4.1.13 on 2024-05-09 03:16
|
||||
|
||||
import uuid
|
||||
|
||||
import django.contrib.auth.models
|
||||
import django.utils.timezone
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from django.db import migrations, models
|
||||
|
||||
import common.db.fields
|
||||
import common.db.models
|
||||
from django.contrib.auth.hashers import make_password
|
||||
import common.utils.django
|
||||
from django.conf import settings
|
||||
import django.contrib.auth.models
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
import users.models.user
|
||||
import uuid
|
||||
|
||||
|
||||
|
||||
def add_default_group(apps, schema_editor):
|
||||
|
@ -62,7 +62,7 @@ class Migration(migrations.Migration):
|
|||
('avatar', models.ImageField(null=True, upload_to='avatar', verbose_name='Avatar')),
|
||||
('wechat', common.db.fields.EncryptCharField(blank=True, max_length=128, verbose_name='Wechat')),
|
||||
('phone', common.db.fields.EncryptCharField(blank=True, max_length=128, null=True, verbose_name='Phone')),
|
||||
('mfa_level', models.SmallIntegerField(choices=[(0, 'Disable'), (1, 'Enable'), (2, 'Force enable')], default=0, verbose_name='MFA')),
|
||||
('mfa_level', models.SmallIntegerField(choices=[(0, "Disabled"), (1, "Enabled"), (2, "Force enabled")], default=0, verbose_name='MFA')),
|
||||
('otp_secret_key', common.db.fields.EncryptCharField(blank=True, max_length=128, null=True, verbose_name='OTP secret key')),
|
||||
('private_key', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Private key')),
|
||||
('public_key', common.db.fields.EncryptTextField(blank=True, null=True, verbose_name='Public key')),
|
||||
|
|
Loading…
Reference in New Issue