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

Fix: Status bar switches to icon view too early #7576

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion pkg/rancher-desktop/components/BackendProgress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ class BackendProgress extends Vue {
}

get progressBusy(): boolean {
return this.progressIndeterminate || this.progress.current < this.progress.max;
const busy = this.progressIndeterminate || this.progress.current < this.progress.max;

this.$emit('progressBarisOpen', busy);

return busy;
}

/** Return a string describing the elapsed time or progress. */
Expand Down
2 changes: 1 addition & 1 deletion pkg/rancher-desktop/components/ImagesFormAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default Vue.extend({

methods: {
submit() {
this.$emit('click', { action: this.action, image: this.image });
this.$emit('click', { action: this.action, image: this.image.trim() });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this meant to go into a different PR?

},
},
});
Expand Down
10 changes: 8 additions & 2 deletions pkg/rancher-desktop/components/NetworkStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export default Vue.extend({
type: Boolean,
default: false,
},
isProgressBarVisible: {
type: Boolean,
default: false,
},
},
data() {
return { networkStatus: true };
Expand Down Expand Up @@ -63,15 +67,17 @@ export default Vue.extend({
<i
v-if="icon"
class="item-icon"
:class="icon"
:class="{'make-icon-inline': isProgressBarVisible, icon: true}"
/>
<span
class="item-label"
:class="{'make-label-invisible': isProgressBarVisible}"
>
<b>{{ t('product.networkStatus') }}:</b>
</span>
<span
class="item-value"
:class="{'make-value-invisible': isProgressBarVisible}"
>
{{ networkStatusLabel }}
</span>
Expand All @@ -97,7 +103,7 @@ export default Vue.extend({
}
}

@media (max-width: 900px) {
@media (max-width: 450px) {
.icon-dot {
vertical-align: top;
padding: 0;
Expand Down
13 changes: 11 additions & 2 deletions pkg/rancher-desktop/components/StatusBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ type BarItem = {

export default Vue.extend({
components: { BackendProgress, StatusBarItem },
computed: {
data() {
return { isProgressBarVisible: false };
},
computed: {
...mapGetters('preferences', ['getPreferences']),
kubernetesVersion(): string {
return this.getPreferences.kubernetes.version;
Expand Down Expand Up @@ -55,6 +58,11 @@ export default Vue.extend({
];
},
},
methods: {
updateProgressBarVisibility(isOpen: boolean) {
this.isProgressBarVisible = isOpen;
},
},
});
</script>

Expand All @@ -69,13 +77,14 @@ export default Vue.extend({
:sub-component="item.component"
:data="item.data"
:icon="item.icon"
:is-progress-bar-visible="isProgressBarVisible"
class="status-bar-item"
>
</status-bar-item>
</template>
</div>
<div class="right-column">
<BackendProgress class="progress" />
<BackendProgress id="right" class="progress" @progressBarisOpen="updateProgressBarVisibility" />
</div>
</footer>
</template>
Expand Down
34 changes: 31 additions & 3 deletions pkg/rancher-desktop/components/StatusBarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export default Vue.extend({
type: String,
required: true,
},
isProgressBarVisible: {
type: Boolean,
default: false,
},
},
computed: {
getSubComponent(): VueConstructor | undefined {
Expand Down Expand Up @@ -61,20 +65,23 @@ export default Vue.extend({
<img
v-if="isSvgIcon"
class="item-icon icon-svg"
:class="{'make-icon-inline': isProgressBarVisible}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The various make-* classes are awkward:

  • The make- prefix is repetative, and doesn't really say much
  • They're all doing the same thing, but with lots of different names

I'd suggest just collapsed instead. Or, even better, move it to a parent element (the actual status bar?) and use CSS rules to select them.

:src="svgIconPath"
>
<i
v-else
class="item-icon"
:class="icon"
:class="{'make-icon-inline': isProgressBarVisible, icon: true}"
/>
<span
class="item-label"
:class="{'make-label-invisible': isProgressBarVisible}"
>
<b>{{ t(data.label.bar) }}:</b>
</span>
<span
class="item-value"
:class="{'make-value-invisible': isProgressBarVisible}"
>
{{ data.value }}
</span>
Expand All @@ -84,6 +91,7 @@ export default Vue.extend({
v-if="subComponent"
:icon="icon"
:is-status-bar-item="true"
:is-progress-bar-visible="isProgressBarVisible"
></component>
</div>
</template>
Expand All @@ -108,7 +116,7 @@ export default Vue.extend({
}
}

@media (max-width: 1000px) {
@media (max-width: 500px) {
.item-label, ::v-deep .item-label {
display: none;
}
Expand All @@ -118,7 +126,7 @@ export default Vue.extend({
}
}

@media (max-width: 900px) {
@media (max-width: 450px) {
.item-value, ::v-deep .item-value {
display: none;
}
Expand All @@ -127,5 +135,25 @@ export default Vue.extend({
display: inline;
}
}

@media (max-width: 1000px) {
.make-label-invisible, ::v-deep .make-label-invisible {
display: none;
}

.make-icon-inline, ::v-deep .make-icon-inline {
display: inline;
}
}

@media (max-width: 900px) {
.make-value-invisible, ::v-deep .make-value-invisible {
display: none;
}

.make-icon-inline, ::v-deep .make-icon-inline {
display: inline;
}
}
}
</style>
8 changes: 7 additions & 1 deletion pkg/rancher-desktop/components/Version.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export default Vue.extend({
type: Boolean,
default: false,
},
isProgressBarVisible: {
type: Boolean,
default: false,
},
},
data() {
return { version: this.t('product.versionChecking') };
Expand Down Expand Up @@ -42,15 +46,17 @@ export default Vue.extend({
<i
v-if="icon"
class="item-icon"
:class="icon"
:class="{'make-icon-inline': isProgressBarVisible, icon: true}"
/>
<span
class="item-label"
:class="{'make-label-invisible': isProgressBarVisible}"
>
<b>{{ t('product.version') }}:</b>
</span>
<span
class="item-value"
:class="{'make-value-invisible': isProgressBarVisible}"
>
{{ version }}
</span>
Expand Down
2 changes: 1 addition & 1 deletion pkg/rancher-desktop/pages/images/add.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default {
this.imageOutputCuller = getImageOutputCuller(command);
},
doImageAction({ action, image }) {
this.imageToPull = image.trim();
this.imageToPull = image;
if (action === 'pull') {
this.doPullAnImage();
}
Expand Down
Loading