diff --git a/app/assets/javascripts/clusters/agents/index.js b/app/assets/javascripts/clusters/agents/index.js index 10055092c29..ba7b3edba72 100644 --- a/app/assets/javascripts/clusters/agents/index.js +++ b/app/assets/javascripts/clusters/agents/index.js @@ -1,6 +1,7 @@ import Vue from 'vue'; import AgentShowPage from 'ee_else_ce/clusters/agents/components/show.vue'; import apolloProvider from './graphql/provider'; +import createRouter from './router'; export default () => { const el = document.querySelector('#js-cluster-agent-details'); @@ -20,6 +21,7 @@ export default () => { return new Vue({ el, apolloProvider, + router: createRouter(), provide: { activityEmptyStateImage, agentName, diff --git a/app/assets/javascripts/clusters/agents/router.js b/app/assets/javascripts/clusters/agents/router.js new file mode 100644 index 00000000000..162a91dc300 --- /dev/null +++ b/app/assets/javascripts/clusters/agents/router.js @@ -0,0 +1,22 @@ +import Vue from 'vue'; +import VueRouter from 'vue-router'; + +Vue.use(VueRouter); + +// Vue Router requires a component to render if the route matches, but since we're only using it for +// querystring handling, we'll create an empty component. +const EmptyRouterComponent = { + render(createElement) { + return createElement('div'); + }, +}; + +export default () => { + // Name and path here don't really matter since we're not rendering anything if the route matches. + const routes = [{ path: '/', name: 'cluster_agents', component: EmptyRouterComponent }]; + return new VueRouter({ + mode: 'history', + base: window.location.pathname, + routes, + }); +}; diff --git a/app/assets/javascripts/pipeline_wizard/components/commit.vue b/app/assets/javascripts/pipeline_wizard/components/commit.vue new file mode 100644 index 00000000000..518b41c66b1 --- /dev/null +++ b/app/assets/javascripts/pipeline_wizard/components/commit.vue @@ -0,0 +1,224 @@ + + + diff --git a/app/assets/javascripts/pipeline_wizard/queries/create_commit.graphql b/app/assets/javascripts/pipeline_wizard/queries/create_commit.graphql new file mode 100644 index 00000000000..9abf8eff587 --- /dev/null +++ b/app/assets/javascripts/pipeline_wizard/queries/create_commit.graphql @@ -0,0 +1,9 @@ +mutation CreateCommit($input: CommitCreateInput!) { + commitCreate(input: $input) { + commit { + id + } + content + errors + } +} diff --git a/app/assets/javascripts/pipeline_wizard/queries/get_file_meta.graphql b/app/assets/javascripts/pipeline_wizard/queries/get_file_meta.graphql new file mode 100644 index 00000000000..87f014fade6 --- /dev/null +++ b/app/assets/javascripts/pipeline_wizard/queries/get_file_meta.graphql @@ -0,0 +1,12 @@ +query GetFileMetadata($fullPath: ID!, $filePath: String!, $ref: String) { + project(fullPath: $fullPath) { + id + repository { + blobs(paths: [$filePath], ref: $ref) { + nodes { + id + } + } + } + } +} diff --git a/app/assets/javascripts/security_configuration/components/training_provider_list.vue b/app/assets/javascripts/security_configuration/components/training_provider_list.vue index dea94503e62..539e2bff17c 100644 --- a/app/assets/javascripts/security_configuration/components/training_provider_list.vue +++ b/app/assets/javascripts/security_configuration/components/training_provider_list.vue @@ -49,7 +49,7 @@ export default { data() { return { errorMessage: '', - toggleLoading: false, + providerLoadingId: null, securityTrainingProviders: [], hasTouchedConfiguration: false, }; @@ -89,37 +89,29 @@ export default { Sentry.captureException(e); } }, - toggleProvider(selectedProviderId) { - const toggledProviders = this.securityTrainingProviders.map((provider) => ({ - ...provider, - ...(provider.id === selectedProviderId && { isEnabled: !provider.isEnabled }), - })); + toggleProvider(provider) { + const { isEnabled } = provider; + const toggledIsEnabled = !isEnabled; - const enabledProviderIds = toggledProviders - .filter(({ isEnabled }) => isEnabled) - .map(({ id }) => id); - - const { isEnabled: selectedProviderIsEnabled } = toggledProviders.find( - (provider) => provider.id === selectedProviderId, - ); - - this.trackProviderToggle(selectedProviderId, selectedProviderIsEnabled); - this.storeEnabledProviders(enabledProviderIds); + this.trackProviderToggle(provider.id, toggledIsEnabled); + this.storeProvider({ ...provider, isEnabled: toggledIsEnabled }); }, - async storeEnabledProviders(enabledProviderIds) { - this.toggleLoading = true; + async storeProvider({ id, isEnabled, isPrimary }) { + this.providerLoadingId = id; try { const { data: { - configureSecurityTrainingProviders: { errors = [] }, + securityTrainingUpdate: { errors = [] }, }, } = await this.$apollo.mutate({ mutation: configureSecurityTrainingProvidersMutation, variables: { input: { - enabledProviders: enabledProviderIds, - fullPath: this.projectFullPath, + projectPath: this.projectFullPath, + providerId: id, + isEnabled, + isPrimary, }, }, }); @@ -133,7 +125,7 @@ export default { } catch { this.errorMessage = this.$options.i18n.configMutationErrorMessage; } finally { - this.toggleLoading = false; + this.providerLoadingId = null; } }, trackProviderToggle(providerId, providerIsEnabled) { @@ -166,25 +158,21 @@ export default {