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

features : Applications sorted by name (Update Navigation.tsx) #611

Closed
wants to merge 3 commits into from
Closed
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
15 changes: 15 additions & 0 deletions ui/src/application/Applications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import TableRow from '@material-ui/core/TableRow';
import Delete from '@material-ui/icons/Delete';
import Edit from '@material-ui/icons/Edit';
import CloudUpload from '@material-ui/icons/CloudUpload';
import HighlightOffIcon from '@material-ui/icons/HighlightOff';
import React, {ChangeEvent, Component, SFC} from 'react';
import ConfirmDialog from '../common/ConfirmDialog';
import DefaultPage from '../common/DefaultPage';
Expand Down Expand Up @@ -84,6 +85,7 @@ class Applications extends Component<Stores<'appStore'>> {
value={app.token}
lastUsed={app.lastUsed}
fUpload={() => this.uploadImage(app.id)}
fDeleteImage={() => this.deleteImage(app.id)}
fDelete={() => (this.deleteId = app.id)}
fEdit={() => (this.updateId = app.id)}
noDelete={app.internal}
Expand Down Expand Up @@ -146,6 +148,14 @@ class Applications extends Component<Stores<'appStore'>> {
alert('Uploaded file must be of type png, jpeg or gif.');
}
};

private deleteImage = (id: number) => {
console.log("delete for " + id)
//this.uploadId = id;
//if (this.upload) {
//this.upload.click();
//}
};
}

interface IRowProps {
Expand All @@ -156,6 +166,7 @@ interface IRowProps {
defaultPriority: number;
lastUsed: string | null;
fUpload: VoidFunction;
fDeleteImage: VoidFunction;
image: string;
fDelete: VoidFunction;
fEdit: VoidFunction;
Expand All @@ -171,6 +182,7 @@ const Row: SFC<IRowProps> = observer(
lastUsed,
fDelete,
fUpload,
fDeleteImage,
image,
fEdit,
}) => (
Expand All @@ -181,6 +193,9 @@ const Row: SFC<IRowProps> = observer(
<IconButton onClick={fUpload} style={{height: 40}}>
<CloudUpload />
</IconButton>
<IconButton onClick={fDeleteImage} style={{height: 40}}>
<HighlightOffIcon />
</IconButton>
</div>
</TableCell>
<TableCell>{name}</TableCell>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/layout/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Navigation extends Component<
public render() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I like the sorting by name. I'd rather have the applications order fully customizable via drag&drop.

const {classes, loggedIn, appStore, navOpen, setNavOpen} = this.props;
const {showRequestNotification} = this.state;
const apps = appStore.getItems();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably should be done in the back end, so that the ordering is consistent with the android app.

const apps = appStore.getItems().slice().sort((a,b) => a.name.localeCompare(b.name));

const userApps =
apps.length === 0
Expand Down