Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
64ff088f
Commit
64ff088f
authored
Oct 28, 2020
by
Natalia Tepluhina
Committed by
Jose Ivan Vargas
Oct 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update instances of deprecatedCreateFlash with new createFlash
parent
ecf8d59f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
41 deletions
+41
-41
app/assets/javascripts/design_management/components/upload/design_dropzone.vue
...s/design_management/components/upload/design_dropzone.vue
+2
-2
app/assets/javascripts/design_management/mixins/all_designs.js
...ssets/javascripts/design_management/mixins/all_designs.js
+8
-8
app/assets/javascripts/design_management/pages/design/index.vue
...sets/javascripts/design_management/pages/design/index.vue
+2
-2
app/assets/javascripts/design_management/pages/index.vue
app/assets/javascripts/design_management/pages/index.vue
+10
-10
app/assets/javascripts/design_management/utils/cache_update.js
...ssets/javascripts/design_management/utils/cache_update.js
+3
-3
spec/frontend/design_management/components/upload/design_dropzone_spec.js
...sign_management/components/upload/design_dropzone_spec.js
+1
-1
spec/frontend/design_management/pages/design/index_spec.js
spec/frontend/design_management/pages/design/index_spec.js
+3
-3
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/pages/index_spec.js
+10
-10
spec/frontend/design_management/utils/cache_update_spec.js
spec/frontend/design_management/utils/cache_update_spec.js
+2
-2
No files found.
app/assets/javascripts/design_management/components/upload/design_dropzone.vue
View file @
64ff088f
<
script
>
import
{
GlIcon
,
GlLink
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
uploadDesignMutation
from
'
../../graphql/mutations/upload_design.mutation.graphql
'
;
import
{
UPLOAD_DESIGN_INVALID_FILETYPE_ERROR
}
from
'
../../utils/error_messages
'
;
import
{
isValidDesignFile
}
from
'
../../utils/design_management_utils
'
;
...
...
@@ -56,7 +56,7 @@ export default {
const
{
files
}
=
dataTransfer
;
if
(
!
this
.
isValidUpload
(
Array
.
from
(
files
)))
{
createFlash
(
UPLOAD_DESIGN_INVALID_FILETYPE_ERROR
);
createFlash
(
{
message
:
UPLOAD_DESIGN_INVALID_FILETYPE_ERROR
}
);
return
;
}
...
...
app/assets/javascripts/design_management/mixins/all_designs.js
View file @
64ff088f
import
{
propertyOf
}
from
'
lodash
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
,
{
FLASH_TYPES
}
from
'
~/flash
'
;
import
{
s__
}
from
'
~/locale
'
;
import
getDesignListQuery
from
'
../graphql/queries/get_design_list.query.graphql
'
;
import
allVersionsMixin
from
'
./all_versions
'
;
...
...
@@ -36,20 +36,20 @@ export default {
},
result
()
{
if
(
this
.
$route
.
query
.
version
&&
!
this
.
hasValidVersion
)
{
createFlash
(
s__
(
createFlash
(
{
message
:
s__
(
'
DesignManagement|Requested design version does not exist. Showing latest version instead
'
,
),
);
}
);
this
.
$router
.
replace
({
name
:
DESIGNS_ROUTE_NAME
,
query
:
{
version
:
undefined
}
});
}
if
(
this
.
designCollection
.
copyState
===
'
ERROR
'
)
{
createFlash
(
s__
(
createFlash
(
{
message
:
s__
(
'
DesignManagement|There was an error moving your designs. Please upload your designs below.
'
,
),
'
warning
'
,
);
type
:
FLASH_TYPES
.
WARNING
,
}
);
}
},
},
...
...
app/assets/javascripts/design_management/pages/design/index.vue
View file @
64ff088f
...
...
@@ -2,7 +2,7 @@
import
Mousetrap
from
'
mousetrap
'
;
import
{
GlLoadingIcon
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
ApolloMutation
}
from
'
vue-apollo
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
import
allVersionsMixin
from
'
../../mixins/all_versions
'
;
import
Toolbar
from
'
../../components/toolbar/index.vue
'
;
...
...
@@ -230,7 +230,7 @@ export default {
onQueryError
(
message
)
{
// because we redirect user to /designs (the issue page),
// we want to create these flashes on the issue page
createFlash
(
message
);
createFlash
(
{
message
}
);
this
.
$router
.
push
({
name
:
this
.
$options
.
DESIGNS_ROUTE_NAME
});
},
onError
(
message
,
e
)
{
...
...
app/assets/javascripts/design_management/pages/index.vue
View file @
64ff088f
<
script
>
import
{
GlLoadingIcon
,
GlButton
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
VueDraggable
from
'
vuedraggable
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
,
{
FLASH_TYPES
}
from
'
~/flash
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
getFilename
}
from
'
~/lib/utils/file_upload
'
;
import
UploadButton
from
'
../components/upload/button.vue
'
;
...
...
@@ -139,8 +139,8 @@ export default {
if
(
!
this
.
canCreateDesign
)
return
false
;
if
(
files
.
length
>
MAXIMUM_FILE_UPLOAD_LIMIT
)
{
createFlash
(
sprintf
(
createFlash
(
{
message
:
sprintf
(
s__
(
'
DesignManagement|The maximum number of designs allowed to be uploaded is %{upload_limit}. Please try again.
'
,
),
...
...
@@ -148,7 +148,7 @@ export default {
upload_limit
:
MAXIMUM_FILE_UPLOAD_LIMIT
,
},
),
);
}
);
return
false
;
}
...
...
@@ -191,7 +191,7 @@ export default {
const
skippedFiles
=
res
?.
data
?.
designManagementUpload
?.
skippedDesigns
||
[];
const
skippedWarningMessage
=
designUploadSkippedWarning
(
this
.
filesToBeSaved
,
skippedFiles
);
if
(
skippedWarningMessage
)
{
createFlash
(
skippedWarningMessage
,
'
warning
'
);
createFlash
(
{
message
:
skippedWarningMessage
,
types
:
FLASH_TYPES
.
WARNING
}
);
}
// if this upload resulted in a new version being created, redirect user to the latest version
...
...
@@ -214,7 +214,7 @@ export default {
},
onUploadDesignError
()
{
this
.
resetFilesToBeSaved
();
createFlash
(
UPLOAD_DESIGN_ERROR
);
createFlash
(
{
message
:
UPLOAD_DESIGN_ERROR
}
);
},
changeSelectedDesigns
(
filename
)
{
if
(
this
.
isDesignSelected
(
filename
))
{
...
...
@@ -245,18 +245,18 @@ export default {
},
onDesignDeleteError
()
{
const
errorMessage
=
designDeletionError
({
singular
:
this
.
selectedDesigns
.
length
===
1
});
createFlash
(
errorMessage
);
createFlash
(
{
message
:
errorMessage
}
);
},
onExistingDesignDropzoneChange
(
files
,
existingDesignFilename
)
{
const
filesArr
=
Array
.
from
(
files
);
if
(
filesArr
.
length
>
1
)
{
createFlash
(
EXISTING_DESIGN_DROP_MANY_FILES_MESSAGE
);
createFlash
(
{
message
:
EXISTING_DESIGN_DROP_MANY_FILES_MESSAGE
}
);
return
;
}
if
(
!
filesArr
.
some
(({
name
})
=>
existingDesignFilename
===
name
))
{
createFlash
(
EXISTING_DESIGN_DROP_INVALID_FILENAME_MESSAGE
);
createFlash
(
{
message
:
EXISTING_DESIGN_DROP_INVALID_FILENAME_MESSAGE
}
);
return
;
}
...
...
@@ -307,7 +307,7 @@ export default {
optimisticResponse
:
moveDesignOptimisticResponse
(
this
.
reorderedDesigns
),
})
.
catch
(()
=>
{
createFlash
(
MOVE_DESIGN_ERROR
);
createFlash
(
{
message
:
MOVE_DESIGN_ERROR
}
);
})
.
finally
(()
=>
{
this
.
isReorderingInProgress
=
false
;
...
...
app/assets/javascripts/design_management/utils/cache_update.js
View file @
64ff088f
...
...
@@ -2,7 +2,7 @@
import
{
differenceBy
}
from
'
lodash
'
;
import
produce
from
'
immer
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
{
extractCurrentDiscussion
,
extractDesign
,
extractDesigns
}
from
'
./design_management_utils
'
;
import
{
ADD_IMAGE_DIFF_NOTE_ERROR
,
...
...
@@ -237,7 +237,7 @@ export const deletePendingTodoFromStore = (store, todoMarkDone, query, queryVari
};
const
onError
=
(
data
,
message
)
=>
{
createFlash
(
message
);
createFlash
(
{
message
}
);
throw
new
Error
(
data
.
errors
);
};
...
...
@@ -286,7 +286,7 @@ export const updateStoreAfterUploadDesign = (store, data, query) => {
export
const
updateDesignsOnStoreAfterReorder
=
(
store
,
data
,
query
)
=>
{
if
(
hasErrors
(
data
))
{
createFlash
(
data
.
errors
[
0
]
);
createFlash
(
{
message
:
data
.
errors
[
0
]
}
);
}
else
{
moveDesignInStore
(
store
,
data
,
query
);
}
...
...
spec/frontend/design_management/components/upload/design_dropzone_spec.js
View file @
64ff088f
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
DesignDropzone
from
'
~/design_management/components/upload/design_dropzone.vue
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
jest
.
mock
(
'
~/flash
'
);
...
...
spec/frontend/design_management/pages/design/index_spec.js
View file @
64ff088f
...
...
@@ -2,7 +2,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import
VueRouter
from
'
vue-router
'
;
import
{
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
ApolloMutation
}
from
'
vue-apollo
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
DesignIndex
from
'
~/design_management/pages/design/index.vue
'
;
import
DesignSidebar
from
'
~/design_management/components/design_sidebar.vue
'
;
import
DesignPresentation
from
'
~/design_management/components/design_presentation.vue
'
;
...
...
@@ -295,7 +295,7 @@ describe('Design management design index page', () => {
wrapper
.
vm
.
onDesignQueryResult
({
data
:
mockResponseNoDesigns
,
loading
:
false
});
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
DESIGN_NOT_FOUND_ERROR
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
{
message
:
DESIGN_NOT_FOUND_ERROR
}
);
expect
(
router
.
push
).
toHaveBeenCalledTimes
(
1
);
expect
(
router
.
push
).
toHaveBeenCalledWith
({
name
:
DESIGNS_ROUTE_NAME
});
});
...
...
@@ -316,7 +316,7 @@ describe('Design management design index page', () => {
wrapper
.
vm
.
onDesignQueryResult
({
data
:
mockResponseWithDesigns
,
loading
:
false
});
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
DESIGN_VERSION_NOT_EXIST_ERROR
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
{
message
:
DESIGN_VERSION_NOT_EXIST_ERROR
}
);
expect
(
router
.
push
).
toHaveBeenCalledTimes
(
1
);
expect
(
router
.
push
).
toHaveBeenCalledWith
({
name
:
DESIGNS_ROUTE_NAME
});
});
...
...
spec/frontend/design_management/pages/index_spec.js
View file @
64ff088f
...
...
@@ -16,7 +16,7 @@ import {
EXISTING_DESIGN_DROP_MANY_FILES_MESSAGE
,
EXISTING_DESIGN_DROP_INVALID_FILENAME_MESSAGE
,
}
from
'
~/design_management/utils/error_messages
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
createRouter
from
'
~/design_management/router
'
;
import
*
as
utils
from
'
~/design_management/utils/design_management_utils
'
;
import
{
...
...
@@ -443,10 +443,10 @@ describe('Design management index page', () => {
return
uploadDesign
.
then
(()
=>
{
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
'
Upload skipped. test.jpg did not change.
'
,
'
warning
'
,
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
{
message
:
'
Upload skipped. test.jpg did not change.
'
,
types
:
'
warning
'
,
}
);
});
});
...
...
@@ -482,7 +482,7 @@ describe('Design management index page', () => {
designDropzone
.
vm
.
$emit
(
'
change
'
,
eventPayload
);
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
message
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
{
message
}
);
});
});
...
...
@@ -747,7 +747,7 @@ describe('Design management index page', () => {
await
wrapper
.
vm
.
$nextTick
();
expect
(
createFlash
).
toHaveBeenCalledWith
(
'
Houston, we have a problem
'
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
{
message
:
'
Houston, we have a problem
'
}
);
});
it
(
'
displays flash if mutation had a non-recoverable error
'
,
async
()
=>
{
...
...
@@ -761,9 +761,9 @@ describe('Design management index page', () => {
await
jest
.
runOnlyPendingTimers
();
// kick off the mocked GQL stuff (promises)
await
wrapper
.
vm
.
$nextTick
();
// kick off the DOM update for flash
expect
(
createFlash
).
toHaveBeenCalledWith
(
'
Something went wrong when reordering designs. Please try again
'
,
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
{
message
:
'
Something went wrong when reordering designs. Please try again
'
,
}
);
});
});
});
spec/frontend/design_management/utils/cache_update_spec.js
View file @
64ff088f
...
...
@@ -11,7 +11,7 @@ import {
UPDATE_IMAGE_DIFF_NOTE_ERROR
,
}
from
'
~/design_management/utils/error_messages
'
;
import
design
from
'
../mock_data/design
'
;
import
{
deprecatedCreateFlash
as
createFlash
}
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
jest
.
mock
(
'
~/flash.js
'
);
...
...
@@ -35,7 +35,7 @@ describe('Design Management cache update', () => {
expect
(
createFlash
).
not
.
toHaveBeenCalled
();
expect
(()
=>
subject
(
mockStore
,
{
errors
:
mockErrors
},
{},
...
extraArgs
)).
toThrow
();
expect
(
createFlash
).
toHaveBeenCalledTimes
(
1
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
errorMessage
);
expect
(
createFlash
).
toHaveBeenCalledWith
(
{
message
:
errorMessage
}
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment