Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor UI of the Appstore page #1679

Merged
merged 30 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ac80698
Refactor UI of the Appstore page
leonardgable Feb 12, 2024
f1fb399
Fix warning message on for clearer message.
leonardgable Feb 14, 2024
adaa4e0
Added update badge on sidemenu and appstore for a better visual on av…
leonardgable Feb 18, 2024
b817270
Improved file organisation and styling on hover install button. The C…
leonardgable Feb 22, 2024
c060e70
Reset the main packages.json to remove any changes made before
leonardgable Feb 22, 2024
6b96c7f
Moved to Card from react strap for better UI consistency. Improved re…
leonardgable Feb 27, 2024
1c2a9ef
Set the row height to autoheight to fit better content and better rea…
leonardgable Mar 8, 2024
b2bb784
Filter out already installed app from the list of available plugins t…
leonardgable Mar 9, 2024
82346da
Created a custom scss theme for the grid to improve reproducibality o…
leonardgable Mar 9, 2024
89cbcaf
Implementation of Update all button for updating all plugins at the s…
leonardgable Mar 11, 2024
e07aed0
Text-wrap on the grid component to wrap whole word which improves the…
leonardgable Mar 25, 2024
5f03c69
Added update filter button for the user to filter all plugins with an…
leonardgable Mar 26, 2024
def6808
Fix bug on update all and small layout improvement
leonardgable Mar 27, 2024
ba0f68d
hide appstore offline indicators
tkurki Mar 27, 2024
8c54898
organise dependencies
tkurki Mar 27, 2024
9f14954
align all buttons and search bar
tkurki Mar 27, 2024
cdca098
simplify listing logic
tkurki Mar 28, 2024
1a64bba
remove extra code
tkurki Mar 28, 2024
f0f2aab
simplify: use precomputed property
tkurki Mar 28, 2024
513b375
revert accidental change
tkurki Mar 28, 2024
238c80b
remove unused import
tkurki Mar 28, 2024
55ba94e
rewording
tkurki Mar 28, 2024
f5a5235
simplify
tkurki Mar 28, 2024
068373e
simplify: useState is not needed
tkurki Mar 28, 2024
83bcb4f
remove <p> to center align vertically, like actions
tkurki Mar 28, 2024
e0d2711
format
tkurki Mar 29, 2024
05aa7f2
Reconfigured webpack and added dependencies version to avoid warning
leonardgable Mar 30, 2024
f42ed02
simplify, useState not needed
tkurki Mar 29, 2024
d6ec1ad
switch from ag-grid to plain bootstrap table
tkurki Mar 30, 2024
0b89721
remove dangling ag-grid references
tkurki Mar 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions package.json
leonardgable marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"packages/resources-provider-plugin"
],
"dependencies": {
"@meri-imperiumi/signalk-teltonika-rutx11": "^0.6.0",
"@signalk/course-provider": "^1.0.0",
"@signalk/n2k-signalk": "^3.0.0",
"@signalk/nmea0183-signalk": "^3.0.0",
Expand Down Expand Up @@ -130,13 +131,13 @@
"@signalk/instrumentpanel": "0.x",
"@signalk/set-system-time": "^1.2.0",
"@signalk/signalk-to-nmea0183": "^1.0.0",
"@signalk/vesselpositions": "^1.0.0",
"@signalk/udp-nmea-plugin": "^2.0.0",
"@signalk/vesselpositions": "^1.0.0",
"@signalk/zones": "^1.0.0",
"signalk-to-nmea2000": "^2.16.0",
"signalk-n2kais-to-nmea0183": "^1.3.1",
"mdns": "^2.5.1",
"serialport": "^11.0.0"
"serialport": "^11.0.0",
"signalk-n2kais-to-nmea0183": "^1.3.1",
"signalk-to-nmea2000": "^2.16.0"
},
"devDependencies": {
"@types/busboy": "^1.5.0",
Expand Down
36 changes: 14 additions & 22 deletions packages/server-admin-ui/src/views/appstore/Apps/Apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import { Button, Input } from 'reactstrap'
import { AgGridReact } from 'ag-grid-react' // React Grid Logic

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import {
faMagnifyingGlass,
faTriangleExclamation,
} from '@fortawesome/free-solid-svg-icons'
import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons'

import WarningBox from './WarningBox'

/* Cell rendering */
import TypeCellRenderer from '../Grid/TypeCellRenderer'
Expand All @@ -21,7 +20,7 @@ import 'ag-grid-community/styles/ag-theme-quartz.css' // Theme

/* FIXME: Temporary simply to code to be replace with data coming from backend */
const tags = [
'Alls',
'All',
'AIS',
'Chart Plotters',
'Cloud',
Expand All @@ -38,8 +37,8 @@ const tags = [
/** Main component */
const Apps = function (props) {
/** State */
const [selectedView, setSelectedView] = useState('Alls')
const [selectedTag, setSelectedTag] = useState('Alls')
const [selectedView, setSelectedView] = useState('All')
const [selectedTag, setSelectedTag] = useState('All')

/* Effects / Watchers */
useEffect(() => {
Expand All @@ -55,8 +54,7 @@ const Apps = function (props) {
}, [])

useEffect(() => {
console.log('SelectedTag', selectedTag)
if (selectedView === 'Alls') {
if (selectedView === 'All') {
refreshGridData(selectedTag, allAppList())
} else if (selectedView === 'Installed')
refreshGridData(selectedTag, installedAppList())
Expand Down Expand Up @@ -145,7 +143,7 @@ const Apps = function (props) {
* Set the rowData with the filter selected
*/
const refreshGridData = useCallback((item, gridData) => {
if (!item || item === 'Alls') return setRowData(gridData)
if (!item || item === 'All') return setRowData(gridData)
let newData = []
newData = gridData.filter((el) => el.categories.includes(item))
setRowData(newData)
Expand All @@ -169,24 +167,18 @@ const Apps = function (props) {
return (
<div className="appstore animated fadeIn">
<section className="appstore__warning section">
<div className="message__container">
<p className="message">
<span>
<FontAwesomeIcon icon={faTriangleExclamation} />
</span>
Sorry you need to restart the server every time you install or
update a plugin. We will improve this in the future.
</p>
</div>
<WarningBox>
Please restart the server after installing or updating a plugin.
leonardgable marked this conversation as resolved.
Show resolved Hide resolved
</WarningBox>
</section>
<header className="appstore__header">
<div className="title__container">
<h3 className="title">Apps & Plugins</h3>
<Button
color={selectedView === 'Alls' ? 'primary' : 'secondary'}
onClick={() => setSelectedView('Alls')}
color={selectedView === 'All' ? 'primary' : 'secondary'}
onClick={() => setSelectedView('All')}
>
Alls
All
</Button>
<Button
color={selectedView === 'Installed' ? 'primary' : 'secondary'}
Expand Down
17 changes: 17 additions & 0 deletions packages/server-admin-ui/src/views/appstore/Apps/WarningBox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faTriangleExclamation } from '@fortawesome/free-solid-svg-icons'

export default function WarningBox({ children }) {
return (
<div className="message__container">
<p className="message">
<span>
<FontAwesomeIcon icon={faTriangleExclamation} />
</span>
{children}
</p>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
import React from 'react'
import { Button } from 'reactstrap'
import { NavLink } from 'react-router-dom'

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faGear, faTrashCan } from '@fortawesome/free-solid-svg-icons'

export default function ActionCellRenderer(props) {
const handleInstallClick = () => {
/* TODO: TO BE IMPLEMENTED */
const handleInstallClick = async () => {
const response = await fetch(
`${window.serverRoutesPrefix}/appstore/install/${props.data.name}/${props.data.version}`,
{
method: 'POST',
credentials: 'include',
}
)
if (response.status === 200) {
// TODO: Show the progress bar and the warning display messaege
// Also show a restart message indicating that the user must restart the server
}
}

const handleRemoveClick = async () => {
if (confirm(`Are you sure you want to uninstall ${props.data.name}?`)) {
const response = await fetch(
`${window.serverRoutesPrefix}/appstore/remove/${props.data.name}`,
{
method: 'POST',
credentials: 'include',
}
)
if (response.status === 200) {
// TODO: Show the user the warning message that the server must be restarted
}
}
}

return (
<div className="cell__renderer cell-action center">
{props.data.installed ? (
<>
<FontAwesomeIcon icon={faTrashCan} />
<FontAwesomeIcon icon={faGear} />{' '}
<NavLink to={`/serverConfiguration/plugins/${props.data.name}`}>
<FontAwesomeIcon icon={faGear} />
</NavLink>

<FontAwesomeIcon icon={faTrashCan} onClick={handleRemoveClick} />
</>
) : (
<Button color="primary" onClick={handleInstallClick}>
Expand Down