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 {
:category=
"buttonCategory"
:size=
"buttonSize"
:class=
"buttonClass"
:disabled=
"isDeleting || !hasSelectedDesigns"
:loading=
"loading"
:icon=
"buttonIcon"
>
<slot></slot>
</gl-button>
:disabled=
"isDeleting || !hasSelectedDesigns"
/>
</div>
</
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
>
/* global Mousetrap */
import
'
mousetrap
'
;
import
{
GlButton
,
GlButtonGroup
}
from
'
@gitlab/ui
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
PaginationButton
from
'
./pagination_button.vue
'
;
import
allDesignsMixin
from
'
../../mixins/all_designs
'
;
import
{
DESIGN_ROUTE_NAME
}
from
'
../../router/constants
'
;
export
default
{
components
:
{
PaginationButton
,
GlButton
,
GlButtonGroup
,
},
mixins
:
[
allDesignsMixin
],
props
:
{
...
...
@@ -31,12 +32,12 @@ export default {
});
},
previousDesign
()
{
if
(
!
this
.
designsCount
)
return
null
;
if
(
this
.
currentIndex
===
0
)
return
null
;
return
this
.
designs
[
this
.
currentIndex
-
1
];
},
nextDesign
()
{
if
(
!
this
.
designsCount
)
return
null
;
if
(
this
.
currentIndex
+
1
===
this
.
designsCount
)
return
null
;
return
this
.
designs
[
this
.
currentIndex
+
1
];
},
...
...
@@ -65,19 +66,21 @@ export default {
<
template
>
<div
v-if=
"designsCount"
class=
"d-flex align-items-center"
>
{{
paginationText
}}
<
div
class=
"btn-group gl-ml
-3"
>
<
pagination
-button
:d
esign=
"
previousDesign"
<
gl-button-group
class=
"ml-3 mr
-3"
>
<
gl
-button
:d
isabled=
"!
previousDesign"
:title=
"s__('DesignManagement|Go to previous design')"
icon
-name
=
"angle-left"
icon=
"angle-left"
class=
"js-previous-design"
@
click=
"navigateToDesign(previousDesign)"
/>
<
pagination
-button
:d
esign=
"
nextDesign"
<
gl
-button
:d
isabled=
"!
nextDesign"
:title=
"s__('DesignManagement|Go to next design')"
icon
-name
=
"angle-right"
icon=
"angle-right"
class=
"js-next-design"
@
click=
"navigateToDesign(nextDesign)"
/>
</
div
>
</
gl-button-group
>
</div>
</
template
>
app/assets/javascripts/design_management/components/toolbar/index.vue
View file @
85bec20f
...
...
@@ -2,17 +2,17 @@
import
{
GlButton
,
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
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
permissionsQuery
from
'
../../graphql/queries/design_permissions.query.graphql
'
;
import
{
DESIGNS_ROUTE_NAME
}
from
'
../../router/constants
'
;
export
default
{
components
:
{
GlButton
,
GlIcon
,
Pagin
ation
,
DesignNavig
ation
,
DeleteButton
,
GlButton
,
},
mixins
:
[
timeagoMixin
],
props
:
{
...
...
@@ -111,19 +111,16 @@ export default {
<small
v-if=
"updatedAt"
class=
"text-secondary"
>
{{
updatedText
}}
</small>
</div>
</div>
<div
class=
"gl-display-flex gl-align-items-center"
>
<pagination
:id=
"id"
class=
"gl-mr-3 gl-flex-shrink-0"
/>
<gl-button
:href=
"image"
icon=
"download"
/>
<delete-button
v-if=
"isLatestVersion && canDeleteDesign"
class=
"gl-ml-3"
:is-deleting=
"isDeleting"
button-variant=
"warning"
button-icon=
"archive"
button-category=
"secondary"
@
deleteSelectedDesigns=
"$emit('delete')"
/>
</div>
<design-navigation
:id=
"id"
class=
"ml-auto flex-shrink-0"
/>
<gl-button
:href=
"image"
icon=
"download"
/>
<delete-button
v-if=
"isLatestVersion && canDeleteDesign"
class=
"gl-ml-3"
:is-deleting=
"isDeleting"
button-variant=
"warning"
button-icon=
"archive"
button-category=
"secondary"
@
deleteSelectedDesigns=
"$emit('delete')"
/>
</header>
</
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 @@
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
class="d-flex align-items-center"
>
0 of 2
<
div
class="
btn-group gl-ml
-3"
<
gl-button-group-stub
class="
ml-3 mr
-3"
>
<pagination-button-stub
<gl-button-stub
category="primary"
class="js-previous-design"
iconname="angle-left"
disabled="true"
icon="angle-left"
size="medium"
title="Go to previous design"
variant="default"
/>
<pagination-button-stub
<gl-button-stub
category="primary"
class="js-next-design"
design="[object Object]
"
iconname="angle-right
"
icon="angle-right
"
size="medium
"
title="Go to next design"
variant="default"
/>
</
div
>
</
gl-button-group-stub
>
</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`]
</div>
</div>
<div
class="gl-display-flex gl-align-items-center"
>
<pagination-stub
class="gl-mr-3 gl-flex-shrink-0"
id="1"
/>
<gl-button-stub
category="primary"
href="/-/designs/306/7f747adcd4693afadbe968d7ba7d983349b9012d"
icon="download"
size="medium"
variant="default"
/>
<delete-button-stub
buttoncategory="secondary"
buttonclass=""
buttonicon="archive"
buttonsize="medium"
buttonvariant="warning"
class="gl-ml-3"
hasselecteddesigns="true"
/>
</div>
<design-navigation-stub
class="ml-auto flex-shrink-0"
id="1"
/>
<gl-button-stub
category="primary"
href="/-/designs/306/7f747adcd4693afadbe968d7ba7d983349b9012d"
icon="download"
size="medium"
variant="default"
/>
<delete-button-stub
buttoncategory="secondary"
buttonclass=""
buttonicon="archive"
buttonsize="medium"
buttonvariant="warning"
class="gl-ml-3"
hasselecteddesigns="true"
/>
</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 */
import
'
mousetrap
'
;
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
'
;
const
push
=
jest
.
fn
();
...
...
@@ -18,7 +18,7 @@ describe('Design management pagination component', () => {
let
wrapper
;
function
createComponent
()
{
wrapper
=
shallowMount
(
Pagin
ation
,
{
wrapper
=
shallowMount
(
DesignNavig
ation
,
{
propsData
:
{
id
:
'
2
'
,
},
...
...
@@ -41,7 +41,7 @@ describe('Design management pagination component', () => {
expect
(
wrapper
.
element
).
toMatchSnapshot
();
});
it
(
'
renders
pagin
ation buttons
'
,
()
=>
{
it
(
'
renders
navig
ation buttons
'
,
()
=>
{
wrapper
.
setData
({
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