Skip to content

Commit

Permalink
Added spire server unique identifier (#472)
Browse files Browse the repository at this point in the history
* add trust domain as spire server unique identifier

Signed-off-by: MohammedAbdi <mohammma@usc.edu>

* update component

Signed-off-by: MohammedAbdi <mohammma@usc.edu>

* add spire server path

Signed-off-by: MohammedAbdi <mohammma@usc.edu>

* update server id

Signed-off-by: MohammedAbdi <mohammma@usc.edu>

* updat trust domain view to be bolder for identification

Signed-off-by: MohammedAbdi <mohammma@usc.edu>

---------

Signed-off-by: Mohammed Abdi <mohammma@usc.edu>
  • Loading branch information
mamy-CS authored and maia-iyer committed Sep 17, 2024
1 parent 1603db1 commit d2c73fb
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
54 changes: 51 additions & 3 deletions frontend/src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@ import tornjak_logo from "res/tornjak_logo.png";
import TornjakHelper from 'components/tornjak-helper';
import KeycloakService from "auth/KeycloakAuth";
import { RootState } from 'redux/reducers';
import TornjakApi from './tornjak-api-helpers';
import {
clickedDashboardTableFunc,
isAuthenticatedUpdateFunc,
accessTokenUpdateFunc,
UserRolesUpdateFunc,
serverInfoUpdateFunc,
tornjakServerInfoUpdateFunc,
spireDebugServerInfoUpdateFunc,
tornjakMessageFunc
} from 'redux/actions';
import { Tag } from 'carbon-components-react';
import {
AccessToken
AccessToken,
ServerInfo,
DebugServerInfo,
TornjakServerInfo
} from './types';
import HeaderToolBar from './navbar-header-toolbar';
import {env} from '../env';
import { env } from '../env';

const Auth_Server_Uri = env.REACT_APP_AUTH_SERVER_URI;

Expand All @@ -39,15 +48,31 @@ type NavigationBarProp = {
clickedDashboardTableFunc: (globalClickedDashboardTable: string) => void,
// the clicked dashboard table
globalClickedDashboardTable: string,
// the server trust domain and nodeAttestorPlugin as a ServerInfoType
globalServerInfo: ServerInfo,
// tornjak server debug info of the selected server
globalDebugServerInfo: DebugServerInfo,
// tornjak server info of the selected server
globalTornjakServerInfo: TornjakServerInfo,
// dispatches a payload for the server trust domain and nodeAttestorPlugin as a ServerInfoType and has a return type of void
serverInfoUpdateFunc: (globalServerInfo: ServerInfo) => void,
// dispatches a payload for the tornjak server info of the selected server and has a return type of void
tornjakServerInfoUpdateFunc: (globalTornjakServerInfo: TornjakServerInfo) => void,
// dispatches a payload for the debug server info of the selected server and has a return type of void
spireDebugServerInfoUpdateFunc: (globalDebugServerInfo: DebugServerInfo) => void,
// dispatches a payload for an Error Message/ Success Message of an executed function as a string and has a return type of void
tornjakMessageFunc: (globalErrorMessage: string) => void,
}

type NavigationBarState = {}

class NavigationBar extends Component<NavigationBarProp, NavigationBarState> {
TornjakHelper: TornjakHelper;
TornjakApi: TornjakApi;
constructor(props: NavigationBarProp) {
super(props);
this.TornjakHelper = new TornjakHelper({});
this.TornjakApi = new TornjakApi(props);
this.state = {};
}

Expand All @@ -64,6 +89,9 @@ class NavigationBar extends Component<NavigationBarProp, NavigationBarState> {
}
}
}
this.TornjakApi.populateLocalTornjakServerInfo(this.props.tornjakServerInfoUpdateFunc, this.props.tornjakMessageFunc);
this.TornjakApi.populateLocalTornjakDebugServerInfo(this.props.spireDebugServerInfoUpdateFunc, this.props.tornjakMessageFunc);
this.TornjakApi.populateServerInfo(this.props.globalTornjakServerInfo, this.props.serverInfoUpdateFunc);
}

render() {
Expand Down Expand Up @@ -133,6 +161,14 @@ class NavigationBar extends Component<NavigationBarProp, NavigationBarState> {
<img src={tornjak_logo} height="50" width="160" alt="Tornjak" /></a>
</span>
</div>
{/* Temporarily using trust domain as server unique identifier */}
<div className="spire-server-unique-identifier">
<Tag type="cyan">
<span style={{ fontWeight: 'bold' }}>Server ID: </span>
<span style={{ textDecoration: 'underline', fontWeight: 'bold' }}>{this.props.globalServerInfo.trustDomain}</span>
{this.props.globalDebugServerInfo.svid_chain[0].id.path}
</Tag>
</div>
</div>
);
}
Expand All @@ -149,11 +185,23 @@ const mapStateToProps = (state: RootState) => ({
globalIsAuthenticated: state.auth.globalIsAuthenticated,
globalAccessToken: state.auth.globalAccessToken,
globalUserRoles: state.auth.globalUserRoles,
globalServerInfo: state.servers.globalServerInfo,
globalDebugServerInfo: state.servers.globalDebugServerInfo,
globalTornjakServerInfo: state.servers.globalTornjakServerInfo,
})

export default connect(
mapStateToProps,
{ clickedDashboardTableFunc, isAuthenticatedUpdateFunc, accessTokenUpdateFunc, UserRolesUpdateFunc }
{
clickedDashboardTableFunc,
isAuthenticatedUpdateFunc,
accessTokenUpdateFunc,
UserRolesUpdateFunc,
serverInfoUpdateFunc,
tornjakServerInfoUpdateFunc,
spireDebugServerInfoUpdateFunc,
tornjakMessageFunc
}
)(NavigationBar)

export { NavigationBar }
10 changes: 9 additions & 1 deletion frontend/src/components/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,12 @@
.delete-cluster-button {
width: 180px;
float: right;
}
}
.spire-server-unique-identifier {
margin-top: 20px;
margin-right: 20px;
z-index: 1000; /* High z-index to ensure it's on top */
position: relative;
display: inline;
float: right; /* Float to the right */
}

0 comments on commit d2c73fb

Please sign in to comment.