Skip to content

Commit

Permalink
Merge pull request #16 from lsst-sqre/tickets/DM-29971
Browse files Browse the repository at this point in the history
DM-29971: Switch UserMenu to show username, not name
  • Loading branch information
jonathansick authored Apr 30, 2021
2 parents 54a1976 + 4a2e8c7 commit 76e8496
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 21 deletions.
2 changes: 0 additions & 2 deletions components/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ const StyledLayout = styled.div`
* content, and footer.
*/
export default function Page({ children, loginData }) {
console.log(loginData);

return (
<StyledLayout>
<Meta />
Expand Down
2 changes: 1 addition & 1 deletion components/userMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const UserMenu = ({ loginData, pageUrl }) => {
return (
<Menu>
<StyledMenuButton>
{loginData.data.name} <StyledFontAwesomeIcon icon="angle-down" />
{loginData.data.username} <StyledFontAwesomeIcon icon="angle-down" />
</StyledMenuButton>
<StyledMenuList>
<MenuLink href="/auth/tokens">Security tokens</MenuLink>
Expand Down
2 changes: 0 additions & 2 deletions hooks/currentUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ const { publicRuntimeConfig } = getConfig();

export const useCurrentUrl = () => {
const { baseUrl } = publicRuntimeConfig;
console.log(`useCurrentUrl getConfig baseUrl ${baseUrl}`);
const router = useRouter();

return new URL(router.pathname, baseUrl);
};
11 changes: 2 additions & 9 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,22 @@ const readYamlConfig = (configPath, schemaPath) => {
const readPublicYamlConfig = () => {
const p = process.env.SQUAREONE_CONFIG_PATH || 'squareone.config.yaml';
const configPath = path.isAbsolute(p) ? p : path.join(process.cwd(), p);
console.log(`Public config path: ${configPath}`);

console.log(`Reading public squareone config from ${configPath}`);
const schemaPath = path.join(__dirname, 'squareone.config.schema.json');

const data = readYamlConfig(configPath, schemaPath);
return data;
};

const readServerYamlConfig = () => {
const p = process.env.SQUAREONE_CONFIG_PATH || 'squareone.serverconfig.yaml';
const configPath = path.isAbsolute(p) ? p : path.join(process.cwd(), p);
console.log(`Server config path: ${configPath}`);

console.log(`Reading server-side squareone config from ${configPath}`);
const schemaPath = path.join(__dirname, 'squareone.serverconfig.schema.json');

const data = readYamlConfig(configPath, schemaPath);
return data;
};

module.exports = (phase, { defaultConfig }) => {
console.log(`Read config in ${phase}`);

const publicYamlConfig = readPublicYamlConfig();
const serverYamlConfig = readServerYamlConfig();

Expand All @@ -65,6 +59,5 @@ module.exports = (phase, { defaultConfig }) => {
];
},
};
console.log(config);
return config;
};
1 change: 0 additions & 1 deletion pages/api/dev/user-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { getDevState } from '../../../devstate';

export default function handler(req, res) {
console.log('user-info');
const { loggedIn, username, name, uid } = getDevState();
if (!loggedIn) {
res.status(401).end('Not logged in');
Expand Down
4 changes: 1 addition & 3 deletions pages/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export default function Login({ baseUrl }) {
method: 'POST',
body,
headers: { 'Content-Type': 'application/json' },
})
.then((response) => console.log(response))
.then(sleep(100).then(() => window.location.assign('/')));
}).then(sleep(100).then(() => window.location.assign('/')));
};

return (
Expand Down
4 changes: 1 addition & 3 deletions pages/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ export default function Logout({ baseUrl }) {
event.preventDefault();
fetch(getDevLogoutEndpoint(currentUrl), {
method: 'POST',
})
.then((response) => console.log(response))
.then(sleep(100).then(() => window.location.assign('/')));
}).then(sleep(100).then(() => window.location.assign('/')));
};

return (
Expand Down

0 comments on commit 76e8496

Please sign in to comment.