Commit 99dbd3f6 authored by Miguel Rincon's avatar Miguel Rincon

Reorganize the runners graphql directory

The graphql directory was becoming unwieldy, this helps add more
fragments and resolvers that are only relevant for one type of
view (list or details).
parent bda0a29e
...@@ -5,7 +5,7 @@ import { convertToGraphQLId } from '~/graphql_shared/utils'; ...@@ -5,7 +5,7 @@ import { convertToGraphQLId } from '~/graphql_shared/utils';
import RunnerHeader from '../components/runner_header.vue'; import RunnerHeader from '../components/runner_header.vue';
import RunnerUpdateForm from '../components/runner_update_form.vue'; import RunnerUpdateForm from '../components/runner_update_form.vue';
import { I18N_FETCH_ERROR } from '../constants'; import { I18N_FETCH_ERROR } from '../constants';
import getRunnerQuery from '../graphql/get_runner.query.graphql'; import runnerQuery from '../graphql/details/runner.query.graphql';
import { captureException } from '../sentry_utils'; import { captureException } from '../sentry_utils';
export default { export default {
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
}, },
apollo: { apollo: {
runner: { runner: {
query: getRunnerQuery, query: runnerQuery,
variables() { variables() {
return { return {
id: convertToGraphQLId(TYPE_CI_RUNNER, this.runnerId), id: convertToGraphQLId(TYPE_CI_RUNNER, this.runnerId),
......
...@@ -8,7 +8,7 @@ import RunnerPauseButton from '../components/runner_pause_button.vue'; ...@@ -8,7 +8,7 @@ import RunnerPauseButton from '../components/runner_pause_button.vue';
import RunnerHeader from '../components/runner_header.vue'; import RunnerHeader from '../components/runner_header.vue';
import RunnerDetails from '../components/runner_details.vue'; import RunnerDetails from '../components/runner_details.vue';
import { I18N_FETCH_ERROR } from '../constants'; import { I18N_FETCH_ERROR } from '../constants';
import getRunnerQuery from '../graphql/get_runner.query.graphql'; import runnerQuery from '../graphql/details/runner.query.graphql';
import { captureException } from '../sentry_utils'; import { captureException } from '../sentry_utils';
export default { export default {
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
}, },
apollo: { apollo: {
runner: { runner: {
query: getRunnerQuery, query: runnerQuery,
variables() { variables() {
return { return {
id: convertToGraphQLId(TYPE_CI_RUNNER, this.runnerId), id: convertToGraphQLId(TYPE_CI_RUNNER, this.runnerId),
......
...@@ -26,8 +26,8 @@ import { ...@@ -26,8 +26,8 @@ import {
STATUS_STALE, STATUS_STALE,
I18N_FETCH_ERROR, I18N_FETCH_ERROR,
} from '../constants'; } from '../constants';
import getRunnersQuery from '../graphql/get_runners.query.graphql'; import runnersAdminQuery from '../graphql/list/admin_runners.query.graphql';
import getRunnersCountQuery from '../graphql/get_runners_count.query.graphql'; import runnersAdminCountQuery from '../graphql/list/admin_runners_count.query.graphql';
import { import {
fromUrlQueryToSearch, fromUrlQueryToSearch,
fromSearchToUrl, fromSearchToUrl,
...@@ -36,7 +36,7 @@ import { ...@@ -36,7 +36,7 @@ import {
import { captureException } from '../sentry_utils'; import { captureException } from '../sentry_utils';
const runnersCountSmartQuery = { const runnersCountSmartQuery = {
query: getRunnersCountQuery, query: runnersAdminCountQuery,
fetchPolicy: fetchPolicies.CACHE_AND_NETWORK, fetchPolicy: fetchPolicies.CACHE_AND_NETWORK,
update(data) { update(data) {
return data?.runners?.count; return data?.runners?.count;
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
}, },
apollo: { apollo: {
runners: { runners: {
query: getRunnersQuery, query: runnersAdminQuery,
// Runners can be updated by users directly in this list. // Runners can be updated by users directly in this list.
// A "cache and network" policy prevents outdated filtered // A "cache and network" policy prevents outdated filtered
// results. // results.
......
...@@ -4,7 +4,7 @@ import { createAlert } from '~/flash'; ...@@ -4,7 +4,7 @@ import { createAlert } from '~/flash';
import { TYPE_GROUP, TYPE_PROJECT } from '~/graphql_shared/constants'; import { TYPE_GROUP, TYPE_PROJECT } from '~/graphql_shared/constants';
import { convertToGraphQLId } from '~/graphql_shared/utils'; import { convertToGraphQLId } from '~/graphql_shared/utils';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import runnersRegistrationTokenResetMutation from '~/runner/graphql/runners_registration_token_reset.mutation.graphql'; import runnersRegistrationTokenResetMutation from '~/runner/graphql/list/runners_registration_token_reset.mutation.graphql';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { INSTANCE_TYPE, GROUP_TYPE, PROJECT_TYPE } from '../../constants'; import { INSTANCE_TYPE, GROUP_TYPE, PROJECT_TYPE } from '../../constants';
......
<script> <script>
import { GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui'; import { GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui';
import runnerDeleteMutation from '~/runner/graphql/runner_delete.mutation.graphql'; import runnerDeleteMutation from '~/runner/graphql/shared/runner_delete.mutation.graphql';
import { createAlert } from '~/flash'; import { createAlert } from '~/flash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
......
<script> <script>
import { GlSkeletonLoading } from '@gitlab/ui'; import { GlSkeletonLoading } from '@gitlab/ui';
import { createAlert } from '~/flash'; import { createAlert } from '~/flash';
import getRunnerJobsQuery from '../graphql/get_runner_jobs.query.graphql'; import runnerJobsQuery from '../graphql/details/runner_jobs.query.graphql';
import { I18N_FETCH_ERROR, I18N_NO_JOBS_FOUND, RUNNER_DETAILS_JOBS_PAGE_SIZE } from '../constants'; import { I18N_FETCH_ERROR, I18N_NO_JOBS_FOUND, RUNNER_DETAILS_JOBS_PAGE_SIZE } from '../constants';
import { captureException } from '../sentry_utils'; import { captureException } from '../sentry_utils';
import { getPaginationVariables } from '../utils'; import { getPaginationVariables } from '../utils';
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
}, },
apollo: { apollo: {
jobs: { jobs: {
query: getRunnerJobsQuery, query: runnerJobsQuery,
variables() { variables() {
return this.variables; return this.variables;
}, },
......
<script> <script>
import { GlButton, GlTooltipDirective } from '@gitlab/ui'; import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import runnerToggleActiveMutation from '~/runner/graphql/runner_toggle_active.mutation.graphql'; import runnerToggleActiveMutation from '~/runner/graphql/shared/runner_toggle_active.mutation.graphql';
import { createAlert } from '~/flash'; import { createAlert } from '~/flash';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { I18N_PAUSE, I18N_RESUME } from '../constants'; import { I18N_PAUSE, I18N_RESUME } from '../constants';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlSkeletonLoading } from '@gitlab/ui'; import { GlSkeletonLoading } from '@gitlab/ui';
import { sprintf, formatNumber } from '~/locale'; import { sprintf, formatNumber } from '~/locale';
import { createAlert } from '~/flash'; import { createAlert } from '~/flash';
import getRunnerProjectsQuery from '../graphql/get_runner_projects.query.graphql'; import runnerProjectsQuery from '../graphql/details/runner_projects.query.graphql';
import { import {
I18N_ASSIGNED_PROJECTS, I18N_ASSIGNED_PROJECTS,
I18N_NONE, I18N_NONE,
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
}, },
apollo: { apollo: {
projects: { projects: {
query: getRunnerProjectsQuery, query: runnerProjectsQuery,
variables() { variables() {
return this.variables; return this.variables;
}, },
......
...@@ -15,7 +15,7 @@ import { createAlert, VARIANT_SUCCESS } from '~/flash'; ...@@ -15,7 +15,7 @@ import { createAlert, VARIANT_SUCCESS } from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { ACCESS_LEVEL_NOT_PROTECTED, ACCESS_LEVEL_REF_PROTECTED, PROJECT_TYPE } from '../constants'; import { ACCESS_LEVEL_NOT_PROTECTED, ACCESS_LEVEL_REF_PROTECTED, PROJECT_TYPE } from '../constants';
import runnerUpdateMutation from '../graphql/runner_update.mutation.graphql'; import runnerUpdateMutation from '../graphql/details/runner_update.mutation.graphql';
export default { export default {
name: 'RunnerUpdateForm', name: 'RunnerUpdateForm',
......
#import "ee_else_ce/runner/graphql/runner_details.fragment.graphql" #import "ee_else_ce/runner/graphql/details/runner_details.fragment.graphql"
query getRunner($id: CiRunnerID!) { query getRunner($id: CiRunnerID!) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# eslint-disable-next-line @graphql-eslint/require-id-when-available # eslint-disable-next-line @graphql-eslint/require-id-when-available
runner(id: $id) { runner(id: $id) {
__typename
...RunnerDetails ...RunnerDetails
} }
} }
fragment RunnerDetailsShared on CiRunner { fragment RunnerDetailsShared on CiRunner {
__typename
id id
runnerType runnerType
active active
...@@ -22,7 +23,7 @@ fragment RunnerDetailsShared on CiRunner { ...@@ -22,7 +23,7 @@ fragment RunnerDetailsShared on CiRunner {
groups { groups {
# Only a single group can be loaded here, while projects # Only a single group can be loaded here, while projects
# are loaded separately using the query with pagination # are loaded separately using the query with pagination
# parameters `get_runner_projects.query.graphql`. # parameters `runner_projects.query.graphql`.
nodes { nodes {
id id
avatarUrl avatarUrl
......
#import "ee_else_ce/runner/graphql/runner_details.fragment.graphql" #import "ee_else_ce/runner/graphql/details/runner_details.fragment.graphql"
# Mutation for updates from the runner form, loads # Mutation for updates from the runner form, loads
# attributes shown in the runner details. # attributes shown in the runner details.
......
#import "~/runner/graphql/runner_node.fragment.graphql" #import "~/runner/graphql/list/list_item.fragment.graphql"
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql" #import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query getRunners( query getRunners(
...@@ -24,7 +24,7 @@ query getRunners( ...@@ -24,7 +24,7 @@ query getRunners(
sort: $sort sort: $sort
) { ) {
nodes { nodes {
...RunnerNode ...ListItem
adminUrl adminUrl
editAdminUrl editAdminUrl
} }
......
#import "~/runner/graphql/runner_node.fragment.graphql" #import "~/runner/graphql/list/list_item.fragment.graphql"
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql" #import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query getGroupRunners( query getGroupRunners(
...@@ -29,8 +29,7 @@ query getGroupRunners( ...@@ -29,8 +29,7 @@ query getGroupRunners(
webUrl webUrl
editUrl editUrl
node { node {
__typename ...ListItem
...RunnerNode
} }
} }
pageInfo { pageInfo {
......
fragment RunnerNode on CiRunner { fragment ListItem on CiRunner {
__typename __typename
id id
description description
......
...@@ -24,8 +24,8 @@ import { ...@@ -24,8 +24,8 @@ import {
STATUS_OFFLINE, STATUS_OFFLINE,
STATUS_STALE, STATUS_STALE,
} from '../constants'; } from '../constants';
import getGroupRunnersQuery from '../graphql/get_group_runners.query.graphql'; import groupRunnersQuery from '../graphql/list/group_runners.query.graphql';
import getGroupRunnersCountQuery from '../graphql/get_group_runners_count.query.graphql'; import groupRunnersCountQuery from '../graphql/list/group_runners_count.query.graphql';
import { import {
fromUrlQueryToSearch, fromUrlQueryToSearch,
fromSearchToUrl, fromSearchToUrl,
...@@ -34,7 +34,7 @@ import { ...@@ -34,7 +34,7 @@ import {
import { captureException } from '../sentry_utils'; import { captureException } from '../sentry_utils';
const runnersCountSmartQuery = { const runnersCountSmartQuery = {
query: getGroupRunnersCountQuery, query: groupRunnersCountQuery,
fetchPolicy: fetchPolicies.CACHE_AND_NETWORK, fetchPolicy: fetchPolicies.CACHE_AND_NETWORK,
update(data) { update(data) {
return data?.group?.runners?.count; return data?.group?.runners?.count;
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
}, },
apollo: { apollo: {
runners: { runners: {
query: getGroupRunnersQuery, query: groupRunnersQuery,
// Runners can be updated by users directly in this list. // Runners can be updated by users directly in this list.
// A "cache and network" policy prevents outdated filtered // A "cache and network" policy prevents outdated filtered
// results. // results.
......
#import "~/runner/graphql/runner_details_shared.fragment.graphql" #import "~/runner/graphql/details/runner_details_shared.fragment.graphql"
fragment RunnerDetails on CiRunner { fragment RunnerDetails on CiRunner {
...RunnerDetailsShared ...RunnerDetailsShared
......
...@@ -8,7 +8,7 @@ import waitForPromises from 'helpers/wait_for_promises'; ...@@ -8,7 +8,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import { runnerData } from 'jest/runner/mock_data'; import { runnerData } from 'jest/runner/mock_data';
import { createAlert, VARIANT_SUCCESS } from '~/flash'; import { createAlert, VARIANT_SUCCESS } from '~/flash';
import RunnerUpdateForm from '~/runner/components/runner_update_form.vue'; import RunnerUpdateForm from '~/runner/components/runner_update_form.vue';
import runnerUpdateMutation from '~/runner/graphql/runner_update.mutation.graphql'; import runnerUpdateMutation from '~/runner/graphql/details/runner_update.mutation.graphql';
jest.mock('~/flash'); jest.mock('~/flash');
......
...@@ -33,19 +33,19 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -33,19 +33,19 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
end end
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
get_runners_query_name = 'get_runners.query.graphql' admin_runners_query = 'list/admin_runners.query.graphql'
let_it_be(:query) do let_it_be(:query) do
get_graphql_query_as_string("#{query_path}#{get_runners_query_name}") get_graphql_query_as_string("#{query_path}#{admin_runners_query}")
end end
it "#{fixtures_path}#{get_runners_query_name}.json" do it "#{fixtures_path}#{admin_runners_query}.json" do
post_graphql(query, current_user: admin, variables: {}) post_graphql(query, current_user: admin, variables: {})
expect_graphql_errors_to_be_empty expect_graphql_errors_to_be_empty
end end
it "#{fixtures_path}#{get_runners_query_name}.paginated.json" do it "#{fixtures_path}#{admin_runners_query}.paginated.json" do
post_graphql(query, current_user: admin, variables: { first: 2 }) post_graphql(query, current_user: admin, variables: { first: 2 })
expect_graphql_errors_to_be_empty expect_graphql_errors_to_be_empty
...@@ -53,13 +53,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -53,13 +53,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
end end
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
get_runners_count_query_name = 'get_runners_count.query.graphql' admin_runners_count_query = 'list/admin_runners_count.query.graphql'
let_it_be(:query) do let_it_be(:query) do
get_graphql_query_as_string("#{query_path}#{get_runners_count_query_name}") get_graphql_query_as_string("#{query_path}#{admin_runners_count_query}")
end end
it "#{fixtures_path}#{get_runners_count_query_name}.json" do it "#{fixtures_path}#{admin_runners_count_query}.json" do
post_graphql(query, current_user: admin, variables: {}) post_graphql(query, current_user: admin, variables: {})
expect_graphql_errors_to_be_empty expect_graphql_errors_to_be_empty
...@@ -67,13 +67,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -67,13 +67,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
end end
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
get_runner_query_name = 'get_runner.query.graphql' runner_query = 'details/runner.query.graphql'
let_it_be(:query) do let_it_be(:query) do
get_graphql_query_as_string("#{query_path}#{get_runner_query_name}") get_graphql_query_as_string("#{query_path}#{runner_query}")
end end
it "#{fixtures_path}#{get_runner_query_name}.json" do it "#{fixtures_path}#{runner_query}.json" do
post_graphql(query, current_user: admin, variables: { post_graphql(query, current_user: admin, variables: {
id: instance_runner.to_global_id.to_s id: instance_runner.to_global_id.to_s
}) })
...@@ -81,7 +81,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -81,7 +81,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
expect_graphql_errors_to_be_empty expect_graphql_errors_to_be_empty
end end
it "#{fixtures_path}#{get_runner_query_name}.with_group.json" do it "#{fixtures_path}#{runner_query}.with_group.json" do
post_graphql(query, current_user: admin, variables: { post_graphql(query, current_user: admin, variables: {
id: group_runner.to_global_id.to_s id: group_runner.to_global_id.to_s
}) })
...@@ -91,13 +91,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -91,13 +91,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
end end
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
get_runner_projects_query_name = 'get_runner_projects.query.graphql' runner_projects_query = 'details/runner_projects.query.graphql'
let_it_be(:query) do let_it_be(:query) do
get_graphql_query_as_string("#{query_path}#{get_runner_projects_query_name}") get_graphql_query_as_string("#{query_path}#{runner_projects_query}")
end end
it "#{fixtures_path}#{get_runner_projects_query_name}.json" do it "#{fixtures_path}#{runner_projects_query}.json" do
post_graphql(query, current_user: admin, variables: { post_graphql(query, current_user: admin, variables: {
id: project_runner.to_global_id.to_s id: project_runner.to_global_id.to_s
}) })
...@@ -107,13 +107,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -107,13 +107,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
end end
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
get_runner_jobs_query_name = 'get_runner_jobs.query.graphql' runner_jobs_query = 'details/runner_jobs.query.graphql'
let_it_be(:query) do let_it_be(:query) do
get_graphql_query_as_string("#{query_path}#{get_runner_jobs_query_name}") get_graphql_query_as_string("#{query_path}#{runner_jobs_query}")
end end
it "#{fixtures_path}#{get_runner_jobs_query_name}.json" do it "#{fixtures_path}#{runner_jobs_query}.json" do
post_graphql(query, current_user: admin, variables: { post_graphql(query, current_user: admin, variables: {
id: instance_runner.to_global_id.to_s id: instance_runner.to_global_id.to_s
}) })
...@@ -131,13 +131,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -131,13 +131,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
end end
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
get_group_runners_query_name = 'get_group_runners.query.graphql' group_runners_query = 'list/group_runners.query.graphql'
let_it_be(:query) do let_it_be(:query) do
get_graphql_query_as_string("#{query_path}#{get_group_runners_query_name}") get_graphql_query_as_string("#{query_path}#{group_runners_query}")
end end
it "#{fixtures_path}#{get_group_runners_query_name}.json" do it "#{fixtures_path}#{group_runners_query}.json" do
post_graphql(query, current_user: group_owner, variables: { post_graphql(query, current_user: group_owner, variables: {
groupFullPath: group.full_path groupFullPath: group.full_path
}) })
...@@ -145,7 +145,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -145,7 +145,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
expect_graphql_errors_to_be_empty expect_graphql_errors_to_be_empty
end end
it "#{fixtures_path}#{get_group_runners_query_name}.paginated.json" do it "#{fixtures_path}#{group_runners_query}.paginated.json" do
post_graphql(query, current_user: group_owner, variables: { post_graphql(query, current_user: group_owner, variables: {
groupFullPath: group.full_path, groupFullPath: group.full_path,
first: 1 first: 1
...@@ -156,13 +156,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do ...@@ -156,13 +156,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do
end end
describe GraphQL::Query, type: :request do describe GraphQL::Query, type: :request do
get_group_runners_count_query_name = 'get_group_runners_count.query.graphql' group_runners_count_query = 'list/group_runners_count.query.graphql'
let_it_be(:query) do let_it_be(:query) do
get_graphql_query_as_string("#{query_path}#{get_group_runners_count_query_name}") get_graphql_query_as_string("#{query_path}#{group_runners_count_query}")
end end
it "#{fixtures_path}#{get_group_runners_count_query_name}.json" do it "#{fixtures_path}#{group_runners_count_query}.json" do
post_graphql(query, current_user: group_owner, variables: { post_graphql(query, current_user: group_owner, variables: {
groupFullPath: group.full_path groupFullPath: group.full_path
}) })
......
...@@ -7,7 +7,7 @@ import { createAlert } from '~/flash'; ...@@ -7,7 +7,7 @@ import { createAlert } from '~/flash';
import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import RunnerHeader from '~/runner/components/runner_header.vue'; import RunnerHeader from '~/runner/components/runner_header.vue';
import getRunnerQuery from '~/runner/graphql/get_runner.query.graphql'; import runnerQuery from '~/runner/graphql/details/runner.query.graphql';
import AdminRunnerEditApp from '~//runner/admin_runner_edit/admin_runner_edit_app.vue'; import AdminRunnerEditApp from '~//runner/admin_runner_edit/admin_runner_edit_app.vue';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
...@@ -29,7 +29,7 @@ describe('AdminRunnerEditApp', () => { ...@@ -29,7 +29,7 @@ describe('AdminRunnerEditApp', () => {
const createComponentWithApollo = ({ props = {}, mountFn = shallowMount } = {}) => { const createComponentWithApollo = ({ props = {}, mountFn = shallowMount } = {}) => {
wrapper = mountFn(AdminRunnerEditApp, { wrapper = mountFn(AdminRunnerEditApp, {
apolloProvider: createMockApollo([[getRunnerQuery, mockRunnerQuery]]), apolloProvider: createMockApollo([[runnerQuery, mockRunnerQuery]]),
propsData: { propsData: {
runnerId: mockRunnerId, runnerId: mockRunnerId,
...props, ...props,
......
...@@ -9,7 +9,7 @@ import { getIdFromGraphQLId } from '~/graphql_shared/utils'; ...@@ -9,7 +9,7 @@ import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import RunnerHeader from '~/runner/components/runner_header.vue'; import RunnerHeader from '~/runner/components/runner_header.vue';
import RunnerPauseButton from '~/runner/components/runner_pause_button.vue'; import RunnerPauseButton from '~/runner/components/runner_pause_button.vue';
import RunnerEditButton from '~/runner/components/runner_edit_button.vue'; import RunnerEditButton from '~/runner/components/runner_edit_button.vue';
import getRunnerQuery from '~/runner/graphql/get_runner.query.graphql'; import runnerQuery from '~/runner/graphql/details/runner.query.graphql';
import AdminRunnerShowApp from '~/runner/admin_runner_show/admin_runner_show_app.vue'; import AdminRunnerShowApp from '~/runner/admin_runner_show/admin_runner_show_app.vue';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
...@@ -42,7 +42,7 @@ describe('AdminRunnerShowApp', () => { ...@@ -42,7 +42,7 @@ describe('AdminRunnerShowApp', () => {
const createComponent = ({ props = {}, mountFn = shallowMount } = {}) => { const createComponent = ({ props = {}, mountFn = shallowMount } = {}) => {
wrapper = mountFn(AdminRunnerShowApp, { wrapper = mountFn(AdminRunnerShowApp, {
apolloProvider: createMockApollo([[getRunnerQuery, mockRunnerQuery]]), apolloProvider: createMockApollo([[runnerQuery, mockRunnerQuery]]),
propsData: { propsData: {
runnerId: mockRunnerId, runnerId: mockRunnerId,
...props, ...props,
......
...@@ -35,8 +35,8 @@ import { ...@@ -35,8 +35,8 @@ import {
STATUS_ACTIVE, STATUS_ACTIVE,
RUNNER_PAGE_SIZE, RUNNER_PAGE_SIZE,
} from '~/runner/constants'; } from '~/runner/constants';
import getRunnersQuery from '~/runner/graphql/get_runners.query.graphql'; import adminRunnersQuery from '~/runner/graphql/list/admin_runners.query.graphql';
import getRunnersCountQuery from '~/runner/graphql/get_runners_count.query.graphql'; import adminRunnersCountQuery from '~/runner/graphql/list/admin_runners_count.query.graphql';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import FilteredSearch from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearch from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
...@@ -71,8 +71,8 @@ describe('AdminRunnersApp', () => { ...@@ -71,8 +71,8 @@ describe('AdminRunnersApp', () => {
const createComponent = ({ props = {}, mountFn = shallowMountExtended } = {}) => { const createComponent = ({ props = {}, mountFn = shallowMountExtended } = {}) => {
const handlers = [ const handlers = [
[getRunnersQuery, mockRunnersQuery], [adminRunnersQuery, mockRunnersQuery],
[getRunnersCountQuery, mockRunnersCountQuery], [adminRunnersCountQuery, mockRunnersCountQuery],
]; ];
wrapper = mountFn(AdminRunnersApp, { wrapper = mountFn(AdminRunnersApp, {
......
...@@ -8,7 +8,7 @@ import waitForPromises from 'helpers/wait_for_promises'; ...@@ -8,7 +8,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import { createAlert } from '~/flash'; import { createAlert } from '~/flash';
import RegistrationTokenResetDropdownItem from '~/runner/components/registration/registration_token_reset_dropdown_item.vue'; import RegistrationTokenResetDropdownItem from '~/runner/components/registration/registration_token_reset_dropdown_item.vue';
import { INSTANCE_TYPE, GROUP_TYPE, PROJECT_TYPE } from '~/runner/constants'; import { INSTANCE_TYPE, GROUP_TYPE, PROJECT_TYPE } from '~/runner/constants';
import runnersRegistrationTokenResetMutation from '~/runner/graphql/runners_registration_token_reset.mutation.graphql'; import runnersRegistrationTokenResetMutation from '~/runner/graphql/list/runners_registration_token_reset.mutation.graphql';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
......
...@@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo'; ...@@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { shallowMountExtended, mountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended, mountExtended } from 'helpers/vue_test_utils_helper';
import runnerDeleteMutation from '~/runner/graphql/runner_delete.mutation.graphql'; import runnerDeleteMutation from '~/runner/graphql/shared/runner_delete.mutation.graphql';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils';
......
...@@ -11,7 +11,7 @@ import RunnerPagination from '~/runner/components/runner_pagination.vue'; ...@@ -11,7 +11,7 @@ import RunnerPagination from '~/runner/components/runner_pagination.vue';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { I18N_NO_JOBS_FOUND, RUNNER_DETAILS_JOBS_PAGE_SIZE } from '~/runner/constants'; import { I18N_NO_JOBS_FOUND, RUNNER_DETAILS_JOBS_PAGE_SIZE } from '~/runner/constants';
import getRunnerJobsQuery from '~/runner/graphql/get_runner_jobs.query.graphql'; import runnerJobsQuery from '~/runner/graphql/details/runner_jobs.query.graphql';
import { runnerData, runnerJobsData } from '../mock_data'; import { runnerData, runnerJobsData } from '../mock_data';
...@@ -34,7 +34,7 @@ describe('RunnerJobs', () => { ...@@ -34,7 +34,7 @@ describe('RunnerJobs', () => {
const createComponent = ({ mountFn = shallowMountExtended } = {}) => { const createComponent = ({ mountFn = shallowMountExtended } = {}) => {
wrapper = mountFn(RunnerJobs, { wrapper = mountFn(RunnerJobs, {
apolloProvider: createMockApollo([[getRunnerJobsQuery, mockRunnerJobsQuery]]), apolloProvider: createMockApollo([[runnerJobsQuery, mockRunnerJobsQuery]]),
propsData: { propsData: {
runner: mockRunner, runner: mockRunner,
}, },
......
...@@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo'; ...@@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { shallowMountExtended, mountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended, mountExtended } from 'helpers/vue_test_utils_helper';
import runnerToggleActiveMutation from '~/runner/graphql/runner_toggle_active.mutation.graphql'; import runnerToggleActiveMutation from '~/runner/graphql/shared/runner_toggle_active.mutation.graphql';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { createAlert } from '~/flash'; import { createAlert } from '~/flash';
......
...@@ -16,7 +16,7 @@ import RunnerAssignedItem from '~/runner/components/runner_assigned_item.vue'; ...@@ -16,7 +16,7 @@ import RunnerAssignedItem from '~/runner/components/runner_assigned_item.vue';
import RunnerPagination from '~/runner/components/runner_pagination.vue'; import RunnerPagination from '~/runner/components/runner_pagination.vue';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import getRunnerProjectsQuery from '~/runner/graphql/get_runner_projects.query.graphql'; import runnerProjectsQuery from '~/runner/graphql/details/runner_projects.query.graphql';
import { runnerData, runnerProjectsData } from '../mock_data'; import { runnerData, runnerProjectsData } from '../mock_data';
...@@ -40,7 +40,7 @@ describe('RunnerProjects', () => { ...@@ -40,7 +40,7 @@ describe('RunnerProjects', () => {
const createComponent = ({ mountFn = shallowMountExtended } = {}) => { const createComponent = ({ mountFn = shallowMountExtended } = {}) => {
wrapper = mountFn(RunnerProjects, { wrapper = mountFn(RunnerProjects, {
apolloProvider: createMockApollo([[getRunnerProjectsQuery, mockRunnerProjectsQuery]]), apolloProvider: createMockApollo([[runnerProjectsQuery, mockRunnerProjectsQuery]]),
propsData: { propsData: {
runner: mockRunner, runner: mockRunner,
}, },
......
...@@ -13,7 +13,7 @@ import { ...@@ -13,7 +13,7 @@ import {
ACCESS_LEVEL_REF_PROTECTED, ACCESS_LEVEL_REF_PROTECTED,
ACCESS_LEVEL_NOT_PROTECTED, ACCESS_LEVEL_NOT_PROTECTED,
} from '~/runner/constants'; } from '~/runner/constants';
import runnerUpdateMutation from '~/runner/graphql/runner_update.mutation.graphql'; import runnerUpdateMutation from '~/runner/graphql/details/runner_update.mutation.graphql';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import { runnerData } from '../mock_data'; import { runnerData } from '../mock_data';
......
...@@ -32,8 +32,8 @@ import { ...@@ -32,8 +32,8 @@ import {
RUNNER_PAGE_SIZE, RUNNER_PAGE_SIZE,
I18N_EDIT, I18N_EDIT,
} from '~/runner/constants'; } from '~/runner/constants';
import getGroupRunnersQuery from '~/runner/graphql/get_group_runners.query.graphql'; import getGroupRunnersQuery from '~/runner/graphql/list/group_runners.query.graphql';
import getGroupRunnersCountQuery from '~/runner/graphql/get_group_runners_count.query.graphql'; import getGroupRunnersCountQuery from '~/runner/graphql/list/group_runners_count.query.graphql';
import GroupRunnersApp from '~/runner/group_runners/group_runners_app.vue'; import GroupRunnersApp from '~/runner/group_runners/group_runners_app.vue';
import { captureException } from '~/runner/sentry_utils'; import { captureException } from '~/runner/sentry_utils';
import FilteredSearch from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue'; import FilteredSearch from '~/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue';
......
// Fixtures generated by: spec/frontend/fixtures/runner.rb // Fixtures generated by: spec/frontend/fixtures/runner.rb
// Admin queries // List queries
import runnersData from 'test_fixtures/graphql/runner/get_runners.query.graphql.json'; import runnersData from 'test_fixtures/graphql/runner/list/admin_runners.query.graphql.json';
import runnersCountData from 'test_fixtures/graphql/runner/get_runners_count.query.graphql.json'; import runnersDataPaginated from 'test_fixtures/graphql/runner/list/admin_runners.query.graphql.paginated.json';
import runnersDataPaginated from 'test_fixtures/graphql/runner/get_runners.query.graphql.paginated.json'; import runnersCountData from 'test_fixtures/graphql/runner/list/admin_runners_count.query.graphql.json';
import runnerData from 'test_fixtures/graphql/runner/get_runner.query.graphql.json'; import groupRunnersData from 'test_fixtures/graphql/runner/list/group_runners.query.graphql.json';
import runnerWithGroupData from 'test_fixtures/graphql/runner/get_runner.query.graphql.with_group.json'; import groupRunnersDataPaginated from 'test_fixtures/graphql/runner/list/group_runners.query.graphql.paginated.json';
import runnerProjectsData from 'test_fixtures/graphql/runner/get_runner_projects.query.graphql.json'; import groupRunnersCountData from 'test_fixtures/graphql/runner/list/group_runners_count.query.graphql.json';
import runnerJobsData from 'test_fixtures/graphql/runner/get_runner_jobs.query.graphql.json';
// Group queries // Details queries
import groupRunnersData from 'test_fixtures/graphql/runner/get_group_runners.query.graphql.json'; import runnerData from 'test_fixtures/graphql/runner/details/runner.query.graphql.json';
import groupRunnersCountData from 'test_fixtures/graphql/runner/get_group_runners_count.query.graphql.json'; import runnerWithGroupData from 'test_fixtures/graphql/runner/details/runner.query.graphql.with_group.json';
import groupRunnersDataPaginated from 'test_fixtures/graphql/runner/get_group_runners.query.graphql.paginated.json'; import runnerProjectsData from 'test_fixtures/graphql/runner/details/runner_projects.query.graphql.json';
import runnerJobsData from 'test_fixtures/graphql/runner/details/runner_jobs.query.graphql.json';
export { export {
runnersData, runnersData,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment