diff --git a/.air.toml b/.air.toml index 92f3f0d..435a885 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 = ["ui", "panels", "builds"] + exclude_dir = ["fe", "panels", "builds"] # Restart on file changes [log] diff --git a/app/helper/env-helper.go b/app/helper/env-helper.go index 0f3e24d..0eb5e1e 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 UI dev directory...") + log.Println("Checking FE dev directory...") _, err := os.Stat("ui") if err != nil { @@ -72,10 +72,10 @@ func CheckUIDevDir() { return } - copyConfigToUi() + copyConfigToFe() } -func copyConfigToUi() { +func copyConfigToFe() { data, err := os.ReadFile(configPath) if err != nil { diff --git a/ui/src/App.vue b/ui/src/App.vue index e1a35cd..99eb1ba 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -35,25 +35,19 @@ 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 deleted file mode 100644 index d3076a5..0000000 --- a/ui/src/components/base/ToastComp.vue +++ /dev/null @@ -1,82 +0,0 @@ - - - - - diff --git a/ui/src/components/dashboard/ServerView.vue b/ui/src/components/dashboard/ServerView.vue index 7752613..0e3caee 100644 --- a/ui/src/components/dashboard/ServerView.vue +++ b/ui/src/components/dashboard/ServerView.vue @@ -93,6 +93,8 @@ 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 @@ -102,6 +104,8 @@ 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 deleted file mode 100644 index c4ad3d1..0000000 --- a/ui/src/components/form/FormInput.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - - - diff --git a/ui/src/components/panels/PanelView.vue b/ui/src/components/panels/PanelView.vue index 1667e74..28a1b82 100644 --- a/ui/src/components/panels/PanelView.vue +++ b/ui/src/components/panels/PanelView.vue @@ -21,48 +21,37 @@ along with this program. If not, see . @@ -113,7 +88,7 @@ const requestWakeLock = async () => { size-full bg-black; - .panel-container { + .panel-preview__content { @apply relative grid justify-center diff --git a/ui/src/main.js b/ui/src/main.js index 7b522e0..2c0d3cc 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -31,9 +31,7 @@ import router from '@/router' const app = createApp(App) -app.use(router) app.use(createPinia()) +app.use(router) -router.isReady().then(() => { - app.mount('#app') -}) +app.mount('#app') diff --git a/ui/src/router/index.js b/ui/src/router/index.js index 9e053b8..83cabea 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 1637554..0f78dab 100644 --- a/ui/src/services/PanelService.js +++ b/ui/src/services/PanelService.js @@ -19,8 +19,6 @@ 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) @@ -120,32 +118,3 @@ 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 deleted file mode 100644 index 823a8cb..0000000 --- a/ui/src/stores/notifications.js +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index b96859f..0000000 --- a/ui/src/stores/settings.js +++ /dev/null @@ -1,74 +0,0 @@ -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 ed3d72c..b96e96f 100644 --- a/ui/src/views/PanelsView.vue +++ b/ui/src/views/PanelsView.vue @@ -45,6 +45,7 @@ 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 b49054f..00094e7 100644 --- a/ui/src/views/SettingsView.vue +++ b/ui/src/views/SettingsView.vue @@ -20,96 +20,9 @@ along with this program. If not, see . --> - -import { isLocal } from '@/services/ApiService' - -import { useSettingStore } from '@/stores/settings' -import { useNoticationStore } from '@/stores/notifications' - -import { computed, onMounted } from 'vue' - -const settings = useSettingStore() -const notifications = useNoticationStore() - -const settingList = computed(() => settings.list) - -onMounted(() => {}) - -function updateSetting(name, type, target) { - if (type == 'checkbox' || type == 'radio') target.value = target.checked - - settings.set(name, target.value) - - notifications.add({ - title: 'Settings updated', - message: 'Settings have been updated', - variant: 'success', - time: 5000, - closable: true, - }) -} - - - +