Skip to content

Commit

Permalink
Merge pull request #29 from bradenn/patch
Browse files Browse the repository at this point in the history
v1.14.1 patch
  • Loading branch information
bradenn authored Jul 12, 2022
2 parents 7c6099d + 8b20324 commit 8a7429b
Show file tree
Hide file tree
Showing 50 changed files with 1,976 additions and 452 deletions.
19 changes: 5 additions & 14 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
<head>
<meta charset="UTF-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="https://fonts.googleapis.com" rel="preconnect">
<link crossorigin href="https://fonts.gstatic.com" rel="preconnect">
<script src="./vendor/fa-6/js/all.min.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500&display=swap" rel="stylesheet">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<title>Udap</title>
<title>UDAP</title>
</head>
<body>

Expand All @@ -25,15 +19,14 @@

vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );

gl_PointSize = size * ( 300.0 / -mvPosition.z );
gl_PointSize = size * ( 325.0 / -mvPosition.z );

vColor *= ( 125.0 / -mvPosition.z );

gl_Position = projectionMatrix * mvPosition;

}




</script>
<script id="fshader" type="x-shader/x-fragment">
uniform sampler2D pointTexture;
Expand All @@ -45,17 +38,15 @@
gl_FragColor = vec4( vColor, 1.0 );

gl_FragColor = gl_FragColor * texture2D( pointTexture, gl_PointCoord );

}




</script>
<div id="app">
<div class="simple-keyboard"></div>
</div>

<script src="./src/main.ts" type="module"></script>
</body>

</html>
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"bootstrap": "^5.1.0",
"glob": "^8.0.1",
"minimist": "~1.2.6",
"moment": "^2.29.2",
"moment": "^2.29.4",
"qrcanvas-vue": "^3.0.0",
"qrcode": "^1.5.0",
"sass": "^1.45.1",
Expand Down
87 changes: 39 additions & 48 deletions client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ import {onMounted, provide, reactive, watch} from "vue";
import {version} from "../package.json";


