Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions packages/server-admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"react-copy-to-clipboard": "^5.0.3",
"react-dom": "^16.13.1",
"react-html-parser": "^2.0.2",
"react-infinite-scroll-component": "^6.1.0",
"react-json-tree": "^0.20.0",
"react-jsonschema-form-bs4": "^1.7.1",
"react-redux": "^5.1.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/server-admin-ui/scss/_bootstrap-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ $colors: (

$theme-colors: (
primary: $blue,
secondary: $gray-300,
secondary: $gray-700,
success: $green,
info: $cyan,
warning: $yellow,
danger: $red,
light: $gray-100,
light: $gray-200,
dark: $gray-800
);

Expand All @@ -59,7 +59,7 @@ $theme-colors: (
// Quickly modify global styling by enabling or disabling optional features.

$enable-transitions: true;
$enable-rounded: false;
$enable-rounded: true;

// Body
//
Expand Down
6 changes: 6 additions & 0 deletions packages/server-admin-ui/scss/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ form.rjsf div.row.array-item {
margin: 0px;
}
}

/** Utility class to attempt to wrap text in a more balanced way. **/
.text-pretty {
text-wrap: balance; /* Fallback for older browsers */
text-wrap: pretty; /* Future spec */
}
2 changes: 1 addition & 1 deletion packages/server-admin-ui/scss/core/_dropdown.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Links, buttons, and more within the dropdown menu
.dropdown-item {
position: relative;
padding: 10px 20px;
padding: 0.375rem 0.75rem;
border-bottom: 1px solid $dropdown-border-color;

&:last-child {
Expand Down
10 changes: 7 additions & 3 deletions packages/server-admin-ui/src/views/Webapps/Webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const propTypes = {
children: PropTypes.node
}

export function urlToWebapp(webAppInfo) {
return webAppInfo.keywords.includes('signalk-embeddable-webapp')
? `/admin/#/e/${toSafeModuleId(webAppInfo.name)}`
: `/${webAppInfo.name}`
}

class Webapp extends Component {
render() {
const { webAppInfo, ...attributes } = this.props
Expand All @@ -36,9 +42,7 @@ class Webapp extends Component {
'text-capitalize'
)
const header = webAppInfo?.signalk?.displayName || webAppInfo.name
const url = webAppInfo.keywords.includes('signalk-embeddable-webapp')
? `/admin/#/e/${toSafeModuleId(webAppInfo.name)}`
: `/${webAppInfo.name}`
const url = urlToWebapp(webAppInfo)

const blockIcon = function (icon, appIcon = null) {
const classes = classNames(
Expand Down
12 changes: 6 additions & 6 deletions packages/server-admin-ui/src/views/appstore/Apps/Apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Apps = function (props) {
}
}

/*
/*
Show different warning message
whether the store is available or if an app was installed or removed
*/
Expand Down Expand Up @@ -103,19 +103,19 @@ const Apps = function (props) {
<CardTitle>Apps & Plugins</CardTitle>
<div className="button-wrapper">
<Button
color={view === 'All' ? 'primary' : 'secondary'}
color={view === 'All' ? 'secondary' : 'light'}
onClick={() => setSelectedView('All')}
>
All
</Button>
<Button
color={view === 'Installed' ? 'primary' : 'secondary'}
color={view === 'Installed' ? 'secondary' : 'light'}
onClick={() => setSelectedView('Installed')}
>
Installed
</Button>
<Button
color={view === 'Updates' ? 'primary' : 'secondary'}
color={view === 'Updates' ? 'secondary' : 'light'}
onClick={() => setSelectedView('Updates')}
>
Updates
Expand All @@ -128,7 +128,7 @@ const Apps = function (props) {
{props.appStore.installing.length > 0 && (
<>
<Button
color={view === 'Installing' ? 'primary' : 'secondary'}
color={view === 'Installing' ? 'secondary' : 'light'}
onClick={() => setSelectedView('Installing')}
>
Installs & Removes
Expand Down Expand Up @@ -174,7 +174,7 @@ const Apps = function (props) {
{props.appStore.categories?.map((item) => (
<Button
key={item}
color="primary"
color="secondary"
className={category === item ? 'active' : undefined}
outline
onClick={() => setSelectedCategory(item)}
Expand Down
128 changes: 59 additions & 69 deletions packages/server-admin-ui/src/views/appstore/AppsList.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,65 @@
import React, { Component } from 'react'

import { Table } from 'reactstrap'
import NameCellRenderer from './Grid/cell-renderers/NameCellRenderer'
import TypeCellRenderer from './Grid/cell-renderers/TypeCellRenderer'
import React, { useEffect, useState } from 'react'
import InfiniteScroll from 'react-infinite-scroll-component'
import { ListGroup, ListGroupItem } from 'reactstrap'
import ActionCellRenderer from './Grid/cell-renderers/ActionCellRenderer'
import VersionCellRenderer from './Grid/cell-renderers/VersionCellRenderer'

const XL_WIDTH = 1200
const L_WIDTH = 992
const M_WIDTH = 768
const S_WIDTH = 576

class AppsList extends Component {
render() {
return (
<Table>
<thead>
<tr>
<th>Name</th>
<th
className={
'text-center ' + (window.innerWidth < S_WIDTH ? 'd-none' : '')
}
>
Version
</th>
<th className={window.innerWidth < L_WIDTH ? 'd-none' : ''}>
Description
</th>
<th className={window.innerWidth < XL_WIDTH ? 'd-none' : ''}>
Author
</th>
<th
className={
'text-center ' + (window.innerWidth < M_WIDTH ? 'd-none' : '')
}
>
<div>Type</div>
</th>
export function AppListItem(app) {
return (
<ListGroupItem className="p-3">
<div className="d-md-flex align-items-center flex-grow-1">
<div className="flex-grow-1 mr-3">
<h5 className="text-dark mb-0">{app.name}</h5>
<div className="text-muted">
<span className="font-weight-bolder">
v{app.installedVersion || app.version}{' '}
</span>
{app.newVersion && (
<>
<span className="text-secondary"> → </span>
<span className="font-weight-bolder text-success font-italic">
v{app.newVersion}
</span>{' '}
</>
)}
released by
<span className="text-nowrap font-weight-bolder">
{' '}
{app.author}
</span>{' '}
on
<span className="text-nowrap"> {app.updated.substring(0, 10)}</span>
</div>
<p className="text-pretty mb-0">{app.description}</p>
</div>
<div className="mt-3 mt-md-0">
<ActionCellRenderer data={app} />
</div>
</div>
</ListGroupItem>
)
}

<th className="text-center">Action</th>
</tr>
</thead>
<tbody>
{this.props.apps.map((app) => (
<tr key={app.name}>
<td>
<NameCellRenderer data={app} value={app.name} />
</td>
<td className={window.innerWidth < S_WIDTH ? 'd-none' : ''}>
<VersionCellRenderer data={app} />
</td>
<td className={window.innerWidth < L_WIDTH ? 'd-none' : ''}>
{app.description}
</td>
<td className={window.innerWidth < XL_WIDTH ? 'd-none' : ''}>
{app.author}
</td>
<td className={window.innerWidth < M_WIDTH ? 'd-none' : ''}>
<TypeCellRenderer data={app} />
</td>
export default function AppList(props) {
const [apps, setApps] = useState([])

<td>
<ActionCellRenderer data={app} />
</td>
</tr>
))}
</tbody>
</Table>
)
function loadMore() {
setApps(props.apps.slice(0, apps.length + 20))
}
}

export default AppsList
// Load initial list of apps
useEffect(loadMore, [props.apps])

return (
<ListGroup>
<InfiniteScroll
dataLength={apps.length}
next={loadMore}
hasMore={apps.length != props.apps.length}
>
{apps.map((app) => (
<AppListItem key={app.name} {...app} />
))}
</InfiniteScroll>
</ListGroup>
)
}
Loading