Skip to content

Commit

Permalink
fix: dont show if not podman
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Drage <charlie@charliedrage.com>
  • Loading branch information
cdrage committed Jul 24, 2023
1 parent 024386d commit d90df20
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/renderer/src/lib/ContainerList.svelte
Expand Up @@ -532,6 +532,7 @@ function errorCallback(container: ContainerInfoUI, errorMessage: string): void {
status: containerGroup.status,
name: containerGroup.name,
engineId: containerGroup.engineId,
engineType: containerGroup.engineType,
containers: [],
}}"
dropdownMenu="{true}" />
Expand Down
3 changes: 3 additions & 0 deletions packages/renderer/src/lib/compose/ComposeActions.svelte
Expand Up @@ -70,6 +70,8 @@ if (dropdownMenu) {
} else {
actionsStyle = FlatMenu;
}
console.log('compose: ', compose);
</script>

<ListItemButtonIcon
Expand Down Expand Up @@ -102,6 +104,7 @@ if (dropdownMenu) {
title="Deploy to Kubernetes"
onClick="{() => deployToKubernetes()}"
menu="{dropdownMenu}"
hidden="{!(compose.engineType === 'podman')}"
detailed="{detailed}"
icon="{faRocket}" />
<ListItemButtonIcon
Expand Down
9 changes: 9 additions & 0 deletions packages/renderer/src/lib/compose/ComposeDetails.svelte
Expand Up @@ -21,6 +21,9 @@ let composeUnsubscribe: Unsubscriber;
let compose: ComposeInfoUI;
// Assume that the engine type is podman until we find a compose group that is docker
let engineType: 'docker' | 'podman' = 'podman';
onMount(() => {
// We will use the containersInfos store to get every container that matches
// the label com.docker.compose.project={composeName}
Expand Down Expand Up @@ -54,11 +57,17 @@ onMount(() => {
return containerUtils.getContainerInfoUI(container);
});
// Get the engine type from the first container in the list (if it exists)
if (convertedContainers.length > 0) {
engineType = convertedContainers[0].engineType;
}
// Make sure we update the compose object with the name, status, engineID, containers, etc.
// or else logging will not appear correctly when loading (it'll see empty containers..)
compose = {
name: composeName,
engineId: engineId,
engineType: engineType,
status: status,
containers: convertedContainers,
};
Expand Down
1 change: 1 addition & 0 deletions packages/renderer/src/lib/compose/ComposeInfoUI.ts
Expand Up @@ -20,6 +20,7 @@ import type { ContainerInfoUI } from '../container/ContainerInfoUI';

export interface ComposeInfoUI {
engineId: string;
engineType: 'podman' | 'docker';
name: string;
status: string;
actionInProgress?: boolean;
Expand Down
1 change: 1 addition & 0 deletions packages/renderer/src/lib/container/ContainerInfoUI.ts
Expand Up @@ -35,6 +35,7 @@ export interface ContainerGroupPartInfoUI {
id?: string;
engineId?: string;
engineName?: string;
engineType?: 'podman' | 'docker';
shortId?: string;
status?: string;
humanCreationDate?: string;
Expand Down
4 changes: 4 additions & 0 deletions packages/renderer/src/lib/container/container-utils.ts
Expand Up @@ -157,6 +157,7 @@ export class ContainerUtils {
name: composeProject,
type: ContainerGroupInfoTypeUI.COMPOSE,
engineId: containerInfo.engineId,
engineType: containerInfo.engineType,
};
}

Expand All @@ -169,6 +170,7 @@ export class ContainerUtils {
id: podInfo.id,
status: (podInfo.status || '').toUpperCase(),
engineId: containerInfo.engineId,
engineType: containerInfo.engineType,
};
}

Expand All @@ -177,6 +179,7 @@ export class ContainerUtils {
name: this.getName(containerInfo),
type: ContainerGroupInfoTypeUI.STANDALONE,
status: (containerInfo.Status || '').toUpperCase(),
engineType: containerInfo.engineType,
};
}

Expand All @@ -198,6 +201,7 @@ export class ContainerUtils {
id: group.id,
status: group.status,
engineId: group.engineId,
engineType: group.engineType,
containers: [],
});
}
Expand Down

0 comments on commit d90df20

Please sign in to comment.