Fix OS switching not working on tree view UI

This commit resolves a rendering bug in the tree view component.
Previously, updating the tree collection prior to node updates led to
rendering errors due to the presence of non-existent nodes in the new
collection.

Changes:

- Implement manual control over the rendering process in tree view. This
  includes clearing the rendering queue and currently rendered nodes
  before updates, aligning the rendering process with the updated
  collection.
- Add Cypress E2E tests to test switching between all operating systems
  and script views, ensuring no uncaught errors and preventing
  regression.
- Replace hardcoded operating system lists in the download URL list view
  with a unified `getSupportedOsList()` method from the application,
  reducing duplication and simplifying future updates.
- Rename `initial-nodes` to `nodes` in `TreeView.vue` to reflect their
  mutable nature.
- Centralize the function for getting operating system names into
  `OperatingSystemNames.ts`, improving reusability in E2E tests.
This commit is contained in:
undergroundwires
2023-12-14 09:51:42 +01:00
parent fe3de498c8
commit 3457fe18cf
13 changed files with 285 additions and 76 deletions

View File

@@ -24,17 +24,10 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { OperatingSystem } from '@/domain/OperatingSystem';
import { injectKey } from '@/presentation/injectionSymbols';
import AppIcon from '@/presentation/components/Shared/Icon/AppIcon.vue';
import DownloadUrlListItem from './DownloadUrlListItem.vue';
const supportedOperativeSystems: readonly OperatingSystem[] = [
OperatingSystem.Windows,
OperatingSystem.Linux,
OperatingSystem.macOS,
];
export default defineComponent({
components: {
DownloadUrlListItem,
@@ -42,8 +35,12 @@ export default defineComponent({
},
setup() {
const { os: currentOs } = injectKey((keys) => keys.useRuntimeEnvironment);
const { application } = injectKey((keys) => keys.useApplication);
const supportedOperativeSystems = application.getSupportedOsList();
const supportedDesktops = [
...supportedOperativeSystems,
...application.getSupportedOsList(),
].sort((os) => (os === currentOs ? 0 : 1));
const hasCurrentOsDesktopVersion = currentOs === undefined

View File

@@ -16,6 +16,7 @@ import {
} from 'vue';
import { injectKey } from '@/presentation/injectionSymbols';
import { OperatingSystem } from '@/domain/OperatingSystem';
import { getOperatingSystemDisplayName } from '@/presentation/components/Shared/OperatingSystemNames';
export default defineComponent({
props: {
@@ -33,7 +34,7 @@ export default defineComponent({
});
const operatingSystemName = computed<string>(() => {
return getOperatingSystemName(props.operatingSystem);
return getOperatingSystemDisplayName(props.operatingSystem);
});
const hasCurrentOsDesktopVersion = computed<boolean>(() => {
@@ -58,20 +59,6 @@ function hasDesktopVersion(os: OperatingSystem): boolean {
|| os === OperatingSystem.Linux
|| os === OperatingSystem.macOS;
}
function getOperatingSystemName(os: OperatingSystem): string {
switch (os) {
case OperatingSystem.Linux:
return 'Linux (preview)';
case OperatingSystem.macOS:
return 'macOS';
case OperatingSystem.Windows:
return 'Windows';
default:
throw new Error(`Unsupported os: ${OperatingSystem[os]}`);
}
}
</script>
<style scoped lang="scss">