This repository was archived by the owner on Jan 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Reuse components #153
Merged
Merged
Reuse components #153
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6785fbf
Reuse components
Ehevi 7ad9bda
Reuse messagePanel components
Ehevi 8d3a031
Remove viewButton components
Ehevi cf8f0eb
Cleanup :broom:
Ehevi 488065b
Apply eslint rules :sparkles:
Ehevi a8ca452
Remove unnecessary functions :broom:
Ehevi 7c40a2f
Apply eslint rules :sparkles:
Ehevi 9759490
Rename reasons to messages
Ehevi f8c3042
bundleDependencies
Ehevi 038a4b5
Organize user messages
Ehevi 3b098a0
No subpage selected view
Ehevi e4a3c96
Remove pageSettings from the main page content
Ehevi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2019-2020 CERN and copyright holders of ALICE O2. | ||
| * See http://alice-o2.web.cern.ch/copyright for details of the copyright holders. | ||
| * All rights not expressly granted are reserved. | ||
| * | ||
| * This software is distributed under the terms of the GNU General Public | ||
| * License v3 (GPL Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| import { h } from '/js/src/index.js'; | ||
| import messagePanel from './messagePanel.js'; | ||
| import spinner from '../common/spinner.js'; | ||
|
|
||
| const goBack = 'Go back'; | ||
| const nothingFound = 'Nothing found'; | ||
|
|
||
| const requestButton = (model) => h('button.btn.btn-primary.m3', { | ||
| onclick: () => model.fetchedData.reqForData(true), | ||
| }, 'Reload'); | ||
|
|
||
| const removeCurrentDataButton = (model, label) => h('button.btn.btn-primary.m3', { | ||
| onclick: () => model.removeCurrentData(), | ||
| }, label); | ||
|
|
||
| export const failure = (model, status) => messagePanel( | ||
| 'no-network-90', | ||
| 'Failed to load data', | ||
| `The services are unavailable (status: ${status ? status : 'unknown'})`, | ||
| requestButton(model), | ||
| ); | ||
|
|
||
| export const unknown = (model) => messagePanel( | ||
| 'unexpected-90', | ||
| 'Unknown error', | ||
| 'Request could not be handled properly', | ||
| requestButton(model), | ||
| ); | ||
|
|
||
| export const sessionError = (model) => messagePanel( | ||
| 'session-timeout-90', | ||
| 'Session error', | ||
| 'Please retry to login', | ||
| h('button.btn.btn-primary.m3', { onclick: () => model.login() }, 'Login'), | ||
| ); | ||
|
|
||
| export const serviceUnavailable = (model) => messagePanel( | ||
| 'no-network-90', | ||
| 'Service temporarily unavailable', | ||
| 'Please contact the administrator', | ||
| h('button.btn.btn-primary.m3', { onclick: async () => await model.login() }, 'Retry'), | ||
| h('.notification-content.shadow-level3.bg-danger.white.br2.p2.notification-close', { | ||
| id: model.dataAccess.serviceUnavailable.messageFieldId, | ||
| }, ''), | ||
| ); | ||
|
|
||
| export const noMatchingData = (model, page) => messagePanel( | ||
| 'nothing-found-90', | ||
| nothingFound, | ||
| 'There is no data that matches your request', | ||
| [ | ||
| h('button.btn.btn-secondary.m3', { | ||
| onclick: () => { | ||
| model.navigation.goToDefaultPageUrl(page); | ||
| }, | ||
| }, 'Clear filters'), | ||
| removeCurrentDataButton(model, goBack), | ||
| ], | ||
| ); | ||
|
|
||
| export const noDataFound = (model) => messagePanel( | ||
| 'nothing-found-90', | ||
| nothingFound, | ||
| 'There is no data to be displayed here', | ||
| [ | ||
| removeCurrentDataButton(model, goBack), | ||
| requestButton(model), | ||
| ], | ||
| ); | ||
|
|
||
| export const nothingSelected = (model) => messagePanel( | ||
| 'nothing-found-90', | ||
| 'No subpage selected', | ||
| 'Please select any of the subpages', | ||
| removeCurrentDataButton(model, goBack), | ||
| ); | ||
|
|
||
| export const waiting = () => { | ||
| const retryButton = h('button.btn.btn-primary.m3', { onclick: () => document.location.reload(true) }, 'Retry'); | ||
| const loadingMessage = h('h3', 'Loading...'); | ||
|
|
||
| return h('.panel.abs-center', | ||
| spinner(), | ||
| loadingMessage, | ||
| retryButton); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.