Initial curated ServiceMap source from 7a0a61232d05ba9097432abef6f7f4102a64d0b8
This commit is contained in:
commit
105251b9c8
96 files changed
+23587
No files matched your search
@@ -0,0 +1,37 @@
|
||||
export type TopologyLevel = "domains" | "applications" | "components";
|
||||
|
||||
export type TopologyLocation = {
|
||||
level: TopologyLevel;
|
||||
domainId: string | null;
|
||||
applicationId: string | null;
|
||||
};
|
||||
|
||||
export const topologyRoot = (): TopologyLocation => ({
|
||||
level: "domains",
|
||||
domainId: null,
|
||||
applicationId: null,
|
||||
});
|
||||
|
||||
export const domainLocation = (domainId: string): TopologyLocation => ({
|
||||
level: "applications",
|
||||
domainId,
|
||||
applicationId: null,
|
||||
});
|
||||
|
||||
export const applicationLocation = (
|
||||
domainId: string | null,
|
||||
applicationId: string,
|
||||
): TopologyLocation => ({
|
||||
level: "components",
|
||||
domainId,
|
||||
applicationId,
|
||||
});
|
||||
|
||||
export const topologyUp = (location: TopologyLocation): TopologyLocation => {
|
||||
if (location.level === "components" && location.domainId)
|
||||
return domainLocation(location.domainId);
|
||||
return topologyRoot();
|
||||
};
|
||||
|
||||
export const isTopologyRoot = (location: TopologyLocation): boolean =>
|
||||
location.level === "domains";
|
||||
Reference in new issue
Block a user