Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes non-regular files from file count #205

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions web/src/components/panels/FilesToPublish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const deploymentStore = useDeploymentStore();
const files = ref<QTreeNode[]>([]);
const expanded = ref<string[]>([]);

type FileInfo = Pick<DeploymentFile, 'size' | 'isEntrypoint' | 'exclusion'>;
type FileInfo = Pick<DeploymentFile, 'size' | 'isEntrypoint' | 'exclusion' | 'isFile' >;

const fileMap = ref(new Map<string, FileInfo>());

Expand All @@ -56,9 +56,14 @@ const selectedFileTotalSize = computed(() : string => {
});

const fileSummary = computed(() => {
const count = deploymentStore.files.length;
const path = deploymentStore.deployment?.sourcePath;

// Calculate the number of files that are "files" (i.e., regular files, not directories, symlinks, etc.)
const count = deploymentStore.files
.map(file => fileMap.value.get(file))
.filter(info => info?.isFile)
.length;

if (count) {
return `${count} files selected from ${path} (total = ${selectedFileTotalSize.value})`;
} else if (path) {
Expand All @@ -83,6 +88,7 @@ function populateFileMap(file: DeploymentFile) {
size: file.size,
isEntrypoint: file.isEntrypoint,
exclusion: file.exclusion,
isFile: file.isFile
};
fileMap.value.set(file.id, info);
file.files.forEach(populateFileMap);
Expand Down