Skip to content

Commit

Permalink
Merge pull request #983 from sennetconsortium/libpitt/982-logout
Browse files Browse the repository at this point in the history
Libpitt/982 logout
  • Loading branch information
maxsibilla authored Oct 19, 2023
2 parents 3fad4a5 + 992c4b0 commit f27afb7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.3
1.6.4
7 changes: 6 additions & 1 deletion src/components/custom/edit/GroupSelect.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React, {useContext} from 'react';
import React, {useContext, useEffect} from 'react';
import {QuestionCircleFill} from "react-bootstrap-icons";
import {Form} from 'react-bootstrap';
import SenNetPopover from "../../SenNetPopover";
import AppContext from "../../../context/AppContext";

const GroupSelect = ({groups, onGroupSelectChange, entity_type, plural}) => {
const {cache} = useContext(AppContext)

useEffect(() => {
groups.sortOnProperty('displayname')
})

return (
<>
<Form.Group className="mb-3" controlId="group_uuid">
Expand Down
22 changes: 18 additions & 4 deletions src/components/custom/js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ export function goToSearch() {
goIntent('search')
}

export function gotToLogin() {
goIntent('login')
}

export function getEntityViewUrl(entity, uuid, {isEdit = false}) {
const pre = isEdit ? '/edit' : ''
return pre + "/" + entity?.toLowerCase() + "?uuid=" + uuid
Expand Down Expand Up @@ -381,6 +377,24 @@ Object.assign(String.prototype, {
}
})

Object.assign(Array.prototype, {
sortOnProperty(key) {
return this.sort((a, b) => {
let fa = a[key].toLowerCase(),
fb = b[key].toLowerCase()

if (fa < fb) {
return -1
}
if (fa > fb) {
return 1
}
return 0
})
}
})


export const flipObj = (obj) => {
return Object.keys(obj).reduce((ret, key) => {
ret[obj[key]] = key;
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portal-ui",
"version": "1.6.3",
"version": "1.6.4",
"private": true,
"scripts": {
"run": "npm-run-all --parallel dev sass",
Expand Down
5 changes: 1 addition & 4 deletions src/pages/logout.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { useEffect, useContext } from 'react'
import Spinner from '../components/custom/Spinner'
import AppContext from '../context/AppContext'
import { gotToLogin } from '../components/custom/js/functions'
import { getLogoutURL } from '../config/config'

function logout() {
const { logout } = useContext(AppContext)
useEffect(() => {
const xhr = new XMLHttpRequest()
xhr.open('GET', getLogoutURL(), true)
logout()
gotToLogin()
window.location = getLogoutURL()
})
return <Spinner text="Logging you out, please wait... " />
}
Expand Down

0 comments on commit f27afb7

Please sign in to comment.