R: Change fieldname comment to description
This commit is contained in:
parent
03fc03a108
commit
417583efa5
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.1.7 on 2025-03-25 09:44
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('library', '0005_alter_libraryitem_owner'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='libraryitem',
|
||||||
|
name='comment',
|
||||||
|
field=models.TextField(blank=True, verbose_name='Описание'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.1.7 on 2025-03-25 19:13
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('library', '0006_alter_libraryitem_comment'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='libraryitem',
|
||||||
|
old_name='comment',
|
||||||
|
new_name='description',
|
||||||
|
),
|
||||||
|
]
|
|
@ -69,8 +69,8 @@ class LibraryItem(Model):
|
||||||
max_length=255,
|
max_length=255,
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
comment = TextField(
|
description = TextField(
|
||||||
verbose_name='Комментарий',
|
verbose_name='Описание',
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
visible = BooleanField(
|
visible = BooleanField(
|
||||||
|
|
|
@ -46,7 +46,7 @@ class TestLibraryItem(TestCase):
|
||||||
self.assertIsNone(item.owner)
|
self.assertIsNone(item.owner)
|
||||||
self.assertEqual(item.title, 'Test')
|
self.assertEqual(item.title, 'Test')
|
||||||
self.assertEqual(item.alias, '')
|
self.assertEqual(item.alias, '')
|
||||||
self.assertEqual(item.comment, '')
|
self.assertEqual(item.description, '')
|
||||||
self.assertEqual(item.visible, True)
|
self.assertEqual(item.visible, True)
|
||||||
self.assertEqual(item.read_only, False)
|
self.assertEqual(item.read_only, False)
|
||||||
self.assertEqual(item.access_policy, AccessPolicy.PUBLIC)
|
self.assertEqual(item.access_policy, AccessPolicy.PUBLIC)
|
||||||
|
@ -59,13 +59,13 @@ class TestLibraryItem(TestCase):
|
||||||
title='Test',
|
title='Test',
|
||||||
owner=self.user1,
|
owner=self.user1,
|
||||||
alias='KS1',
|
alias='KS1',
|
||||||
comment='Test comment',
|
description='Test description',
|
||||||
location=LocationHead.COMMON
|
location=LocationHead.COMMON
|
||||||
)
|
)
|
||||||
self.assertEqual(item.owner, self.user1)
|
self.assertEqual(item.owner, self.user1)
|
||||||
self.assertEqual(item.title, 'Test')
|
self.assertEqual(item.title, 'Test')
|
||||||
self.assertEqual(item.alias, 'KS1')
|
self.assertEqual(item.alias, 'KS1')
|
||||||
self.assertEqual(item.comment, 'Test comment')
|
self.assertEqual(item.description, 'Test description')
|
||||||
self.assertEqual(item.location, LocationHead.COMMON)
|
self.assertEqual(item.location, LocationHead.COMMON)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,13 @@ class LibraryViewSet(viewsets.ModelViewSet):
|
||||||
if operation.title != instance.title:
|
if operation.title != instance.title:
|
||||||
operation.title = instance.title
|
operation.title = instance.title
|
||||||
changed = True
|
changed = True
|
||||||
if operation.comment != instance.comment:
|
if operation.description != instance.description:
|
||||||
operation.comment = instance.comment
|
operation.description = instance.description
|
||||||
changed = True
|
changed = True
|
||||||
if changed:
|
if changed:
|
||||||
update_list.append(operation)
|
update_list.append(operation)
|
||||||
if update_list:
|
if update_list:
|
||||||
Operation.objects.bulk_update(update_list, ['alias', 'title', 'comment'])
|
Operation.objects.bulk_update(update_list, ['alias', 'title', 'description'])
|
||||||
|
|
||||||
def perform_destroy(self, instance: m.LibraryItem) -> None:
|
def perform_destroy(self, instance: m.LibraryItem) -> None:
|
||||||
if instance.item_type == m.LibraryItemType.RSFORM:
|
if instance.item_type == m.LibraryItemType.RSFORM:
|
||||||
|
@ -160,7 +160,7 @@ class LibraryViewSet(viewsets.ModelViewSet):
|
||||||
clone.owner = cast(User, self.request.user)
|
clone.owner = cast(User, self.request.user)
|
||||||
clone.title = serializer.validated_data['title']
|
clone.title = serializer.validated_data['title']
|
||||||
clone.alias = serializer.validated_data.get('alias', '')
|
clone.alias = serializer.validated_data.get('alias', '')
|
||||||
clone.comment = serializer.validated_data.get('comment', '')
|
clone.description = serializer.validated_data.get('description', '')
|
||||||
clone.visible = serializer.validated_data.get('visible', True)
|
clone.visible = serializer.validated_data.get('visible', True)
|
||||||
clone.read_only = False
|
clone.read_only = False
|
||||||
clone.access_policy = serializer.validated_data.get('access_policy', m.AccessPolicy.PUBLIC)
|
clone.access_policy = serializer.validated_data.get('access_policy', m.AccessPolicy.PUBLIC)
|
||||||
|
|
|
@ -7,7 +7,16 @@ from . import models
|
||||||
class OperationAdmin(admin.ModelAdmin):
|
class OperationAdmin(admin.ModelAdmin):
|
||||||
''' Admin model: Operation. '''
|
''' Admin model: Operation. '''
|
||||||
ordering = ['oss']
|
ordering = ['oss']
|
||||||
list_display = ['id', 'oss', 'operation_type', 'result', 'alias', 'title', 'comment', 'position_x', 'position_y']
|
list_display = [
|
||||||
|
'id',
|
||||||
|
'oss',
|
||||||
|
'operation_type',
|
||||||
|
'result',
|
||||||
|
'alias',
|
||||||
|
'title',
|
||||||
|
'description',
|
||||||
|
'position_x',
|
||||||
|
'position_y']
|
||||||
search_fields = ['id', 'operation_type', 'title', 'alias']
|
search_fields = ['id', 'operation_type', 'title', 'alias']
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.1.7 on 2025-03-25 09:44
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('oss', '0008_alter_operation_result'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='operation',
|
||||||
|
name='comment',
|
||||||
|
field=models.TextField(blank=True, verbose_name='Описание'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.1.7 on 2025-03-25 19:13
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('oss', '0009_alter_operation_comment'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='operation',
|
||||||
|
old_name='comment',
|
||||||
|
new_name='description',
|
||||||
|
),
|
||||||
|
]
|
|
@ -53,8 +53,8 @@ class Operation(Model):
|
||||||
verbose_name='Название',
|
verbose_name='Название',
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
comment = TextField(
|
description = TextField(
|
||||||
verbose_name='Комментарий',
|
verbose_name='Описание',
|
||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,8 @@ class OperationSchema:
|
||||||
if schema is not None:
|
if schema is not None:
|
||||||
operation.alias = schema.alias
|
operation.alias = schema.alias
|
||||||
operation.title = schema.title
|
operation.title = schema.title
|
||||||
operation.comment = schema.comment
|
operation.description = schema.description
|
||||||
operation.save(update_fields=['result', 'alias', 'title', 'comment'])
|
operation.save(update_fields=['result', 'alias', 'title', 'description'])
|
||||||
|
|
||||||
if schema is not None and has_children:
|
if schema is not None and has_children:
|
||||||
rsform = RSForm(schema)
|
rsform = RSForm(schema)
|
||||||
|
@ -227,7 +227,7 @@ class OperationSchema:
|
||||||
owner=self.model.owner,
|
owner=self.model.owner,
|
||||||
alias=operation.alias,
|
alias=operation.alias,
|
||||||
title=operation.title,
|
title=operation.title,
|
||||||
comment=operation.comment,
|
description=operation.description,
|
||||||
visible=False,
|
visible=False,
|
||||||
access_policy=self.model.access_policy,
|
access_policy=self.model.access_policy,
|
||||||
location=self.model.location
|
location=self.model.location
|
||||||
|
|
|
@ -44,7 +44,7 @@ class OperationCreateSerializer(serializers.Serializer):
|
||||||
model = Operation
|
model = Operation
|
||||||
fields = \
|
fields = \
|
||||||
'alias', 'operation_type', 'title', \
|
'alias', 'operation_type', 'title', \
|
||||||
'comment', 'result', 'position_x', 'position_y'
|
'description', 'result', 'position_x', 'position_y'
|
||||||
|
|
||||||
create_schema = serializers.BooleanField(default=False, required=False)
|
create_schema = serializers.BooleanField(default=False, required=False)
|
||||||
item_data = OperationCreateData()
|
item_data = OperationCreateData()
|
||||||
|
@ -63,7 +63,7 @@ class OperationUpdateSerializer(serializers.Serializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
''' serializer metadata. '''
|
''' serializer metadata. '''
|
||||||
model = Operation
|
model = Operation
|
||||||
fields = 'alias', 'title', 'comment'
|
fields = 'alias', 'title', 'description'
|
||||||
|
|
||||||
target = PKField(many=False, queryset=Operation.objects.all())
|
target = PKField(many=False, queryset=Operation.objects.all())
|
||||||
item_data = OperationUpdateData()
|
item_data = OperationUpdateData()
|
||||||
|
|
|
@ -28,6 +28,6 @@ class TestOperation(TestCase):
|
||||||
self.assertEqual(self.operation.result, None)
|
self.assertEqual(self.operation.result, None)
|
||||||
self.assertEqual(self.operation.alias, 'KS1')
|
self.assertEqual(self.operation.alias, 'KS1')
|
||||||
self.assertEqual(self.operation.title, '')
|
self.assertEqual(self.operation.title, '')
|
||||||
self.assertEqual(self.operation.comment, '')
|
self.assertEqual(self.operation.description, '')
|
||||||
self.assertEqual(self.operation.position_x, 0)
|
self.assertEqual(self.operation.position_x, 0)
|
||||||
self.assertEqual(self.operation.position_y, 0)
|
self.assertEqual(self.operation.position_y, 0)
|
||||||
|
|
|
@ -123,7 +123,7 @@ class TestChangeAttributes(EndpointTester):
|
||||||
|
|
||||||
@decl_endpoint('/api/library/{item}', method='patch')
|
@decl_endpoint('/api/library/{item}', method='patch')
|
||||||
def test_sync_from_result(self):
|
def test_sync_from_result(self):
|
||||||
data = {'alias': 'KS111', 'title': 'New Title', 'comment': 'New Comment'}
|
data = {'alias': 'KS111', 'title': 'New Title', 'description': 'New description'}
|
||||||
|
|
||||||
self.executeOK(data=data, item=self.ks1.model.pk)
|
self.executeOK(data=data, item=self.ks1.model.pk)
|
||||||
self.operation1.refresh_from_db()
|
self.operation1.refresh_from_db()
|
||||||
|
@ -131,7 +131,7 @@ class TestChangeAttributes(EndpointTester):
|
||||||
self.assertEqual(self.operation1.result, self.ks1.model)
|
self.assertEqual(self.operation1.result, self.ks1.model)
|
||||||
self.assertEqual(self.operation1.alias, data['alias'])
|
self.assertEqual(self.operation1.alias, data['alias'])
|
||||||
self.assertEqual(self.operation1.title, data['title'])
|
self.assertEqual(self.operation1.title, data['title'])
|
||||||
self.assertEqual(self.operation1.comment, data['comment'])
|
self.assertEqual(self.operation1.description, data['description'])
|
||||||
|
|
||||||
@decl_endpoint('/api/oss/{item}/update-operation', method='patch')
|
@decl_endpoint('/api/oss/{item}/update-operation', method='patch')
|
||||||
def test_sync_from_operation(self):
|
def test_sync_from_operation(self):
|
||||||
|
@ -140,7 +140,7 @@ class TestChangeAttributes(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test3 mod',
|
'alias': 'Test3 mod',
|
||||||
'title': 'Test title mod',
|
'title': 'Test title mod',
|
||||||
'comment': 'Comment mod'
|
'description': 'Comment mod'
|
||||||
},
|
},
|
||||||
'positions': [],
|
'positions': [],
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ class TestChangeAttributes(EndpointTester):
|
||||||
self.ks3.refresh_from_db()
|
self.ks3.refresh_from_db()
|
||||||
self.assertEqual(self.ks3.model.alias, data['item_data']['alias'])
|
self.assertEqual(self.ks3.model.alias, data['item_data']['alias'])
|
||||||
self.assertEqual(self.ks3.model.title, data['item_data']['title'])
|
self.assertEqual(self.ks3.model.title, data['item_data']['title'])
|
||||||
self.assertEqual(self.ks3.model.comment, data['item_data']['comment'])
|
self.assertEqual(self.ks3.model.description, data['item_data']['description'])
|
||||||
|
|
||||||
@decl_endpoint('/api/library/{item}', method='delete')
|
@decl_endpoint('/api/library/{item}', method='delete')
|
||||||
def test_destroy_oss_consequence(self):
|
def test_destroy_oss_consequence(self):
|
||||||
|
|
|
@ -281,7 +281,7 @@ class TestChangeOperations(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test4 mod',
|
'alias': 'Test4 mod',
|
||||||
'title': 'Test title mod',
|
'title': 'Test title mod',
|
||||||
'comment': 'Comment mod'
|
'description': 'Comment mod'
|
||||||
},
|
},
|
||||||
'positions': [],
|
'positions': [],
|
||||||
'substitutions': [
|
'substitutions': [
|
||||||
|
@ -315,7 +315,7 @@ class TestChangeOperations(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test4 mod',
|
'alias': 'Test4 mod',
|
||||||
'title': 'Test title mod',
|
'title': 'Test title mod',
|
||||||
'comment': 'Comment mod'
|
'description': 'Comment mod'
|
||||||
},
|
},
|
||||||
'positions': [],
|
'positions': [],
|
||||||
'arguments': [self.operation1.pk],
|
'arguments': [self.operation1.pk],
|
||||||
|
|
|
@ -143,7 +143,7 @@ class TestOssViewset(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test3',
|
'alias': 'Test3',
|
||||||
'title': 'Test title',
|
'title': 'Test title',
|
||||||
'comment': 'Тест кириллицы',
|
'description': 'Тест кириллицы',
|
||||||
'position_x': 1,
|
'position_x': 1,
|
||||||
'position_y': 1,
|
'position_y': 1,
|
||||||
},
|
},
|
||||||
|
@ -165,7 +165,7 @@ class TestOssViewset(EndpointTester):
|
||||||
self.assertEqual(new_operation['alias'], data['item_data']['alias'])
|
self.assertEqual(new_operation['alias'], data['item_data']['alias'])
|
||||||
self.assertEqual(new_operation['operation_type'], data['item_data']['operation_type'])
|
self.assertEqual(new_operation['operation_type'], data['item_data']['operation_type'])
|
||||||
self.assertEqual(new_operation['title'], data['item_data']['title'])
|
self.assertEqual(new_operation['title'], data['item_data']['title'])
|
||||||
self.assertEqual(new_operation['comment'], data['item_data']['comment'])
|
self.assertEqual(new_operation['description'], data['item_data']['description'])
|
||||||
self.assertEqual(new_operation['position_x'], data['item_data']['position_x'])
|
self.assertEqual(new_operation['position_x'], data['item_data']['position_x'])
|
||||||
self.assertEqual(new_operation['position_y'], data['item_data']['position_y'])
|
self.assertEqual(new_operation['position_y'], data['item_data']['position_y'])
|
||||||
self.assertEqual(new_operation['result'], None)
|
self.assertEqual(new_operation['result'], None)
|
||||||
|
@ -223,7 +223,7 @@ class TestOssViewset(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test4',
|
'alias': 'Test4',
|
||||||
'title': 'Test title',
|
'title': 'Test title',
|
||||||
'comment': 'Comment',
|
'description': 'Comment',
|
||||||
'operation_type': OperationType.INPUT,
|
'operation_type': OperationType.INPUT,
|
||||||
'result': self.ks1.model.pk
|
'result': self.ks1.model.pk
|
||||||
},
|
},
|
||||||
|
@ -238,7 +238,7 @@ class TestOssViewset(EndpointTester):
|
||||||
schema = LibraryItem.objects.get(pk=new_operation['result'])
|
schema = LibraryItem.objects.get(pk=new_operation['result'])
|
||||||
self.assertEqual(schema.alias, data['item_data']['alias'])
|
self.assertEqual(schema.alias, data['item_data']['alias'])
|
||||||
self.assertEqual(schema.title, data['item_data']['title'])
|
self.assertEqual(schema.title, data['item_data']['title'])
|
||||||
self.assertEqual(schema.comment, data['item_data']['comment'])
|
self.assertEqual(schema.description, data['item_data']['description'])
|
||||||
self.assertEqual(schema.visible, False)
|
self.assertEqual(schema.visible, False)
|
||||||
self.assertEqual(schema.access_policy, self.owned.model.access_policy)
|
self.assertEqual(schema.access_policy, self.owned.model.access_policy)
|
||||||
self.assertEqual(schema.location, self.owned.model.location)
|
self.assertEqual(schema.location, self.owned.model.location)
|
||||||
|
@ -286,7 +286,7 @@ class TestOssViewset(EndpointTester):
|
||||||
self.executeBadData(data=data, item=self.owned_id)
|
self.executeBadData(data=data, item=self.owned_id)
|
||||||
|
|
||||||
self.operation1.result = None
|
self.operation1.result = None
|
||||||
self.operation1.comment = 'TestComment'
|
self.operation1.description = 'TestComment'
|
||||||
self.operation1.title = 'TestTitle'
|
self.operation1.title = 'TestTitle'
|
||||||
self.operation1.save()
|
self.operation1.save()
|
||||||
response = self.executeOK(data=data)
|
response = self.executeOK(data=data)
|
||||||
|
@ -296,7 +296,7 @@ class TestOssViewset(EndpointTester):
|
||||||
self.assertEqual(new_schema['id'], self.operation1.result.pk)
|
self.assertEqual(new_schema['id'], self.operation1.result.pk)
|
||||||
self.assertEqual(new_schema['alias'], self.operation1.alias)
|
self.assertEqual(new_schema['alias'], self.operation1.alias)
|
||||||
self.assertEqual(new_schema['title'], self.operation1.title)
|
self.assertEqual(new_schema['title'], self.operation1.title)
|
||||||
self.assertEqual(new_schema['comment'], self.operation1.comment)
|
self.assertEqual(new_schema['description'], self.operation1.description)
|
||||||
|
|
||||||
data['target'] = self.operation3.pk
|
data['target'] = self.operation3.pk
|
||||||
self.executeBadData(data=data)
|
self.executeBadData(data=data)
|
||||||
|
@ -326,14 +326,14 @@ class TestOssViewset(EndpointTester):
|
||||||
data['input'] = self.ks1.model.pk
|
data['input'] = self.ks1.model.pk
|
||||||
self.ks1.model.alias = 'Test42'
|
self.ks1.model.alias = 'Test42'
|
||||||
self.ks1.model.title = 'Test421'
|
self.ks1.model.title = 'Test421'
|
||||||
self.ks1.model.comment = 'TestComment42'
|
self.ks1.model.description = 'TestComment42'
|
||||||
self.ks1.save()
|
self.ks1.save()
|
||||||
response = self.executeOK(data=data)
|
response = self.executeOK(data=data)
|
||||||
self.operation1.refresh_from_db()
|
self.operation1.refresh_from_db()
|
||||||
self.assertEqual(self.operation1.result, self.ks1.model)
|
self.assertEqual(self.operation1.result, self.ks1.model)
|
||||||
self.assertEqual(self.operation1.alias, self.ks1.model.alias)
|
self.assertEqual(self.operation1.alias, self.ks1.model.alias)
|
||||||
self.assertEqual(self.operation1.title, self.ks1.model.title)
|
self.assertEqual(self.operation1.title, self.ks1.model.title)
|
||||||
self.assertEqual(self.operation1.comment, self.ks1.model.comment)
|
self.assertEqual(self.operation1.description, self.ks1.model.description)
|
||||||
|
|
||||||
@decl_endpoint('/api/oss/{item}/set-input', method='patch')
|
@decl_endpoint('/api/oss/{item}/set-input', method='patch')
|
||||||
def test_set_input_change_schema(self):
|
def test_set_input_change_schema(self):
|
||||||
|
@ -382,7 +382,7 @@ class TestOssViewset(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test3 mod',
|
'alias': 'Test3 mod',
|
||||||
'title': 'Test title mod',
|
'title': 'Test title mod',
|
||||||
'comment': 'Comment mod'
|
'description': 'Comment mod'
|
||||||
},
|
},
|
||||||
'positions': [],
|
'positions': [],
|
||||||
'arguments': [self.operation2.pk, self.operation1.pk],
|
'arguments': [self.operation2.pk, self.operation1.pk],
|
||||||
|
@ -406,7 +406,7 @@ class TestOssViewset(EndpointTester):
|
||||||
self.operation3.refresh_from_db()
|
self.operation3.refresh_from_db()
|
||||||
self.assertEqual(self.operation3.alias, data['item_data']['alias'])
|
self.assertEqual(self.operation3.alias, data['item_data']['alias'])
|
||||||
self.assertEqual(self.operation3.title, data['item_data']['title'])
|
self.assertEqual(self.operation3.title, data['item_data']['title'])
|
||||||
self.assertEqual(self.operation3.comment, data['item_data']['comment'])
|
self.assertEqual(self.operation3.description, data['item_data']['description'])
|
||||||
args = self.operation3.getQ_arguments().order_by('order')
|
args = self.operation3.getQ_arguments().order_by('order')
|
||||||
self.assertEqual(args[0].argument.pk, data['arguments'][0])
|
self.assertEqual(args[0].argument.pk, data['arguments'][0])
|
||||||
self.assertEqual(args[0].order, 0)
|
self.assertEqual(args[0].order, 0)
|
||||||
|
@ -426,7 +426,7 @@ class TestOssViewset(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test3 mod',
|
'alias': 'Test3 mod',
|
||||||
'title': 'Test title mod',
|
'title': 'Test title mod',
|
||||||
'comment': 'Comment mod'
|
'description': 'Comment mod'
|
||||||
},
|
},
|
||||||
'positions': [],
|
'positions': [],
|
||||||
}
|
}
|
||||||
|
@ -435,10 +435,10 @@ class TestOssViewset(EndpointTester):
|
||||||
self.operation1.refresh_from_db()
|
self.operation1.refresh_from_db()
|
||||||
self.assertEqual(self.operation1.alias, data['item_data']['alias'])
|
self.assertEqual(self.operation1.alias, data['item_data']['alias'])
|
||||||
self.assertEqual(self.operation1.title, data['item_data']['title'])
|
self.assertEqual(self.operation1.title, data['item_data']['title'])
|
||||||
self.assertEqual(self.operation1.comment, data['item_data']['comment'])
|
self.assertEqual(self.operation1.description, data['item_data']['description'])
|
||||||
self.assertEqual(self.operation1.result.alias, data['item_data']['alias'])
|
self.assertEqual(self.operation1.result.alias, data['item_data']['alias'])
|
||||||
self.assertEqual(self.operation1.result.title, data['item_data']['title'])
|
self.assertEqual(self.operation1.result.title, data['item_data']['title'])
|
||||||
self.assertEqual(self.operation1.result.comment, data['item_data']['comment'])
|
self.assertEqual(self.operation1.result.description, data['item_data']['description'])
|
||||||
|
|
||||||
@decl_endpoint('/api/oss/{item}/update-operation', method='patch')
|
@decl_endpoint('/api/oss/{item}/update-operation', method='patch')
|
||||||
def test_update_operation_invalid_substitution(self):
|
def test_update_operation_invalid_substitution(self):
|
||||||
|
@ -451,7 +451,7 @@ class TestOssViewset(EndpointTester):
|
||||||
'item_data': {
|
'item_data': {
|
||||||
'alias': 'Test3 mod',
|
'alias': 'Test3 mod',
|
||||||
'title': 'Test title mod',
|
'title': 'Test title mod',
|
||||||
'comment': 'Comment mod'
|
'description': 'Comment mod'
|
||||||
},
|
},
|
||||||
'positions': [],
|
'positions': [],
|
||||||
'arguments': [self.operation1.pk, self.operation2.pk],
|
'arguments': [self.operation1.pk, self.operation2.pk],
|
||||||
|
@ -490,7 +490,7 @@ class TestOssViewset(EndpointTester):
|
||||||
self.operation3.refresh_from_db()
|
self.operation3.refresh_from_db()
|
||||||
schema = self.operation3.result
|
schema = self.operation3.result
|
||||||
self.assertEqual(schema.alias, self.operation3.alias)
|
self.assertEqual(schema.alias, self.operation3.alias)
|
||||||
self.assertEqual(schema.comment, self.operation3.comment)
|
self.assertEqual(schema.description, self.operation3.description)
|
||||||
self.assertEqual(schema.title, self.operation3.title)
|
self.assertEqual(schema.title, self.operation3.title)
|
||||||
self.assertEqual(schema.visible, False)
|
self.assertEqual(schema.visible, False)
|
||||||
items = list(RSForm(schema).constituents())
|
items = list(RSForm(schema).constituents())
|
||||||
|
|
|
@ -295,15 +295,15 @@ class OssViewSet(viewsets.GenericViewSet, generics.ListAPIView, generics.Retriev
|
||||||
oss.update_positions(serializer.validated_data['positions'])
|
oss.update_positions(serializer.validated_data['positions'])
|
||||||
operation.alias = serializer.validated_data['item_data']['alias']
|
operation.alias = serializer.validated_data['item_data']['alias']
|
||||||
operation.title = serializer.validated_data['item_data']['title']
|
operation.title = serializer.validated_data['item_data']['title']
|
||||||
operation.comment = serializer.validated_data['item_data']['comment']
|
operation.description = serializer.validated_data['item_data']['description']
|
||||||
operation.save(update_fields=['alias', 'title', 'comment'])
|
operation.save(update_fields=['alias', 'title', 'description'])
|
||||||
|
|
||||||
if operation.result is not None:
|
if operation.result is not None:
|
||||||
can_edit = permissions.can_edit_item(request.user, operation.result)
|
can_edit = permissions.can_edit_item(request.user, operation.result)
|
||||||
if can_edit or operation.operation_type == m.OperationType.SYNTHESIS:
|
if can_edit or operation.operation_type == m.OperationType.SYNTHESIS:
|
||||||
operation.result.alias = operation.alias
|
operation.result.alias = operation.alias
|
||||||
operation.result.title = operation.title
|
operation.result.title = operation.title
|
||||||
operation.result.comment = operation.comment
|
operation.result.description = operation.description
|
||||||
operation.result.save()
|
operation.result.save()
|
||||||
if 'arguments' in serializer.validated_data:
|
if 'arguments' in serializer.validated_data:
|
||||||
oss.set_arguments(operation.pk, serializer.validated_data['arguments'])
|
oss.set_arguments(operation.pk, serializer.validated_data['arguments'])
|
||||||
|
|
|
@ -42,7 +42,7 @@ class RSFormTRSSerializer(serializers.Serializer):
|
||||||
'type': _TRS_TYPE,
|
'type': _TRS_TYPE,
|
||||||
'title': schema.title,
|
'title': schema.title,
|
||||||
'alias': schema.alias,
|
'alias': schema.alias,
|
||||||
'comment': schema.comment,
|
'comment': schema.description,
|
||||||
'items': [],
|
'items': [],
|
||||||
'claimed': False,
|
'claimed': False,
|
||||||
'selection': [],
|
'selection': [],
|
||||||
|
@ -78,7 +78,7 @@ class RSFormTRSSerializer(serializers.Serializer):
|
||||||
'type': _TRS_TYPE,
|
'type': _TRS_TYPE,
|
||||||
'title': data['title'],
|
'title': data['title'],
|
||||||
'alias': data['alias'],
|
'alias': data['alias'],
|
||||||
'comment': data['comment'],
|
'comment': data['description'],
|
||||||
'items': [],
|
'items': [],
|
||||||
'claimed': False,
|
'claimed': False,
|
||||||
'selection': [],
|
'selection': [],
|
||||||
|
@ -123,7 +123,7 @@ class RSFormTRSSerializer(serializers.Serializer):
|
||||||
if self.context['load_meta']:
|
if self.context['load_meta']:
|
||||||
result['title'] = data.get('title', 'Без названия')
|
result['title'] = data.get('title', 'Без названия')
|
||||||
result['alias'] = data.get('alias', '')
|
result['alias'] = data.get('alias', '')
|
||||||
result['comment'] = data.get('comment', '')
|
result['description'] = data.get('description', '')
|
||||||
if 'id' in data:
|
if 'id' in data:
|
||||||
result['id'] = data['id']
|
result['id'] = data['id']
|
||||||
self.instance = RSForm.from_id(result['id'])
|
self.instance = RSForm.from_id(result['id'])
|
||||||
|
@ -144,7 +144,7 @@ class RSFormTRSSerializer(serializers.Serializer):
|
||||||
owner=validated_data.get('owner', None),
|
owner=validated_data.get('owner', None),
|
||||||
alias=validated_data['alias'],
|
alias=validated_data['alias'],
|
||||||
title=validated_data['title'],
|
title=validated_data['title'],
|
||||||
comment=validated_data['comment'],
|
description=validated_data['description'],
|
||||||
visible=validated_data['visible'],
|
visible=validated_data['visible'],
|
||||||
read_only=validated_data['read_only'],
|
read_only=validated_data['read_only'],
|
||||||
access_policy=validated_data['access_policy'],
|
access_policy=validated_data['access_policy'],
|
||||||
|
@ -171,8 +171,8 @@ class RSFormTRSSerializer(serializers.Serializer):
|
||||||
instance.model.alias = validated_data['alias']
|
instance.model.alias = validated_data['alias']
|
||||||
if 'title' in validated_data:
|
if 'title' in validated_data:
|
||||||
instance.model.title = validated_data['title']
|
instance.model.title = validated_data['title']
|
||||||
if 'comment' in validated_data:
|
if 'description' in validated_data:
|
||||||
instance.model.comment = validated_data['comment']
|
instance.model.description = validated_data['description']
|
||||||
|
|
||||||
order = 0
|
order = 0
|
||||||
prev_constituents = instance.constituents()
|
prev_constituents = instance.constituents()
|
||||||
|
|
|
@ -30,7 +30,7 @@ class TestRSFormViewset(EndpointTester):
|
||||||
work_dir = os.path.dirname(os.path.abspath(__file__))
|
work_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
data = {
|
data = {
|
||||||
'title': 'Test123',
|
'title': 'Test123',
|
||||||
'comment': '123',
|
'description': '123',
|
||||||
'alias': 'ks1',
|
'alias': 'ks1',
|
||||||
'location': LocationHead.PROJECTS,
|
'location': LocationHead.PROJECTS,
|
||||||
'access_policy': AccessPolicy.PROTECTED,
|
'access_policy': AccessPolicy.PROTECTED,
|
||||||
|
@ -45,7 +45,7 @@ class TestRSFormViewset(EndpointTester):
|
||||||
self.assertEqual(response.data['owner'], self.user.pk)
|
self.assertEqual(response.data['owner'], self.user.pk)
|
||||||
self.assertEqual(response.data['title'], data['title'])
|
self.assertEqual(response.data['title'], data['title'])
|
||||||
self.assertEqual(response.data['alias'], data['alias'])
|
self.assertEqual(response.data['alias'], data['alias'])
|
||||||
self.assertEqual(response.data['comment'], data['comment'])
|
self.assertEqual(response.data['description'], data['description'])
|
||||||
|
|
||||||
|
|
||||||
@decl_endpoint('/api/rsforms', method='get')
|
@decl_endpoint('/api/rsforms', method='get')
|
||||||
|
|
|
@ -586,8 +586,8 @@ def _prepare_rsform_data(data: dict, request: Request, owner: Union[User, None])
|
||||||
data['title'] = 'Без названия ' + request.FILES['file'].fileName
|
data['title'] = 'Без названия ' + request.FILES['file'].fileName
|
||||||
if 'alias' in request.data and request.data['alias'] != '':
|
if 'alias' in request.data and request.data['alias'] != '':
|
||||||
data['alias'] = request.data['alias']
|
data['alias'] = request.data['alias']
|
||||||
if 'comment' in request.data and request.data['comment'] != '':
|
if 'description' in request.data and request.data['description'] != '':
|
||||||
data['comment'] = request.data['comment']
|
data['description'] = request.data['description']
|
||||||
|
|
||||||
visible = True
|
visible = True
|
||||||
if 'visible' in request.data:
|
if 'visible' in request.data:
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
"owner": 1,
|
"owner": 1,
|
||||||
"title": "Банк выражений",
|
"title": "Банк выражений",
|
||||||
"alias": "БВ",
|
"alias": "БВ",
|
||||||
"comment": "Банк шаблонов для генерации выражений",
|
"description": "Банк шаблонов для генерации выражений",
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
"owner": 5,
|
"owner": 5,
|
||||||
"title": "Групповая операция",
|
"title": "Групповая операция",
|
||||||
"alias": "БК09",
|
"alias": "БК09",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
"owner": 3,
|
"owner": 3,
|
||||||
"title": "Булева алгебра",
|
"title": "Булева алгебра",
|
||||||
"alias": "БК12",
|
"alias": "БК12",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
"owner": 3,
|
"owner": 3,
|
||||||
"title": "Генеалогия",
|
"title": "Генеалогия",
|
||||||
"alias": "D0001",
|
"alias": "D0001",
|
||||||
"comment": "построено на основе понятия \"родство\" из Википедии",
|
"description": "построено на основе понятия \"родство\" из Википедии",
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
"owner": 1,
|
"owner": 1,
|
||||||
"title": "Вещества и смеси",
|
"title": "Вещества и смеси",
|
||||||
"alias": "КС Вещества",
|
"alias": "КС Вещества",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -173,7 +173,7 @@
|
||||||
"owner": 1,
|
"owner": 1,
|
||||||
"title": "Объект-объектные отношения",
|
"title": "Объект-объектные отношения",
|
||||||
"alias": "КС ООО",
|
"alias": "КС ООО",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -190,7 +190,7 @@
|
||||||
"owner": 1,
|
"owner": 1,
|
||||||
"title": "Процессы",
|
"title": "Процессы",
|
||||||
"alias": "КС Процессы",
|
"alias": "КС Процессы",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
"owner": 1,
|
"owner": 1,
|
||||||
"title": "Экологические правоотношения",
|
"title": "Экологические правоотношения",
|
||||||
"alias": "ЭКОС",
|
"alias": "ЭКОС",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": true,
|
"visible": true,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -224,7 +224,7 @@
|
||||||
"owner": 1,
|
"owner": 1,
|
||||||
"title": "Объектная среда",
|
"title": "Объектная среда",
|
||||||
"alias": "КС Объект-сред",
|
"alias": "КС Объект-сред",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
"owner": 1,
|
"owner": 1,
|
||||||
"title": "Процессные среды",
|
"title": "Процессные среды",
|
||||||
"alias": "КС Проц-сред",
|
"alias": "КС Проц-сред",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"read_only": false,
|
"read_only": false,
|
||||||
"access_policy": "public",
|
"access_policy": "public",
|
||||||
|
@ -6763,7 +6763,7 @@
|
||||||
"fields": {
|
"fields": {
|
||||||
"operation": 9,
|
"operation": 9,
|
||||||
"argument": 1,
|
"argument": 1,
|
||||||
"order": 0
|
"order": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -6772,7 +6772,7 @@
|
||||||
"fields": {
|
"fields": {
|
||||||
"operation": 9,
|
"operation": 9,
|
||||||
"argument": 2,
|
"argument": 2,
|
||||||
"order": 1
|
"order": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -6781,7 +6781,7 @@
|
||||||
"fields": {
|
"fields": {
|
||||||
"operation": 10,
|
"operation": 10,
|
||||||
"argument": 4,
|
"argument": 4,
|
||||||
"order": 0
|
"order": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -6790,7 +6790,7 @@
|
||||||
"fields": {
|
"fields": {
|
||||||
"operation": 10,
|
"operation": 10,
|
||||||
"argument": 9,
|
"argument": 9,
|
||||||
"order": 1
|
"order": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -7414,7 +7414,7 @@
|
||||||
"result": 38,
|
"result": 38,
|
||||||
"alias": "КС Вещества",
|
"alias": "КС Вещества",
|
||||||
"title": "Вещества и смеси",
|
"title": "Вещества и смеси",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"position_x": 530.0,
|
"position_x": 530.0,
|
||||||
"position_y": 370.0
|
"position_y": 370.0
|
||||||
}
|
}
|
||||||
|
@ -7428,7 +7428,7 @@
|
||||||
"result": 39,
|
"result": 39,
|
||||||
"alias": "КС ООО",
|
"alias": "КС ООО",
|
||||||
"title": "Объект-объектные отношения",
|
"title": "Объект-объектные отношения",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"position_x": 710.0,
|
"position_x": 710.0,
|
||||||
"position_y": 370.0
|
"position_y": 370.0
|
||||||
}
|
}
|
||||||
|
@ -7442,7 +7442,7 @@
|
||||||
"result": 40,
|
"result": 40,
|
||||||
"alias": "КС Процессы",
|
"alias": "КС Процессы",
|
||||||
"title": "Процессы",
|
"title": "Процессы",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"position_x": 890.0,
|
"position_x": 890.0,
|
||||||
"position_y": 370.0
|
"position_y": 370.0
|
||||||
}
|
}
|
||||||
|
@ -7456,7 +7456,7 @@
|
||||||
"result": 43,
|
"result": 43,
|
||||||
"alias": "КС Объект-сред",
|
"alias": "КС Объект-сред",
|
||||||
"title": "Объектная среда",
|
"title": "Объектная среда",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"position_x": 620.0,
|
"position_x": 620.0,
|
||||||
"position_y": 470.0
|
"position_y": 470.0
|
||||||
}
|
}
|
||||||
|
@ -7470,7 +7470,7 @@
|
||||||
"result": 44,
|
"result": 44,
|
||||||
"alias": "КС Проц-сред",
|
"alias": "КС Проц-сред",
|
||||||
"title": "Процессные среды",
|
"title": "Процессные среды",
|
||||||
"comment": "",
|
"description": "",
|
||||||
"position_x": 760.0,
|
"position_x": 760.0,
|
||||||
"position_y": 570.0
|
"position_y": 570.0
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ export const schemaLibraryItem = z.strictObject({
|
||||||
item_type: schemaLibraryItemType,
|
item_type: schemaLibraryItemType,
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
alias: z.string().nonempty(),
|
alias: z.string().nonempty(),
|
||||||
comment: z.string(),
|
description: z.string(),
|
||||||
visible: z.boolean(),
|
visible: z.boolean(),
|
||||||
read_only: z.boolean(),
|
read_only: z.boolean(),
|
||||||
location: z.string(),
|
location: z.string(),
|
||||||
|
@ -82,7 +82,7 @@ export const schemaCloneLibraryItem = schemaLibraryItem
|
||||||
item_type: true,
|
item_type: true,
|
||||||
title: true,
|
title: true,
|
||||||
alias: true,
|
alias: true,
|
||||||
comment: true,
|
description: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
read_only: true,
|
read_only: true,
|
||||||
location: true,
|
location: true,
|
||||||
|
@ -101,7 +101,7 @@ export const schemaCreateLibraryItem = z
|
||||||
item_type: schemaLibraryItemType,
|
item_type: schemaLibraryItemType,
|
||||||
title: z.string().optional(),
|
title: z.string().optional(),
|
||||||
alias: z.string().optional(),
|
alias: z.string().optional(),
|
||||||
comment: z.string(),
|
description: z.string(),
|
||||||
visible: z.boolean(),
|
visible: z.boolean(),
|
||||||
read_only: z.boolean(),
|
read_only: z.boolean(),
|
||||||
location: z.string().refine(data => validateLocation(data), { message: errorMsg.invalidLocation }),
|
location: z.string().refine(data => validateLocation(data), { message: errorMsg.invalidLocation }),
|
||||||
|
@ -124,7 +124,7 @@ export const schemaUpdateLibraryItem = z.strictObject({
|
||||||
item_type: schemaLibraryItemType,
|
item_type: schemaLibraryItemType,
|
||||||
title: z.string().nonempty(errorMsg.requiredField),
|
title: z.string().nonempty(errorMsg.requiredField),
|
||||||
alias: z.string().nonempty(errorMsg.requiredField),
|
alias: z.string().nonempty(errorMsg.requiredField),
|
||||||
comment: z.string(),
|
description: z.string(),
|
||||||
visible: z.boolean(),
|
visible: z.boolean(),
|
||||||
read_only: z.boolean()
|
read_only: z.boolean()
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,7 +43,7 @@ export function DlgCloneLibraryItem() {
|
||||||
item_type: base.item_type,
|
item_type: base.item_type,
|
||||||
title: cloneTitle(base),
|
title: cloneTitle(base),
|
||||||
alias: base.alias,
|
alias: base.alias,
|
||||||
comment: base.comment,
|
description: base.description,
|
||||||
visible: true,
|
visible: true,
|
||||||
read_only: false,
|
read_only: false,
|
||||||
access_policy: AccessPolicy.PUBLIC,
|
access_policy: AccessPolicy.PUBLIC,
|
||||||
|
@ -119,7 +119,7 @@ export function DlgCloneLibraryItem() {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextArea id='dlg_comment' {...register('comment')} label='Описание' rows={4} error={errors.comment} />
|
<TextArea id='dlg_comment' {...register('description')} label='Описание' rows={4} error={errors.description} />
|
||||||
|
|
||||||
{selected.length > 0 ? (
|
{selected.length > 0 ? (
|
||||||
<Controller
|
<Controller
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe('Testing matching LibraryItem', () => {
|
||||||
item_type: LibraryItemType.RSFORM,
|
item_type: LibraryItemType.RSFORM,
|
||||||
title: 'Item1',
|
title: 'Item1',
|
||||||
alias: 'I1',
|
alias: 'I1',
|
||||||
comment: 'comment',
|
description: 'description',
|
||||||
time_create: 'I2',
|
time_create: 'I2',
|
||||||
time_update: '',
|
time_update: '',
|
||||||
owner: null,
|
owner: null,
|
||||||
|
@ -24,7 +24,7 @@ describe('Testing matching LibraryItem', () => {
|
||||||
item_type: LibraryItemType.RSFORM,
|
item_type: LibraryItemType.RSFORM,
|
||||||
title: '',
|
title: '',
|
||||||
alias: '',
|
alias: '',
|
||||||
comment: '',
|
description: '',
|
||||||
time_create: '',
|
time_create: '',
|
||||||
time_update: '',
|
time_update: '',
|
||||||
owner: null,
|
owner: null,
|
||||||
|
@ -46,7 +46,7 @@ describe('Testing matching LibraryItem', () => {
|
||||||
expect(matchLibraryItem(item1, item1.title + '@invalid')).toEqual(false);
|
expect(matchLibraryItem(item1, item1.title + '@invalid')).toEqual(false);
|
||||||
expect(matchLibraryItem(item1, item1.alias + '@invalid')).toEqual(false);
|
expect(matchLibraryItem(item1, item1.alias + '@invalid')).toEqual(false);
|
||||||
expect(matchLibraryItem(item1, item1.time_create)).toEqual(false);
|
expect(matchLibraryItem(item1, item1.time_create)).toEqual(false);
|
||||||
expect(matchLibraryItem(item1, item1.comment)).toEqual(true);
|
expect(matchLibraryItem(item1, item1.description)).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ const LOCATION_REGEXP = /^\/[PLUS]((\/[!\d\p{L}]([!\d\p{L}\- ]*[!\d\p{L}])?)*)?$
|
||||||
*/
|
*/
|
||||||
export function matchLibraryItem(target: ILibraryItem, query: string): boolean {
|
export function matchLibraryItem(target: ILibraryItem, query: string): boolean {
|
||||||
const matcher = new TextMatcher(query);
|
const matcher = new TextMatcher(query);
|
||||||
return matcher.test(target.alias) || matcher.test(target.title) || matcher.test(target.comment);
|
return matcher.test(target.alias) || matcher.test(target.title) || matcher.test(target.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -211,10 +211,10 @@ export function FormCreateItem() {
|
||||||
|
|
||||||
<TextArea
|
<TextArea
|
||||||
id='schema_comment'
|
id='schema_comment'
|
||||||
{...register('comment')}
|
{...register('description')}
|
||||||
label='Описание'
|
label='Описание'
|
||||||
placeholder={file && 'Загрузить из файла'}
|
placeholder={file && 'Загрузить из файла'}
|
||||||
error={errors.comment}
|
error={errors.description}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className='flex justify-around gap-6 py-3'>
|
<div className='flex justify-around gap-6 py-3'>
|
||||||
|
|
|
@ -67,7 +67,7 @@ export const schemaOperation = z.strictObject({
|
||||||
|
|
||||||
alias: z.string(),
|
alias: z.string(),
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
comment: z.string(),
|
description: z.string(),
|
||||||
|
|
||||||
position_x: z.number(),
|
position_x: z.number(),
|
||||||
position_y: z.number(),
|
position_y: z.number(),
|
||||||
|
@ -107,7 +107,7 @@ export const schemaOperationCreate = z.strictObject({
|
||||||
alias: z.string().nonempty(),
|
alias: z.string().nonempty(),
|
||||||
operation_type: schemaOperationType,
|
operation_type: schemaOperationType,
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
comment: z.string(),
|
description: z.string(),
|
||||||
position_x: z.number(),
|
position_x: z.number(),
|
||||||
position_y: z.number(),
|
position_y: z.number(),
|
||||||
result: z.number().nullable()
|
result: z.number().nullable()
|
||||||
|
@ -145,7 +145,7 @@ export const schemaOperationUpdate = z.strictObject({
|
||||||
item_data: z.strictObject({
|
item_data: z.strictObject({
|
||||||
alias: z.string().nonempty(errorMsg.requiredField),
|
alias: z.string().nonempty(errorMsg.requiredField),
|
||||||
title: z.string(),
|
title: z.string(),
|
||||||
comment: z.string()
|
description: z.string()
|
||||||
}),
|
}),
|
||||||
arguments: z.array(z.number()),
|
arguments: z.array(z.number()),
|
||||||
substitutions: z.array(schemaCstSubstitute)
|
substitutions: z.array(schemaCstSubstitute)
|
||||||
|
|
|
@ -63,10 +63,10 @@ export function InfoOperation({ operation }: InfoOperationProps) {
|
||||||
{operation.title}
|
{operation.title}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
{operation.comment ? (
|
{operation.description ? (
|
||||||
<p>
|
<p>
|
||||||
<b>Комментарий: </b>
|
<b>Описание: </b>
|
||||||
{operation.comment}
|
{operation.description}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
{operation.substitutions.length > 0 ? (
|
{operation.substitutions.length > 0 ? (
|
||||||
|
|
|
@ -56,7 +56,7 @@ export function DlgCreateOperation() {
|
||||||
position_y: defaultY,
|
position_y: defaultY,
|
||||||
alias: '',
|
alias: '',
|
||||||
title: '',
|
title: '',
|
||||||
comment: ''
|
description: ''
|
||||||
},
|
},
|
||||||
arguments: initialInputs,
|
arguments: initialInputs,
|
||||||
create_schema: false,
|
create_schema: false,
|
||||||
|
|
|
@ -49,7 +49,7 @@ export function TabInputOperation() {
|
||||||
setValue('create_schema', false);
|
setValue('create_schema', false);
|
||||||
setValue('item_data.alias', schema.alias);
|
setValue('item_data.alias', schema.alias);
|
||||||
setValue('item_data.title', schema.title);
|
setValue('item_data.title', schema.title);
|
||||||
setValue('item_data.comment', schema.comment, { shouldValidate: true });
|
setValue('item_data.description', schema.description, { shouldValidate: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -74,7 +74,7 @@ export function TabInputOperation() {
|
||||||
label='Описание'
|
label='Описание'
|
||||||
noResize
|
noResize
|
||||||
rows={3}
|
rows={3}
|
||||||
{...register('item_data.comment')}
|
{...register('item_data.description')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ export function TabSynthesisOperation() {
|
||||||
label='Описание'
|
label='Описание'
|
||||||
noResize
|
noResize
|
||||||
rows={3}
|
rows={3}
|
||||||
{...register('item_data.comment')}
|
{...register('item_data.description')}
|
||||||
error={errors.item_data?.comment}
|
error={errors.item_data?.description}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ export function DlgEditOperation() {
|
||||||
item_data: {
|
item_data: {
|
||||||
alias: target.alias,
|
alias: target.alias,
|
||||||
title: target.title,
|
title: target.title,
|
||||||
comment: target.comment
|
description: target.description
|
||||||
},
|
},
|
||||||
arguments: target.arguments,
|
arguments: target.arguments,
|
||||||
substitutions: target.substitutions.map(sub => ({
|
substitutions: target.substitutions.map(sub => ({
|
||||||
|
|
|
@ -32,8 +32,8 @@ export function TabOperation() {
|
||||||
label='Описание'
|
label='Описание'
|
||||||
noResize
|
noResize
|
||||||
rows={3}
|
rows={3}
|
||||||
{...register('item_data.comment')}
|
{...register('item_data.description')}
|
||||||
error={errors.item_data?.comment}
|
error={errors.item_data?.description}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -38,7 +38,7 @@ export function FormOSS() {
|
||||||
item_type: LibraryItemType.RSFORM,
|
item_type: LibraryItemType.RSFORM,
|
||||||
title: schema.title,
|
title: schema.title,
|
||||||
alias: schema.alias,
|
alias: schema.alias,
|
||||||
comment: schema.comment,
|
description: schema.description,
|
||||||
visible: schema.visible,
|
visible: schema.visible,
|
||||||
read_only: schema.read_only
|
read_only: schema.read_only
|
||||||
}
|
}
|
||||||
|
@ -90,10 +90,10 @@ export function FormOSS() {
|
||||||
|
|
||||||
<TextArea
|
<TextArea
|
||||||
id='schema_comment'
|
id='schema_comment'
|
||||||
{...register('comment')}
|
{...register('description')}
|
||||||
label='Описание'
|
label='Описание'
|
||||||
rows={3}
|
rows={3}
|
||||||
error={errors.comment}
|
error={errors.description}
|
||||||
disabled={!isMutable || isProcessing}
|
disabled={!isMutable || isProcessing}
|
||||||
/>
|
/>
|
||||||
{isMutable || isModified ? (
|
{isMutable || isModified ? (
|
||||||
|
|
|
@ -47,7 +47,7 @@ export function FormRSForm() {
|
||||||
item_type: LibraryItemType.RSFORM,
|
item_type: LibraryItemType.RSFORM,
|
||||||
title: schema.title,
|
title: schema.title,
|
||||||
alias: schema.alias,
|
alias: schema.alias,
|
||||||
comment: schema.comment,
|
description: schema.description,
|
||||||
visible: schema.visible,
|
visible: schema.visible,
|
||||||
read_only: schema.read_only
|
read_only: schema.read_only
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,10 @@ export function FormRSForm() {
|
||||||
|
|
||||||
<TextArea
|
<TextArea
|
||||||
id='schema_comment'
|
id='schema_comment'
|
||||||
{...register('comment')}
|
{...register('description')}
|
||||||
label='Описание'
|
label='Описание'
|
||||||
rows={3}
|
rows={3}
|
||||||
error={errors.comment}
|
error={errors.description}
|
||||||
disabled={!isContentEditable || isProcessing}
|
disabled={!isContentEditable || isProcessing}
|
||||||
/>
|
/>
|
||||||
{isContentEditable || isDirty ? (
|
{isContentEditable || isDirty ? (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user