diff --git a/.air.toml b/.air.toml
index 435a885..92f3f0d 100644
--- a/.air.toml
+++ b/.air.toml
@@ -10,7 +10,7 @@ bin = "tmp/main.exe"
[build]
cmd = "go build -o ./tmp/main.exe main.go"
include_ext = ["go"]
- exclude_dir = ["fe", "panels", "builds"]
+ exclude_dir = ["ui", "panels", "builds"]
# Restart on file changes
[log]
diff --git a/app/helper/env-helper.go b/app/helper/env-helper.go
index 0eb5e1e..0f3e24d 100644
--- a/app/helper/env-helper.go
+++ b/app/helper/env-helper.go
@@ -64,7 +64,7 @@ func configFileExists() bool {
}
func CheckUIDevDir() {
- log.Println("Checking FE dev directory...")
+ log.Println("Checking UI dev directory...")
_, err := os.Stat("ui")
if err != nil {
@@ -72,10 +72,10 @@ func CheckUIDevDir() {
return
}
- copyConfigToFe()
+ copyConfigToUi()
}
-func copyConfigToFe() {
+func copyConfigToUi() {
data, err := os.ReadFile(configPath)
if err != nil {
diff --git a/ui/src/App.vue b/ui/src/App.vue
index 99eb1ba..e1a35cd 100644
--- a/ui/src/App.vue
+++ b/ui/src/App.vue
@@ -35,19 +35,25 @@ along with this program. If not, see .
Not authorized!
Click here to start authorization and open the "Devices" page on your PC.
+
diff --git a/ui/src/components/base/ToastComp.vue b/ui/src/components/base/ToastComp.vue
new file mode 100644
index 0000000..d3076a5
--- /dev/null
+++ b/ui/src/components/base/ToastComp.vue
@@ -0,0 +1,82 @@
+
+
+
+
+
+
{{ title }}
+
{{ message }}
+
+
+
+
+
+
diff --git a/ui/src/components/dashboard/ServerView.vue b/ui/src/components/dashboard/ServerView.vue
index 0e3caee..7752613 100644
--- a/ui/src/components/dashboard/ServerView.vue
+++ b/ui/src/components/dashboard/ServerView.vue
@@ -93,8 +93,6 @@ const server = reactive({
onMounted(async () => {
const serverIP = await device.serverGetIP()
server.ip = serverIP
- // server.port = window.__CONFIG__.MCRM__PORT
- // server.fullPath = `http://${server.ip}:${server.port}`
const remoteCount = await device.serverGetRemotes(true)
server.remoteCount = remoteCount
@@ -104,8 +102,6 @@ onMounted(async () => {
const panelCount = await panel.getList(true)
server.panelCount = panelCount
-
- console.log(server)
})
diff --git a/ui/src/components/form/FormInput.vue b/ui/src/components/form/FormInput.vue
new file mode 100644
index 0000000..c4ad3d1
--- /dev/null
+++ b/ui/src/components/form/FormInput.vue
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
diff --git a/ui/src/components/panels/PanelView.vue b/ui/src/components/panels/PanelView.vue
index 28a1b82..1667e74 100644
--- a/ui/src/components/panels/PanelView.vue
+++ b/ui/src/components/panels/PanelView.vue
@@ -21,37 +21,48 @@ along with this program. If not, see .
@@ -88,7 +113,7 @@ const viewPanelListeners = () => {
size-full
bg-black;
- .panel-preview__content {
+ .panel-container {
@apply relative
grid
justify-center
diff --git a/ui/src/main.js b/ui/src/main.js
index 2c0d3cc..7b522e0 100644
--- a/ui/src/main.js
+++ b/ui/src/main.js
@@ -31,7 +31,9 @@ import router from '@/router'
const app = createApp(App)
-app.use(createPinia())
app.use(router)
+app.use(createPinia())
-app.mount('#app')
+router.isReady().then(() => {
+ app.mount('#app')
+})
diff --git a/ui/src/router/index.js b/ui/src/router/index.js
index 83cabea..9e053b8 100644
--- a/ui/src/router/index.js
+++ b/ui/src/router/index.js
@@ -60,11 +60,11 @@ const router = createRouter({
name: 'devices',
component: () => import('../views/DevicesView.vue'),
},
- // {
- // path: '/settings',
- // name: 'settings',
- // component: () => import('../views/SettingsView.vue'),
- // },
+ {
+ path: '/settings',
+ name: 'settings',
+ component: () => import('../views/SettingsView.vue'),
+ },
// {
// path: '/about',
// name: 'about',
diff --git a/ui/src/services/PanelService.js b/ui/src/services/PanelService.js
index 0f78dab..1637554 100644
--- a/ui/src/services/PanelService.js
+++ b/ui/src/services/PanelService.js
@@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
+import { useNoticationStore } from '@/stores/notifications'
+
export const SetPanelStyle = (styleStr) => {
const styleEl = document.createElement('style')
styleEl.setAttribute('custom_panel_style', true)
@@ -118,3 +120,32 @@ export const PanelDialogListeners = (panelEl) => {
})
})
}
+
+const getPanelUrl = () => {
+ const url = new URL(window.location.href)
+ return url.pathname
+}
+
+export const SavePanelToLocal = () => {
+ localStorage.setItem('last_opened_panel', getPanelUrl())
+
+ const notificationStore = useNoticationStore()
+
+ notificationStore.add({
+ message: 'Panel will be opened next launch',
+ variant: 'success',
+ time: 1000,
+ })
+}
+
+export const CheckLocalPanel = () => {
+ const localPanel = localStorage.getItem('last_opened_panel')
+
+ if (localPanel) return localPanel == getPanelUrl()
+
+ return false
+}
+
+export const GetLocalPanel = () => {
+ return localStorage.getItem('last_opened_panel')
+}
diff --git a/ui/src/stores/notifications.js b/ui/src/stores/notifications.js
new file mode 100644
index 0000000..823a8cb
--- /dev/null
+++ b/ui/src/stores/notifications.js
@@ -0,0 +1,20 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+
+export const useNoticationStore = defineStore('notications', () => {
+ const list = ref({})
+
+ const add = (notification) => {
+ list.value[Date.now()] = notification
+ }
+
+ const remove = (id) => {
+ delete list.value[id]
+ }
+
+ return {
+ list,
+ add,
+ remove,
+ }
+})
diff --git a/ui/src/stores/settings.js b/ui/src/stores/settings.js
new file mode 100644
index 0000000..b96859f
--- /dev/null
+++ b/ui/src/stores/settings.js
@@ -0,0 +1,74 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+
+export const useSettingStore = defineStore('settings', () => {
+ const list = ref({})
+
+ const get = (key, all = false) => {
+ if (key === undefined) return list.value
+
+ if (!all) return list.value[key].value
+ else return list.value[key]
+ }
+
+ const set = (key, value) => {
+ if (value === 'true' || value === 'false') value = value === 'true'
+
+ list.value[key].value = value
+
+ saveSettings()
+ }
+
+ const loadSettings = (returnObj = false) => {
+ const settings = localStorage.getItem('settings')
+
+ if (settings) list.value = JSON.parse(settings)
+ else list.value = loadDefaultSettings()
+
+ if (returnObj) return list.value
+ }
+
+ const loadDefaultSettings = () => {
+ const defaultSettings = {
+ openLastPanel: {
+ title: 'Open last panel',
+ label: 'Open last panel',
+ description: 'Open the last panel on startup',
+ type: 'checkbox',
+ value: true,
+ remote: true,
+ },
+ mcrmPort: {
+ title: 'Macrame port',
+ label: 'Port',
+ description:
+ 'The port that is used by Macrame, changing this will require a restart of the application.',
+ type: 'number',
+ value: window.__CONFIG__.MCRM__PORT,
+ remote: false,
+ disabled: true,
+ },
+ }
+
+ return defaultSettings
+ }
+
+ const saveSettings = () => {
+ localStorage.setItem('settings', JSON.stringify(list.value))
+ }
+
+ const resetSettings = () => {
+ localStorage.removeItem('settings')
+ list.value = loadDefaultSettings()
+ }
+
+ return {
+ list,
+ get,
+ set,
+ loadSettings,
+ loadDefaultSettings,
+ saveSettings,
+ resetSettings,
+ }
+})
diff --git a/ui/src/views/PanelsView.vue b/ui/src/views/PanelsView.vue
index b96e96f..ed3d72c 100644
--- a/ui/src/views/PanelsView.vue
+++ b/ui/src/views/PanelsView.vue
@@ -45,7 +45,6 @@ import ButtonComp from '@/components/base/ButtonComp.vue'
import PanelEdit from '@/components/panels/PanelEdit.vue'
import PanelView from '@/components/panels/PanelView.vue'
import PanelsOverview from '@/components/panels/PanelsOverview.vue'
-import { isLocal } from '@/services/ApiService'
import { IconArrowLeft } from '@tabler/icons-vue'
import { onMounted, onUpdated, reactive } from 'vue'
import { useRoute, useRouter } from 'vue-router'
diff --git a/ui/src/views/SettingsView.vue b/ui/src/views/SettingsView.vue
index 00094e7..b49054f 100644
--- a/ui/src/views/SettingsView.vue
+++ b/ui/src/views/SettingsView.vue
@@ -20,9 +20,96 @@ along with this program. If not, see .
-->
-
+
+
+
Settings
+
+ Reset
+
+
+
+
+
+
+
+
{{ setting.title }}
+
+ {{ setting.description }}
+
+
+
+
+
+
+
-
+
+
+