mirror of https://github.com/jumpserver/jumpserver
perf: tags update
parent
cd1f6a9137
commit
7be6cf2b73
|
@ -122,11 +122,17 @@ class LabelRelatedField(serializers.RelatedField):
|
||||||
from labels.models import LabeledResource, Label
|
from labels.models import LabeledResource, Label
|
||||||
if data is None:
|
if data is None:
|
||||||
return data
|
return data
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict) and data.get("id"):
|
||||||
pk = data.get("id") or data.get("pk")
|
pk = data.get("id") or data.get("pk")
|
||||||
label = Label.objects.get(pk=pk)
|
label = Label.objects.get(pk=pk)
|
||||||
else:
|
else:
|
||||||
|
if isinstance(data, dict):
|
||||||
|
k = data.get("name")
|
||||||
|
v = data.get("value")
|
||||||
|
elif isinstance(data, str) and ":" in data:
|
||||||
k, v = data.split(":", 1)
|
k, v = data.split(":", 1)
|
||||||
|
else:
|
||||||
|
raise serializers.ValidationError(_("Invalid data type"))
|
||||||
label, __ = Label.objects.get_or_create(name=k, value=v, defaults={'name': k, 'value': v})
|
label, __ = Label.objects.get_or_create(name=k, value=v, defaults={'name': k, 'value': v})
|
||||||
return LabeledResource(label=label)
|
return LabeledResource(label=label)
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@
|
||||||
"Disable": "Disable",
|
"Disable": "Disable",
|
||||||
"DisableSelected": "Disable selected",
|
"DisableSelected": "Disable selected",
|
||||||
"DisplayName": "Name",
|
"DisplayName": "Name",
|
||||||
"Docs": "Document",
|
"Docs": "Docs",
|
||||||
"Download": "Download",
|
"Download": "Download",
|
||||||
"DownloadCenter": "Download",
|
"DownloadCenter": "Download",
|
||||||
"DownloadFTPFileTip": "The current action does not record files, or the file size exceeds the threshold (default 100m), or it has not yet been saved to the corresponding storage",
|
"DownloadFTPFileTip": "The current action does not record files, or the file size exceeds the threshold (default 100m), or it has not yet been saved to the corresponding storage",
|
||||||
|
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue