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

[MS] Workspace history #8743

Merged
merged 7 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@types/luxon": "^3.3.4",
"axios": "^1.7.4",
"luxon": "^3.4.4",
"megashark-lib": "git+https://github.com/Scille/megashark-lib.git#8f336a55f3244c0db6ddfe14ea1f7d2bbfbb6e19",
"megashark-lib": "git+https://github.com/Scille/megashark-lib.git#a9430d2cd6d0f481ff4fef3c53682553a1391822",
"qrcode-vue3": "^1.6.8",
"uuid": "^9.0.1",
"vue": "^3.3.8",
Expand Down
2 changes: 2 additions & 0 deletions client/src/components/files/FileCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:current-path="currentPath"
@files-added="$emit('filesAdded', $event)"
:is-reader="isWorkspaceReader"
@drop-as-reader="$emit('dropAsReader')"
>
<div class="card-checkbox">
<!-- eslint-disable vue/no-mutating-props -->
Expand Down Expand Up @@ -101,6 +102,7 @@ const emits = defineEmits<{
(e: 'click', event: Event, entry: EntryModel): void;
(e: 'menuClick', event: Event, entry: EntryModel, onFinished: () => void): void;
(e: 'filesAdded', imports: FileImportTuple[]): void;
(e: 'dropAsReader'): void;
}>();

defineExpose({
Expand Down
14 changes: 4 additions & 10 deletions client/src/components/files/FileDropZone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ import { DocumentImport, MsImage } from 'megashark-lib';
import { FileImportTuple, getFilesFromDrop } from '@/components/files/utils';
import { FsPath } from '@/parsec';
import { IonLabel } from '@ionic/vue';
import { computed, inject, onMounted, onUnmounted, ref } from 'vue';
import { Information, InformationLevel, InformationManager, InformationManagerKey, PresentationMode } from '@/services/informationManager';
import { computed, onMounted, onUnmounted, ref } from 'vue';

defineExpose({
reset,
Expand All @@ -50,10 +49,10 @@ const props = defineProps<{

const emits = defineEmits<{
(e: 'filesAdded', imports: FileImportTuple[]): void;
(e: 'dropAsReader'): void;
}>();

const dragEnterCount = ref(0);
const informationManager: InformationManager = inject(InformationManagerKey)!;

const isActive = computed(() => {
return !props.disabled && !props.isReader && dragEnterCount.value > 0;
Expand All @@ -77,13 +76,8 @@ onUnmounted(() => {

async function onDrop(event: DragEvent): Promise<void> {
if (props.isReader) {
await informationManager.present(
new Information({
message: 'FoldersPage.ImportFile.noDropForReader',
level: InformationLevel.Error,
}),
PresentationMode.Toast,
);
event.stopPropagation();
emits('dropAsReader');
return;
}
if (props.disabled) {
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/files/FileGridDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:show-drop-message="true"
@files-added="$emit('filesAdded', $event)"
:is-reader="ownRole === WorkspaceRole.Reader"
@drop-as-reader="$emit('dropAsReader')"
>
<div
class="scroll"
Expand All @@ -24,6 +25,7 @@
@menu-click="(event, entry, onFinished) => $emit('menuClick', event, entry, onFinished)"
@files-added="onFilesAdded"
:is-workspace-reader="ownRole === WorkspaceRole.Reader"
@drop-as-reader="$emit('dropAsReader')"
/>
<file-card
class="folder-grid-item"
Expand All @@ -35,6 +37,7 @@
@click="$emit('click', file, $event)"
@menu-click="(event, entry, onFinished) => $emit('menuClick', event, entry, onFinished)"
@files-added="onFilesAdded"
@drop-as-reader="$emit('dropAsReader')"
/>

<file-card-processing
Expand Down Expand Up @@ -73,6 +76,7 @@ const emits = defineEmits<{
(e: 'menuClick', event: Event, entry: EntryModel, onFinished: () => void): void;
(e: 'globalMenuClick', event: Event): void;
(e: 'filesAdded', imports: FileImportTuple[]): void;
(e: 'dropAsReader'): void;
}>();

onMounted(async () => {
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/files/FileListDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@files-added="$emit('filesAdded', $event)"
:show-drop-message="true"
:is-reader="ownRole === WorkspaceRole.Reader"
@drop-as-reader="$emit('dropAsReader')"
>
<div
class="scroll"
Expand Down Expand Up @@ -54,6 +55,7 @@
@selected-change="onSelectedChange"
@files-added="onFilesAdded"
:is-workspace-reader="ownRole === WorkspaceRole.Reader"
@drop-as-reader="$emit('dropAsReader')"
/>
<file-list-item
v-for="file in files.getEntries()"
Expand All @@ -65,6 +67,7 @@
@menu-click="(event, entry, onFinished) => $emit('menuClick', event, entry, onFinished)"
@selected-change="onSelectedChange"
@files-added="onFilesAdded"
@drop-as-reader="$emit('dropAsReader')"
/>
<file-list-item-processing
v-for="op in operationsInProgress"
Expand Down Expand Up @@ -103,6 +106,7 @@ const emits = defineEmits<{
(e: 'menuClick', event: Event, entry: EntryModel, onFinished: () => void): void;
(e: 'globalMenuClick', event: Event): void;
(e: 'filesAdded', imports: FileImportTuple[]): void;
(e: 'dropAsReader'): void;
}>();

const fileDropZoneRef = ref();
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/files/FileListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

<template>
<file-drop-zone
:disabled="entry.isFile()"
:disabled="disableDrop || entry.isFile()"
:current-path="currentPath"
@files-added="$emit('filesAdded', $event)"
:is-reader="isWorkspaceReader"
class="drop-zone-item"
@drop-as-reader="$emit('dropAsReader')"
>
<ion-item
button
Expand Down Expand Up @@ -118,13 +119,15 @@ const props = defineProps<{
entry: EntryModel;
showCheckbox: boolean;
isWorkspaceReader?: boolean;
disableDrop?: boolean;
}>();

const emits = defineEmits<{
(e: 'click', event: Event, entry: EntryModel): void;
(e: 'menuClick', event: Event, entry: EntryModel, onFinished: () => void): void;
(e: 'selectedChange', entry: EntryModel, checked: boolean): void;
(e: 'filesAdded', imports: FileImportTuple[]): void;
(e: 'dropAsReader'): void;
}>();

defineExpose({
Expand Down
Loading