diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 58b221fcac..f864ab2d5e 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -537,6 +537,7 @@ class ScheduleList(ListCreateAPIView): name = _("Schedules") model = models.Schedule serializer_class = serializers.ScheduleSerializer + ordering = ('id',) class ScheduleDetail(RetrieveUpdateDestroyAPIView): diff --git a/awx/ui/src/components/Schedule/ScheduleList/ScheduleList.js b/awx/ui/src/components/Schedule/ScheduleList/ScheduleList.js index d74d9f64f7..7f69eddb0a 100644 --- a/awx/ui/src/components/Schedule/ScheduleList/ScheduleList.js +++ b/awx/ui/src/components/Schedule/ScheduleList/ScheduleList.js @@ -166,7 +166,7 @@ function ScheduleList({ headerRow={ {t`Name`} - {t`Type`} + {t`Type`} {t`Next Run`} {t`Actions`} diff --git a/tools/data_generators/presets.tsv b/tools/data_generators/presets.tsv index c42f831cb7..b78c81d08f 100644 --- a/tools/data_generators/presets.tsv +++ b/tools/data_generators/presets.tsv @@ -4,6 +4,7 @@ users 500 5000 3 3 3 3 3 3 110 teams 200 500 2 2 2 2 2 2 100 projects 150 1000 30 30 30 30 30 30 110 job_templates 300 2000 127 127 127 127 127 127 110 +schedules 50 1 5 8 1 1 1 1 1 credentials 150 2000 50 50 50 50 50 50 110 inventories 150 2000 6 6 6 6 6 6 110 inventory_groups 700 500 15 15 15 15 15 15 110 @@ -12,4 +13,4 @@ wfjts 50 100 0 0 0 0 0 0 0 nodes 1000 1000 0 0 0 0 0 0 0 labels 1000 1000 0 0 0 0 0 0 0 jobs 2000 5000 157208 1000 10000 50000 100000 200000 1000 -job_events 40000 100000 3370942 20000 200000 1000000 2000000 4000000 20000 \ No newline at end of file +job_events 40000 100000 3370942 20000 200000 1000000 2000000 4000000 20000 diff --git a/tools/data_generators/rbac_dummy_data_generator.py b/tools/data_generators/rbac_dummy_data_generator.py index de06fae81f..b5d268a0bc 100755 --- a/tools/data_generators/rbac_dummy_data_generator.py +++ b/tools/data_generators/rbac_dummy_data_generator.py @@ -53,6 +53,7 @@ from awx.main.models import ( # noqa WorkflowJobTemplateNode, batch_role_ancestor_rebuilding, ) +from awx.main.models.schedules import Schedule #noqa from awx.main.signals import disable_activity_stream, disable_computed_fields # noqa @@ -63,6 +64,7 @@ option_list = [ make_option('--teams', action='store', type='int', default=5, help='Number of teams to create'), make_option('--projects', action='store', type='int', default=10, help='Number of projects to create'), make_option('--job-templates', action='store', type='int', default=20, help='Number of job templates to create'), + make_option('--schedules', action='store', type='int', default=50, help='Number of schedules to create'), make_option('--credentials', action='store', type='int', default=5, help='Number of credentials to create'), make_option('--inventories', action='store', type='int', default=5, help='Number of credentials to create'), make_option('--inventory-groups', action='store', type='int', default=10, help='Number of credentials to create'), @@ -110,6 +112,7 @@ n_users = int(options['users']) n_teams = int(options['teams']) n_projects = int(options['projects']) n_job_templates = int(options['job_templates']) +n_schedules = int(options['schedules']) n_credentials = int(options['credentials']) n_inventories = int(options['inventories']) n_inventory_groups = int(options['inventory_groups']) @@ -126,6 +129,7 @@ users = [] teams = [] projects = [] job_templates = [] +schedules = [] credentials = [] inventories = [] inventory_groups = [] @@ -570,6 +574,29 @@ def make_the_data(): if n: print('') + print('# Creating %d Schedules' % n_schedules) + jt_idx = 0 + for n in spread(n_schedules, n_job_templates): + jt = job_templates[0] + for i in range(n): + ids['schedules'] += 1 + schedules_id = ids['schedules'] + unified_job_template = job_templates[jt_idx] + + sys.stdout.write('\r Assigning %d to %s: %d ' % (n, jt, i + 1)) + sys.stdout.flush() + schedule, _ = Schedule.objects.get_or_create( + name='%s Schedule %d' % (prefix, schedules_id), + rrule="DTSTART;TZID=America/New_York:20220505T111500 RRULE:INTERVAL=1;COUNT=1;FREQ=MINUTELY", + created_by=next(creator_gen), + modified_by=next(modifier_gen), + unified_job_template=unified_job_template, + ) + schedule._is_new = _ + schedules.append(schedule) + + + print('# Creating %d Labels' % n_labels) org_idx = 0 for n in spread(n_labels, n_organizations):