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

feat: tari launchpad #3671

Merged
merged 32 commits into from
Dec 23, 2021
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
41dbdff
Tari launchpad MVP
CjS77 Dec 14, 2021
1768eec
Add resource stats method
CjS77 Dec 15, 2021
acf5cc7
Pretty up frontend with Oruga
CjS77 Dec 15, 2021
822c6d8
Service tabs
CjS77 Dec 16, 2021
0829e41
Refactor service commands
CjS77 Dec 17, 2021
3fd70b1
Container stats and status
CjS77 Dec 20, 2021
f8359ae
Fix docker files
CjS77 Dec 20, 2021
a80240e
build image script
CjS77 Dec 20, 2021
0eee21e
Fix container status updates
CjS77 Dec 21, 2021
a9d2e03
Add documentation
CjS77 Dec 21, 2021
a5beedf
Add frontails image
CjS77 Dec 21, 2021
368dc72
cargo fmt
CjS77 Dec 21, 2021
d10fe68
clippy lints
CjS77 Dec 21, 2021
cd76d33
Merge branch 'weatherwax' into launchpad_ww
stringhandler Dec 21, 2021
c429289
ci: fix ci dependencies
stringhandler Dec 21, 2021
a597bce
Fix log server
CjS77 Dec 21, 2021
aaa61c1
Merge branch 'launchpad_ww' of github.com:tari-project/tari into laun…
CjS77 Dec 21, 2021
ea032fb
Merge branch 'weatherwax' into launchpad_ww
CjS77 Dec 21, 2021
5bfe1bb
cargo fmt
CjS77 Dec 21, 2021
29b8188
fix: fix incorrect depeendency
stringhandler Dec 21, 2021
ca2d49d
Add missing use stmt
CjS77 Dec 21, 2021
9c8df93
Provide os-dependent mount path
CjS77 Dec 21, 2021
002f6b2
ci: add npm build step
stringhandler Dec 22, 2021
0ac1749
fix fmt toolchain
stringhandler Dec 22, 2021
86ef747
Use ring buffers for logs instead of arrays
CjS77 Dec 22, 2021
7126a91
fix clippy
stringhandler Dec 22, 2021
7c4841a
Merge remote-tracking branch 'origin/launchpad_ww' into launchpad_ww
CjS77 Dec 22, 2021
ae4ed59
fix clippy
stringhandler Dec 23, 2021
ddaa559
fix clippy
stringhandler Dec 23, 2021
102b769
fix tests
stringhandler Dec 23, 2021
dc47c1b
precompile npm
stringhandler Dec 23, 2021
956e787
Merge branch 'weatherwax' into launchpad_ww
aviator-app[bot] Dec 23, 2021
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
Prev Previous commit
Next Next commit
Service tabs
CjS77 committed Dec 16, 2021
commit 822c6d852ecc5050daa4603ff20557712c88ac09
32 changes: 31 additions & 1 deletion applications/launchpad/gui-vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion applications/launchpad/gui-vue/package.json
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@
"@oruga-ui/oruga-next": "^0.4.8",
"@tauri-apps/api": "^1.0.0-beta.8",
"core-js": "^3.6.5",
"vue": "^3.0.0"
"vue": "^3.0.0",
"vuex": "^4.0.2"
},
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-beta.10",
10 changes: 5 additions & 5 deletions applications/launchpad/gui-vue/src/components/Containers.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="containers">
<h1>Containers</h1>
<button @click="pullImages">Pull images</button>
<o-button @click="pullImages">Pull images</o-button>
<ul>
<li v-for="(image, i) of imageList" :key="i"><b>{{ image }}</b>:{{ ' ' }}{{ info[image].status }} /
{{ info[image].progress }}%
@@ -15,7 +15,6 @@
<script>
import {invoke} from '@tauri-apps/api/tauri'
import {listen} from '@tauri-apps/api/event'
import { ref } from 'vue';

