Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Notifications project
web-portal
Commits
c38e4ec6
Commit
c38e4ec6
authored
Jan 18, 2021
by
Emmanuel Ormancey
Committed by
Carina Antunes
Jan 18, 2021
Browse files
[
#27
] Archives integration
parent
169e143d
Pipeline
#2239159
passed with stages
in 5 minutes and 48 seconds
Changes
8
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
.env
View file @
c38e4ec6
...
...
@@ -4,3 +4,4 @@ REACT_APP_AUTHORIZATION_URL=https://auth.cern.ch/auth/realms/cern/protocol/openi
REACT_APP_OAUTH_REDIRECT_URL=https://localhost:3000/redirect
REACT_APP_OAUTH_LOGOUT_URL=https://localhost:3000/logout
REACT_APP_NODE_TLS_REJECT_UNAUTHORIZED=0
REACT_APP_ARCHIVE_URL=https://cern.ch/notifications-archives
.env.dev
View file @
c38e4ec6
...
...
@@ -3,3 +3,4 @@ REACT_APP_OAUTH_CLIENT_ID=push-notifications
REACT_APP_AUTHORIZATION_URL=https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/auth
REACT_APP_OAUTH_REDIRECT_URL=https://test-notifications-service.web.cern.ch/redirect
REACT_APP_OAUTH_LOGOUT_URL=https://test-notifications-service.web.cern.ch/logout
REACT_APP_ARCHIVE_URL=https://cern.ch/notifications-archives
.gitignore
View file @
c38e4ec6
...
...
@@ -23,3 +23,5 @@ yarn-debug.log*
yarn-error.log*
.idea
.vscode
yarn.lock
src/*.css
README.md
View file @
c38e4ec6
...
...
@@ -10,13 +10,18 @@
npm install
```
2.
After installing all the dependencies, you should be able to run the project
```
npm start
```
```
npm start
```
## Test docker image locally
We can build the docker image to test the production build of the system:
The Dockerfile is meant to build the image that is going to be used in the production environment,
so it expects to use the production build of the web-portal application. So first of all we should build the application:
```
npx env-cmd -f .env cross-env npm build
```
When the build is finished, we can build the docker image to test the production build of the system:
```
docker build . -t web-portal
```
...
...
src/channels/components/ChannelsList/ChannelsList.js
View file @
c38e4ec6
...
...
@@ -10,21 +10,31 @@ import * as getChannelsActionCreators from '../../actions/GetChannels';
import
*
as
getPublicChannelsActionCreators
from
'
../../actions/GetPublicChannels
'
;
const
columns
=
[
{
id
:
'
name
'
,
numeric
:
false
,
disablePadding
:
true
,
label
:
'
Name
'
},
{
id
:
'
name
'
,
label
:
'
Name
'
},
{
id
:
'
description
'
,
numeric
:
false
,
disablePadding
:
false
,
label
:
'
Description
'
,
},
{
id
:
'
visibility
'
,
numeric
:
false
,
disablePadding
:
false
,
label
:
'
Visibility
'
,
},
{
id
:
'
archive
'
,
label
:
'
Archive
'
,
type
:
'
bool
'
,
},
];
const
renderCellValue
=
(
channel
,
column
)
=>
{
if
(
column
.
type
===
'
bool
'
)
{
if
(
channel
[
column
.
id
]
===
true
)
return
'
Enabled
'
;
else
if
(
channel
[
column
.
id
]
===
false
)
return
'
Disabled
'
;
}
else
if
(
channel
[
column
.
id
])
return
channel
[
column
.
id
].
toString
();
return
''
;
};
const
ChannelsList
=
({
channels
,
totalNumberOfChannels
,
...
...
@@ -57,9 +67,7 @@ const ChannelsList = ({
return
(
<
Table
.
Row
key
=
{
channel
.
id
}
>
{
columns
.
map
(
column
=>
(
<
Table
.
Cell
key
=
{
column
.
id
}
>
{
channel
[
column
.
id
]
?
channel
[
column
.
id
].
toString
()
:
''
}
<
/Table.Cell
>
<
Table
.
Cell
key
=
{
column
.
id
}
>
{
renderCellValue
(
channel
,
column
)}
<
/Table.Cell
>
))}
<
Table
.
Cell
>
{
isAuthenticated
&&
!
channel
.
subscribed
&&
(
...
...
@@ -94,6 +102,18 @@ const ChannelsList = ({
}}
/
>
)}
{
channel
.
archive
&&
channel
.
subscribed
&&
(
<
Button
content
=
"
Go to archive
"
primary
onClick
=
{()
=>
{
window
.
open
(
`
${
process
.
env
.
REACT_APP_ARCHIVE_URL
}
/data/
${
channel
.
name
}
`
,
'
_blank
'
);
}}
/
>
)}
<
/Table.Cell
>
<
/Table.Row
>
);
...
...
src/channels/components/EditChannelComponent/EditChannelComponent.js
View file @
c38e4ec6
...
...
@@ -140,6 +140,32 @@ const EditChannelComponent = ({
/
>
<
/Form.Group
>
)}
<
Form
.
Group
inline
>
<
label
>
Archive
<
/label
>
<
Form
.
Field
control
=
{
Radio
}
label
=
"
Enabled
"
value
=
"
true
"
checked
=
{
updatedChannel
.
archive
}
onChange
=
{()
=>
setChannel
({...
channel
,
archive
:
true
})}
/
>
<
Form
.
Field
control
=
{
Radio
}
label
=
"
Disabled
"
value
=
"
false
"
checked
=
{
updatedChannel
.
archive
===
false
}
onChange
=
{()
=>
setChannel
({...
channel
,
archive
:
false
})}
/
>
<
span
>
(
archive
content
to
{
'
'
}
<
a
href
=
{
process
.
env
.
REACT_APP_ARCHIVE_URL
}
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
>
{
process
.
env
.
REACT_APP_ARCHIVE_URL
}
<
/a
>
)
<
/span
>
<
/Form.Group
>
<
Form
.
Button
>
Submit
<
/Form.Button
>
<
/Form
>
<
Modal
trigger
=
{
<
Button
>
Delete
<
/Button>}
>
...
...
@@ -181,6 +207,7 @@ EditChannelComponent.propTypes = {
description
:
PropTypes
.
string
,
visibility
:
PropTypes
.
string
,
subscriptionPolicy
:
PropTypes
.
string
,
archive
:
PropTypes
.
bool
,
}).
isRequired
,
};
...
...
src/channels/pages/CreateChannelPage/CreateChannelPage.js
View file @
c38e4ec6
...
...
@@ -18,6 +18,7 @@ const CreateChannelPage = ({createChannel, showSnackbar, history}) => {
},
visibility
:
'
RESTRICTED
'
,
subscriptionPolicy
:
'
SELF_SUBSCRIPTION
'
,
archive
:
false
,
});
const
updateField
=
(
e
,
d
)
=>
{
...
...
@@ -177,6 +178,42 @@ const CreateChannelPage = ({createChannel, showSnackbar, history}) => {
/
>
<
/Form.Group
>
)}
<
Form
.
Group
inline
>
<
label
>
Archive
<
/label
>
<
Popup
content
=
{
`Channel content will be automatically archived in
${
process
.
env
.
REACT_APP_ARCHIVE_URL
}
`
}
trigger
=
{
<
Form
.
Field
control
=
{
Radio
}
label
=
"
Enabled
"
value
=
"
true
"
checked
=
{
channel
.
archive
===
true
}
onChange
=
{()
=>
setChannel
({...
channel
,
archive
:
true
})}
/
>
}
/
>
<
Popup
content
=
"
Channel content will not be archived.
"
trigger
=
{
<
Form
.
Field
control
=
{
Radio
}
label
=
"
Disabled
"
value
=
"
false
"
checked
=
{
channel
.
archive
===
false
}
onChange
=
{()
=>
setChannel
({...
channel
,
archive
:
false
})}
/
>
}
/
>
<
span
>
(
archive
content
to
{
'
'
}
<
a
href
=
{
process
.
env
.
REACT_APP_ARCHIVE_URL
}
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
>
{
process
.
env
.
REACT_APP_ARCHIVE_URL
}
<
/a
>
)
<
/span
>
<
/Form.Group
>
<
Form
.
Button
>
Submit
<
/Form.Button
>
<
/Form
>
<
/Segment
>
...
...
yarn.lock
deleted
100644 → 0
View file @
169e143d
This diff is collapsed.
Click to expand it.
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