Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
c23ceaa8
Commit
c23ceaa8
authored
Apr 20, 2019
by
Hannah Stepanek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add direct-linked group to the store
parent
2ddb5369
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
0 deletions
+85
-0
index.js
src/sidebar/store/index.js
+2
-0
direct-linked-group.js
src/sidebar/store/modules/direct-linked-group.js
+57
-0
direct-linked-group-test.js
src/sidebar/store/modules/test/direct-linked-group-test.js
+26
-0
No files found.
src/sidebar/store/index.js
View file @
c23ceaa8
...
...
@@ -36,6 +36,7 @@ const debugMiddleware = require('./debug-middleware');
const
activity
=
require
(
'./modules/activity'
);
const
annotations
=
require
(
'./modules/annotations'
);
const
directLinkedGroup
=
require
(
'./modules/direct-linked-group'
);
const
frames
=
require
(
'./modules/frames'
);
const
links
=
require
(
'./modules/links'
);
const
groups
=
require
(
'./modules/groups'
);
...
...
@@ -86,6 +87,7 @@ function store($rootScope, settings) {
const
modules
=
[
activity
,
annotations
,
directLinkedGroup
,
frames
,
links
,
groups
,
...
...
src/sidebar/store/modules/direct-linked-group.js
0 → 100644
View file @
c23ceaa8
'use strict'
;
const
util
=
require
(
'../util'
);
function
init
()
{
return
{
/**
* Indicates that an error occured in retrieving/showing the direct linked group.
* This could be because:
* - the group does not exist
* - the user does not have permission
* - the group is out of scope for the given page
* @type {boolean}
*/
directLinkedGroupFetchFailed
:
false
,
};
}
const
update
=
{
UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED
(
state
,
action
)
{
return
{
directLinkedGroupFetchFailed
:
action
.
directLinkedGroupFetchFailed
,
};
},
};
const
actions
=
util
.
actionTypes
(
update
);
/**
* Set the direct linked group fetch failure to true.
*/
function
setDirectLinkedGroupFetchFailed
()
{
return
{
type
:
actions
.
UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED
,
directLinkedGroupFetchFailed
:
true
,
};
}
/**
* Clear the direct linked group fetch failure.
*/
function
clearDirectLinkedGroupFetchFailed
()
{
return
{
type
:
actions
.
UPDATE_DIRECT_LINKED_GROUP_FETCH_FAILED
,
directLinkedGroupFetchFailed
:
false
,
};
}
module
.
exports
=
{
init
,
update
,
actions
:
{
setDirectLinkedGroupFetchFailed
,
clearDirectLinkedGroupFetchFailed
,
},
selectors
:
{},
};
src/sidebar/store/modules/test/direct-linked-group-test.js
0 → 100644
View file @
c23ceaa8
'use strict'
;
const
createStore
=
require
(
'../../create-store'
);
const
directLinkedGroup
=
require
(
'../direct-linked-group'
);
describe
(
'sidebar/store/modules/direct-linked-group'
,
()
=>
{
let
store
;
beforeEach
(()
=>
{
store
=
createStore
([
directLinkedGroup
]);
});
it
(
'sets directLinkedGroupFetchFailed to true'
,
()
=>
{
store
.
setDirectLinkedGroupFetchFailed
();
assert
.
isTrue
(
store
.
getState
().
directLinkedGroupFetchFailed
);
});
it
(
'sets directLinkedGroupFetchFailed to false'
,
()
=>
{
store
.
setDirectLinkedGroupFetchFailed
();
store
.
clearDirectLinkedGroupFetchFailed
();
assert
.
isFalse
(
store
.
getState
().
directLinkedGroupFetchFailed
);
});
});
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