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

feat: support vfolder trash bin #2204

Merged
merged 29 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
739a21c
feat: draft UI for vfolder trash bin
agatha197 Feb 6, 2024
acad626
feat: disable restore and deletion button if status is `delete-ongoing`
agatha197 Feb 6, 2024
8e455f6
feat: update api for trash bin
agatha197 Feb 6, 2024
a715560
fix: set delete folder name
agatha197 Feb 6, 2024
355124d
feat: renaming and disable only delete-pending status
agatha197 Feb 7, 2024
86c21b0
feat: use vfolder id instead of name
agatha197 Feb 7, 2024
48804d0
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Feb 14, 2024
f64ec7d
feat: set body for requesting restore/delete from trash bin
agatha197 Feb 15, 2024
2d75da1
docs: update i18n translations
agatha197 Feb 15, 2024
10486e2
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Feb 19, 2024
4a9eb88
misc: update i18n
agatha197 Feb 19, 2024
e004bb8
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Feb 23, 2024
bab2ae1
feat: confirm with user input when delete from trash bin
agatha197 Feb 23, 2024
d55342d
feat: make input value blank whenever opening delete dialog
agatha197 Feb 23, 2024
820ff88
feature: impl vfolder delete_by_id request
fregataa Feb 24, 2024
074d0bf
feat: use folder id instead of name when deleting
agatha197 Feb 26, 2024
1523ad5
feat: change delete param according to manager ver.
agatha197 Feb 26, 2024
0b7394f
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Feb 28, 2024
decc101
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Mar 13, 2024
687e7ae
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Mar 28, 2024
c1b3bb4
style: use token color to `--mdc-tab-color-default`
agatha197 Mar 28, 2024
a4cd738
feat: update schema
agatha197 Mar 28, 2024
1a79a9f
feat: count number of folders in consideration of vfolder status
agatha197 Mar 28, 2024
c24bea0
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Apr 1, 2024
fb89e14
feat: apply feedbacks
agatha197 Apr 1, 2024
c969df0
update: i18n translations
agatha197 Apr 1, 2024
84a603f
handle status 204 like null content type
yomybaby Apr 1, 2024
32c8068
Merge branch 'main' into feat/vfolder-trash-bin
agatha197 Apr 1, 2024
98bca3b
update: i18n translations
agatha197 Apr 1, 2024
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: 1 addition & 1 deletion i18n.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = {
const content = fs.readFileSync(file.path, enc);
let count = 0;

parser.parseFuncFromString(content, {list: ['_t', 't']}, (key, options) => {
parser.parseFuncFromString(content, {list: ['_t', '_tr', '_text', 't']}, (key, options) => {
parser.set(key, Object.assign({}, options, {
nsSeparator: false,
keySeparator: '.'
Expand Down
15 changes: 15 additions & 0 deletions react/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,11 @@ type UserResourcePolicy {
"""Added since 24.03.1. Limitation of the quota size of user vfolders."""
max_quota_scope_size: BigInt
max_vfolder_size: BigInt @deprecated(reason: "Deprecated since 23.09.1")

"""
Added since 23.09.10. Maximum available number of sessions per single model service which the user is in charge of.
"""
max_session_count_per_model_session: Int
}

type ProjectResourcePolicy {
Expand Down Expand Up @@ -1354,6 +1359,11 @@ input CreateUserResourcePolicyInput {

"""Added since 24.03.1. Limitation of the quota size of user vfolders."""
max_quota_scope_size: BigInt

"""
Added since 24.03.1. Maximum available number of sessions per single model service which the user is in charge of.
"""
max_session_count_per_model_session: Int
}

type ModifyUserResourcePolicy {
Expand All @@ -1367,6 +1377,11 @@ input ModifyUserResourcePolicyInput {

"""Added since 24.03.1. Limitation of the quota size of user vfolders."""
max_quota_scope_size: BigInt

"""
Added since 24.03.1. Maximum available number of sessions per single model service which the user is in charge of.
"""
max_session_count_per_model_session: Int
}

type DeleteUserResourcePolicy {
Expand Down
29 changes: 26 additions & 3 deletions react/src/components/StorageStatusPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ import {
Button,
} from 'antd';
import graphql from 'babel-plugin-relay/macro';
import _ from 'lodash';
import React, { useDeferredValue, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useQuery } from 'react-query';
import { useLazyLoadQuery } from 'react-relay';

export type DeadVFolderStatus =
| 'delete-pending'
| 'delete-ongoing'
| 'delete-complete'
| 'delete-error';

const StorageStatusPanel: React.FC<{
fetchKey: string;
}> = ({ fetchKey }) => {
Expand All @@ -50,6 +57,15 @@ const StorageStatusPanel: React.FC<{
sm: 1,
xs: 1,
};
const deadVFolderStatuses: DeadVFolderStatus[] = [
'delete-pending',
'delete-ongoing',
'delete-complete',
'delete-error',
];
const isDeadVFolderStatus = (status: string) => {
return _.includes(deadVFolderStatuses, status);
};

const { data: vfolders } = useQuery(
['vfolders', { deferredFetchKey }],
Expand All @@ -58,13 +74,20 @@ const StorageStatusPanel: React.FC<{
},
);
const createdCount = vfolders?.filter(
(item: any) => item.is_owner && item.ownership_type === 'user',
(item: any) =>
item.is_owner &&
item.ownership_type === 'user' &&
!isDeadVFolderStatus(item.status),
).length;
const projectFolderCount = vfolders?.filter(
(item: any) => item.ownership_type === 'group',
(item: any) =>
item.ownership_type === 'group' && !isDeadVFolderStatus(item.status),
).length;
const invitedCount = vfolders?.filter(
(item: any) => !item.is_owner && item.ownership_type === 'user',
(item: any) =>
!item.is_owner &&
item.ownership_type === 'user' &&
!isDeadVFolderStatus(item.status),
).length;

// TODO: Add resolver to enable subquery and modify to call useLazyLoadQuery only once.
Expand Down
19 changes: 14 additions & 5 deletions resources/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@
"FolderRenamed": "Ordner umbenannt",
"FolderNameMismatched": "Ordnername stimmt nicht überein. Bitte prüfen Sie, ob Leerzeichen im Eingabefeld vorhanden sind oder nicht.",
"SameFileName": "Der Eingabewert ist mit dem zu aktualisierenden Dateinamen identisch. Bitte ändern Sie es in einen anderen Namen.",
"FolderDeleted": "Ordner gelöscht",
"FolderDeleted": "Der Ordner {{ FolderName }} wurde gelöscht.",
"FolderUpdated": "Ordneroption(en) aktualisiert",
"FolderDisconnected": "Ordner wurde getrennt.",
"FileRenamed": "Datei umbenannt",
Expand All @@ -633,7 +633,13 @@
"CloneFolder": "Ordner klonen",
"ShareFolder": "Ordner teilen",
"ModifyPermissions": "Berechtigungen ändern",
"LeaveFolder": "Ordner verlassen"
"LeaveFolder": "Ordner verlassen",
"Restore": "Wiederherstellen",
"DeleteForever": "Unwiederuflich löschen",
"FolderRestored": "Der Ordner {{ folderName }} wurde wiederhergestellt.",
"FolderDeletedForever": "Der Ordner {{ folderName }} wurde endgültig gelöscht.",
"MoveToTrashBin": "In den Papierkorb verschieben",
"MovedToTrashBin": "Der Ordner {{ folderName }} wurde in den Papierkorb verschoben."
},
"explorer": {
"Delete": "Löschen...",
Expand Down Expand Up @@ -731,14 +737,16 @@
"CannotBeUndone": "ACHTUNG: Dies kann nicht rückgängig gemacht werden!",
"LogDeletion": "Möchten Sie wirklich alle Protokollnachrichten löschen?",
"WillBeAppliedToNewSessions": "Dieses Update wird auf neue Sitzungen angewendet.",
"Required": "Erforderlich"
"Required": "Erforderlich",
"DeleteForeverDesc": "ACHTUNG: Ausgewählte Elemente werden für immer gelöscht und Sie können sie nicht wiederherstellen."
},
"ask": {
"DoYouWantToProceed": "Willst du fortfahren?"
},
"title": {
"LetsDouble-Check": "Lass uns das überprüfen",
"Notice": "Hinweis"
"Notice": "Hinweis",
"DeleteForever": "Unwiederuflich löschen?"
},
"ErrorOccurred": "Ein Fehler ist aufgetreten",
"error": {
Expand Down Expand Up @@ -1481,7 +1489,8 @@
"ForUser": "Für Benutzer",
"ForProject": "Für Projekt",
"QuotaDoesNotSupported": "Dieses Speicher-Backend unterstützt keine Quoten.",
"BeCarefulToSetUserResourcePolicy": "Die Änderung einer Ressourcenrichtlinie kann sich auf alle Benutzer auswirken, die diese Benutzer-Ressourcenrichtlinie verwenden, daher ist sie mit Vorsicht zu genießen."
"BeCarefulToSetUserResourcePolicy": "Die Änderung einer Ressourcenrichtlinie kann sich auf alle Benutzer auswirken, die diese Benutzer-Ressourcenrichtlinie verwenden, daher ist sie mit Vorsicht zu genießen.",
"StorageSetting": "__NOT_TRANSLATED__"
},
"totp": {
"TotpSetupCompleted": "Aktivierte 2FA",
Expand Down
25 changes: 19 additions & 6 deletions resources/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@
"FolderRenamed": "Ο φάκελος μετονομάστηκε",
"FolderNameMismatched": "Το όνομα φακέλου δεν ταιριάζει. Ελέγξτε αν ο χαρακτήρας διαστήματος στο πεδίο εισαγωγής ή όχι.",
"SameFileName": "Η τιμή εισαγωγής είναι ίδια με το όνομα αρχείου που θέλετε να ενημερώσετε. Αλλάξτε το σε διαφορετικό όνομα.",
"FolderDeleted": "Ο φάκελος διαγράφηκε",
"FolderDeleted": "Ο φάκελος {{ folderName }} έχει διαγραφεί.",
"FolderUpdated": "Ενημερώθηκαν οι επιλογές φακέλων",
"FolderDisconnected": "Ο φάκελος αποσυνδέθηκε.",
"FileRenamed": "Το αρχείο μετονομάστηκε",
Expand All @@ -633,7 +633,13 @@
"CloneFolder": "Φάκελος κλωνοποίησης",
"ShareFolder": "Φάκελος κοινής χρήσης",
"ModifyPermissions": "Τροποποίηση δικαιωμάτων",
"LeaveFolder": "Αφήστε το φάκελο"
"LeaveFolder": "Αφήστε το φάκελο",
"Restore": "Επαναφέρω",
"DeleteForever": "Διαγραφή για πάντα",
"FolderRestored": "Ο φάκελος {{ folderName }} έχει αποκατασταθεί.",
"FolderDeletedForever": "Ο φάκελος {{ folderName }} έχει διαγραφεί οριστικά.",
"MovedToTrashBin": "Ο φάκελος {{ folderName }} έχει μετακινηθεί στον κάδο απορριμμάτων.",
"MoveToTrashBin": "Μετακίνηση στον κάδο απορριμμάτων"
},
"explorer": {
"Delete": "Διαγράφω...",
Expand Down Expand Up @@ -731,14 +737,16 @@
"CannotBeUndone": "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: αυτό δεν μπορεί να αναιρεθεί!",
"LogDeletion": "Είστε βέβαιοι ότι θέλετε να διαγράψετε όλα τα μηνύματα καταγραφής;",
"WillBeAppliedToNewSessions": "Αυτή η ενημέρωση θα εφαρμοστεί σε νέες περιόδους σύνδεσης.",
"Required": "Απαιτούμενο"
"Required": "Απαιτούμενο",
"DeleteForeverDesc": "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: επιλεγμένα στοιχεία θα διαγραφούν οριστικά και δεν θα μπορείτε να τα επαναφέρετε."
},
"ask": {
"DoYouWantToProceed": "Θέλετε να συνεχίσετε?"
},
"title": {
"LetsDouble-Check": "Ας ελέγξουμε ξανά",
"Notice": "Ανακοίνωση"
"Notice": "Ανακοίνωση",
"DeleteForever": "Διαγραφή για πάντα;"
},
"ErrorOccurred": "Προέκυψε σφάλμα",
"error": {
Expand Down Expand Up @@ -1437,7 +1445,11 @@
"YouAreAboutToTerminate": "Πρόκειται να τερματίσετε",
"Owner": "Ιδιοκτήτης",
"ServiceDelegatedFrom": "Το μοντέλο υπηρεσίας δημιουργείται από τον {{ createdUser }}, αλλά η ιδιοκτησία της συνεδρίας θα ανατεθεί στον {{ sessionOwner }}",
"FailedToTerminateService": "Η αίτηση τερματισμού της υπηρεσίας απέτυχε."
"FailedToTerminateService": "Η αίτηση τερματισμού της υπηρεσίας απέτυχε.",
"ServiceUpdated": "Η υπηρεσία μοντέλου {{ όνομα }} ενημερώθηκε με επιτυχία.",
"FailedToUpdateService": "Η ενημέρωση της υπηρεσίας απέτυχε.",
"ServiceCreated": "Η υπηρεσία μοντέλου {{ όνομα }} δημιουργήθηκε με επιτυχία.",
"ServiceTerminated": "Η υπηρεσία μοντέλου {{ όνομα }} τερματίστηκε με επιτυχία."
},
"ErrorBoundary": {
"title": "Εμφανίστηκε σφάλμα.",
Expand Down Expand Up @@ -1477,7 +1489,8 @@
"ForUser": "Για τον χρήστη",
"ForProject": "Για το έργο",
"QuotaDoesNotSupported": "Αυτό το backend αποθήκευσης δεν υποστηρίζει ποσόστωση.",
"BeCarefulToSetUserResourcePolicy": "Η αλλαγή μιας πολιτικής πόρων μπορεί να επηρεάσει όλους τους χρήστες που χρησιμοποιούν αυτή την πολιτική πόρων χρήστη, γι' αυτό χρησιμοποιήστε την με προσοχή."
"BeCarefulToSetUserResourcePolicy": "Η αλλαγή μιας πολιτικής πόρων μπορεί να επηρεάσει όλους τους χρήστες που χρησιμοποιούν αυτή την πολιτική πόρων χρήστη, γι' αυτό χρησιμοποιήστε την με προσοχή.",
"StorageSetting": "__NOT_TRANSLATED__"
},
"totp": {
"TotpSetupCompleted": "Ενεργοποιημένο 2FA",
Expand Down
19 changes: 14 additions & 5 deletions resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@
"SelectUser": "Search and select User",
"QuotaScopeSuccessfullyUpdated": "Quota Scope successfully updated",
"AllowNumberAndDot": "Allows positive numbers and .(dot) only"
}
},
"StorageSetting": "StorageSetting"
},
"general": {
"cores": "cores",
Expand Down Expand Up @@ -718,7 +719,7 @@
"FolderRenamed": "Folder renamed",
"FolderNameMismatched": "Folder name mismatched. Please Check whether space character in the input field or not.",
"SameFileName": "The input value is same as the filename to update. Please change it to a different name.",
"FolderDeleted": "Folder deleted",
"FolderDeleted": "The {{ folderName }} folder has been deleted.",
"FolderUpdated": "Folder option(s) updated",
"FolderDisconnected": "Folder has been disconnected.",
"FileRenamed": "File Renamed",
Expand All @@ -742,7 +743,13 @@
"CloneFolder": "Clone folder",
"LeaveFolder": "Leave folder",
"ShareFolder": "Share folder",
"ModifyPermissions": "Modify permissions"
"ModifyPermissions": "Modify permissions",
"Restore": "Restore",
"DeleteForever": "Delete forever",
"FolderRestored": "The {{ folderName }} folder has been restored.",
"FolderDeletedForever": "The {{ folderName }} folder has been deleted forever.",
"MovedToTrashBin": "The {{ folderName }} folder has been moved to the trash bin.",
"MoveToTrashBin": "Move to trash bin"
},
"explorer": {
"Delete": "Delete",
Expand Down Expand Up @@ -832,14 +839,16 @@
"CannotBeUndone": "WARNING: this cannot be undone!",
"LogDeletion": "Are you sure you want to delete all of the log messages?",
"WillBeAppliedToNewSessions": "This update will be applied to new sessions.",
"Required": "Required"
"Required": "Required",
"DeleteForeverDesc": "WARNING: selected items will be deleted forever and you won't be able to restore them."
},
"ask": {
"DoYouWantToProceed": "Do you want to proceed?"
},
"title": {
"Notice": "Notice",
"LetsDouble-Check": "Let's Double-check"
"LetsDouble-Check": "Let's Double-check",
"DeleteForever": "Delete Forever?"
},
"ErrorOccurred": "Error Occurred",
"error": {
Expand Down
29 changes: 9 additions & 20 deletions resources/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
"FileRenamed": "Archivo renombrado",
"FolderCloned": "Carpeta clonada",
"FolderCreated": "Carpeta creada",
"FolderDeleted": "Carpeta eliminada",
"FolderDeleted": "La carpeta {{ folderName }} ha sido eliminada.",
"FolderDisconnected": "Se ha desconectado la carpeta.",
"FolderInfo": "Información",
"FolderNameMismatched": "El nombre de la carpeta no coincide. Compruebe si hay espacios en blanco en el campo de entrada.",
Expand Down Expand Up @@ -353,7 +353,13 @@
"TypeFolderNameToDelete": "Escriba el nombre de la carpeta que desea eliminar",
"TypeFolderNameToLeave": "Escriba el nombre de la carpeta que desea abandonar",
"TypeNewFolderName": "Escriba el nombre de la nueva carpeta",
"View": "Ver"
"View": "Ver",
"MoveToTrashBin": "Mover a la papelera",
"MovedToTrashBin": "La carpeta {{ folderName }} se ha movido a la papelera.",
"DeleteForever": "Borrar para siempre",
"Restore": "Restaurar",
"FolderRestored": "La carpeta {{ folderName }} ha sido restaurada.",
"FolderDeletedForever": "La carpeta {{ folderName }} se ha eliminado para siempre."
},
"invitation": {
"FolderSharingNotAvailableToUser": "El uso compartido de carpetas no está disponible para los usuarios solicitados:",
Expand Down Expand Up @@ -385,25 +391,8 @@
"userQuotaScopeId": "Quota Scope ID"
},
"dialog": {
"ErrorOccurred": "Se ha producido un error",
"ask": {
"DoYouWantToProceed": "¿Quieres continuar?"
},
"error": {
"Error": "Error"
},
"hide": {
"DonotShowThisAgain": "No vuelvas a mostrar esto."
},
"title": {
"LetsDouble-Check": "Doble comprobación",
"Notice": "Aviso"
},
"warning": {
"CannotBeUndone": "ATENCIÓN: ¡esto no se puede deshacer!",
"LogDeletion": "¿Estás seguro de que quieres borrar todos los mensajes de registro?",
"Required": "Requerido",
"WillBeAppliedToNewSessions": "Esta actualización se aplicará a las nuevas sesiones."
"DeleteForeverDesc": "ADVERTENCIA: los elementos seleccionados se eliminarán para siempre y no podrás restaurarlos."
}
},
"eduapi": {
Expand Down
29 changes: 9 additions & 20 deletions resources/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
"FileRenamed": "Tiedosto nimetty uudelleen",
"FolderCloned": "Kloonattu kansio",
"FolderCreated": "Kansio luotu",
"FolderDeleted": "Kansio poistettu",
"FolderDeleted": "Kansio {{ folderName }} on poistettu.",
"FolderDisconnected": "Kansio on katkaistu.",
"FolderInfo": "Info",
"FolderNameMismatched": "Kansion nimi ei täsmää. Tarkista, onko syöttökentässä välilyönti vai ei.",
Expand Down Expand Up @@ -353,7 +353,13 @@
"TypeFolderNameToDelete": "Kirjoita poistettavan kansion nimi",
"TypeFolderNameToLeave": "Kirjoita poistuvan kansion nimi",
"TypeNewFolderName": "Kirjoita uuden kansion nimi",
"View": "Näytä"
"View": "Näytä",
"MoveToTrashBin": "Siirrä roskakoriin",
"MovedToTrashBin": "Kansio {{ folderName }} on siirretty roskakoriin.",
"DeleteForever": "Poista ikuisesti",
"Restore": "Palauttaa",
"FolderRestored": "Kansio {{ folderName }} on palautettu.",
"FolderDeletedForever": "Kansio {{ folderName }} on poistettu pysyvästi."
},
"invitation": {
"FolderSharingNotAvailableToUser": "Kansioiden jakaminen ei ole käytettävissä pyydetyille käyttäjille:",
Expand Down Expand Up @@ -385,25 +391,8 @@
"userQuotaScopeId": "Quota Scope ID"
},
"dialog": {
"ErrorOccurred": "Tapahtunut virhe",
"ask": {
"DoYouWantToProceed": "Haluatteko jatkaa?"
},
"error": {
"Error": "Virhe"
},
"hide": {
"DonotShowThisAgain": "Älä näytä tätä enää."
},
"title": {
"LetsDouble-Check": "Tupla-tarkistetaan",
"Notice": "Ilmoitus"
},
"warning": {
"CannotBeUndone": "VAROITUS: tätä ei voi perua!",
"LogDeletion": "Haluatko varmasti poistaa kaikki lokiviestit?",
"Required": "Vaadittu",
"WillBeAppliedToNewSessions": "Tätä päivitystä sovelletaan uusiin istuntoihin."
"DeleteForeverDesc": "VAROITUS: valitut kohteet poistetaan pysyvästi, etkä voi palauttaa niitä."
}
},
"eduapi": {
Expand Down
Loading
Loading