Skip to content

Commit

Permalink
Rename composable isLoaded to isConfigLoaded
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Aug 5, 2023
1 parent 6405206 commit 6c19854
Show file tree
Hide file tree
Showing 29 changed files with 40 additions and 46 deletions.
4 changes: 2 additions & 2 deletions client/src/components/AboutGalaxy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ExternalLink from "@/components/ExternalLink.vue";
import License from "@/components/License/License.vue";
import UtcDate from "@/components/UtcDate.vue";
const { config, isLoaded } = useConfig();
const { config, isConfigLoaded } = useConfig();
const clientBuildDate = __buildTimestamp__ || new Date().toISOString();
const apiDocsLink = `${getAppRoot()}api/docs`;
Expand All @@ -27,7 +27,7 @@ const versionUserDocumentationUrl = computed(() => {
</script>

<template>
<div v-if="isLoaded" class="about-galaxy">
<div v-if="isConfigLoaded" class="about-galaxy">
<Heading h1 :icon="['gxd', 'galaxyLogo']" size="xl">About This Galaxy</Heading>
<div>
<!-- Galaxy version (detailed), with a link to the release notes -->
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ActivityBar/ActivityBar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import mountTarget from "./ActivityBar.vue";
jest.mock("composables/config");
useConfig.mockReturnValue({
config: {},
isLoaded: true,
isConfigLoaded: true,
});

jest.mock("vue-router/composables", () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default {
totalItemsInQuery: { type: Number, default: 0 },
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data: function () {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/NewUserWelcome/NewUserWelcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
Slides,
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/PageDisplay/PageDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Panels/Common/ToolSection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ useConfig.mockReturnValue({
config: {
toolbox_auto_sort: true,
},
isLoaded: true,
isConfigLoaded: true,
});

const localVue = getLocalVue();
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Panels/Common/ToolSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ export default {
},
},
setup() {
const { config, isLoaded } = useConfig();
const { config, isConfigLoaded } = useConfig();
return {
config,
isLoaded,
isConfigLoaded,
};
},
data() {
Expand Down Expand Up @@ -136,7 +136,7 @@ export default {
// the order set and hope for the best from the integrated
// panel.
if (
this.isLoaded &&
this.isConfigLoaded &&
this.config.toolbox_auto_sort === true &&
this.sortItems === true &&
!this.category.elems.some((el) => el.text !== undefined && el.text !== "")
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Panels/ProviderAwareToolBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
ToolPanelViewProvider,
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Panels/ToolBox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ useConfig.mockReturnValue({
config: {
toolbox_auto_sort: true,
},
isLoaded: true,
isConfigLoaded: true,
});

describe("ToolBox", () => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Sharing/Sharing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/StsDownloadButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Tool/ToolCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jest.mock("@/schema");
jest.mock("@/composables/config", () => ({
useConfig: jest.fn(() => ({
config: { enable_tool_source_display: false },
isLoaded: true,
isConfigLoaded: true,
})),
}));

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Tool/ToolForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Toolshed/RepositoryDetails/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Upload/UploadModal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jest.mock("@/schema");
jest.mock("@/composables/config", () => ({
useConfig: jest.fn(() => ({
config: {},
isLoaded: true,
isConfigLoaded: true,
})),
}));

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Upload/UploadModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import UploadModalContent from "./UploadModalContent";
const { currentUser } = storeToRefs(useUserStore());
const { currentHistoryId } = useUserHistories(currentUser);
const { config, isLoaded } = useConfig();
const { config, isConfigLoaded } = useConfig();
function getDefaultOptions() {
const baseOptions = {
Expand All @@ -27,7 +27,7 @@ function getDefaultOptions() {
immediateFiles: null,
};
const configOptions = isLoaded.value
const configOptions = isConfigLoaded.value
? {
uploadPath: config.value.nginx_upload_path ?? `${getAppRoot()}api/tools`,
chunkUploadSize: config.value.chunk_upload_size,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/User/DiskUsage/DiskUsageSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
QuotaUsageSummary,
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/User/ThemeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useCurrentTheme } from "@/composables/user";
import { withPrefix } from "@/utils/redirect";
const { currentTheme, setCurrentTheme } = useCurrentTheme();
const { config, isLoaded } = useConfig();
const { config, isConfigLoaded } = useConfig();
const show = ref(false);
const currentValue = computed({
Expand All @@ -23,7 +23,7 @@ function getLogo(themeDetails) {
}
watch(
() => isLoaded.value,
() => isConfigLoaded.value,
() => {
const themes = Object.keys(config.value.themes);
show.value = themes?.length > 1 ?? false;
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/User/UserPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jest.mock("@/schema");
jest.mock("@/composables/config", () => ({
useConfig: jest.fn(() => ({
config: { enable_tool_source_display: false },
isLoaded: true,
isConfigLoaded: true,
})),
}));

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Workflow/InvocationReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default {
},
},
setup() {
const { config, isLoaded: isConfigLoaded } = useConfig(true);
const { config, isConfigLoaded } = useConfig(true);
return { config, isConfigLoaded };
},
data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ useConfig.mockReturnValue({
config: {
enable_celery_tasks: true,
},
isLoaded: true,
isConfigLoaded: true,
});

const invocationJobsSummaryById = {
Expand Down
6 changes: 3 additions & 3 deletions client/src/composables/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export function useConfig(fetchOnce = false) {
const store = useConfigStore();

const config = computed(() => store.config);
const isLoaded = computed(() => store.isLoaded);
const isConfigLoaded = computed(() => store.isLoaded);

// Anytime we mount this (for now), make sure to load.
onMounted(() => {
if (!(fetchOnce && isLoaded)) {
if (!(fetchOnce && isConfigLoaded)) {
store.loadConfig();
}
});

return { config, isLoaded };
return { config, isConfigLoaded };
}
14 changes: 4 additions & 10 deletions client/src/composables/toolTrainingMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ type TrainingMaterialResponse = {
[id: string]: TrainingDetails;
};

type Config = {
tool_training_recommendations: boolean;
tool_training_recommendations_api_url: string;
tool_training_recommendations_link: string;
};

export type TutorialDetails = {
category: string;
title: string;
Expand Down Expand Up @@ -61,10 +55,10 @@ function mapToolIds() {

/** Training information about given tool */
export function useToolTrainingMaterial(id: string, name: string, version: string, owner?: string) {
const { config, isLoaded }: { config: Ref<Config>; isLoaded: Ref<boolean> } = useConfig();
const { config, isConfigLoaded } = useConfig();
const apiEnabled = computed(() => {
return Boolean(
isLoaded.value &&
isConfigLoaded.value &&
config.value.tool_training_recommendations &&
config.value.tool_training_recommendations_api_url
);
Expand All @@ -73,9 +67,9 @@ export function useToolTrainingMaterial(id: string, name: string, version: strin
const cacheLoaded = ref(false);

watch(
() => isLoaded.value,
() => isConfigLoaded.value,
async () => {
if (!isLoaded.value) {
if (!isConfigLoaded.value) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions client/src/entry/analysis/modules/Admin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useConfig } from "@/composables/config";
import AdminPanel from "@/components/admin/AdminPanel.vue";
import FlexPanel from "@/components/Panels/FlexPanel.vue";
const { config, isLoaded } = useConfig();
const { config, isConfigLoaded } = useConfig();
const panelProperties = computed(() => {
return {
Expand All @@ -18,7 +18,7 @@ const panelProperties = computed(() => {
</script>

<template>
<div v-if="isLoaded" id="columns" class="d-flex">
<div v-if="isConfigLoaded" id="columns" class="d-flex">
<FlexPanel side="left">
<AdminPanel v-bind="panelProperties" />
</FlexPanel>
Expand Down

0 comments on commit 6c19854

Please sign in to comment.