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] Adds spinner when loading workspaces and folders #8617

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions client/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@
"createWorkspace": "New workspace",
"itemCount": "No items | 1 item | {count} items",
"noWorkspaces": "You do not have access to any workspace yet. Workspaces that you create or have been shared with you will be listed here.",
"loading": "Loading your workspaces...",
"noMatchingWorkspaces": "No workspace match this search filter.",
"listError": "Failed to list the workspaces.",
"newWorkspaceError": "Failed to create a new workspace.",
Expand Down Expand Up @@ -430,6 +431,7 @@
"itemCount": "No items | 1 item | {count} items",
"itemSelectedCount": "No selected items | 1 selected item | {count} selected items",
"emptyFolder": "This folder is empty.",
"loading": "Loading the folder...",
"listDisplayTitles": {
"name": "Name",
"updatedBy": "Updated By",
Expand Down
2 changes: 2 additions & 0 deletions client/src/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@
"createWorkspace": "Nouvel espace de travail",
"itemCount": "Aucun élément | 1 élément | {count} éléments",
"noWorkspaces": "Vous n'avez pas encore accès à un espace de travail. Les espaces de travail que vous créerez ou qui vous seront partagés s'afficheront ici.",
"loading": "Chargement de vos espaces de travail...",
"noMatchingWorkspaces": "Aucun espace de travail ne correspond à cette recherche.",
"listError": "Impossible de lister les espaces de travail.",
"newWorkspaceError": "Impossible de créer le nouvel espace de travail.",
Expand Down Expand Up @@ -430,6 +431,7 @@
"itemCount": "Aucun élément | Un élément | {count} éléments",
"itemSelectedCount": "Aucun élément sélectionné | 1 élément sélectionné | {count} éléments sélectionnés",
"emptyFolder": "Ce dossier est vide.",
"loading": "Chargement du dossier...",
"listDisplayTitles": {
"name": "Nom",
"updatedBy": "Modifié par",
Expand Down
25 changes: 23 additions & 2 deletions client/src/views/files/FoldersPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,22 @@
@files-added="startImportFiles"
/>
<div
v-if="folders.entriesCount() + files.entriesCount() + (fileOperationsCurrentDir ? fileOperationsCurrentDir.length : 0) === 0"
v-show="querying"
class="body-lg"
>
<div class="no-files-content">
<ms-spinner />
<ion-text>
{{ $msTranslate('FoldersPage.loading') }}
</ion-text>
</div>
</div>

<div
v-if="
!querying &&
folders.entriesCount() + files.entriesCount() + (fileOperationsCurrentDir ? fileOperationsCurrentDir.length : 0) === 0

Check failure on line 148 in client/src/views/files/FoldersPage.vue

View workflow job for this annotation

GitHub Actions / web / 🌐 Web tests

Expected indentation of 14 spaces but found 12 spaces
"
class="no-files body-lg"
>
<file-drop-zone
Expand All @@ -149,7 +164,7 @@
</div>
</file-drop-zone>
</div>
<div v-else>
<div v-else-if="!querying">
<div v-if="displayView === DisplayState.List">
<file-list-display
:files="files"
Expand Down Expand Up @@ -200,6 +215,7 @@
Translatable,
Clipboard,
asyncComputed,
MsSpinner,
} from 'megashark-lib';
import * as parsec from '@/parsec';

Expand Down Expand Up @@ -311,6 +327,9 @@
const files = ref(new EntryCollection<FileModel>());
const displayView = ref(DisplayState.List);
const workspaceInfo: Ref<parsec.StartedWorkspaceInfo | null> = ref(null);
// Init at true to avoid blinking while we're mounting the component
// but we're not loading the files yet.
const querying = ref(true);

const fileInputsRef = ref();
let eventCbId: string | null = null;
Expand Down Expand Up @@ -702,6 +721,7 @@
if (!currentRouteIs(Routes.Documents)) {
return;
}
querying.value = true;
const result = await parsec.statFolderChildren(workspaceInfo.value.handle, currentPath.value);
if (result.ok) {
const newFolders: FolderModel[] = [];
Expand Down Expand Up @@ -761,6 +781,7 @@
PresentationMode.Toast,
);
}
querying.value = false;
}

async function onEntryClick(entry: EntryModel, _event: Event): Promise<void> {
Expand Down
18 changes: 17 additions & 1 deletion client/src/views/workspaces/WorkspacesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@
<!-- workspaces -->
<div class="workspaces-container scroll">
<div
v-if="filteredWorkspaces.length === 0"
v-show="querying"
class="body-lg"
>
<div class="no-workspaces-content">
<ms-spinner />
<ion-text>
{{ $msTranslate('WorkspacesPage.loading') }}
</ion-text>
</div>
</div>

<div
v-if="!querying && filteredWorkspaces.length === 0"
class="no-workspaces body"
>
<div class="no-workspaces-content">
Expand Down Expand Up @@ -161,6 +173,7 @@ import {
MsSorter,
MsSorterChangeEvent,
MsSearchInput,
MsSpinner,
} from 'megashark-lib';
import {
WORKSPACES_PAGE_DATA_KEY,
Expand Down Expand Up @@ -223,6 +236,7 @@ const workspaceList: Ref<Array<WorkspaceInfo>> = ref([]);
const displayView = ref(DisplayState.Grid);
const favorites: Ref<WorkspaceID[]> = ref([]);
const filterWorkspaceName = ref('');
const querying = ref(true);

const informationManager: InformationManager = inject(InformationManagerKey)!;
const storageManager: StorageManager = inject(StorageManagerKey)!;
Expand Down Expand Up @@ -396,6 +410,7 @@ async function refreshWorkspacesList(): Promise<void> {
if (!currentRouteIs(Routes.Workspaces)) {
return;
}
querying.value = true;
const result = await parsecListWorkspaces();
if (result.ok) {
for (const wk of result.value) {
Expand Down Expand Up @@ -424,6 +439,7 @@ async function refreshWorkspacesList(): Promise<void> {
PresentationMode.Toast,
);
}
querying.value = false;
}

const filteredWorkspaces = computed(() => {
Expand Down
Loading