Skip to content

Commit

Permalink
More general improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym committed Feb 24, 2024
1 parent b5d6fe0 commit 01e0a8e
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 121 deletions.
15 changes: 12 additions & 3 deletions packages/dashboard-v2/src/appUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,22 @@ export const apiHandler = {
newKey: encode(newKey)
})
},
updateMetadata: (bucket, key, metadata) => {
return api.post(
updateMetadata: async (bucket, key, metadata) => {
let prefix = ''
if (key.includes('/')) {
prefix = key.replace(key.split('/').pop(), '')
}

const resp = await api.post(
`/buckets/${bucket}/${encode(key)}`,
{
customMetadata: metadata
}
)

if (resp.status === 200) {
return mapFile(resp.data, prefix)
}
},
multipartCreate: (file, key, bucket) => {
return api.post(`/buckets/${bucket}/multipart/create`, null, {
Expand Down Expand Up @@ -193,7 +202,7 @@ export const apiHandler = {
let contentFolders = []

while (truncated) {
const response = await this.listObjects(bucket, prefix, delimiter, cursor)
const response = await apiHandler.listObjects(bucket, prefix, delimiter, cursor)

truncated = response.data.truncated
cursor = response.data.cursor
Expand Down
9 changes: 8 additions & 1 deletion packages/dashboard-v2/src/components/files/FileOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ export default defineComponent({
this.$bus.emit('fetchFiles')
this.reset()
this.q.notify({
group: false,
icon: 'done', // we add an icon
spinner: false, // we reset the spinner setting so the icon can be displayed
message: 'File renamed!',
timeout: 2500 // we will timeout it in 2.5s
})
},
deleteConfirm: async function() {
this.deleteModal = false
Expand All @@ -90,7 +97,7 @@ export default defineComponent({
timeout: 0
})
console.log(this.deleteFolderContents)
// console.log(this.deleteFolderContents)
for (const [i, innerFile] of this.deleteFolderContents.entries()) {
if (innerFile.key) {
await apiHandler.deleteObject(innerFile.key, this.selectedBucket)
Expand Down
91 changes: 73 additions & 18 deletions packages/dashboard-v2/src/components/main/LeftSidebar.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<template>
<div class="q-pa-md">
<div class="flex column">
<div class="q-pa-md" style="height: 100%">
<div class="flex column" style="height: 100%">
<q-btn color="green" icon="add" stack class="q-mb-lg" label="New">
<q-menu>
<q-list>
<q-item clickable v-close-popup @click="$refs.createFolder.open()">
<q-item-section>
<q-item-label><q-icon name="create_new_folder" size="sm"/> New Folder</q-item-label>
<q-item-label>
<q-icon name="create_new_folder" size="sm" />
New Folder
</q-item-label>
</q-item-section>
</q-item>

<q-item clickable v-close-popup @click="$bus.emit('openFilesUploader')">
<q-item-section>
<q-item-label><q-icon name="upload_file" size="sm"/> Upload Files</q-item-label>
<q-item-label>
<q-icon name="upload_file" size="sm" />
Upload Files
</q-item-label>
</q-item-section>
</q-item>

<q-item clickable v-close-popup @click="$bus.emit('openFoldersUploader')">
<q-item-section>
<q-item-label><q-icon name="folder" size="sm"/> Upload Folders</q-item-label>
<q-item-label>
<q-icon name="folder" size="sm" />
Upload Folders
</q-item-label>
</q-item-section>
</q-item>
</q-list>
Expand All @@ -27,9 +36,41 @@

<q-btn class="q-mb-sm" @click="gotoFiles" color="blue" icon="folder_copy" label="Files" stack />
<q-btn class="q-mb-sm" @click="gotoEmail" color="blue" icon="email" label="Email" stack />

<q-btn class="q-mb-sm q-mt-auto q-mb-0" @click="alert=true" color="secondary" icon="question_mark" label="Info"
stack />
</div>
</div>

<q-dialog v-model="alert" persistent no-esc-dismiss no-route-dismiss no-backdrop-dismiss>
<q-card>
<q-card-section>
<div class="text-h6">🎉 Welcome to the new Dashboard v2! 🚀</div>
</q-card-section>

<q-card-section class="q-pt-none">
We're thrilled to introduce our revamped interface, designed to enhance your experience and productivity. As you
explore the new features and improvements, feel free to provide feedback or report any issues you encounter.
Your input helps us fine-tune the dashboard to meet your needs better.<br>
<br>
<template v-if="firstTimeAlert">
To revisit this message in the future, simply click on the question mark icon located in the left corner. Your
feedback is invaluable to us, so don't hesitate to reach out with any thoughts or concerns.<br>
<br>
</template>
Please report issues here: <a href="https://github.com/G4brym/R2-Explorer/issues/58" target="_blank">https://github.com/G4brym/R2-Explorer/issues/58</a><br>
<br>
Thank you for being a part of our journey towards excellence! 🌟<br>
<br>
Best regards<br>
</q-card-section>

<q-card-actions align="right">
<q-btn flat label="OK" color="primary" v-close-popup />
</q-card-actions>
</q-card>
</q-dialog>

<create-folder ref="createFolder" />
</template>

Expand All @@ -39,37 +80,51 @@ import { useMainStore } from "stores/main-store";
import CreateFolder from "components/files/CreateFolder.vue";
export default defineComponent({
name: 'LeftSidebar',
name: "LeftSidebar",
data: function() {
return {
alert: false,
firstTimeAlert: true
};
},
components: { CreateFolder },
methods: {
gotoEmail: function() {
if(this.selectedApp !== 'email')
this.changeApp('email')
if (this.selectedApp !== "email")
this.changeApp("email");
},
gotoFiles: function() {
if(this.selectedApp !== 'files')
this.changeApp('files')
if (this.selectedApp !== "files")
this.changeApp("files");
},
changeApp: function(app) {
this.$router.push({ name: `${app}-home`, params: { bucket: this.selectedBucket }})
this.$router.push({ name: `${app}-home`, params: { bucket: this.selectedBucket } });
}
},
computed: {
selectedBucket: function () {
return this.$route.params.bucket
selectedBucket: function() {
return this.$route.params.bucket;
},
selectedApp: function () {
return this.$route.name.split('-')[0]
selectedApp: function() {
return this.$route.name.split("-")[0];
}
},
mounted: function() {
const alertSeen = localStorage.getItem("DASH_V2_ALERT");
if (!alertSeen) {
this.alert = true;
localStorage.setItem("DASH_V2_ALERT", true);
}
},
setup() {
const mainStore = useMainStore();
return {
mainStore,
mainStore
};
},
})
}
});
</script>

<style scoped>
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard-v2/src/components/main/Topbar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<q-btn dense flat round icon="menu" @click="$emit('toggle')" />

<q-toolbar-title class="text-bold">
<q-toolbar-title style="overflow: unset" class="text-bold">
<q-avatar>
<img src="/v2.0/logo-white.svg">
</q-avatar>
Expand Down
5 changes: 3 additions & 2 deletions packages/dashboard-v2/src/components/utils/DragAndDrop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ export default {
z-index: -1;
display: flex;
position: absolute;
height: 100%;
width: 100%;
right: 0;
left: 0;
bottom: 0;
top: 0;
flex-direction: column;
}
Expand Down
Loading

0 comments on commit 01e0a8e

Please sign in to comment.