Skip to content

Commit

Permalink
Get Token button (#474)
Browse files Browse the repository at this point in the history
* removed SGC column from target list

* #1540 added preferred alias functionality

* #1540 added edit column to target list and use target settings modal

* #1540 updated "Open" label and read only version of display name

* Squashed commit of the following:

commit c5bba58
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Tue Dec 10 08:13:00 2024 +0100

    #1603 - fixes

* Squashed commit of the following:

commit 9d9bf8c
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Wed Dec 11 15:20:54 2024 +0100

    fixed frontend part of the ticket. Now properly resolves target based on the target name and target access string

* - fixed issue when the template protein is missing

* Squashed commit of the following:

commit 2fd529e
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Mon Dec 16 10:44:15 2024 +0100

    - changes labels in searchSettingsDialog

commit 12499a9
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Mon Dec 16 09:47:05 2024 +0100

    -small fix

commit cbf95f1
Merge: 5bd7756 900d851
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Thu Dec 12 13:34:14 2024 +0100

    Merge branch '#1563-LHS-search' of https://github.com/m2ms/fragalysis-frontend into #1563-LHS-search

commit 5bd7756
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Thu Dec 12 13:30:00 2024 +0100

    - search aliases

commit 3e7540f
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Tue Dec 10 12:12:03 2024 +0100

    - checkpoint

commit 6631373
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Fri Dec 6 10:05:51 2024 +0100

    - #1563 - all the UI and infrastructure and search by shortcode and compound id is done

commit 900d851
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Thu Dec 12 13:30:00 2024 +0100

    - search aliases

commit a72f427
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Tue Dec 10 12:12:03 2024 +0100

    - checkpoint

commit 4b7d699
Merge: 4579a9d 32c837d
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Tue Dec 10 10:26:34 2024 +0100

    Merge branch '#1563-LHS-search' of https://github.com/m2ms/fragalysis-frontend into #1563-LHS-search

commit 4579a9d
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Fri Dec 6 10:05:51 2024 +0100

    - #1563 - all the UI and infrastructure and search by shortcode and compound id is done

commit 32c837d
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Fri Dec 6 10:05:51 2024 +0100

    - #1563 - all the UI and infrastructure and search by shortcode and compound id is done

* - fixes #1622 and changes defaults for search settings

* Squashed commit of the following:

commit 021d6f2
Merge: a5fb901 182a10a
Author: boriskovar-m2ms <boris.kovar@m2ms.sk>
Date:   Thu Dec 19 13:49:43 2024 +0100

    Merge branch '#1533-direct-links' of https://github.com/m2ms/fragalysis-frontend into #1533-direct-links

commit a5fb901
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Tue Dec 17 16:56:49 2024 +0100

    - implements #1533

commit 182a10a
Author: Boris Kovar <boris.kovar@m2ms.sk>
Date:   Tue Dec 17 16:56:49 2024 +0100

    - implements #1533

* #1606 pose properties table from tooltip to separate icon

* added button to menu for getting session token

---------

Co-authored-by: boriskovar-m2ms <boris.kovar@m2ms.sk>
  • Loading branch information
matej-vavrek and boriskovar-m2ms authored Jan 30, 2025
1 parent 9e58751 commit 347ad82
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions js/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ import { AddProjectDetail } from '../projects/addProjectDetail';
import { ServicesStatusWrapper } from '../services';
import { COMPANIES, get_logo } from '../funders/constants';
import { setEditTargetDialogOpen } from '../target/redux/actions';
import { Settings, Upload } from '@mui/icons-material';
import { Pin, Settings, Upload } from '@mui/icons-material';
import { TargetSettingsModal } from '../target/targetSettingsModal';
import { SnapshotType } from '../projects/redux/constants';
import { NglContext } from '../nglView/nglProvider';
import { VIEWS } from '../../constants/constants';
import moment from 'moment';
import { ToastContext } from '../toast';
import { api } from '../../utils/api';
import { api, METHOD } from '../../utils/api';

const useStyles = makeStyles(theme => ({
padding: {
Expand Down Expand Up @@ -179,6 +179,26 @@ export default memo(
window.open(link, '_blank');
};

const getTokenFromApi = async () => {
return api({
url: `${base_url}/api/token/`,
method: METHOD.GET
})
.then(resp => {
return resp.data.sessionid;
})
.catch(err => {
console.log('error fetching token', err);
return '';
});
};

const getToken = async () => {
const token = await getTokenFromApi();
await navigator.clipboard.writeText(token);
toastInfo(`Token '${token}' was copied to the clipboard`, { autoHideDuration: 5000 });
};

const createSnapshot = useCallback(
(title, description) => {
if (!currentSnapshotId || !currentProject || !title || !description) return;
Expand Down Expand Up @@ -665,6 +685,13 @@ export default memo(
}
{DJANGO_CONTEXT.pk &&
<>
<Divider />
<ListItem button onClick={getToken}>
<ListItemIcon>
<Pin />
</ListItemIcon>
<ListItemText primary="Get Token" />
</ListItem>
<Divider />
<ListItem button onClick={() => openLink(URLS.lhsUpload)}>
<ListItemIcon>
Expand Down

0 comments on commit 347ad82

Please sign in to comment.