Skip to content

Commit 2c87f15

Browse files
committed
fix: add vue to example for installer
1 parent 386ba5e commit 2c87f15

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

example/src/Views/Installer.tsx

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ import {CommonModule} from '@angular/common';
6565
})
6666
6767
export class InstallerView implements OnInit {
68+
public entries: {platform: string; type: string; url: string; version: string; arch: string}[] = [];
6869
public wrapperStyle = {position: 'fixed', bottom: '0px', right: '32px', height: '260px', width: '280px', 'background-color': '#444', padding: '16px 20px'};
6970
public buttonStyle = {display: 'block', width: '100%', 'margin-bottom': '16px', padding: '8px'};
70-
public entries: {platform: string; type: string; url: string; version: string; arch: string}[] = [];
7171
7272
ngOnInit() {
7373
window.asperaSdk.getInstallerInfo().then(response => {
74+
// Installers for your platform. While normally just one. Some OS may provide multiple for user to choose.
7475
this.entries = response.entries;
7576
}).catch(error => {
7677
console.error('Installer info get failed', error);
@@ -86,6 +87,39 @@ export class InstallerView implements OnInit {
8687
}
8788
}`;
8889

90+
const InstallerViewVue = `<script setup>
91+
import { ref } from 'vue';
92+
93+
// Value for installer list
94+
const entries = ref([]);
95+
const wrapperStyle = {position: 'fixed', bottom: '0', right: '32px', height: '260px', width: '280px', backgroundColor: '#444', padding: '16px 20px'};
96+
const buttonStyle = {display: 'block', width: '100%', marginBottom: '16px', padding: '8px'};
97+
98+
const launch = () => {
99+
window.asperaSdk.launch();
100+
};
101+
102+
const install = (url) => {
103+
window.open(url, '_blank', 'noopener,noreferrer');
104+
};
105+
106+
window.asperaSdk.getInstallerInfo().then(response => {
107+
// Installers for your platform. While normally just one. Some OS may provide multiple for user to choose.
108+
entries.value = response.entries;
109+
}).catch(error => {
110+
console.error('Installer info get failed', error);
111+
});
112+
</script>
113+
114+
<template>
115+
<div :style="wrapperStyle">
116+
<h4 :style="{marginBottom: '20px', color: '#fff'}">IBM Aspera Installer</h4>
117+
<button :style="buttonStyle" type="button" @click="launch()">Launch</button>
118+
<button v-for="entry of entries" :style="buttonStyle" type="button" @click="install(entry.url)">Install ({{entry.platform}} - {{entry.type}})</button>
119+
</div>
120+
</template>
121+
`;
122+
89123
export default function Installer() {
90124
const [tabIndex, setTabIndex] = useState(0);
91125

@@ -111,9 +145,10 @@ export default function Installer() {
111145
<Tab>React</Tab>
112146
<Tab>JavaScript</Tab>
113147
<Tab>Angular</Tab>
148+
<Tab>Vue</Tab>
114149
</TabList>
115150
</Tabs>
116-
{[InstallerViewReact, window.installerAspera.toString(), InstallerViewAngular].map((item, index) => getCodeView(item, index))}
151+
{[InstallerViewReact, window.installerAspera.toString(), InstallerViewAngular, InstallerViewVue].map((item, index) => getCodeView(item, index))}
117152
</div>
118153
);
119154
};

0 commit comments

Comments
 (0)