15064: Fetch discovery documents for all remotes
[arvados-workbench2.git] / src / views / workbench / fed-login.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { connect } from 'react-redux';
7 import { RootState } from '~/store/store';
8 import { AuthState } from '~/store/auth/auth-reducer';
9 import { getSaltedToken } from '~/store/auth/auth-action-session';
10
11 export interface FedLoginProps {
12     auth: AuthState;
13 }
14
15 const mapStateToProps = ({ auth }: RootState) => ({ auth });
16
17 export const FedLogin = connect(mapStateToProps)(
18     class extends React.Component<FedLoginProps> {
19         render() {
20             const auth = this.props.auth;
21             const remoteHostsConfig = auth.remoteHostsConfig;
22             if (!auth.user || !auth.user.uuid.startsWith(auth.homeCluster)) {
23                 return <></>;
24             }
25             return <div>
26                 {Object.keys(remoteHostsConfig)
27                     .filter((k) => k !== auth.homeCluster)
28                     .map((k) => <iframe key={k} src={"https://" + remoteHostsConfig[k].workbench2Url} style={{ visibility: "hidden" }} />)}
29             </div>;
30         }
31     });