Skip to content

Commit 9bea32e

Browse files
authored
Merge pull request galaxyproject#19963 from ElectronicBlueberry/g-button-replacement-1
Button replacement batch 1
2 parents bfc612e + 3bc870e commit 9bea32e

19 files changed

Lines changed: 188 additions & 129 deletions

client/src/components/ActivityBar/ActivityItem.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useActivityStore } from "@/stores/activityStore";
1010
import type { ActivityVariant } from "@/stores/activityStoreTypes";
1111
import localize from "@/utils/localization";
1212
13+
import GButton from "../BaseComponents/GButton.vue";
1314
import TextShort from "@/components/Common/TextShort.vue";
1415
import Popper from "@/components/Popper/Popper.vue";
1516
@@ -101,9 +102,9 @@ const meta = computed(() => store.metaForId(props.id));
101102
<small v-else>No tooltip available for this item</small>
102103
<div v-if="options" class="nav-options p-1">
103104
<router-link v-for="(option, index) in options" :key="index" :to="option.value">
104-
<b-button size="sm" variant="outline-primary" class="w-100 my-1 text-break text-light">
105+
<GButton size="small" outline color="blue" class="w-100 my-1 text-break text-light">
105106
{{ option.name }}
106-
</b-button>
107+
</GButton>
107108
</router-link>
108109
</div>
109110
</div>

