Skip to content

Commit

Permalink
adding MVP implementation in QuotaMeter
Browse files Browse the repository at this point in the history
  • Loading branch information
assuntad23 committed Sep 14, 2023
1 parent 28ada02 commit 6fd771e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
19 changes: 16 additions & 3 deletions client/src/components/Masthead/QuotaMeter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
:disabled="isAnonymous"
class="ml-auto"
:title="title"
data-description="storage dashboard link">
data-description="storage dashboard link"
@mouseover="callHelpMode"
@focus="callHelpMode">
{{ usingString + " " + totalUsageString }}
</b-link>
</div>
Expand All @@ -18,7 +20,9 @@
:disabled="isAnonymous"
to="/storage"
:title="title"
data-description="storage dashboard link">
data-description="storage dashboard link"
@mouseover="callHelpMode"
@focus="callHelpMode">
<b-progress :max="100">
<b-progress-bar aria-label="Quota usage" :value="usage" :variant="variant" />
</b-progress>
Expand All @@ -29,22 +33,26 @@
</template>

<script>
import { mapState } from "pinia";
import { mapState, mapStores } from "pinia";
import { bytesToString } from "utils/utils";
import { useConfigStore } from "@/stores/configurationStore";
import { useHelpModeTextStore } from "@/stores/helpmode/helpModeTextStore";
import { useUserStore } from "@/stores/userStore";
export default {
name: "QuotaMeter",
data() {
//
return {
usingString: this.l("Using"),
helpTextString: "This is your Quota storage meter. It is an indication of how much storage you are using. To learn more about Quota Storage, check out this GTN tutorial.",
};
},
computed: {
...mapState(useConfigStore, ["config"]),
...mapState(useUserStore, ["currentUser", "isAnonymous"]),
...mapStores(useHelpModeTextStore),
hasQuota() {
const quotasEnabled = this.config?.enable_quotas ?? false;
const quotaLimited = this.currentUser?.quota !== "unlimited" ?? false;
Expand Down Expand Up @@ -86,6 +94,11 @@ export default {
}
},
},
methods: {
callHelpMode() {
this.helpModeTextStore.addHelpModeText(this.helpTextString);
},
},
};
</script>
Expand Down
14 changes: 2 additions & 12 deletions client/src/stores/helpmode/helpModeTextStore.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
import { defineStore } from "pinia";

export const useHelpModeTextStore = defineStore("helpModeTextStore", {
export const useHelpModeTextStore = defineStore("helpModeText", {
state: () => {
return {
helpmodetext: "",
helpmodetext: "Welcome to Galaxy Help Mode!",
};
},

actions: {
addHelpModeText(text) {
//only push up to 20 items, then start removing the oldest items
//do we need to keep track of more than one item? or is this an enhancement?
// if (!this.helpmodetext.includes(text)) {
// if (this.helpmodetext.length < 20) {
// this.helpmodetext.push(text);
// } else {
// this.helpmodetext.shift();
// this.helpmodetext.push(text);
// }
// }
this.helpmodetext = text;
},
},
Expand Down

0 comments on commit 6fd771e

Please sign in to comment.