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
4f2c0d6c
Commit
4f2c0d6c
authored
Jul 01, 2020
by
Scott Stern
Committed by
Jose Ivan Vargas
Jul 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add confidential and locked discussion vue components for issue header
parent
7d5e9ef6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
5 deletions
+123
-5
app/assets/javascripts/issue_show/components/issuable_header_warnings.vue
...cripts/issue_show/components/issuable_header_warnings.vue
+28
-0
app/assets/javascripts/issue_show/index.js
app/assets/javascripts/issue_show/index.js
+12
-0
app/assets/javascripts/notes/stores/modules/index.js
app/assets/javascripts/notes/stores/modules/index.js
+1
-0
app/assets/javascripts/pages/projects/issues/show.js
app/assets/javascripts/pages/projects/issues/show.js
+2
-1
app/views/projects/issues/show.html.haml
app/views/projects/issues/show.html.haml
+1
-4
spec/frontend/issue_show/components/issuable_header_warnings_spec.js
...nd/issue_show/components/issuable_header_warnings_spec.js
+79
-0
No files found.
app/assets/javascripts/issue_show/components/issuable_header_warnings.vue
0 → 100644
View file @
4f2c0d6c
<
script
>
import
{
mapState
}
from
'
vuex
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
export
default
{
components
:
{
Icon
,
},
computed
:
{
...
mapState
({
confidential
:
({
noteableData
})
=>
noteableData
.
confidential
,
dicussionLocked
:
({
noteableData
})
=>
noteableData
.
discussion_locked
,
}),
},
};
</
script
>
<
template
>
<div
class=
"gl-display-inline-block"
>
<div
v-if=
"confidential"
class=
"issuable-warning-icon inline"
>
<icon
class=
"icon"
name=
"eye-slash"
data-testid=
"confidential"
/>
</div>
<div
v-if=
"dicussionLocked"
class=
"issuable-warning-icon inline"
>
<icon
class=
"icon"
name=
"lock"
data-testid=
"locked"
/>
</div>
</div>
</
template
>
app/assets/javascripts/issue_show/index.js
View file @
4f2c0d6c
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
issuableApp
from
'
./components/app.vue
'
;
import
issuableApp
from
'
./components/app.vue
'
;
import
IssuableHeaderWarnings
from
'
./components/issuable_header_warnings.vue
'
;
import
{
parseIssuableData
}
from
'
./utils/parse_data
'
;
import
{
parseIssuableData
}
from
'
./utils/parse_data
'
;
import
{
store
}
from
'
~/notes/stores
'
;
export
default
function
initIssueableApp
()
{
export
default
function
initIssueableApp
()
{
return
new
Vue
({
return
new
Vue
({
...
@@ -15,3 +17,13 @@ export default function initIssueableApp() {
...
@@ -15,3 +17,13 @@ export default function initIssueableApp() {
},
},
});
});
}
}
export
function
issuableHeaderWarnings
()
{
return
new
Vue
({
el
:
document
.
getElementById
(
'
js-issuable-header-warnings
'
),
store
,
render
(
createElement
)
{
return
createElement
(
IssuableHeaderWarnings
);
},
});
}
app/assets/javascripts/notes/stores/modules/index.js
View file @
4f2c0d6c
...
@@ -26,6 +26,7 @@ export default () => ({
...
@@ -26,6 +26,7 @@ export default () => ({
},
},
userData
:
{},
userData
:
{},
noteableData
:
{
noteableData
:
{
discussion_locked
:
false
,
confidential
:
false
,
// TODO: Move data like this to Issue Store, should not be apart of notes.
confidential
:
false
,
// TODO: Move data like this to Issue Store, should not be apart of notes.
current_user
:
{},
current_user
:
{},
preview_note_path
:
'
path/to/preview
'
,
preview_note_path
:
'
path/to/preview
'
,
...
...
app/assets/javascripts/pages/projects/issues/show.js
View file @
4f2c0d6c
...
@@ -3,7 +3,7 @@ import Issue from '~/issue';
...
@@ -3,7 +3,7 @@ import Issue from '~/issue';
import
ShortcutsIssuable
from
'
~/behaviors/shortcuts/shortcuts_issuable
'
;
import
ShortcutsIssuable
from
'
~/behaviors/shortcuts/shortcuts_issuable
'
;
import
ZenMode
from
'
~/zen_mode
'
;
import
ZenMode
from
'
~/zen_mode
'
;
import
'
~/notes/index
'
;
import
'
~/notes/index
'
;
import
initIssueableApp
from
'
~/issue_show
'
;
import
initIssueableApp
,
{
issuableHeaderWarnings
}
from
'
~/issue_show
'
;
import
initSentryErrorStackTraceApp
from
'
~/sentry_error_stack_trace
'
;
import
initSentryErrorStackTraceApp
from
'
~/sentry_error_stack_trace
'
;
import
initRelatedMergeRequestsApp
from
'
~/related_merge_requests
'
;
import
initRelatedMergeRequestsApp
from
'
~/related_merge_requests
'
;
import
initVueIssuableSidebarApp
from
'
~/issuable_sidebar/sidebar_bundle
'
;
import
initVueIssuableSidebarApp
from
'
~/issuable_sidebar/sidebar_bundle
'
;
...
@@ -12,6 +12,7 @@ export default function() {
...
@@ -12,6 +12,7 @@ export default function() {
initIssueableApp
();
initIssueableApp
();
initSentryErrorStackTraceApp
();
initSentryErrorStackTraceApp
();
initRelatedMergeRequestsApp
();
initRelatedMergeRequestsApp
();
issuableHeaderWarnings
();
import
(
/* webpackChunkName: 'design_management' */
'
~/design_management
'
)
import
(
/* webpackChunkName: 'design_management' */
'
~/design_management
'
)
.
then
(
module
=>
module
.
default
())
.
then
(
module
=>
module
.
default
())
...
...
app/views/projects/issues/show.html.haml
View file @
4f2c0d6c
...
@@ -24,10 +24,7 @@
...
@@ -24,10 +24,7 @@
%span
.d-none.d-sm-block
Open
%span
.d-none.d-sm-block
Open
.issuable-meta
.issuable-meta
-
if
@issue
.
confidential
#js-issuable-header-warnings
.issuable-warning-icon.inline
=
sprite_icon
(
'eye-slash'
,
size:
16
,
css_class:
'icon'
)
-
if
@issue
.
discussion_locked?
.issuable-warning-icon.inline
=
sprite_icon
(
'lock'
,
size:
16
,
css_class:
'icon'
)
=
issuable_meta
(
@issue
,
@project
,
"Issue"
)
=
issuable_meta
(
@issue
,
@project
,
"Issue"
)
%a
.btn.btn-default.float-right.d-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle
{
href:
"#"
}
%a
.btn.btn-default.float-right.d-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle
{
href:
"#"
}
...
...
spec/frontend/issue_show/components/issuable_header_warnings_spec.js
0 → 100644
View file @
4f2c0d6c
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
Vuex
from
'
vuex
'
;
import
IssuableHeaderWarnings
from
'
~/issue_show/components/issuable_header_warnings.vue
'
;
import
createStore
from
'
~/notes/stores
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
describe
(
'
IssuableHeaderWarnings
'
,
()
=>
{
let
wrapper
;
let
store
;
const
findConfidential
=
()
=>
wrapper
.
find
(
'
[data-testid="confidential"]
'
);
const
findLocked
=
()
=>
wrapper
.
find
(
'
[data-testid="locked"]
'
);
const
confidentialIconName
=
()
=>
findConfidential
().
attributes
(
'
name
'
);
const
lockedIconName
=
()
=>
findLocked
().
attributes
(
'
name
'
);
const
createComponent
=
()
=>
{
wrapper
=
shallowMount
(
IssuableHeaderWarnings
,
{
store
,
localVue
});
};
beforeEach
(()
=>
{
store
=
createStore
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
store
=
null
;
});
describe
(
'
when confidential is on
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
noteableData
.
confidential
=
true
;
createComponent
();
});
it
(
'
renders the confidential icon
'
,
()
=>
{
expect
(
confidentialIconName
()).
toBe
(
'
eye-slash
'
);
});
});
describe
(
'
when confidential is off
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
noteableData
.
confidential
=
false
;
createComponent
();
});
it
(
'
does not find the component
'
,
()
=>
{
expect
(
findConfidential
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
when discussion locked is on
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
noteableData
.
discussion_locked
=
true
;
createComponent
();
});
it
(
'
renders the locked icon
'
,
()
=>
{
expect
(
lockedIconName
()).
toBe
(
'
lock
'
);
});
});
describe
(
'
when discussion locked is off
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
noteableData
.
discussion_locked
=
false
;
createComponent
();
});
it
(
'
does not find the component
'
,
()
=>
{
expect
(
findLocked
().
exists
()).
toBe
(
false
);
});
});
});
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