Merge branch 'feature/RaspberryDisplay' into 'master'

created RasberryDisplay Module

See merge request fronk/thetool!245
This commit is contained in:
Frank Schubert
2024-02-14 12:41:35 +00:00
19 changed files with 12569 additions and 9 deletions
+51
View File
@@ -0,0 +1,51 @@
[v-cloak] {
display: none !important;
}
.display-grid {
display: grid;
grid-template-columns: repeat(8, 11.25vw);
grid-row-gap: 20px;
width: 100vw;
}
.display {
background-color: #f8f9fa;
border: 2px solid #dee2e6;
border-radius: 4px;
overflow: hidden;
font-size: clamp(0.6rem, 0.8rem, 1.1rem);
display: grid;
grid-template-rows: repeat(3, 1fr);
justify-items: center;
}
.display > *:nth-child(1) {
align-self: start;
}
.display > *:nth-child(2) {
align-self: center;
}
.display > *:nth-child(3) {
align-self: end;
}
.small-27-inch {
grid-column: span 1;
margin: 0 0.37vw;
width: calc(10.5vw);
height: calc(10.5vw * 9 / 16)
}
.big-42-inch {
grid-column: span 2;
margin: 0 0.37vw;
width: calc(21vw);
height: calc(21vw * 9 / 16)
}
label {
margin: 0;
}
+63
View File
@@ -0,0 +1,63 @@
// noinspection JSJQueryEfficiency
Vue.filter('cleanupURL', function (value) {
value = value.replace(/^(?:https?:\/\/)?(?:www\.)?/i, "").split('/')[0];
return value;
})
new Vue({
el: '#app',
mounted() {
this.fetchDisplays()
},
methods: {
async rebootRaspberry(displayID) {
this.loading = true;
await axios.get(`${window['TT_CONFIG']["BASE_URL"]}/api?do=reboot`, {
params: {
displayID: displayID
}
});
this.loading = false;
},
async fetchDisplays() {
this.loading = true;
const response = await axios.get(`${window['TT_CONFIG']["BASE_URL"]}/api?do=getDisplays`);
this.displays = response.data.result;
this.loading = false;
Vue.nextTick(() => {
$('[data-toggle="tooltip"]').tooltip('dispose');
$('[data-toggle="tooltip"]').tooltip();
});
},
enableDisplayURLEditMode(displayID) {
this.displaysURLEditMode = displayID;
const _this = this;
// wait for the DOM to update
Vue.nextTick(() => {
_this.$refs['displayURLEditInput'][0].focus();
});
},
disableDisplayURLEditMode(displayID, displayURL) {
this.displaysURLEditMode = null;
this.submitChanges(displayID, 'display_url', displayURL);
},
async submitChanges(displayID, field, value) {
this.loading = true;
await axios.get(`${window['TT_CONFIG']["BASE_URL"]}/api?do=change`, {
params: {
displayID: displayID,
field: field,
value: value,
}
});
await this.fetchDisplays();
this.loading = false;
}
},
data: {
loading: false,
displaysURLEditMode: null,
displays: null,
}
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,45 @@
# TheTool Vue Frontend Framework
## Components
### tt-page-title
The `tt-page-title` is used to create the Title and breadcumbs on the top of the page
#### Props
- `title`: String - The title of the current page. This will be displayed prominently at the top of the breadcrumb navigation bar.
- `path`: Array - An array of objects representing the breadcrumb path. Each object in the array should have the following properties:
- `text`: String - The display text for the breadcrumb item.
- `href`: String - The URL that the breadcrumb item links to.
#### Usage
Include the Component on the View
```php
$additionalJS = ["plugins/vue/tt-components/tt-page-title.js"];
```
Then use it inside the Vue App
```vue
<tt-page-title :title="'Your Page Title'" :path="[
{ text: 'Home', href: '/' },
{ text: 'Library', href: '/library' },
{ text: 'Data', href: '/library/data' } // Current Page
]"></tt-page-title>
```
### tt-loader
The `tt-loader` is used to display a loader
#### Usage
Include the Component on the View
```php
$additionalJS = ["plugins/vue/tt-components/tt-loader.js"];
$additionalCSS = ["plugins/vue/tt-components/css/tt-loader.css"];
```
Then use it inside the Vue App in the container where it should get full width
```vue
<tt-loader></tt-loader>
@@ -0,0 +1,25 @@
.overlay {
width: 100%;
height: 100%;
background-color: rgba(10, 10, 10, 0.5); /* Semi-transparent black */
z-index: 9999;
display: flex;
justify-content: center;
align-items: center; /* Center the spinner vertically and horizontally */
position: absolute;
top: 50%;
left: 50%;
opacity: 0.5;
transform: translate(-50%, -50%);
}
/* Define the transition */
.fade-enter-active, .fade-leave-active {
transition: opacity 0.2s ease;
}
.fade-enter, .fade-leave-to /* .fade-leave-active in <2.1.8 */
{
opacity: 0;
}
@@ -0,0 +1,15 @@
Vue.component('tt-loader', {
template: `
<transition name="fade">
<div class="w-100 h-100" style="position: absolute;">
<div class="overlay" id="loading">
<div class="d-flex justify-content-center">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
</transition>
`
});
@@ -0,0 +1,19 @@
Vue.component('tt-page-title', {
props: ['title', 'path'],
template: `
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item" v-for="item in path" :key="item.text">
<a :href="item.href">{{ item.text }}</a>
</li>
</ol>
</div>
<h4 class="page-title">{{ title }}</h4>
</div>
</div>
</div>
`
});
File diff suppressed because it is too large Load Diff
+11
View File
File diff suppressed because one or more lines are too long