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
85bec20f
Commit
85bec20f
authored
Aug 10, 2020
by
Jarek Ostrowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update design mgmt navigation to gl-button
MR:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39104
parent
e4772db6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
76 additions
and
208 deletions
+76
-208
app/assets/javascripts/design_management/components/delete_button.vue
...avascripts/design_management/components/delete_button.vue
+2
-4
app/assets/javascripts/design_management/components/toolbar/design_navigation.vue
...esign_management/components/toolbar/design_navigation.vue
+15
-12
app/assets/javascripts/design_management/components/toolbar/index.vue
...avascripts/design_management/components/toolbar/index.vue
+14
-17
app/assets/javascripts/design_management/components/toolbar/pagination_button.vue
...esign_management/components/toolbar/pagination_button.vue
+0
-48
changelogs/unreleased/230477-design-pagination-2.yml
changelogs/unreleased/230477-design-pagination-2.yml
+5
-0
spec/frontend/design_management/components/toolbar/__snapshots__/design_navigation_spec.js.snap
...ents/toolbar/__snapshots__/design_navigation_spec.js.snap
+15
-9
spec/frontend/design_management/components/toolbar/__snapshots__/index_spec.js.snap
...ement/components/toolbar/__snapshots__/index_spec.js.snap
+22
-26
spec/frontend/design_management/components/toolbar/__snapshots__/pagination_button_spec.js.snap
...ents/toolbar/__snapshots__/pagination_button_spec.js.snap
+0
-28
spec/frontend/design_management/components/toolbar/design_navigation_spec.js
...n_management/components/toolbar/design_navigation_spec.js
+3
-3
spec/frontend/design_management/components/toolbar/pagination_button_spec.js
...n_management/components/toolbar/pagination_button_spec.js
+0
-61
No files found.
app/assets/javascripts/design_management/components/delete_button.vue
View file @
85bec20f
...
@@ -95,11 +95,9 @@ export default {
...
@@ -95,11 +95,9 @@ export default {
:category=
"buttonCategory"
:category=
"buttonCategory"
:size=
"buttonSize"
:size=
"buttonSize"
:class=
"buttonClass"
:class=
"buttonClass"
:disabled=
"isDeleting || !hasSelectedDesigns"
:loading=
"loading"
:loading=
"loading"
:icon=
"buttonIcon"
:icon=
"buttonIcon"
>
:disabled=
"isDeleting || !hasSelectedDesigns"
<slot></slot>
/>
</gl-button>
</div>
</div>
</
template
>
</
template
>
app/assets/javascripts/design_management/components/toolbar/
pagin
ation.vue
→
app/assets/javascripts/design_management/components/toolbar/
design_navig
ation.vue
View file @
85bec20f
<
script
>
<
script
>
/* global Mousetrap */
/* global Mousetrap */
import
'
mousetrap
'
;
import
'
mousetrap
'
;
import
{
GlButton
,
GlButtonGroup
}
from
'
@gitlab/ui
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
PaginationButton
from
'
./pagination_button.vue
'
;
import
allDesignsMixin
from
'
../../mixins/all_designs
'
;
import
allDesignsMixin
from
'
../../mixins/all_designs
'
;
import
{
DESIGN_ROUTE_NAME
}
from
'
../../router/constants
'
;
import
{
DESIGN_ROUTE_NAME
}
from
'
../../router/constants
'
;
export
default
{
export
default
{
components
:
{
components
:
{
PaginationButton
,
GlButton
,
GlButtonGroup
,
},
},
mixins
:
[
allDesignsMixin
],
mixins
:
[
allDesignsMixin
],
props
:
{
props
:
{
...
@@ -31,12 +32,12 @@ export default {
...
@@ -31,12 +32,12 @@ export default {
});
});
},
},
previousDesign
()
{
previousDesign
()
{
if
(
!
this
.
designsCount
)
return
null
;
if
(
this
.
currentIndex
===
0
)
return
null
;
return
this
.
designs
[
this
.
currentIndex
-
1
];
return
this
.
designs
[
this
.
currentIndex
-
1
];
},
},
nextDesign
()
{
nextDesign
()
{
if
(
!
this
.
designsCount
)
return
null
;
if
(
this
.
currentIndex
+
1
===
this
.
designsCount
)
return
null
;
return
this
.
designs
[
this
.
currentIndex
+
1
];
return
this
.
designs
[
this
.
currentIndex
+
1
];
},
},
...
@@ -65,19 +66,21 @@ export default {
...
@@ -65,19 +66,21 @@ export default {
<
template
>
<
template
>
<div
v-if=
"designsCount"
class=
"d-flex align-items-center"
>
<div
v-if=
"designsCount"
class=
"d-flex align-items-center"
>
{{
paginationText
}}
{{
paginationText
}}
<
div
class=
"btn-group gl-ml
-3"
>
<
gl-button-group
class=
"ml-3 mr
-3"
>
<
pagination
-button
<
gl
-button
:d
esign=
"
previousDesign"
:d
isabled=
"!
previousDesign"
:title=
"s__('DesignManagement|Go to previous design')"
:title=
"s__('DesignManagement|Go to previous design')"
icon
-name
=
"angle-left"
icon=
"angle-left"
class=
"js-previous-design"
class=
"js-previous-design"
@
click=
"navigateToDesign(previousDesign)"
/>
/>
<
pagination
-button
<
gl
-button
:d
esign=
"
nextDesign"
:d
isabled=
"!
nextDesign"
:title=
"s__('DesignManagement|Go to next design')"
:title=
"s__('DesignManagement|Go to next design')"
icon
-name
=
"angle-right"
icon=
"angle-right"
class=
"js-next-design"
class=
"js-next-design"
@
click=
"navigateToDesign(nextDesign)"
/>
/>
</
div
>
</
gl-button-group
>
</div>
</div>
</
template
>
</
template
>
app/assets/javascripts/design_management/components/toolbar/index.vue
View file @
85bec20f
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
import
{
GlButton
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
timeagoMixin
from
'
~/vue_shared/mixins/timeago
'
;
import
timeagoMixin
from
'
~/vue_shared/mixins/timeago
'
;
import
Pagination
from
'
./pagin
ation.vue
'
;
import
DesignNavigation
from
'
./design_navig
ation.vue
'
;
import
DeleteButton
from
'
../delete_button.vue
'
;
import
DeleteButton
from
'
../delete_button.vue
'
;
import
permissionsQuery
from
'
../../graphql/queries/design_permissions.query.graphql
'
;
import
permissionsQuery
from
'
../../graphql/queries/design_permissions.query.graphql
'
;
import
{
DESIGNS_ROUTE_NAME
}
from
'
../../router/constants
'
;
import
{
DESIGNS_ROUTE_NAME
}
from
'
../../router/constants
'
;
export
default
{
export
default
{
components
:
{
components
:
{
GlButton
,
GlIcon
,
GlIcon
,
Pagin
ation
,
DesignNavig
ation
,
DeleteButton
,
DeleteButton
,
GlButton
,
},
},
mixins
:
[
timeagoMixin
],
mixins
:
[
timeagoMixin
],
props
:
{
props
:
{
...
@@ -111,19 +111,16 @@ export default {
...
@@ -111,19 +111,16 @@ export default {
<small
v-if=
"updatedAt"
class=
"text-secondary"
>
{{
updatedText
}}
</small>
<small
v-if=
"updatedAt"
class=
"text-secondary"
>
{{
updatedText
}}
</small>
</div>
</div>
</div>
</div>
<design-navigation
:id=
"id"
class=
"ml-auto flex-shrink-0"
/>
<div
class=
"gl-display-flex gl-align-items-center"
>
<gl-button
:href=
"image"
icon=
"download"
/>
<pagination
:id=
"id"
class=
"gl-mr-3 gl-flex-shrink-0"
/>
<delete-button
<gl-button
:href=
"image"
icon=
"download"
/>
v-if=
"isLatestVersion && canDeleteDesign"
<delete-button
class=
"gl-ml-3"
v-if=
"isLatestVersion && canDeleteDesign"
:is-deleting=
"isDeleting"
class=
"gl-ml-3"
button-variant=
"warning"
:is-deleting=
"isDeleting"
button-icon=
"archive"
button-variant=
"warning"
button-category=
"secondary"
button-icon=
"archive"
@
deleteSelectedDesigns=
"$emit('delete')"
button-category=
"secondary"
/>
@
deleteSelectedDesigns=
"$emit('delete')"
/>
</div>
</header>
</header>
</
template
>
</
template
>
app/assets/javascripts/design_management/components/toolbar/pagination_button.vue
deleted
100644 → 0
View file @
e4772db6
<
script
>
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
DESIGN_ROUTE_NAME
}
from
'
../../router/constants
'
;
export
default
{
components
:
{
Icon
,
},
props
:
{
design
:
{
type
:
Object
,
required
:
false
,
default
:
null
,
},
title
:
{
type
:
String
,
required
:
true
,
},
iconName
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
designLink
()
{
if
(
!
this
.
design
)
return
{};
return
{
name
:
DESIGN_ROUTE_NAME
,
params
:
{
id
:
this
.
design
.
filename
},
query
:
this
.
$route
.
query
,
};
},
},
};
</
script
>
<
template
>
<router-link
:to=
"designLink"
:disabled=
"!design"
:class=
"
{ disabled: !design }"
:aria-label="title"
class="btn btn-default"
>
<icon
:name=
"iconName"
/>
</router-link>
</
template
>
changelogs/unreleased/230477-design-pagination-2.yml
0 → 100644
View file @
85bec20f
---
title
:
Update design mgmt navigation to use gl-button
merge_request
:
39104
author
:
type
:
changed
spec/frontend/design_management/components/toolbar/__snapshots__/
pagin
ation_spec.js.snap
→
spec/frontend/design_management/components/toolbar/__snapshots__/
design_navig
ation_spec.js.snap
View file @
85bec20f
...
@@ -2,28 +2,34 @@
...
@@ -2,28 +2,34 @@
exports[`Design management pagination component hides components when designs are empty 1`] = `<!---->`;
exports[`Design management pagination component hides components when designs are empty 1`] = `<!---->`;
exports[`Design management pagination component renders
pagin
ation buttons 1`] = `
exports[`Design management pagination component renders
navig
ation buttons 1`] = `
<div
<div
class="d-flex align-items-center"
class="d-flex align-items-center"
>
>
0 of 2
0 of 2
<
div
<
gl-button-group-stub
class="
btn-group gl-ml
-3"
class="
ml-3 mr
-3"
>
>
<pagination-button-stub
<gl-button-stub
category="primary"
class="js-previous-design"
class="js-previous-design"
iconname="angle-left"
disabled="true"
icon="angle-left"
size="medium"
title="Go to previous design"
title="Go to previous design"
variant="default"
/>
/>
<pagination-button-stub
<gl-button-stub
category="primary"
class="js-next-design"
class="js-next-design"
design="[object Object]
"
icon="angle-right
"
iconname="angle-right
"
size="medium
"
title="Go to next design"
title="Go to next design"
variant="default"
/>
/>
</
div
>
</
gl-button-group-stub
>
</div>
</div>
`;
`;
spec/frontend/design_management/components/toolbar/__snapshots__/index_spec.js.snap
View file @
85bec20f
...
@@ -35,31 +35,27 @@ exports[`Design management toolbar component renders design and updated data 1`]
...
@@ -35,31 +35,27 @@ exports[`Design management toolbar component renders design and updated data 1`]
</div>
</div>
</div>
</div>
<div
<design-navigation-stub
class="gl-display-flex gl-align-items-center"
class="ml-auto flex-shrink-0"
>
id="1"
<pagination-stub
/>
class="gl-mr-3 gl-flex-shrink-0"
id="1"
<gl-button-stub
/>
category="primary"
href="/-/designs/306/7f747adcd4693afadbe968d7ba7d983349b9012d"
<gl-button-stub
icon="download"
category="primary"
size="medium"
href="/-/designs/306/7f747adcd4693afadbe968d7ba7d983349b9012d"
variant="default"
icon="download"
/>
size="medium"
variant="default"
<delete-button-stub
/>
buttoncategory="secondary"
buttonclass=""
<delete-button-stub
buttonicon="archive"
buttoncategory="secondary"
buttonsize="medium"
buttonclass=""
buttonvariant="warning"
buttonicon="archive"
class="gl-ml-3"
buttonsize="medium"
hasselecteddesigns="true"
buttonvariant="warning"
/>
class="gl-ml-3"
hasselecteddesigns="true"
/>
</div>
</header>
</header>
`;
`;
spec/frontend/design_management/components/toolbar/__snapshots__/pagination_button_spec.js.snap
deleted
100644 → 0
View file @
e4772db6
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Design management pagination button component disables button when no design is passed 1`] = `
<router-link-stub
aria-label="Test title"
class="btn btn-default disabled"
disabled="true"
to="[object Object]"
>
<icon-stub
name="angle-right"
size="16"
/>
</router-link-stub>
`;
exports[`Design management pagination button component renders router-link 1`] = `
<router-link-stub
aria-label="Test title"
class="btn btn-default"
to="[object Object]"
>
<icon-stub
name="angle-right"
size="16"
/>
</router-link-stub>
`;
spec/frontend/design_management/components/toolbar/
pagin
ation_spec.js
→
spec/frontend/design_management/components/toolbar/
design_navig
ation_spec.js
View file @
85bec20f
/* global Mousetrap */
/* global Mousetrap */
import
'
mousetrap
'
;
import
'
mousetrap
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Pagination
from
'
~/design_management/components/toolbar/pagin
ation.vue
'
;
import
DesignNavigation
from
'
~/design_management/components/toolbar/design_navig
ation.vue
'
;
import
{
DESIGN_ROUTE_NAME
}
from
'
~/design_management/router/constants
'
;
import
{
DESIGN_ROUTE_NAME
}
from
'
~/design_management/router/constants
'
;
const
push
=
jest
.
fn
();
const
push
=
jest
.
fn
();
...
@@ -18,7 +18,7 @@ describe('Design management pagination component', () => {
...
@@ -18,7 +18,7 @@ describe('Design management pagination component', () => {
let
wrapper
;
let
wrapper
;
function
createComponent
()
{
function
createComponent
()
{
wrapper
=
shallowMount
(
Pagin
ation
,
{
wrapper
=
shallowMount
(
DesignNavig
ation
,
{
propsData
:
{
propsData
:
{
id
:
'
2
'
,
id
:
'
2
'
,
},
},
...
@@ -41,7 +41,7 @@ describe('Design management pagination component', () => {
...
@@ -41,7 +41,7 @@ describe('Design management pagination component', () => {
expect
(
wrapper
.
element
).
toMatchSnapshot
();
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
});
it
(
'
renders
pagin
ation buttons
'
,
()
=>
{
it
(
'
renders
navig
ation buttons
'
,
()
=>
{
wrapper
.
setData
({
wrapper
.
setData
({
designs
:
[{
id
:
'
1
'
},
{
id
:
'
2
'
}],
designs
:
[{
id
:
'
1
'
},
{
id
:
'
2
'
}],
});
});
...
...
spec/frontend/design_management/components/toolbar/pagination_button_spec.js
deleted
100644 → 0
View file @
e4772db6
import
{
createLocalVue
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
VueRouter
from
'
vue-router
'
;
import
PaginationButton
from
'
~/design_management/components/toolbar/pagination_button.vue
'
;
import
{
DESIGN_ROUTE_NAME
}
from
'
~/design_management/router/constants
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
VueRouter
);
const
router
=
new
VueRouter
();
describe
(
'
Design management pagination button component
'
,
()
=>
{
let
wrapper
;
function
createComponent
(
design
=
null
)
{
wrapper
=
shallowMount
(
PaginationButton
,
{
localVue
,
router
,
propsData
:
{
design
,
title
:
'
Test title
'
,
iconName
:
'
angle-right
'
,
},
stubs
:
[
'
router-link
'
],
});
}
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
disables button when no design is passed
'
,
()
=>
{
createComponent
();
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
it
(
'
renders router-link
'
,
()
=>
{
createComponent
({
id
:
'
2
'
});
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
describe
(
'
designLink
'
,
()
=>
{
it
(
'
returns empty link when design is null
'
,
()
=>
{
createComponent
();
expect
(
wrapper
.
vm
.
designLink
).
toEqual
({});
});
it
(
'
returns design link
'
,
()
=>
{
createComponent
({
id
:
'
2
'
,
filename
:
'
test
'
});
wrapper
.
vm
.
$router
.
replace
(
'
/root/test-project/issues/1/designs/test?version=1
'
);
expect
(
wrapper
.
vm
.
designLink
).
toEqual
({
name
:
DESIGN_ROUTE_NAME
,
params
:
{
id
:
'
test
'
},
query
:
{
version
:
'
1
'
},
});
});
});
});
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