Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
a60762f1c9
commit
7a78c31f67
13 changed files with 72 additions and 19 deletions
|
@ -109,7 +109,7 @@ export default {
|
|||
return regex.test(this.variable.secret_value);
|
||||
},
|
||||
containsVariableReference() {
|
||||
const regex = RegExp(/\$/);
|
||||
const regex = /\$/;
|
||||
return regex.test(this.variable.secret_value);
|
||||
},
|
||||
displayMaskedError() {
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
EXTENSION_BASE_LINE_NUMBERS_CLASS,
|
||||
} from '../constants';
|
||||
|
||||
const hashRegexp = new RegExp('#?L', 'g');
|
||||
const hashRegexp = /#?L/g;
|
||||
|
||||
const createAnchor = (href) => {
|
||||
const fragment = new DocumentFragment();
|
||||
|
|
|
@ -581,7 +581,7 @@ export default class FilteredSearchManager {
|
|||
* Eg. not[foo]=%bar
|
||||
* key = foo; value = %bar
|
||||
*/
|
||||
const notKeyValueRegex = new RegExp(/not\[(\w+)\]\[?\]?=(.*)/);
|
||||
const notKeyValueRegex = /not\[(\w+)\]\[?\]?=(.*)/;
|
||||
|
||||
return params.map((query) => {
|
||||
// Check if there are matches for `not` operator
|
||||
|
|
|
@ -844,7 +844,7 @@ class GfmAutoComplete {
|
|||
}
|
||||
}
|
||||
|
||||
GfmAutoComplete.regexSubtext = new RegExp(/\s+/g);
|
||||
GfmAutoComplete.regexSubtext = /\s+/g;
|
||||
|
||||
GfmAutoComplete.defaultLoadingData = ['loading'];
|
||||
|
||||
|
|
|
@ -69,12 +69,12 @@ export default class CreateMergeRequestDropdown {
|
|||
// with user's inputs.
|
||||
this.regexps = {
|
||||
branch: {
|
||||
createBranchPath: new RegExp('(branch_name=)(.+?)(?=&issue)'),
|
||||
createMrPath: new RegExp('(source_branch%5D=)(.+?)(?=&)'),
|
||||
createBranchPath: /(branch_name=)(.+?)(?=&issue)/,
|
||||
createMrPath: /(source_branch%5D=)(.+?)(?=&)/,
|
||||
},
|
||||
ref: {
|
||||
createBranchPath: new RegExp('(ref=)(.+?)$'),
|
||||
createMrPath: new RegExp('(target_branch%5D=)(.+?)$'),
|
||||
createBranchPath: /(ref=)(.+?)$/,
|
||||
createMrPath: /(target_branch%5D=)(.+?)$/,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ export default {
|
|||
this.selectedTemplate = selectedTemplate;
|
||||
},
|
||||
validateProjectKey() {
|
||||
if (this.projectKey && !new RegExp(/^[a-z0-9_]+$/).test(this.projectKey)) {
|
||||
if (this.projectKey && !/^[a-z0-9_]+$/.test(this.projectKey)) {
|
||||
this.projectKeyError = __('Only use lowercase letters, numbers, and underscores.');
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ const Template = (args, { argTypes }) => ({
|
|||
additionalInformation: args.additionalInformation || null,
|
||||
confirmDangerMessage: args.confirmDangerMessage || 'You require more Vespene Gas',
|
||||
htmlConfirmationMessage: args.confirmDangerMessage || false,
|
||||
confirmButtonText: args.confirmButtonText || 'Cancel',
|
||||
cancelButtonText: args.cancelButtonText || 'Confirm',
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
CONFIRM_DANGER_MODAL_TITLE,
|
||||
CONFIRM_DANGER_PHRASE_TEXT,
|
||||
CONFIRM_DANGER_WARNING,
|
||||
CONFIRM_DANGER_MODAL_ERROR,
|
||||
CONFIRM_DANGER_MODAL_CANCEL,
|
||||
} from './constants';
|
||||
|
||||
export default {
|
||||
|
@ -40,6 +40,9 @@ export default {
|
|||
additionalInformation: {
|
||||
default: CONFIRM_DANGER_WARNING,
|
||||
},
|
||||
cancelButtonText: {
|
||||
default: CONFIRM_DANGER_MODAL_CANCEL,
|
||||
},
|
||||
},
|
||||
props: {
|
||||
modalId: {
|
||||
|
@ -66,6 +69,11 @@ export default {
|
|||
attributes: [{ variant: 'danger', disabled: !this.isValid, class: 'qa-confirm-button' }],
|
||||
};
|
||||
},
|
||||
actionCancel() {
|
||||
return {
|
||||
text: this.cancelButtonText,
|
||||
};
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
equalString(a, b) {
|
||||
|
@ -77,7 +85,6 @@ export default {
|
|||
CONFIRM_DANGER_MODAL_TITLE,
|
||||
CONFIRM_DANGER_WARNING,
|
||||
CONFIRM_DANGER_PHRASE_TEXT,
|
||||
CONFIRM_DANGER_MODAL_ERROR,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -88,6 +95,7 @@ export default {
|
|||
:data-testid="modalId"
|
||||
:title="$options.i18n.CONFIRM_DANGER_MODAL_TITLE"
|
||||
:action-primary="actionPrimary"
|
||||
:action-cancel="actionCancel"
|
||||
@primary="$emit('confirm')"
|
||||
>
|
||||
<gl-alert
|
||||
|
@ -110,7 +118,7 @@ export default {
|
|||
</template>
|
||||
</gl-sprintf>
|
||||
</p>
|
||||
<gl-form-group :state="isValid" :invalid-feedback="$options.i18n.CONFIRM_DANGER_MODAL_ERROR">
|
||||
<gl-form-group :state="isValid">
|
||||
<gl-form-input
|
||||
id="confirm_name_input"
|
||||
v-model="confirmationPhrase"
|
||||
|
|
|
@ -2,7 +2,6 @@ import { __ } from '~/locale';
|
|||
|
||||
export const CONFIRM_DANGER_MODAL_ID = 'confirm-danger-modal';
|
||||
export const CONFIRM_DANGER_MODAL_TITLE = __('Confirmation required');
|
||||
export const CONFIRM_DANGER_MODAL_ERROR = __('Confirmation required');
|
||||
export const CONFIRM_DANGER_MODAL_BUTTON = __('Confirm');
|
||||
export const CONFIRM_DANGER_WARNING = __(
|
||||
'This action can lead to data loss. To prevent accidental actions we ask you to confirm your intention.',
|
||||
|
@ -10,3 +9,4 @@ export const CONFIRM_DANGER_WARNING = __(
|
|||
export const CONFIRM_DANGER_PHRASE_TEXT = __(
|
||||
'Please type %{phrase_code} to proceed or close this modal to cancel.',
|
||||
);
|
||||
export const CONFIRM_DANGER_MODAL_CANCEL = __('Cancel');
|
||||
|
|
|
@ -58,7 +58,7 @@ module Gitlab
|
|||
def url(path)
|
||||
host = integration.api_url.presence || integration.url
|
||||
|
||||
URI.join(host, '/api.php/v1/', path)
|
||||
URI.parse(Gitlab::Utils.append_path(host, "api.php/v1/#{path}"))
|
||||
end
|
||||
|
||||
def headers
|
||||
|
|
|
@ -371,10 +371,8 @@ describe('Badges store actions', () => {
|
|||
const url = axios.get.mock.calls[0][0];
|
||||
|
||||
expect(url).toMatch(new RegExp(`^${dummyEndpointUrl}/render?`));
|
||||
expect(url).toMatch(
|
||||
new RegExp('\\?link_url=%3Cscript%3EI%20am%20dangerous!%3C%2Fscript%3E&'),
|
||||
);
|
||||
expect(url).toMatch(new RegExp('&image_url=%26make-sandwich%3Dtrue$'));
|
||||
expect(url).toMatch(/\\?link_url=%3Cscript%3EI%20am%20dangerous!%3C%2Fscript%3E&/);
|
||||
expect(url).toMatch(/&image_url=%26make-sandwich%3Dtrue$/);
|
||||
});
|
||||
|
||||
it('dispatches requestRenderedBadge and receiveRenderedBadge for successful response', async () => {
|
||||
|
|
|
@ -3,6 +3,7 @@ import {
|
|||
CONFIRM_DANGER_WARNING,
|
||||
CONFIRM_DANGER_MODAL_BUTTON,
|
||||
CONFIRM_DANGER_MODAL_ID,
|
||||
CONFIRM_DANGER_MODAL_CANCEL,
|
||||
} from '~/vue_shared/components/confirm_danger/constants';
|
||||
import ConfirmDangerModal from '~/vue_shared/components/confirm_danger/confirm_danger_modal.vue';
|
||||
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
|
||||
|
@ -10,6 +11,7 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
|
|||
describe('Confirm Danger Modal', () => {
|
||||
const confirmDangerMessage = 'This is a dangerous activity';
|
||||
const confirmButtonText = 'Confirm button text';
|
||||
const cancelButtonText = 'Cancel button text';
|
||||
const phrase = 'You must construct additional pylons';
|
||||
const modalId = CONFIRM_DANGER_MODAL_ID;
|
||||
|
||||
|
@ -21,6 +23,7 @@ describe('Confirm Danger Modal', () => {
|
|||
const findDefaultWarning = () => wrapper.findByTestId('confirm-danger-warning');
|
||||
const findAdditionalMessage = () => wrapper.findByTestId('confirm-danger-message');
|
||||
const findPrimaryAction = () => findModal().props('actionPrimary');
|
||||
const findCancelAction = () => findModal().props('actionCancel');
|
||||
const findPrimaryActionAttributes = (attr) => findPrimaryAction().attributes[0][attr];
|
||||
|
||||
const createComponent = ({ provide = {} } = {}) =>
|
||||
|
@ -34,7 +37,9 @@ describe('Confirm Danger Modal', () => {
|
|||
});
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = createComponent({ provide: { confirmDangerMessage, confirmButtonText } });
|
||||
wrapper = createComponent({
|
||||
provide: { confirmDangerMessage, confirmButtonText, cancelButtonText },
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -54,6 +59,10 @@ describe('Confirm Danger Modal', () => {
|
|||
expect(findPrimaryActionAttributes('variant')).toBe('danger');
|
||||
});
|
||||
|
||||
it('renders the cancel button', () => {
|
||||
expect(findCancelAction().text).toBe(cancelButtonText);
|
||||
});
|
||||
|
||||
it('renders the correct confirmation phrase', () => {
|
||||
expect(findConfirmationPhrase().text()).toBe(
|
||||
`Please type ${phrase} to proceed or close this modal to cancel.`,
|
||||
|
@ -72,6 +81,10 @@ describe('Confirm Danger Modal', () => {
|
|||
it('renders the default confirm button', () => {
|
||||
expect(findPrimaryAction().text).toBe(CONFIRM_DANGER_MODAL_BUTTON);
|
||||
});
|
||||
|
||||
it('renders the default cancel button', () => {
|
||||
expect(findCancelAction().text).toBe(CONFIRM_DANGER_MODAL_CANCEL);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with a valid confirmation phrase', () => {
|
||||
|
|
|
@ -130,4 +130,36 @@ RSpec.describe Gitlab::Zentao::Client do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#url' do
|
||||
context 'api url' do
|
||||
shared_examples 'joins api_url correctly' do
|
||||
it 'verify url' do
|
||||
expect(integration.send(:url, "products/1").to_s)
|
||||
.to eq("https://jihudemo.zentao.net/zentao/api.php/v1/products/1")
|
||||
end
|
||||
end
|
||||
|
||||
context 'no ends slash' do
|
||||
let(:zentao_integration) { create(:zentao_integration, api_url: 'https://jihudemo.zentao.net/zentao') }
|
||||
|
||||
include_examples 'joins api_url correctly'
|
||||
end
|
||||
|
||||
context 'ends slash' do
|
||||
let(:zentao_integration) { create(:zentao_integration, api_url: 'https://jihudemo.zentao.net/zentao/') }
|
||||
|
||||
include_examples 'joins api_url correctly'
|
||||
end
|
||||
end
|
||||
|
||||
context 'no api url' do
|
||||
let(:zentao_integration) { create(:zentao_integration, url: 'https://jihudemo.zentao.net') }
|
||||
|
||||
it 'joins url correctly' do
|
||||
expect(integration.send(:url, "products/1").to_s)
|
||||
.to eq("https://jihudemo.zentao.net/api.php/v1/products/1")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue