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

fix(ui): Changed button appearance and fixed tooltip #222

Merged
merged 2 commits into from
Dec 9, 2023
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
26 changes: 17 additions & 9 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default class App extends Component {
runningTaskCount: 0,
isFetching: false,
repoDescription: "",
isRepositoryConnected: false
};

this.fetchTaskSummary = this.fetchTaskSummary.bind(this);
Expand Down Expand Up @@ -58,6 +59,7 @@ export default class App extends Component {
if (result.data.description) {
this.setState({
repoDescription: result.data.description,
isRepositoryConnected: result.data.connected
});
}
}).catch(error => { /* ignore */ });
Expand All @@ -80,6 +82,7 @@ export default class App extends Component {

// this is invoked via AppContext whenever repository is connected, disconnected, etc.
repositoryUpdated(isConnected) {
this.setState({ isRepositoryConnected: isConnected })
if (isConnected) {
window.location.replace("/snapshots");
} else {
Expand All @@ -94,7 +97,7 @@ export default class App extends Component {
}

render() {
const { uiPrefs, runningTaskCount } = this.state;
const { uiPrefs, runningTaskCount, isRepositoryConnected } = this.state;

return (
<Router>
Expand All @@ -105,14 +108,19 @@ export default class App extends Component {
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="me-auto">
<NavLink data-testid="tab-snapshots" data-title="Snapshots" className="nav-link" activeClassName="active" to="/snapshots">Snapshots</NavLink>
<NavLink data-testid="tab-policies" data-title="Policies" className="nav-link" activeClassName="active" to="/policies">Policies</NavLink>
<NavLink data-testid="tab-tasks" data-title="Tasks" className="nav-link" activeClassName="active" to="/tasks">Tasks <>
{runningTaskCount > 0 && <>({runningTaskCount})</>}
</>
</NavLink>
<NavLink data-testid="tab-repo" data-title="Repository" className="nav-link" activeClassName="active" to="/repo">Repository</NavLink>
<NavLink data-testid="tab-preferences" data-title="Preferences" className="nav-link" activeClassName="active" to="/preferences">Preferences</NavLink>
<span className="d-inline-block" data-toggle="tooltip" title="Repository is not connected">
<NavLink data-testid="tab-snapshots" title="" data-title="Snapshots" className={isRepositoryConnected ? "nav-link" : "nav-link disabled"} to="/snapshots">Snapshots</NavLink>
</span>
<span className="d-inline-block" data-toggle="tooltip" title="Repository is not connected">
<NavLink data-testid="tab-policies" title="" data-title="Policies" className={isRepositoryConnected ? "nav-link" : "nav-link disabled"} to="/policies">Policies</NavLink>
</span>
<span className="d-inline-block" data-toggle="tooltip" title="Repository is not connected">
<NavLink data-testid="tab-tasks" title="" data-title="Tasks" className={isRepositoryConnected ? "nav-link" : "nav-link disabled"} to="/tasks">Tasks
<>{runningTaskCount > 0 && <>({runningTaskCount})</>}</>
</NavLink>
</span>
<NavLink data-testid="tab-repo" data-title="Repository" className="nav-link" to="/repo">Repository</NavLink>
<NavLink data-testid="tab-preferences" data-title="Preferences" className="nav-link" to="/preferences">Preferences</NavLink>
</Nav>
</Navbar.Collapse>
</Navbar>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Snapshots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class Snapshots extends Component {

case "PENDING":
return <>
<Spinner data-testid="snapshot-pending" animation="border" variant="secondary" size="sm" title="Snapshot will after the previous snapshot completes" />
<Spinner data-testid="snapshot-pending" animation="border" variant="secondary" size="sm" title="Snapshot will start after the previous snapshot completes" />
&nbsp;Pending
</>;

Expand Down
10 changes: 5 additions & 5 deletions src/utils/uiutil.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { faBan, faCheck, faChevronLeft, faCopy, faExclamationCircle, faExclamationTriangle, faFolderOpen, faTerminal, faWindowClose } from '@fortawesome/free-solid-svg-icons';
import { faBan, faCheck, faChevronLeft, faCopy, faExclamationCircle, faExclamationTriangle, faFolderOpen, faTerminal, faXmark } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import axios from 'axios';
import React, { useState } from 'react';
Expand Down Expand Up @@ -274,10 +274,10 @@ export function taskStatusSymbol(task) {
case "RUNNING":
return <>
<Spinner animation="border" variant="primary" size="sm" /> Running for {dur}
&nbsp;
<FontAwesomeIcon size="sm" color="red" icon={faWindowClose} title="Cancel task" onClick={() => cancelTask(task.id)} />
</>;

<button className="btn btn-sm btn-link" type="button" onClick={() => cancelTask(task.id)}>
<FontAwesomeIcon color="red" size='lg' title="Cancel task" icon={faXmark} />
</button>
</>
case "SUCCESS":
return <p title={dur}><FontAwesomeIcon icon={faCheck} color="green" /> Finished in {dur}</p>;

Expand Down
Loading