Commit 034d543b authored by Fabio Pitino's avatar Fabio Pitino Committed by Miguel Rincon

Remove specs that test for disabled state

These specs are not relevant anymore as the these settings are
completely hidden from the user when they don't have access.
parent 9b664910
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
import { GlAlert, GlFormCheckbox, GlLink } from '@gitlab/ui'; import { GlAlert, GlFormCheckbox, GlLink } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import UpdateKeepLatestArtifactProjectSetting from './graphql/mutations/update_keep_latest_artifact_project_setting.mutation.graphql'; import UpdateKeepLatestArtifactProjectSetting from './graphql/mutations/update_keep_latest_artifact_project_setting.mutation.graphql';
import GetKeepLatestArtifactApplicationSetting from './graphql/queries/get_keep_latest_artifact_application_setting.query.graphql';
import GetKeepLatestArtifactProjectSetting from './graphql/queries/get_keep_latest_artifact_project_setting.query.graphql'; import GetKeepLatestArtifactProjectSetting from './graphql/queries/get_keep_latest_artifact_project_setting.query.graphql';
export default { export default {
...@@ -14,7 +13,6 @@ export default { ...@@ -14,7 +13,6 @@ export default {
enabledHelpText: __( enabledHelpText: __(
'The latest artifacts created by jobs in the most recent successful pipeline will be stored.', 'The latest artifacts created by jobs in the most recent successful pipeline will be stored.',
), ),
disabledHelpText: __('This feature is disabled at the instance level.'),
helpLinkText: __('More information'), helpLinkText: __('More information'),
checkboxText: __('Keep artifacts from most recent successful jobs'), checkboxText: __('Keep artifacts from most recent successful jobs'),
}, },
...@@ -46,19 +44,12 @@ export default { ...@@ -46,19 +44,12 @@ export default {
this.reportError(this.$options.errors.fetchError); this.reportError(this.$options.errors.fetchError);
}, },
}, },
projectSettingDisabled: {
query: GetKeepLatestArtifactApplicationSetting,
update(data) {
return !data.ciApplicationSettings?.keepLatestArtifact;
},
},
}, },
data() { data() {
return { return {
keepLatestArtifact: null, keepLatestArtifact: null,
errorMessage: '', errorMessage: '',
isAlertDismissed: false, isAlertDismissed: false,
projectSettingDisabled: true,
}; };
}, },
computed: { computed: {
...@@ -66,9 +57,7 @@ export default { ...@@ -66,9 +57,7 @@ export default {
return this.errorMessage && !this.isAlertDismissed; return this.errorMessage && !this.isAlertDismissed;
}, },
helpText() { helpText() {
return this.projectSettingDisabled return this.$options.i18n.enabledHelpText;
? this.$options.i18n.disabledHelpText
: this.$options.i18n.enabledHelpText;
}, },
}, },
methods: { methods: {
...@@ -106,10 +95,7 @@ export default { ...@@ -106,10 +95,7 @@ export default {
@dismiss="isAlertDismissed = true" @dismiss="isAlertDismissed = true"
>{{ errorMessage }}</gl-alert >{{ errorMessage }}</gl-alert
> >
<gl-form-checkbox <gl-form-checkbox v-model="keepLatestArtifact" @change="updateSetting"
v-model="keepLatestArtifact"
:disabled="projectSettingDisabled"
@change="updateSetting"
><strong class="gl-mr-3">{{ $options.i18n.checkboxText }}</strong> ><strong class="gl-mr-3">{{ $options.i18n.checkboxText }}</strong>
<gl-link :href="helpPagePath">{{ $options.i18n.helpLinkText }}</gl-link> <gl-link :href="helpPagePath">{{ $options.i18n.helpLinkText }}</gl-link>
<template v-if="!$apollo.loading" #help>{{ helpText }}</template> <template v-if="!$apollo.loading" #help>{{ helpText }}</template>
......
...@@ -47,16 +47,17 @@ ...@@ -47,16 +47,17 @@
.settings-content .settings-content
= render 'projects/runners/index' = render 'projects/runners/index'
%section.settings.no-animate#js-artifacts-settings{ class: ('expanded' if expanded) } - if Gitlab::CurrentSettings.current_application_settings.keep_latest_artifact?
.settings-header %section.settings.no-animate#js-artifacts-settings{ class: ('expanded' if expanded) }
%h4 .settings-header
= _("Artifacts") %h4
%button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' } = _("Artifacts")
= expanded ? _('Collapse') : _('Expand') %button.btn.gl-button.btn-default.js-settings-toggle{ type: 'button' }
%p = expanded ? _('Collapse') : _('Expand')
= _("A job artifact is an archive of files and directories saved by a job when it finishes.") %p
.settings-content = _("A job artifact is an archive of files and directories saved by a job when it finishes.")
#js-artifacts-settings-app{ data: { full_path: @project.full_path, help_page_path: help_page_path('ci/pipelines/job_artifacts', anchor: 'keep-artifacts-from-most-recent-successful-jobs') } } .settings-content
#js-artifacts-settings-app{ data: { full_path: @project.full_path, help_page_path: help_page_path('ci/pipelines/job_artifacts', anchor: 'keep-artifacts-from-most-recent-successful-jobs') } }
%section.qa-variables-settings.settings.no-animate#js-cicd-variables-settings{ class: ('expanded' if expanded), data: { qa_selector: 'variables_settings_content' } } %section.qa-variables-settings.settings.no-animate#js-cicd-variables-settings{ class: ('expanded' if expanded), data: { qa_selector: 'variables_settings_content' } }
.settings-header .settings-header
......
---
title: Fix keep latest artifacts checkbox being always disabled
merge_request: 54669
author:
type: fixed
...@@ -30054,9 +30054,6 @@ msgstr "" ...@@ -30054,9 +30054,6 @@ msgstr ""
msgid "This epic does not exist or you don't have sufficient permission." msgid "This epic does not exist or you don't have sufficient permission."
msgstr "" msgstr ""
msgid "This feature is disabled at the instance level."
msgstr ""
msgid "This feature requires local storage to be enabled" msgid "This feature requires local storage to be enabled"
msgstr "" msgstr ""
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Keep latest artifact checkbox when application keep latest artifact setting is disabled checkbox is disabled when application setting is disabled 1`] = `
<div>
<!---->
<b-form-checkbox-stub
checked="true"
class="gl-form-checkbox"
disabled="true"
plain="true"
value="true"
>
<strong
class="gl-mr-3"
>
Keep artifacts from most recent successful jobs
</strong>
<gl-link-stub
href="/help/ci/pipelines/job_artifacts"
>
More information
</gl-link-stub>
<p
class="help-text"
>
This feature is disabled at the instance level.
</p>
</b-form-checkbox-stub>
</div>
`;
exports[`Keep latest artifact checkbox when application keep latest artifact setting is enabled sets correct setting value in checkbox with query result 1`] = ` exports[`Keep latest artifact checkbox when application keep latest artifact setting is enabled sets correct setting value in checkbox with query result 1`] = `
<div> <div>
<!----> <!---->
......
...@@ -120,23 +120,4 @@ describe('Keep latest artifact checkbox', () => { ...@@ -120,23 +120,4 @@ describe('Keep latest artifact checkbox', () => {
expect(findCheckbox().attributes('disabled')).toBeUndefined(); expect(findCheckbox().attributes('disabled')).toBeUndefined();
}); });
}); });
describe('when application keep latest artifact setting is disabled', () => {
it('checkbox is disabled when application setting is disabled', async () => {
createComponent({
keepLatestArtifactApplicationQueryHandler: jest.fn().mockResolvedValue({
data: {
ciApplicationSettings: {
keepLatestArtifact: false,
},
},
}),
});
await wrapper.vm.$nextTick();
expect(wrapper.element).toMatchSnapshot();
expect(findCheckbox().attributes('disabled')).toBe('true');
});
});
}); });
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