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
d335be8a
Commit
d335be8a
authored
Apr 05, 2021
by
Angelo Gulina
Committed by
Savas Vedova
Apr 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subscription Details: fix table styles and skeleton
parent
512a4bfc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
44 deletions
+79
-44
ee/app/assets/javascripts/pages/admin/cloud_licenses/components/subscription_details_card.vue
...n/cloud_licenses/components/subscription_details_card.vue
+0
-4
ee/app/assets/javascripts/pages/admin/cloud_licenses/components/subscription_details_table.vue
.../cloud_licenses/components/subscription_details_table.vue
+74
-25
ee/spec/frontend/admin/cloud_licenses/components/subscription_details_card_spec.js
...oud_licenses/components/subscription_details_card_spec.js
+0
-8
ee/spec/frontend/admin/cloud_licenses/components/subscription_details_table_spec.js
...ud_licenses/components/subscription_details_table_spec.js
+2
-7
ee/spec/frontend/admin/cloud_licenses/mock_data.js
ee/spec/frontend/admin/cloud_licenses/mock_data.js
+3
-0
No files found.
ee/app/assets/javascripts/pages/admin/cloud_licenses/components/subscription_details_card.vue
View file @
d335be8a
...
@@ -26,10 +26,6 @@ export default {
...
@@ -26,10 +26,6 @@ export default {
},
},
computed
:
{
computed
:
{
details
()
{
details
()
{
if
(
!
Object
.
keys
(
this
.
subscription
).
length
)
{
return
[];
}
return
this
.
detailsFields
.
map
((
detail
)
=>
({
return
this
.
detailsFields
.
map
((
detail
)
=>
({
canCopy
:
detail
===
'
id
'
,
canCopy
:
detail
===
'
id
'
,
label
:
detailsLabels
[
detail
],
label
:
detailsLabels
[
detail
],
...
...
ee/app/assets/javascripts/pages/admin/cloud_licenses/components/subscription_details_table.vue
View file @
d335be8a
<
script
>
<
script
>
import
{
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
GlSkeletonLoader
,
GlTable
}
from
'
@gitlab/ui
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
{
copySubscriptionIdButtonText
}
from
'
../constants
'
;
import
{
copySubscriptionIdButtonText
}
from
'
../constants
'
;
const
placeholderHeightFactor
=
32
;
const
placeholderWidth
=
180
;
const
DEFAULT_TH_CLASSES
=
'
gl-display-none
'
;
const
DEFAULT_TD_CLASSES
=
'
gl-border-none! gl-h-7 gl-line-height-normal! gl-p-0!
'
;
export
default
{
export
default
{
i18n
:
{
i18n
:
{
copySubscriptionIdButtonText
,
copySubscriptionIdButtonText
,
},
},
fields
:
[
{
key
:
'
label
'
,
label
:
''
,
thClass
:
DEFAULT_TH_CLASSES
,
tdClass
:
`
${
DEFAULT_TD_CLASSES
}
gl-w-13`
,
},
{
key
:
'
value
'
,
label
:
''
,
thClass
:
DEFAULT_TH_CLASSES
,
tdClass
:
DEFAULT_TD_CLASSES
,
},
],
name
:
'
SubscriptionDetailsTable
'
,
name
:
'
SubscriptionDetailsTable
'
,
components
:
{
components
:
{
ClipboardButton
,
ClipboardButton
,
GlSkeletonLoader
,
GlSkeletonLoader
,
GlTable
,
},
},
props
:
{
props
:
{
details
:
{
details
:
{
...
@@ -18,36 +38,65 @@ export default {
...
@@ -18,36 +38,65 @@ export default {
required
:
true
,
required
:
true
,
},
},
},
},
computed
:
{
hasContent
()
{
return
this
.
details
.
some
(({
value
})
=>
Boolean
(
value
));
},
placeholderContainerHeight
()
{
return
this
.
details
.
length
*
placeholderHeightFactor
;
},
placeholderContainerWidth
()
{
return
placeholderWidth
;
},
placeHolderHeight
()
{
return
placeholderHeightFactor
/
2
;
},
},
methods
:
{
methods
:
{
isNotLast
(
index
)
{
isLastRow
(
index
)
{
return
index
<
this
.
details
.
length
-
1
;
return
index
===
this
.
details
.
length
-
1
;
},
placeHolderPosition
(
index
)
{
return
(
index
-
1
)
*
placeholderHeightFactor
;
},
},
},
},
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div
v-if=
"!details.length"
>
<gl-table
v-if=
"hasContent"
:fields=
"$options.fields"
:items=
"details"
class=
"gl-m-0!"
>
<gl-skeleton-loader
:lines=
"1"
/>
<template
#cell(label)=
"
{ item }">
<gl-skeleton-loader
:lines=
"1"
/>
<p
class=
"gl-font-weight-bold"
data-testid=
"details-label"
>
{{
item
.
label
}}
:
</p>
</div>
</
template
>
<ul
v-else
class=
"gl-list-style-none gl-m-0 gl-p-0"
>
<li
<
template
#cell(value)=
"{ item }"
>
v-for=
"(detail, index) in details"
<p
class=
"gl-relative"
data-testid=
"details-content"
>
:key=
"detail.label"
{{
item
.
value
}}
:class=
"
{ 'gl-mb-3': isNotLast(index) }"
<clipboard-button
class="gl-display-flex"
v-if=
"item.canCopy"
>
:text=
"item.value"
<p
class=
"gl-font-weight-bold gl-m-0"
data-testid=
"details-label"
>
{{
detail
.
label
}}
:
</p>
:title=
"$options.i18n.copySubscriptionIdButtonText"
<p
class=
"gl-m-0 gl-ml-4"
data-testid=
"details-content"
>
{{
detail
.
value
}}
</p>
category=
"tertiary"
<clipboard-button
class=
"gl-absolute gl-mt-n2 gl-ml-2"
v-if=
"detail.canCopy"
size=
"small"
:text=
"detail.value"
/>
:title=
"$options.i18n.copySubscriptionIdButtonText"
</p>
category=
"tertiary"
</
template
>
class=
"gl-ml-2"
</gl-table>
size=
"small"
<div
v-else
:style=
"{ height: `${placeholderContainerHeight}px`, width: `${placeholderContainerWidth}px` }"
class=
"gl-pt-2"
>
<gl-skeleton-loader
:height=
"placeholderContainerHeight"
:width=
"placeholderContainerWidth"
>
<rect
v-for=
"index in details.length"
:key=
"index"
:height=
"placeHolderHeight"
:width=
"placeholderContainerWidth"
:y=
"placeHolderPosition(index)"
rx=
"8"
/>
/>
</
li
>
</
gl-skeleton-loader
>
</
ul
>
</
div
>
</template>
</template>
ee/spec/frontend/admin/cloud_licenses/components/subscription_details_card_spec.js
View file @
d335be8a
...
@@ -67,14 +67,6 @@ describe('Subscription Details Card', () => {
...
@@ -67,14 +67,6 @@ describe('Subscription Details Card', () => {
});
});
});
});
describe
(
'
with empty subscription
'
,
()
=>
{
it
(
'
passes an empty array to the table component
'
,
()
=>
{
createComponent
({
subscription
:
{}
});
expect
(
findSubscriptionDetailsTable
().
props
(
'
details
'
)).
toEqual
([]);
});
});
describe
(
'
with no title
'
,
()
=>
{
describe
(
'
with no title
'
,
()
=>
{
it
(
'
does not display a title
'
,
()
=>
{
it
(
'
does not display a title
'
,
()
=>
{
createComponent
();
createComponent
();
...
...
ee/spec/frontend/admin/cloud_licenses/components/subscription_details_table_spec.js
View file @
d335be8a
import
{
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
shallowM
ount
}
from
'
@vue/test-utils
'
;
import
{
m
ount
}
from
'
@vue/test-utils
'
;
import
SubscriptionDetailsTable
from
'
ee/pages/admin/cloud_licenses/components/subscription_details_table.vue
'
;
import
SubscriptionDetailsTable
from
'
ee/pages/admin/cloud_licenses/components/subscription_details_table.vue
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
...
@@ -22,11 +22,10 @@ describe('Subscription Details Table', () => {
...
@@ -22,11 +22,10 @@ describe('Subscription Details Table', () => {
const
findContentCells
=
()
=>
wrapper
.
findAllByTestId
(
'
details-content
'
);
const
findContentCells
=
()
=>
wrapper
.
findAllByTestId
(
'
details-content
'
);
const
findLabelCells
=
()
=>
wrapper
.
findAllByTestId
(
'
details-label
'
);
const
findLabelCells
=
()
=>
wrapper
.
findAllByTestId
(
'
details-label
'
);
const
findLastRow
=
()
=>
wrapper
.
findAll
(
'
li
'
).
wrappers
.
slice
(
-
1
).
pop
();
const
findClipboardButton
=
()
=>
wrapper
.
findComponent
(
ClipboardButton
);
const
findClipboardButton
=
()
=>
wrapper
.
findComponent
(
ClipboardButton
);
const
createComponent
=
(
details
=
licenseDetails
)
=>
{
const
createComponent
=
(
details
=
licenseDetails
)
=>
{
wrapper
=
extendedWrapper
(
shallowM
ount
(
SubscriptionDetailsTable
,
{
propsData
:
{
details
}
}));
wrapper
=
extendedWrapper
(
m
ount
(
SubscriptionDetailsTable
,
{
propsData
:
{
details
}
}));
};
};
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -52,10 +51,6 @@ describe('Subscription Details Table', () => {
...
@@ -52,10 +51,6 @@ describe('Subscription Details Table', () => {
expect
(
findLabelCells
().
wrappers
.
every
(
hasFontWeightBold
)).
toBe
(
true
);
expect
(
findLabelCells
().
wrappers
.
every
(
hasFontWeightBold
)).
toBe
(
true
);
});
});
it
(
'
does not add space to the last row
'
,
()
=>
{
expect
(
findLastRow
().
classes
(
'
gl-mb-3
'
)).
toBe
(
false
);
});
it
(
'
does not show a clipboard button
'
,
()
=>
{
it
(
'
does not show a clipboard button
'
,
()
=>
{
expect
(
findClipboardButton
().
exists
()).
toBe
(
false
);
expect
(
findClipboardButton
().
exists
()).
toBe
(
false
);
});
});
...
...
ee/spec/frontend/admin/cloud_licenses/mock_data.js
View file @
d335be8a
...
@@ -5,6 +5,9 @@ export const license = {
...
@@ -5,6 +5,9 @@ export const license = {
lastSync
:
'
just now - actual date
'
,
lastSync
:
'
just now - actual date
'
,
startsAt
:
'
22 February
'
,
startsAt
:
'
22 February
'
,
renews
:
'
in 11 months
'
,
renews
:
'
in 11 months
'
,
name
:
'
Jane Doe
'
,
email
:
'
user@acmecorp.com
'
,
company
:
'
ACME Corp
'
,
},
},
};
};
...
...
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