interface Preferences {
export interface Preferences {
ui: {
blurBg: boolean
background: string
screensaver: {
enabled: boolean
countdown: number
}
background: {
image: string,
blur: boolean
}
theme: string
mode: string
blur: number
Expand All @@ -21,9 +27,15 @@ interface Preferences {

const preferenceDefaults: Preferences = {
ui: {
blurBg: false,
screensaver: {
enabled: true,
countdown: 60 * 5
},
background: {
image: "milk",
blur: true
},
blur: 6,
background: "milk",
mode: "cursor",
theme: "dark",
brightness: 100,
Expand All @@ -40,7 +52,10 @@ function restore() {
let stored = localStorage.getItem("preferences")
if (stored) {
let parsed: Preferences = JSON.parse(stored)
save(parsed)
return parsed
} else {
save(preferenceDefaults)
}
return preferenceDefaults
}
Expand All @@ -63,7 +78,6 @@ let state = reactive({
countdown: 3,
context: false,
remote: {},

system: {
nexus: {
system: {
Expand All @@ -78,6 +92,10 @@ let state = reactive({
}
})

onMounted(() => {
resetCountdown()
})

let screensaver = reactive({
show: false,
countdown: 0,
Expand All @@ -93,14 +111,14 @@ function forceScreensaver() {
}

function resetCountdown() {
screensaver.countdown = 60 * 5
screensaver.countdown = preferences.ui.screensaver.countdown
screensaver.hideTerminal = false
screensaver.show = false
if (screensaver.interval !== 0) {
clearInterval(screensaver.interval)
screensaver.interval = 0
}
if (!preferences.ui.outlines) return
if (!preferences.ui.screensaver.enabled) return
screensaver.interval = setInterval(() => {
screensaver.countdown -= 1;
if (screensaver.countdown <= 0) {
Expand All @@ -114,47 +132,9 @@ function resetCountdown() {
}, 1000)
}

onMounted(() => {
resetCountdown()
state.context = false
state.fps = 0
})

provide('system', state.system)

function handleUpdate() {
if (state.countdown <= 0) {
clearInterval(state.timeout)
state.timeout = 0
state.hideHome = false
}
}

let lastReset = performance.now()
let totalFrames = 0

function tick() {
totalFrames++
let now = performance.now()
let dFps = totalFrames / ((now - lastReset) / 1000.0)
state.fps = Math.round(dFps * 10) / 10
if (totalFrames > 2000) {
totalFrames = 0
lastReset = performance.now()
}
}

function hideHome(hide: boolean) {
state.hideHome = hide
}

function toggleContext(hide: boolean) {
state.context = hide
}

provide('ui', preferences.ui)
provide('context', toggleContext)
provide('hideHome', hideHome)
provide('preferences', preferences)


</script>
Expand All @@ -163,7 +143,8 @@ provide('hideHome', hideHome)
<div
:class="`${preferences.ui.night?'night-vision':''} theme-${preferences.ui.theme} mode-${preferences.ui.mode} blurs-${preferences.ui.blur} brightness-${preferences.ui.brightness}`"
class="root" v-on:mousedown="(e) => resetCountdown()">
<img :class="`${preferences.ui.blurBg?'backdrop-blurred':''}`" :src="`/custom/${preferences.ui.background}@4x.png`"
<img :class="`${preferences.ui.background.blur?'backdrop-blurred':''}`"
:src="`/custom/${preferences.ui.background.image}@4x.png`"
alt="Background" class="backdrop "/>
<div v-if="preferences.ui.watermark" class="watermark">
<div class="d-flex gap">
Expand All @@ -183,6 +164,7 @@ provide('hideHome', hideHome)
<div v-if="preferences.ui.grid" class="grid"></div>

<div v-if="state.context" class="context context-light"></div>

<router-view/>


Expand All @@ -191,6 +173,15 @@ provide('hideHome', hideHome)
</template>

<style lang="scss">
.overlay-notification {
position: fixed;
z-index: 1;
height: 4.5rem;
width: 15rem;
padding: 1rem;
right: 0;
top: 0;
}

.screensaver-text {
animation: screensaverTextLoadIn 500ms ease-in forwards;
Expand Down
18 changes: 12 additions & 6 deletions client/src/components/IdTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import Loader from "@/components/Loader.vue";
import Plot from "@/components/plot/Plot.vue";
import Toggle from "@/components/plot/Toggle.vue";
import type {Remote} from "@/types";
import type {Preferences} from "@/App.vue";
let state = reactive({
menu: false,
reloading: true,
connected: false,
})
let ui: any = inject("ui")
let preferences: Preferences = inject("preferences") as Preferences
let remote: Remote = inject('remote') as Remote
let system: any = inject('system')
Expand Down Expand Up @@ -130,7 +131,7 @@ function reload() {
</div>
</Plot>
<Plot :cols="1" :rows="1" title="Brightness">
<input v-model="ui.brightness"
<input v-model="preferences.ui.brightness"
:max=20
:min=4
:step=1
Expand All @@ -139,10 +140,15 @@ function reload() {
@mousemove.stop>
</Plot>
<Plot :cols="2" :rows="2" title="Quick Settings">
<Toggle :active="ui.grid" :fn="() => ui.grid = !ui.grid" title="Grid"></Toggle>
<Toggle :active="ui.outlines" :fn="() => ui.outlines = !ui.outlines" title="Screensaver"></Toggle>
<Toggle :active="ui.watermark" :fn="() => ui.watermark = !ui.watermark" title="Watermark"></Toggle>
<Toggle :active="ui.blurBg" :fn="() => ui.blurBg = !ui.blurBg" title="Bg Blur"></Toggle>
<Toggle :active="preferences.ui.grid" :fn="() => preferences.ui.grid = !preferences.ui.grid"
title="Grid"></Toggle>
<Toggle :active="preferences.ui.screensaver.enabled"
:fn="() => preferences.ui.screensaver.enabled = !preferences.ui.screensaver.enabled"
title="Screensaver"></Toggle>
<Toggle :active="preferences.ui.watermark" :fn="() => preferences.ui.watermark = !preferences.ui.watermark"
title="Watermark"></Toggle>
<Toggle :active="preferences.ui.background.blur"
:fn="() => preferences.ui.background.blur = !preferences.ui.background.blur" title="Bg Blur"></Toggle>
</Plot>

</div>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/plot/Plot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let props = defineProps<Plot>()
<div class="element element-group">
<div v-if="props.title" class="d-flex align-items-center justify-content-between">
<div class="label-c1 label-o4 label-w500 px-1 pb-1">{{ props.title }}</div>
<div class="label-c2 label-w500 label-r label-o2 px-1">{{ props.alt }}</div>
<div class="label-c2 label-w500 label-r label-o2 px-1" v-html="props.alt"></div>
</div>
<div :class="`${props.small?'plot-sm':'plot'}`" class="">
<slot></slot>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/plot/Radio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function up() {

<template>
<div :class="`${props.active?'active':''}`" class="radio subplot d-flex justify-content-center"
@mousedown="handle" @mouseleave="(e) => up()" @mouseout="(e) => up()" @mouseup="(e) => up()">
@click="(e) => props.fn()">
<div><span v-if="props.icon"><i :class="`fa-${props.icon}`" class="fa-solid "></i>&nbsp;</span>{{ props.title }}
<div v-if="props.sf" class="label-o3 label-c2" v-html="props.sf"></div>
</div>
Expand Down
11 changes: 7 additions & 4 deletions client/src/components/plot/Subplot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ const props = defineProps<Props>()
</script>

<template>
<div v-if="props.to" :class="`${props.to===$router.currentRoute.value.fullPath?'':'subplot-inline'}`"
<div v-if="props.to"
:class="`${props.to===$router.currentRoute.value.fullPath?'':'subplot-inline'} ${props.theme?`theme-${props.theme}`:''}`"
class="subplot p-1"
@mouseover="$router.replace(props.to || '/')">
<div class="d-flex justify-content-start px-1">
<div class="label-w500 label-o3 label-c1"><i :class="`fa-solid fa-${props.icon} fa-fw`"></i></div>
<div class="label-w500 label-c1 px-2">{{ props.name }}</div>
<div v-if="props.icon" class="label-w500 label-o3 label-c1"><i :class="`fa-solid fa-${props.icon} fa-fw`"></i>
</div>
<div class="label-w500 label-c1 px-2 text-center">{{ props.name }}</div>
</div>

<slot></slot>
Expand All @@ -36,7 +38,8 @@ const props = defineProps<Props>()
class="d-flex ">
<div v-if="props.icon" class="label-w500 label-o3 label-c1"><i :class="`fa-solid fa-${props.icon} fa-fw`"></i>
</div>
<div class="label-w500 label-c1 px-2 text-center">{{ props.name }}</div>
<div v-if="sf" v-html="sf"></div>
<div class="label-w500 label-c1 px-2 label-o4 text-center">{{ props.name }}</div>
<div v-if="props.alt" class="label-w400 label-o4 label-c1 px-2">{{ props.alt }}</div>


Expand Down
1 change: 1 addition & 0 deletions client/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Settings from "@/views/terminal/settings/Settings.vue";
import Preferences from "@/views/terminal/settings/Preferences.vue";
import Connection from "@/views/terminal/settings/Connection.vue";
import Modules from "@/views/terminal/settings/module/Modules.vue";

import Endpoints from "@/views/terminal/settings/endpoint/Endpoints.vue";
import Timings from "@/views/terminal/settings/Timings.vue";
import Zones from "@/views/terminal/settings/zone/Zones.vue";
Expand Down
25 changes: 25 additions & 0 deletions client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,39 @@ export interface Attribute {
order: number;
}

export interface Utilization {
memory: {
total: number;
used: number;
};
network: {
hostname: string;
ipv4: string;
mac: string;
};
cpu: {
cores: number;
usage: number[];
};
disk: {
total: number;
used: number;
};
}

export interface Device {
created: string;
updated: string;
state: string;
id: string;
networkId: string;
entityId: string;
name: string;
hostname: string;
utilization: Utilization;
isQueryable: boolean
lastSeen: string;
latency: number;
mac: string;
ipv4: string;
ipv6: string;
Expand Down
Loading

0 comments on commit 8a7429b

Please sign in to comment.