@@ -120,17 +124,25 @@
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 1d5f4d1..eb0ae1c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,6 +1,13 @@
import { createRouter, createMemoryHistory, createWebHistory, createWebHashHistory } from 'vue-router'
import routes from './routes';
+// useful for importing router outside of vue components
+// import {router} from "@/router"
+export const router = new createRouter({
+ routes,
+ history: createWebHistory(process.env.VUE_ROUTER_BASE)
+})
+
export default function ({ store }) {
const createHistory = process.env.SERVER
? createMemoryHistory
diff --git a/src/router/routes.js b/src/router/routes.js
index 3d36372..4cd141e 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -1,11 +1,26 @@
const routes = [
{
path: "/",
- name: "Dashboard",
- component: () => import("@/views/Dashboard"),
- meta: {
- requireAuth: true
- }
+ name: "MainLayout",
+ component: () => import("@/layouts/MainLayout"),
+ children: [
+ {
+ path: "agents/:agent_id",
+ name: "Agent",
+ component: () => import("@/views/Agent"),
+ meta: {
+ requireAuth: true
+ }
+ },
+ {
+ path: "",
+ name: "Dashboard",
+ component: () => import("@/views/Dashboard"),
+ meta: {
+ requireAuth: true
+ }
+ },
+ ]
},
{
path: "/setup",
diff --git a/src/store/index.js b/src/store/index.js
index dc5a0fa..889a311 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,5 +1,5 @@
import { createStore } from 'vuex'
-import { Screen } from 'quasar'
+import { Screen, Dark, LoadingBar } from 'quasar'
import axios from "axios";
export default function () {
@@ -8,12 +8,14 @@ export default function () {
return {
username: localStorage.getItem("user_name") || null,
token: localStorage.getItem("access_token") || null,
- clients: {},
tree: [],
+ agents: [],
treeReady: false,
+ selectedTree: "",
selectedRow: null,
agentTableLoading: false,
needrefresh: false,
+ refreshSummaryTab: false,
tableHeight: "300px",
tabHeight: "300px",
showCommunityScripts: false,
@@ -23,7 +25,10 @@ export default function () {
clientTreeSort: "alphafail",
clientTreeSplitter: 20,
noCodeSign: false,
- hosted: false
+ hosted: false,
+ clearSearchWhenSwitching: false,
+ currentTRMMVersion: null,
+ latestTRMMVersion: null
}
},
getters: {
@@ -39,14 +44,8 @@ export default function () {
showCommunityScripts(state) {
return state.showCommunityScripts;
},
- needRefresh(state) {
- return state.needrefresh;
- },
- agentTableHeight(state) {
- return state.tableHeight;
- },
- tabsTableHeight(state) {
- return state.tabHeight;
+ allClientsSelected(state) {
+ return !state.selectedTree;
},
},
mutations: {
@@ -64,9 +63,6 @@ export default function () {
state.token = null;
state.username = null;
},
- getUpdatedSites(state, clients) {
- state.clients = clients;
- },
loadTree(state, treebar) {
state.tree = treebar;
state.treeReady = true;
@@ -104,6 +100,24 @@ export default function () {
},
SET_HOSTED(state, val) {
state.hosted = val
+ },
+ setClearSearchWhenSwitching(state, val) {
+ state.clearSearchWhenSwitching = val
+ },
+ setLatestTRMMVersion(state, val) {
+ state.latestTRMMVersion = val
+ },
+ setCurrentTRMMVersion(state, val) {
+ state.currentTRMMVersion = val
+ },
+ setAgents(state, agents) {
+ state.agents = agents
+ },
+ setRefreshSummaryTab(state, val) {
+ state.refreshSummaryTab = val
+ },
+ setSelectedTree(state, val) {
+ state.selectedTree = val
}
},
actions: {
@@ -119,14 +133,53 @@ export default function () {
})
.catch(e => { })
},
- getDashInfo(context) {
- return axios.get("/core/dashinfo/");
+ refreshDashboard({ state, commit, dispatch }, clearTreeSelected = false) {
+ if (clearTreeSelected || !state.selectedTree) {
+ dispatch("loadAgents")
+ commit("setSelectedTree", "")
+ }
+ else if (state.selectedTree.includes("Client")) {
+ dispatch("loadAgents", `?client=${state.selectedTree.split("|")[1]}`)
+ }
+ else if (state.selectedTree.includes("Site")) {
+ dispatch("loadAgents", `?site=${state.selectedTree.split("|")[1]}`)
+ } else {
+ console.error("refreshDashboard has incorrect parameters")
+ return
+ }
+
+ if (clearTreeSelected) commit("destroySubTable")
+
+ dispatch("loadTree");
+ dispatch("getDashInfo", false);
},
- getUpdatedSites(context) {
- axios.get("/clients/").then(r => {
- context.commit("getUpdatedSites", r.data);
- })
- .catch(e => { });
+ async loadAgents(context, params = null) {
+ context.commit("AGENT_TABLE_LOADING", true);
+ try {
+ const { data } = await axios.get(`/agents/${params ? params : ""}`)
+ context.commit("setAgents", data);
+ } catch (e) {
+ console.error(e)
+ }
+
+ context.commit("AGENT_TABLE_LOADING", false);
+ },
+ async getDashInfo(context, edited = true) {
+ const { data } = await axios.get("/core/dashinfo/");
+ if (edited) {
+ LoadingBar.setDefaults({ color: data.loading_bar_color });
+ context.commit("setClearSearchWhenSwitching", data.clear_search_when_switching);
+ context.commit("SET_DEFAULT_AGENT_TBL_TAB", data.default_agent_tbl_tab);
+ context.commit("SET_CLIENT_TREE_SORT", data.client_tree_sort);
+ context.commit("SET_CLIENT_SPLITTER", data.client_tree_splitter);
+ }
+ Dark.set(data.dark_mode);
+ context.commit("setCurrentTRMMVersion", data.trmm_version);
+ context.commit("setLatestTRMMVersion", data.latest_trmm_ver);
+ context.commit("SET_AGENT_DBLCLICK_ACTION", data.dbl_click_action);
+ context.commit("SET_URL_ACTION", data.url_action);
+ context.commit("setShowCommunityScripts", data.show_community_scripts);
+ context.commit("SET_HOSTED", data.hosted);
},
loadTree({ commit, state }) {
axios.get("/clients/").then(r => {
diff --git a/src/views/Agent.vue b/src/views/Agent.vue
new file mode 100644
index 0000000..1265bba
--- /dev/null
+++ b/src/views/Agent.vue
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue
index 524103e..f32b83a 100644
--- a/src/views/Dashboard.vue
+++ b/src/views/Dashboard.vue
@@ -1,469 +1,351 @@
-
-
-
- You are viewing an outdated version of this page.
-
-
-
-
-
- Tactical RMMv{{ currentTRMMVersion }}
- v{{ latestTRMMVersion }} available
-
-
-
-
-
-
-
-
- Agent Count
- {{ totalAgents }}
-
-
- Servers
-
-
-
-
-
-
- Total: {{ serverCount }}
-
-
-
-
-
-
-
-
- Offline: {{ serverOfflineCount }}
-
-
- Workstations
-
-
-
-
-
-
- Total: {{ workstationCount }}
-
-
-
-
-
-
-
-
- Offline: {{ workstationOfflineCount }}
-
-
-
-
-
-
-
-
-
-
-
-
- Preferences
-
-
-
-
- Logout
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-