Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
bb896ae9cb
commit
2086fce7ba
|
|
@ -1,26 +1,23 @@
|
|||
<script>
|
||||
import {
|
||||
GlAlert,
|
||||
GlLoadingIcon,
|
||||
GlFormGroup,
|
||||
GlFormInput,
|
||||
GlFormInputGroup,
|
||||
GlInputGroupText,
|
||||
} from '@gitlab/ui';
|
||||
import { createAlert } from '~/alert';
|
||||
import { numberToHumanSize } from '~/lib/utils/number_utils';
|
||||
import { joinPaths } from '~/lib/utils/url_utility';
|
||||
import { s__ } from '~/locale';
|
||||
import UploadDropzone from '~/vue_shared/components/upload_dropzone/upload_dropzone.vue';
|
||||
import { uploadModel } from '../services/upload_model';
|
||||
|
||||
const emptyValue = {
|
||||
file: null,
|
||||
subfolder: '',
|
||||
};
|
||||
import { emptyArtifactFile } from '../constants';
|
||||
|
||||
export default {
|
||||
name: 'ImportArtifactZone',
|
||||
components: {
|
||||
GlAlert,
|
||||
GlFormGroup,
|
||||
GlFormInput,
|
||||
GlFormInputGroup,
|
||||
|
|
@ -42,7 +39,7 @@ export default {
|
|||
value: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => emptyValue,
|
||||
default: () => emptyArtifactFile,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
|
@ -50,6 +47,7 @@ export default {
|
|||
file: this.value.file,
|
||||
subfolder: this.value.subfolder,
|
||||
loading: false,
|
||||
error: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -62,30 +60,43 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
resetFile() {
|
||||
this.file = null;
|
||||
this.loading = false;
|
||||
this.$emit('input', null);
|
||||
this.discardFile();
|
||||
},
|
||||
submitRequest(importPath) {
|
||||
this.loading = true;
|
||||
uploadModel({ importPath, file: this.file, subfolder: this.subfolder })
|
||||
.then(() => {
|
||||
this.resetFile();
|
||||
this.$emit('change');
|
||||
this.resetFile();
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((error) => {
|
||||
this.resetFile();
|
||||
createAlert({ message: this.$options.i18n.errorMessage });
|
||||
this.error = error;
|
||||
});
|
||||
},
|
||||
emitInput(value) {
|
||||
this.$emit('input', { ...value });
|
||||
},
|
||||
changeSubfolder(subfolder) {
|
||||
this.subfolder = subfolder;
|
||||
this.emitInput({ file: this.file, subfolder });
|
||||
},
|
||||
uploadFile(file) {
|
||||
this.file = file;
|
||||
this.emitInput({ file, subfolder: this.subfolder });
|
||||
|
||||
if (this.submitOnSelect && this.path) {
|
||||
this.submitRequest(this.path);
|
||||
}
|
||||
|
||||
this.$emit('input', { file, subfolder: this.subfolder });
|
||||
},
|
||||
hideAlert() {
|
||||
this.error = null;
|
||||
},
|
||||
discardFile() {
|
||||
this.file = null;
|
||||
this.subfolder = '';
|
||||
this.emitInput(emptyArtifactFile);
|
||||
},
|
||||
},
|
||||
i18n: {
|
||||
|
|
@ -93,8 +104,6 @@ export default {
|
|||
uploadSingleMessage: s__(
|
||||
'MlModelRegistry|Drop or %{linkStart}select%{linkEnd} artifact to attach',
|
||||
),
|
||||
errorMessage: s__('MlModelRegistry|Error importing artifact. Please try again.'),
|
||||
submitErrorMessage: s__('MlModelRegistry|Nothing to submit. Please try again.'),
|
||||
subfolderPrependText: s__('MlModelRegistry|Upload files under path: '),
|
||||
},
|
||||
validFileMimetypes: [],
|
||||
|
|
@ -104,21 +113,20 @@ export default {
|
|||
<div class="gl-p-5">
|
||||
<upload-dropzone
|
||||
single-file-selection
|
||||
display-as-card
|
||||
:valid-file-mimetypes="$options.validFileMimetypes"
|
||||
:upload-single-message="$options.i18n.uploadSingleMessage"
|
||||
:drop-to-start-message="$options.i18n.dropToStartMessage"
|
||||
:is-file-valid="() => true"
|
||||
@change="uploadFile"
|
||||
>
|
||||
<div
|
||||
v-if="file"
|
||||
class="card upload-dropzone-card upload-dropzone-border gl-w-full gl-h-full gl-align-items-center gl-justify-content-center gl-p-3"
|
||||
>
|
||||
<gl-alert v-if="file" variant="success" :dismissible="!loading" @dismiss="discardFile">
|
||||
<gl-loading-icon v-if="loading" class="gl-p-5" size="sm" />
|
||||
<div data-testid="formatted-file-size">{{ formattedFileSize }}</div>
|
||||
<div data-testid="file-name">{{ fileFullpath }}</div>
|
||||
</div>
|
||||
</gl-alert>
|
||||
<gl-alert v-if="error" variant="danger" :dismissible="true" @dismiss="hideAlert">
|
||||
{{ error }}
|
||||
</gl-alert>
|
||||
</upload-dropzone>
|
||||
<gl-form-group label-for="subfolderId">
|
||||
<div>
|
||||
|
|
@ -129,6 +137,7 @@ export default {
|
|||
data-testid="subfolderId"
|
||||
autocomplete="off"
|
||||
class="gl-mb-5"
|
||||
@input="changeSubfolder"
|
||||
/>
|
||||
|
||||
<template #prepend>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
WIDGET_TYPE_LINKED_ITEMS,
|
||||
WIDGET_TYPE_DESIGNS,
|
||||
LINKED_ITEMS_ANCHOR,
|
||||
WORK_ITEM_REFERENCE_CHAR,
|
||||
} from '../constants';
|
||||
|
||||
import workItemUpdatedSubscription from '../graphql/work_item_updated.subscription.graphql';
|
||||
|
|
@ -152,7 +153,7 @@ export default {
|
|||
? ` · ${this.workItem.namespace.fullPath}`
|
||||
: '';
|
||||
|
||||
document.title = `${this.workItem.title} · ${this.workItem?.workItemType?.name}${path}`;
|
||||
document.title = `${this.workItem.title} (${WORK_ITEM_REFERENCE_CHAR}${this.workItem.iid}) · ${this.workItem?.workItemType?.name}${path}`;
|
||||
}
|
||||
},
|
||||
subscribeToMore: {
|
||||
|
|
|
|||
|
|
@ -351,3 +351,5 @@ export const DEFAULT_EPIC_COLORS = '#1068bf';
|
|||
|
||||
export const MAX_FREQUENT_PROJECTS = 3;
|
||||
export const CREATE_NEW_WORK_ITEM_MODAL = 'create_new_work_item_modal';
|
||||
|
||||
export const WORK_ITEM_REFERENCE_CHAR = '#';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
variables:
|
||||
DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.91.0'
|
||||
DAST_AUTO_DEPLOY_IMAGE_VERSION: 'v2.93.0'
|
||||
|
||||
.dast-auto-deploy:
|
||||
image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${DAST_AUTO_DEPLOY_IMAGE_VERSION}"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
variables:
|
||||
AUTO_DEPLOY_IMAGE_VERSION: 'v2.91.0'
|
||||
AUTO_DEPLOY_IMAGE_VERSION: 'v2.93.0'
|
||||
|
||||
.auto-deploy:
|
||||
image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
variables:
|
||||
AUTO_DEPLOY_IMAGE_VERSION: 'v2.91.0'
|
||||
AUTO_DEPLOY_IMAGE_VERSION: 'v2.93.0'
|
||||
|
||||
.auto-deploy:
|
||||
image: "${CI_TEMPLATE_REGISTRY_HOST}/gitlab-org/cluster-integration/auto-deploy-image:${AUTO_DEPLOY_IMAGE_VERSION}"
|
||||
|
|
|
|||
|
|
@ -33252,9 +33252,6 @@ msgstr ""
|
|||
msgid "MlModelRegistry|Enter some model description"
|
||||
msgstr ""
|
||||
|
||||
msgid "MlModelRegistry|Error importing artifact. Please try again."
|
||||
msgstr ""
|
||||
|
||||
msgid "MlModelRegistry|Experiment"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -33351,9 +33348,6 @@ msgstr ""
|
|||
msgid "MlModelRegistry|No registered versions"
|
||||
msgstr ""
|
||||
|
||||
msgid "MlModelRegistry|Nothing to submit. Please try again."
|
||||
msgstr ""
|
||||
|
||||
msgid "MlModelRegistry|Parameters"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { GlFormInputGroup, GlLoadingIcon, GlInputGroupText } from '@gitlab/ui';
|
||||
import { GlAlert, GlFormInputGroup, GlLoadingIcon, GlInputGroupText } from '@gitlab/ui';
|
||||
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
|
||||
import waitForPromises from 'helpers/wait_for_promises';
|
||||
import { createAlert } from '~/alert';
|
||||
import { uploadModel } from '~/ml/model_registry/services/upload_model';
|
||||
import ImportArtifactZone from '~/ml/model_registry/components/import_artifact_zone.vue';
|
||||
import UploadDropzone from '~/vue_shared/components/upload_dropzone/upload_dropzone.vue';
|
||||
|
|
@ -25,6 +24,7 @@ describe('ImportArtifactZone', () => {
|
|||
const emulateFileDrop = () => zone().vm.$emit('change', file);
|
||||
const subfolderInput = () => wrapper.findByTestId('subfolderId');
|
||||
const subfolderInputPrependText = () => wrapper.findComponent(GlInputGroupText);
|
||||
const alert = () => wrapper.findComponent(GlAlert);
|
||||
|
||||
describe('Successful upload', () => {
|
||||
beforeEach(() => {
|
||||
|
|
@ -134,14 +134,12 @@ describe('ImportArtifactZone', () => {
|
|||
});
|
||||
|
||||
it('displays an error on failure', async () => {
|
||||
uploadModel.mockRejectedValue('Internal server error.');
|
||||
uploadModel.mockRejectedValue('File is too big.');
|
||||
|
||||
await emulateFileDrop();
|
||||
await waitForPromises();
|
||||
|
||||
expect(createAlert).toHaveBeenCalledWith({
|
||||
message: 'Error importing artifact. Please try again.',
|
||||
});
|
||||
expect(alert().text()).toBe('File is too big.');
|
||||
});
|
||||
|
||||
it('resets the state on failure', async () => {
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ describe('WorkItemDetail component', () => {
|
|||
});
|
||||
|
||||
it('updates the document title', () => {
|
||||
expect(document.title).toEqual('Updated title · Task · test-project-path');
|
||||
expect(document.title).toEqual('Updated title (#1) · Task · test-project-path');
|
||||
});
|
||||
|
||||
it('renders todos widget if logged in', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue