Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Remove Servers from Host Path (#154)
Browse files Browse the repository at this point in the history
Co-authored-by: James Bradford <j.bradford@pnnl.gov>
  • Loading branch information
arniebradfo and James Bradford authored Jun 23, 2023
1 parent a4f970e commit 296a59b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion applications/client/src/store/graphql/CommandModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class CommandModel extends ExtendedModel(CommandModelBase, {}) {
const appStore = getRoot<AppStore>(this);
const time = appStore.settings.momentTz(this?.input?.current?.dateTime);
const operator = formatOperatorName(this?.operator?.current.name || 'unknown');
const server = this?.beacon?.current?.host?.current?.server?.displayName;
const server = this?.beacon?.current?.host?.current?.server?.displayName; // BLDSTRIKE-598: servers?
const host = this?.beacon?.current?.host?.current?.displayName;
const beaconName = this?.beacon?.current?.displayName;
const beaconUser = this?.beacon?.current?.meta?.[0]?.maybeCurrent?.username;
Expand Down
2 changes: 2 additions & 0 deletions applications/client/src/store/graphql/HostModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export { selectFromHost, hostModelPrimitives, HostModelSelector } from './HostMo
*/
@model('Host')
export class HostModel extends ExtendedModel(HostModelBase, {
// BLDSTRIKE-598: should be this.serverIds plural
serverId: prop<string | undefined>().withSetter(),
}) {
protected onAttachedToRootStore(rootStore: any): (() => void) | void {
Expand All @@ -39,6 +40,7 @@ export class HostModel extends ExtendedModel(HostModelBase, {
@observable.ref maxTime: Moment | undefined;

@computed get server(): ServerModel | undefined {
// BLDSTRIKE-598: should be this.servers plural
const appStore = getRoot<AppStore>(this);
return this.serverId ? appStore?.graphqlStore?.servers.get(this.serverId) : undefined;
}
Expand Down
1 change: 1 addition & 0 deletions applications/client/src/store/graphql/ServerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class ServerModel extends ExtendedModel(ServerModelBase, {
if (beacon?.host?.maybeCurrent) {
getMinMaxTime(this, beacon.meta[0]?.maybeCurrent?.startTime);
getMinMaxTime(this, beacon.meta[0]?.maybeCurrent?.endTime);
// BLDSTRIKE-598: add to Array/Set host.setServerIds, don't override last
beacon.host?.maybeCurrent?.setServerId(this.id);
this.hosts.set(beacon.host.id, hostCampaignRef(beacon.host?.maybeCurrent));
if (beacon.host?.maybeCurrent?.cobaltStrikeServer) cobaltStrikeHost = beacon.host.maybeCurrent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,37 @@ export const NavBreadcrumbs = observer<NavBreadcrumbsProps>(
: undefined,
});

if (store.campaign?.interactionState.selectedCommandType)
if (store.campaign?.interactionState.selectedCommandType) {
crumbs.push({
text: 'Command',
current: true,
});
else if (store.campaign?.interactionState.selectedOperator)
} else if (store.campaign?.interactionState.selectedOperator) {
crumbs.push({
text: 'Operator',
current: true,
});
else if (store.campaign?.interactionState.selectedServer)
crumbs.push({
text: !store.campaign?.interactionState.selectedHost
? 'Server'
: store.campaign?.interactionState.selectedServer?.current?.displayName,
current: !store.campaign?.interactionState.selectedHost,
onClick: store.campaign?.interactionState.selectedHost
? (e) => {
onNavigate(e);
store.campaign?.interactionState.selectedServer?.current.searchSelect();
}
: undefined,
});
} else if (store.campaign?.interactionState.selectedServer) {
if (!store.campaign?.interactionState.selectedHost) {
crumbs.push({
text: 'Server',
current: true,
});
} else if (store.campaign?.interactionState.selectedBeacon) {
crumbs.push({
text: store.campaign?.interactionState.selectedServer?.current?.displayName,
onClick: (e) => {
onNavigate(e);
store.campaign?.interactionState.selectedServer?.current.searchSelect();
},
});
} /* else { BLDSTRIKE-598
// const serverCount = store.campaign?.interactionState.selectedHost.current.servers.length
crumbs.push({
text: '...', // serverCount,
});
} */
}

if (store.campaign?.interactionState.selectedHost)
crumbs.push({
Expand Down

0 comments on commit 296a59b

Please sign in to comment.