async function pullImages() {
console.log("Pulling images");
@@ -41,11 +40,12 @@ export default {
name: 'containers',
async setup() {
console.log("Getting image list");
let imageList = ref(['foo', 'bar']);
let imageList = [];
try {
imageList.value = await invoke("image_list");
} catch (err) {
console.log(err);
console.log("Using default image list");
}
return {imageList}
},
@@ -55,7 +55,7 @@ export default {
const errors = "None";
console.log("ImageList:", this.imageList);
this.imageList.forEach(p => info[p] = {status: "Unknown", progress: 0});
return {info, errors }
return {info, errors}
},
methods: {pullImages}
}
@@ -70,7 +70,7 @@ ul {
}

li {
text-align: left ;
text-align: left;
margin: 0 10px;
}

97 changes: 59 additions & 38 deletions applications/launchpad/gui-vue/src/components/LaunchDocker.vue
Original file line number Diff line number Diff line change
@@ -23,12 +23,17 @@

<template>
<o-tabs v-model="activeTab">
<o-tab-item value="0" label="Setup">
<o-tab-item value="0" label="Images">
<suspense>
<Containers></Containers>
</suspense>
</o-tab-item>
<o-tab-item value="1" label="Setup">
<div>
<h1>Workspace</h1>
<input v-model="workspaceName" placeholder="MyWorkspace"/>
<button @click="createWorkspace">Create workspace</button>
<button @click="openWorkspace">Open workspace</button>
<o-input v-model="workspaceName" placeholder="MyWorkspace"></o-input>
<o-button @click="createWorkspace">Create workspace</o-button>
<o-button @click="openWorkspace">Open workspace</o-button>
<p>
<b>Workspace status:</b><span>{{ workspaceStatus }}</span>
</p>
@@ -53,30 +58,34 @@
</div>

<div>
<input type="checkbox" id="base_node" v-model="options.has_base_node"/>
<label for="base_node">Spin up a Base Node</label>
</div>

<div>
<input type="checkbox" id="wallet" v-model="options.has_wallet"/>
<label for="wallet">Spin up a wallet</label>
<div v-if="options.has_wallet">
<input v-model="options.wallet_password" placeholder="password"/>
<div class="field">
<o-checkbox id="base_node" v-model="options.has_base_node">
Spin up a Base Node
</o-checkbox>
</div>
</div>


<div>
<input type="checkbox" id="sha3_miner" v-model="options.has_sha3_miner"/>
<label for="sha3_miner">Spin up a SHA3 miner</label>
<div v-if="options.has_sha3_miner">
<input v-model.number="options.sha3_mining_threads" placeholder="# SHA3 mining threads"/>
<div class="field">
<o-checkbox v-model="options.has_wallet">
Spin up a wallet
</o-checkbox>
</div>
<div class="field">
<div v-if="options.has_wallet">
<input v-model="options.wallet_password" placeholder="password"/>
</div>
</div>
<div class="field">
<o-checkbox v-model="options.has_sha3_miner">
Spin up a SHA3 miner
</o-checkbox>
<div v-if="options.has_sha3_miner">
<input v-model.number="options.sha3_mining_threads" placeholder="# SHA3 mining threads"/>
</div>
</div>
<div class="field">
<o-checkbox v-model="options.has_mm_proxy">
Spin up a Monero Miner
</o-checkbox>
</div>
</div>

<div>
<input type="checkbox" id="mm_proxy" v-model="options.has_mm_proxy"/>
<label for="mm_proxy">Spin up a Monero Miner</label>
<div v-if="options.has_mm_proxy">
<ul>
<li><input v-model="options.monerod_url" placeholder="Monerod URL"/></li>
@@ -98,20 +107,26 @@

</o-tab-item>

<o-tab-item value="3" label="Logs">
<div class="logs">
<hr/>
<h2>Logs</h2>
<table>
<tr v-for="(log, index) in logs" v-bind:key="index">
<td>{{ log }}</td>
</tr>
</table>
<hr/>
</div>
<o-tab-item value="2" label="Tor">
<service name="Tor"></service>
</o-tab-item>

<o-tab-item value="3" label="Base Node">
<service name="Base Node"></service>
</o-tab-item>

<o-tab-item value="4" label="Wallet">
<service name="Wallet"></service>
</o-tab-item>

<o-tab-item value="5" label="SHA3 Miner">
<service name="SHA3 miner"></service>
</o-tab-item>
</o-tabs>

<o-tab-item value="6" label="Merged miner">
<service name="Merged Miner"></service>
</o-tab-item>
</o-tabs>


</template>
@@ -120,6 +135,8 @@
import {invoke} from '@tauri-apps/api/tauri'
import {save, open} from '@tauri-apps/api/dialog'
import {listen} from "@tauri-apps/api/event";
import {defineAsyncComponent} from "vue";
import service from "@/components/Service";

const imageNames = [
"tor",
@@ -187,6 +204,10 @@ async function launch() {

export default {
name: "LaunchDocker",
components: {
Containers: defineAsyncComponent(() => import("@/components/Containers")),
service
},
data() {
const options = {
root_folder: "/tmp/tari",
97 changes: 97 additions & 0 deletions applications/launchpad/gui-vue/src/components/Service.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<template>
<h1>{{ name }}</h1>
<div>
<p><b>Network:</b> {{ $store.state.networkConfig.tari_network }}</p>
<p><b>Workspace:</b> {{ $store.state.networkConfig.root_folder }}</p>
<o-button @click="startContainer">Start</o-button>
<o-button @click="stopContainer">Stop</o-button>
<p><b>Status:</b> {{ status }}</p>

</div>

<div class="stats">
<h2>Stats <o-icon pack="fas" icon="tachometer-alt"> </o-icon></h2>
<p><b>CPU:</b> {{ stats.cpu }}%</p>
<p><b>Memory:</b> {{ stats.mem }} MB</p>
</div>

<div class="logs">
<hr/>
<h2>Logs</h2>
<o-table
:data="logs"
:columns="columns"
:striped="true"
:narrowed="true"
:hoverable="true"
:sticky-header="true"
:debounce-search="100"
>
</o-table>
<hr/>
</div>
</template>

<script>
// import {invoke} from '@tauri-apps/api/tauri'
// import {listen} from '@tauri-apps/api/event'

function startContainer() {
console.log(`Starting ${this.name}...`)
}

function stopContainer() {
console.log(`Stopping ${this.name}...`)
}

export default {
name: 'service',
props: {
name: String,
},

data() {
const logs = [
{id: 0, timestamp: (new Date()).toISOString(), message: "Logs go here"}
];
const columns = [
{
field: 'id',
label: 'ID',
width: '100',
numeric: true,
searchable: false
},
{
field: 'timestamp',
label: 'Time',
searchable: false
},
{
field: 'message',
label: 'Message',
searchable: true
}
];
const stats = {
cpu: 0,
mem: 0,
};
return {
status: "None",
logs,
columns,
stats
}
},
methods: {
startContainer,
stopContainer,
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
3 changes: 3 additions & 0 deletions applications/launchpad/gui-vue/src/main.js
Original file line number Diff line number Diff line change
@@ -35,10 +35,13 @@ library.add(
faCaretUp
);

import store from "./store";

createApp(App)
.component('vue-fontawesome', FontAwesomeIcon)
.use(Oruga, {
iconComponent: 'vue-fontawesome',
iconPack: 'fas'
})
.use(store)
.mount('#app')
24 changes: 24 additions & 0 deletions applications/launchpad/gui-vue/src/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { createStore } from 'vuex'

export const store = createStore({
state () {
return {
networkConfig: {
tari_network: "weatherwax",
root_folder: "/tmp/tari",
docker_registry: null,
docker_tag: null,
}
}
},
mutations: {
setNetwork(state, network) {
state.networkConfig.tari_network = network;
},
setRootFolder(state, folder) {
state.networkConfig.root_folder = folder;
}
}
})

export default store