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
541094fb
Commit
541094fb
authored
Feb 02, 2022
by
Fernando Arias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix add corpus modal logic
* Make logic more robust to handle slow network requests
parent
13c7fdaa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
13 deletions
+85
-13
ee/app/assets/javascripts/security_configuration/corpus_management/components/columns/name.vue
...nfiguration/corpus_management/components/columns/name.vue
+2
-2
ee/app/assets/javascripts/security_configuration/corpus_management/components/corpus_table.vue
...nfiguration/corpus_management/components/corpus_table.vue
+8
-5
ee/app/assets/javascripts/security_configuration/corpus_management/components/corpus_upload.vue
...figuration/corpus_management/components/corpus_upload.vue
+1
-1
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/resolvers/resolvers.js
...guration/corpus_management/graphql/resolvers/resolvers.js
+1
-0
ee/spec/frontend/security_configuration/corpus_management/__snapshots__/corpus_table_spec.js.snap
...corpus_management/__snapshots__/corpus_table_spec.js.snap
+5
-5
ee/spec/frontend/security_configuration/corpus_management/components/corpus_upload_spec.js
...ration/corpus_management/components/corpus_upload_spec.js
+68
-0
No files found.
ee/app/assets/javascripts/security_configuration/corpus_management/components/columns/name.vue
View file @
541094fb
...
...
@@ -41,9 +41,9 @@ export default {
{{
name
}}
<span
class=
"gl-text-gray-500"
data-testid=
"file-size"
>
(
{{
fileSize
}}
)
</span>
</div>
<div
data-testid=
"latest-job"
>
<div
data-testid=
"latest-job"
class=
"gl-text-truncate"
>
{{
this
.
$options
.
i18n
.
latestJob
}}
<gl-link
v-if=
"jobUrl"
class=
"gl-display-inline-block"
:href=
"jobUrl"
target=
"_blank"
>
<gl-link
v-if=
"jobUrl"
:href=
"jobUrl"
target=
"_blank"
>
{{
latestJob
}}
</gl-link>
<template
v-else
>
-
</
template
>
...
...
ee/app/assets/javascripts/security_configuration/corpus_management/components/corpus_table.vue
View file @
541094fb
...
...
@@ -6,6 +6,7 @@ import Target from 'ee/security_configuration/corpus_management/components/colum
import
{
s__
}
from
'
~/locale
'
;
import
UserDate
from
'
~/vue_shared/components/user_date.vue
'
;
import
{
ISO_SHORT_FORMAT
}
from
'
~/vue_shared/constants
'
;
import
{
thWidthClass
}
from
'
~/lib/utils/table_utility
'
;
const
thClass
=
'
gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!
'
;
...
...
@@ -28,27 +29,29 @@ export default {
{
key
:
'
name
'
,
label
:
s__
(
'
CorpusManagement|Corpus name
'
),
thClass
,
thClass
:
`
${
thClass
}
${
thWidthClass
(
40
)}
`
,
tdClass
:
'
gl-text-truncate gl-max-w-15
'
,
},
{
key
:
'
target
'
,
label
:
s__
(
'
CorpusManagement|Target
'
),
thClass
,
thClass
:
`
${
thClass
}
${
thWidthClass
(
20
)}
`
,
tdClass
:
'
gl-word-break-word
'
,
},
{
key
:
'
lastUpdated
'
,
label
:
s__
(
'
CorpusManagement|Last updated
'
),
thClass
,
thClass
:
`
${
thClass
}
${
thWidthClass
(
15
)}
`
,
},
{
key
:
'
lastUsed
'
,
label
:
s__
(
'
CorpusManagement|Last used
'
),
thClass
,
thClass
:
`
${
thClass
}
${
thWidthClass
(
15
)}
`
,
},
{
key
:
'
actions
'
,
label
:
s__
(
'
CorpusManagement|Actions
'
),
thClass
,
thClass
:
`
${
thClass
}
${
thWidthClass
(
10
)}
`
,
},
],
i18n
:
{
...
...
ee/app/assets/javascripts/security_configuration/corpus_management/components/corpus_upload.vue
View file @
541094fb
...
...
@@ -57,7 +57,7 @@ export default {
return
decimalBytes
(
this
.
totalSize
);
},
isUploaded
()
{
return
this
.
states
?.
uploadState
.
progress
===
100
;
return
Boolean
(
this
.
states
?.
uploadState
.
uploadedPackageId
)
;
},
variant
()
{
return
this
.
isUploaded
?
'
confirm
'
:
'
default
'
;
...
...
ee/app/assets/javascripts/security_configuration/corpus_management/graphql/resolvers/resolvers.js
View file @
541094fb
...
...
@@ -160,6 +160,7 @@ export default {
uploadState
.
isUploading
=
false
;
uploadState
.
progress
=
0
;
uploadState
.
cancelToken
=
null
;
uploadState
.
uploadedPackageId
=
null
;
uploadState
.
errors
.
name
=
''
;
uploadState
.
errors
.
file
=
''
;
});
...
...
ee/spec/frontend/security_configuration/corpus_management/__snapshots__/corpus_table_spec.js.snap
View file @
541094fb
...
...
@@ -7,7 +7,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
>
<th
aria-colindex="1"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!
gl-w-40p gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!
"
role="columnheader"
scope="col"
>
...
...
@@ -17,7 +17,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th>
<th
aria-colindex="2"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!
gl-w-20p gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!
"
role="columnheader"
scope="col"
>
...
...
@@ -27,7 +27,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th>
<th
aria-colindex="3"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!
gl-w-15p gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!
"
role="columnheader"
scope="col"
>
...
...
@@ -37,7 +37,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th>
<th
aria-colindex="4"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!
gl-w-15p gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!
"
role="columnheader"
scope="col"
>
...
...
@@ -47,7 +47,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th>
<th
aria-colindex="5"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!"
class="gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!
gl-w-10p gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!
"
role="columnheader"
scope="col"
>
...
...
ee/spec/frontend/security_configuration/corpus_management/components/corpus_upload_spec.js
View file @
541094fb
...
...
@@ -94,5 +94,73 @@ describe('Corpus Upload', () => {
expect
(
findNewCorpusButton
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
add button
'
,
()
=>
{
it
(
'
is disabled when corpus has not been uploaded
'
,
()
=>
{
createComponent
({
mocks
:
{
states
:
{
uploadState
:
{
progress
:
0
,
uploadedPackageId
:
null
,
},
},
},
});
expect
(
findModal
().
props
(
'
actionPrimary
'
)).
toEqual
({
attributes
:
{
'
data-testid
'
:
'
modal-confirm
'
,
disabled
:
true
,
variant
:
'
default
'
,
},
text
:
'
Add
'
,
});
});
it
(
'
is disabled when corpus has 100 percent completion, but is still waiting on the server response
'
,
()
=>
{
createComponent
({
mocks
:
{
states
:
{
uploadState
:
{
progress
:
100
,
uploadedPackageId
:
null
,
},
},
},
});
expect
(
findModal
().
props
(
'
actionPrimary
'
)).
toEqual
({
attributes
:
{
'
data-testid
'
:
'
modal-confirm
'
,
disabled
:
true
,
variant
:
'
default
'
,
},
text
:
'
Add
'
,
});
});
it
(
'
is enabled when corpus has been uploaded
'
,
()
=>
{
createComponent
({
mocks
:
{
states
:
{
uploadState
:
{
progress
:
100
,
uploadedPackageId
:
1
,
},
},
},
});
expect
(
findModal
().
props
(
'
actionPrimary
'
)).
toEqual
({
attributes
:
{
'
data-testid
'
:
'
modal-confirm
'
,
disabled
:
false
,
variant
:
'
confirm
'
,
},
text
:
'
Add
'
,
});
});
});
});
});
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