debian-mirror-gitlab/spec/frontend/runner/mock_data.js

323 lines
8.8 KiB
JavaScript
Raw Normal View History

2021-09-04 01:27:46 +05:30
// Fixtures generated by: spec/frontend/fixtures/runner.rb
2021-11-11 11:23:49 +05:30
2022-07-16 23:28:13 +05:30
// Show runner queries
import runnerData from 'test_fixtures/graphql/runner/show/runner.query.graphql.json';
import runnerWithGroupData from 'test_fixtures/graphql/runner/show/runner.query.graphql.with_group.json';
import runnerProjectsData from 'test_fixtures/graphql/runner/show/runner_projects.query.graphql.json';
import runnerJobsData from 'test_fixtures/graphql/runner/show/runner_jobs.query.graphql.json';
// Edit runner queries
import runnerFormData from 'test_fixtures/graphql/runner/edit/runner_form.query.graphql.json';
2022-05-07 20:08:51 +05:30
// List queries
2022-08-13 15:12:31 +05:30
import allRunnersData from 'test_fixtures/graphql/runner/list/all_runners.query.graphql.json';
import allRunnersDataPaginated from 'test_fixtures/graphql/runner/list/all_runners.query.graphql.paginated.json';
import runnersCountData from 'test_fixtures/graphql/runner/list/all_runners_count.query.graphql.json';
2022-05-07 20:08:51 +05:30
import groupRunnersData from 'test_fixtures/graphql/runner/list/group_runners.query.graphql.json';
import groupRunnersDataPaginated from 'test_fixtures/graphql/runner/list/group_runners.query.graphql.paginated.json';
import groupRunnersCountData from 'test_fixtures/graphql/runner/list/group_runners_count.query.graphql.json';
2021-11-11 11:23:49 +05:30
2022-11-25 23:54:43 +05:30
import { DEFAULT_MEMBERSHIP, RUNNER_PAGE_SIZE } from '~/runner/constants';
2022-08-13 15:12:31 +05:30
2022-08-27 11:52:29 +05:30
const emptyPageInfo = {
__typename: 'PageInfo',
hasNextPage: false,
hasPreviousPage: false,
startCursor: '',
endCursor: '',
};
2022-06-21 17:19:12 +05:30
// Other mock data
2022-08-13 15:12:31 +05:30
// Mock searches and their corresponding urls
export const mockSearchExamples = [
{
name: 'a default query',
urlQuery: '',
2022-11-25 23:54:43 +05:30
search: {
runnerType: null,
membership: DEFAULT_MEMBERSHIP,
filters: [],
pagination: {},
sort: 'CREATED_DESC',
},
graphqlVariables: {
membership: DEFAULT_MEMBERSHIP,
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
isDefault: true,
},
{
name: 'a single status',
urlQuery: '?status[]=ACTIVE',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [{ type: 'status', value: { data: 'ACTIVE', operator: '=' } }],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
membership: DEFAULT_MEMBERSHIP,
status: 'ACTIVE',
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'a single term text search',
urlQuery: '?search=something',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [
{
type: 'filtered-search-term',
value: { data: 'something' },
},
],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
membership: DEFAULT_MEMBERSHIP,
search: 'something',
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'a two terms text search',
urlQuery: '?search=something+else',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [
{
type: 'filtered-search-term',
value: { data: 'something' },
},
{
type: 'filtered-search-term',
value: { data: 'else' },
},
],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
membership: DEFAULT_MEMBERSHIP,
search: 'something else',
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'single instance type',
urlQuery: '?runner_type[]=INSTANCE_TYPE',
search: {
runnerType: 'INSTANCE_TYPE',
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
type: 'INSTANCE_TYPE',
membership: DEFAULT_MEMBERSHIP,
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'multiple runner status',
urlQuery: '?status[]=ACTIVE&status[]=PAUSED',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [
{ type: 'status', value: { data: 'ACTIVE', operator: '=' } },
{ type: 'status', value: { data: 'PAUSED', operator: '=' } },
],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
status: 'ACTIVE',
membership: DEFAULT_MEMBERSHIP,
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'multiple status, a single instance type and a non default sort',
urlQuery: '?status[]=ACTIVE&runner_type[]=INSTANCE_TYPE&sort=CREATED_ASC',
search: {
runnerType: 'INSTANCE_TYPE',
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [{ type: 'status', value: { data: 'ACTIVE', operator: '=' } }],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_ASC',
},
graphqlVariables: {
status: 'ACTIVE',
type: 'INSTANCE_TYPE',
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
sort: 'CREATED_ASC',
first: RUNNER_PAGE_SIZE,
},
},
{
name: 'a tag',
urlQuery: '?tag[]=tag-1',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [{ type: 'tag', value: { data: 'tag-1', operator: '=' } }],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
graphqlVariables: {
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
tagList: ['tag-1'],
first: 20,
sort: 'CREATED_DESC',
},
},
{
name: 'two tags',
urlQuery: '?tag[]=tag-1&tag[]=tag-2',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [
{ type: 'tag', value: { data: 'tag-1', operator: '=' } },
{ type: 'tag', value: { data: 'tag-2', operator: '=' } },
],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
graphqlVariables: {
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
tagList: ['tag-1', 'tag-2'],
first: 20,
sort: 'CREATED_DESC',
},
},
{
name: 'the next page',
2022-08-27 11:52:29 +05:30
urlQuery: '?after=AFTER_CURSOR',
2022-08-13 15:12:31 +05:30
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [],
2022-08-27 11:52:29 +05:30
pagination: { after: 'AFTER_CURSOR' },
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
membership: DEFAULT_MEMBERSHIP,
sort: 'CREATED_DESC',
after: 'AFTER_CURSOR',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'the previous page',
2022-08-27 11:52:29 +05:30
urlQuery: '?before=BEFORE_CURSOR',
2022-08-13 15:12:31 +05:30
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [],
2022-08-27 11:52:29 +05:30
pagination: { before: 'BEFORE_CURSOR' },
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
membership: DEFAULT_MEMBERSHIP,
sort: 'CREATED_DESC',
before: 'BEFORE_CURSOR',
last: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'the next page filtered by a status, an instance type, tags and a non default sort',
urlQuery:
2022-08-27 11:52:29 +05:30
'?status[]=ACTIVE&runner_type[]=INSTANCE_TYPE&tag[]=tag-1&tag[]=tag-2&sort=CREATED_ASC&after=AFTER_CURSOR',
2022-08-13 15:12:31 +05:30
search: {
runnerType: 'INSTANCE_TYPE',
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [
{ type: 'status', value: { data: 'ACTIVE', operator: '=' } },
{ type: 'tag', value: { data: 'tag-1', operator: '=' } },
{ type: 'tag', value: { data: 'tag-2', operator: '=' } },
],
2022-08-27 11:52:29 +05:30
pagination: { after: 'AFTER_CURSOR' },
2022-08-13 15:12:31 +05:30
sort: 'CREATED_ASC',
},
graphqlVariables: {
status: 'ACTIVE',
type: 'INSTANCE_TYPE',
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
tagList: ['tag-1', 'tag-2'],
sort: 'CREATED_ASC',
after: 'AFTER_CURSOR',
first: RUNNER_PAGE_SIZE,
},
},
{
name: 'paused runners',
urlQuery: '?paused[]=true',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [{ type: 'paused', value: { data: 'true', operator: '=' } }],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
paused: true,
membership: DEFAULT_MEMBERSHIP,
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
{
name: 'active runners',
urlQuery: '?paused[]=false',
search: {
runnerType: null,
2022-11-25 23:54:43 +05:30
membership: DEFAULT_MEMBERSHIP,
2022-08-13 15:12:31 +05:30
filters: [{ type: 'paused', value: { data: 'false', operator: '=' } }],
2022-08-27 11:52:29 +05:30
pagination: {},
2022-08-13 15:12:31 +05:30
sort: 'CREATED_DESC',
},
2022-11-25 23:54:43 +05:30
graphqlVariables: {
paused: false,
membership: DEFAULT_MEMBERSHIP,
sort: 'CREATED_DESC',
first: RUNNER_PAGE_SIZE,
},
2022-08-13 15:12:31 +05:30
},
];
2022-06-21 17:19:12 +05:30
export const onlineContactTimeoutSecs = 2 * 60 * 60;
2022-07-23 23:45:48 +05:30
export const staleTimeoutSecs = 7889238; // Ruby's `3.months`
export const emptyStateSvgPath = 'emptyStateSvgPath.svg';
export const emptyStateFilteredSvgPath = 'emptyStateFilteredSvgPath.svg';
2022-06-21 17:19:12 +05:30
2021-11-18 22:05:49 +05:30
export {
2022-08-13 15:12:31 +05:30
allRunnersData,
allRunnersDataPaginated,
2022-07-16 23:28:13 +05:30
runnersCountData,
groupRunnersData,
groupRunnersDataPaginated,
groupRunnersCountData,
2022-08-27 11:52:29 +05:30
emptyPageInfo,
2022-04-04 11:22:00 +05:30
runnerData,
runnerWithGroupData,
runnerProjectsData,
runnerJobsData,
2022-07-16 23:28:13 +05:30
runnerFormData,
2021-11-18 22:05:49 +05:30
};