client/src/components/ActivityBar/ActivitySettings.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe("ActivitySettings", () => {
6767
await nextTick();
6868
const items = wrapper.findAll(activityItemSelector);
6969
expect(items.length).toBe(1);
70-
const checkbox = items.at(0).find("[title='Hide in Activity Bar']");
70+
const checkbox = items.at(0).find("[data-title='Hide in Activity Bar']");
7171
expect(checkbox.exists()).toBeTruthy();
7272
const icon = wrapper.find("[icon='activity-test-icon'");
7373
expect(icon.exists()).toBeTruthy();
@@ -87,12 +87,12 @@ describe("ActivitySettings", () => {
8787
await wrapper.vm.$nextTick();
8888
const items = wrapper.findAll(activityItemSelector);
8989
expect(items.length).toBe(1);
90-
const checkbox = items.at(0).find("[title='Show in Activity Bar']");
90+
const checkbox = items.at(0).find("[data-title='Show in Activity Bar']");
9191
expect(checkbox.exists()).toBeTruthy();
9292
expect(activityStore.getAll()[0].visible).toBeFalsy();
9393
checkbox.trigger("click");
9494
await wrapper.vm.$nextTick();
95-
const visibleCheckbox = items.at(0).find("[title='Hide in Activity Bar']");
95+
const visibleCheckbox = items.at(0).find("[data-title='Hide in Activity Bar']");
9696
expect(visibleCheckbox.exists()).toBeTruthy();
9797
expect(activityStore.getAll()[0].visible).toBeTruthy();
9898
});

client/src/components/ActivityBar/ActivitySettings.vue

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { useRouter } from "vue-router/composables";
88
import { useActivityStore } from "@/stores/activityStore";
99
import type { Activity } from "@/stores/activityStoreTypes";
1010
11+
import GButton from "@/components/BaseComponents/GButton.vue";
12+
1113
const props = defineProps<{
1214
activityBarId: string;
1315
query: string;
@@ -87,34 +89,40 @@ function executeActivity(activity: Activity) {
8789
}}</span>
8890
</span>
8991
<div>
90-
<BButton
92+
<GButton
9193
v-if="activity.mutable"
92-
v-b-tooltip.hover
94+
tooltip
9395
data-description="delete activity"
94-
size="sm"
96+
size="small"
97+
transparent
98+
icon-only
99+
color="blue"
95100
title="Delete Activity"
96-
variant="link"
97101
@click.stop="onRemove(activity)">
98102
<FontAwesomeIcon :icon="faTrash" fa-fw />
99-
</BButton>
100-
<BButton
103+
</GButton>
104+
<GButton
101105
v-if="activity.visible"
102-
v-b-tooltip.hover
103-
size="sm"
106+
tooltip
107+
size="small"
108+
transparent
109+
icon-only
110+
color="blue"
104111
title="Hide in Activity Bar"
105-
variant="link"
106112
@click.stop="onFavorite(activity)">
107113
<FontAwesomeIcon :icon="faStar" fa-fw />
108-
</BButton>
109-
<BButton
114+
</GButton>
115+
<GButton
110116
v-else
111-
v-b-tooltip.hover
112-
size="sm"
117+
tooltip
118+
transparent
119+
icon-only
120+
color="blue"
121+
size="small"
113122
title="Show in Activity Bar"
114-
variant="link"
115123
@click.stop="onFavorite(activity)">
116124
<FontAwesomeIcon :icon="faStarRegular" fa-fw />
117-
</BButton>
125+
</GButton>
118126
</div>
119127
</span>
120128
</div>

client/src/components/BaseComponents/GButton.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const emit = defineEmits<{
3535
}>();
3636
3737
function onClick(event: PointerEvent) {
38-
if (!props.disabled) {
38+
if (props.disabled) {
39+
event.preventDefault();
40+
} else {
3941
emit("click", event);
4042
emit("update:pressed", !props.pressed);
4143
}
@@ -118,6 +120,7 @@ useAccessibleHover(
118120
ref="buttonRef"
119121
class="g-button"
120122
:data-title="currentTooltip"
123+
:data-disabled="props.disabled"
121124
:class="{ ...variantClasses, ...styleClasses }"
122125
:to="props.to"
123126
:href="props.to ?? props.href"
@@ -203,6 +206,12 @@ useAccessibleHover(
203206
&:focus-visible {
204207
border-color: var(--color-grey-600);
205208
}
209+
210+
&.g-outline.g-pressed {
211+
background-color: var(--color-grey-600);
212+
color: var(--color-grey-100);
213+
border-color: var(--color-grey-800);
214+
}
206215
}
207216
208217
@each $color in "blue", "green", "red", "yellow", "orange" {

client/src/components/GalaxyWizard.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
import { library } from "@fortawesome/fontawesome-svg-core";
33
import { faThumbsDown, faThumbsUp } from "@fortawesome/free-solid-svg-icons";
44
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
5-
import { BAlert, BButton, BSkeleton } from "bootstrap-vue";
5+
import { BAlert, BSkeleton } from "bootstrap-vue";
66
import { ref } from "vue";
77
88
import { GalaxyApi } from "@/api";
99
import { useMarkdown } from "@/composables/markdown";
1010
import { errorMessageAsString } from "@/utils/simple-error";
1111
12+
import GButton from "./BaseComponents/GButton.vue";
1213
import LoadingSpan from "./LoadingSpan.vue";
1314
1415
library.add(faThumbsUp, faThumbsDown);
@@ -89,10 +90,10 @@ async function sendFeedback(value: "up" | "down") {
8990
<BAlert v-if="errorMessage" variant="danger" show>
9091
{{ errorMessage }}
9192
</BAlert>
92-
<BButton v-else-if="!queryResponse" class="w-100" variant="info" :disabled="busy" @click="submitQuery">
93+
<GButton v-else-if="!queryResponse" class="w-100" color="blue" :disabled="busy" @click="submitQuery">
9394
<span v-if="!busy"> Let our Help Wizard Figure it out! </span>
9495
<LoadingSpan v-else message="Thinking" />
95-
</BButton>
96+
</GButton>
9697
<div :class="props.view == 'wizard' && 'mt-4'">
9798
<div v-if="busy">
9899
<BSkeleton animation="wave" width="85%" />
@@ -105,20 +106,20 @@ async function sendFeedback(value: "up" | "down") {
105106
<div v-if="queryResponse" class="feedback-buttons mt-2">
106107
<hr class="w-100" />
107108
<h4>Was this answer helpful?</h4>
108-
<BButton
109-
variant="success"
109+
<GButton
110+
color="green"
110111
:disabled="feedback !== null"
111112
:class="{ submitted: feedback === 'up' }"
112113
@click="sendFeedback('up')">
113114
<FontAwesomeIcon :icon="faThumbsUp" fixed-width />
114-
</BButton>
115-
<BButton
116-
variant="danger"
115+
</GButton>
116+
<GButton
117+
color="red"
117118
:disabled="feedback !== null"
118119
:class="{ submitted: feedback === 'down' }"
119120
@click="sendFeedback('down')">
120121
<FontAwesomeIcon :icon="faThumbsDown" fixed-width />
121-
</BButton>
122+
</GButton>
122123
<i v-if="!feedback">This feedback helps us improve our responses.</i>
123124
<i v-else>Thank you for your feedback!</i>
124125
</div>

client/src/components/HistoryImport.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe("HistoryImport.vue", () => {
5454

5555
it("should render a form with submit disabled because inputs empty", async () => {
5656
expect(wrapper.find(".import-button").exists()).toBeTruthy();
57-
expect(wrapper.find(".import-button").attributes("disabled")).toBeTruthy();
57+
expect(wrapper.find(".import-button").attributes("data-disabled")).toBeTruthy();
5858
expect(wrapper.vm.importReady).toBeFalsy();
5959
});
6060

client/src/components/HistoryImport.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
<FilesInput ref="filesInput" v-model="sourceRemoteFilesUri" />
7272
</b-form-group>
7373

74-
<b-button class="import-button" variant="primary" type="submit" :disabled="!importReady">
74+
<GButton class="import-button" color="blue" type="submit" :disabled="!importReady">
7575
Import {{ identifierText }}
76-
</b-button>
76+
</GButton>
7777
</b-form>
7878
</div>
7979
</div>
@@ -98,6 +98,7 @@ import { fetchFileSources } from "@/api/remoteFiles";
9898
9999
import ExternalLink from "./ExternalLink";
100100
101+
import GButton from "./BaseComponents/GButton.vue";
101102
import FilesInput from "components/FilesDialog/FilesInput.vue";
102103
103104
library.add(faFolderOpen);
@@ -106,7 +107,7 @@ library.add(faExternalLinkAlt);
106107
Vue.use(BootstrapVue);
107108
108109
export default {
109-
components: { FilesInput, FontAwesomeIcon, JobError, LoadingSpan, ExternalLink },
110+
components: { FilesInput, FontAwesomeIcon, JobError, LoadingSpan, ExternalLink, GButton },
110111
props: {
111112
invocationImport: {
112113
type: Boolean,

client/src/components/IconCard.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
<b-col cols="auto"><i :class="icon"></i></b-col>
77
</b-row>
88
</b-container>
9-
<b-button variant="primary" @click="onButtonClick">{{ buttonText }}</b-button>
9+
<GButton color="blue" @click="onButtonClick">{{ buttonText }}</GButton>
1010
</b-card>
1111
</template>
1212

1313
<script>
14+
import GButton from "./BaseComponents/GButton.vue";
15+
1416
/** A generic Card, used as a template, that displays an action button,
1517
* an icon (font-awesome), along with a title and description.
1618
* Clicking the button emits an "onButtonClick" event. */
1719
export default {
20+
components: { GButton },
1821
props: {
1922
title: {
2023
type: String,

client/src/components/Markdown/Markdown.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ onMounted(() => {
9393
class="markdown-pdf-export"
9494
:fallback-url="exportLink"
9595
:download-endpoint="downloadEndpoint"
96-
size="sm"
96+
size="small"
9797
title="Generate PDF"
98-
variant="outline-primary" />
98+
color="blue"
99+
outline />
99100
<BButton
100101
v-if="!readOnly"
101102
v-b-tooltip.hover

0 commit comments

Comments
 (0)