add frontend project

This commit is contained in:
amar
2023-05-30 08:32:18 +02:00
parent 2a564bba38
commit ac3429868a
33 changed files with 12787 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
export const state = () => ({
devices: [],
device: {},
});
export const mutations = {
update(state, params) {
state.device = { ...params };
},
updateDevices(state, params) {
state.devices = [...params];
},
};
export const actions = {
get({ commit, state }, params) {
console.log("===>", this.$axios);
return this.$axios.get(`/devices`);
},
getByName({ commit, rootGetters }, params) {
return this.$axios.get(`/devices/${params.name}`);
},
getFacts({ commit, rootGetters }, params) {
return this.$axios.get(`/devices/${params.name}/facts`);
},
getInterfacesIp({ commit, rootGetters }, params) {
return this.$axios.get(`/devices/${params.name}/interfaces/ip`);
},
getInterfaces({ commit, rootGetters }, params) {
return this.$axios.get(`/devices/${params.name}/interfaces`);
},
getSnapshots({ commit, rootGetters }, params) {
return this.$axios.get(`/devices/${params.name}/snapshots`);
},
buildSnapshots({ commit, rootGetters }, params) {
return this.$axios.post(`/devices/${params.name}/snapshots`);
},
config({ commit, rootGetters }, params) {
return this.$axios.post(`/devices/${params.name}/config`, params.data);
},
post({ commit }, params) {
return this.$axios.post(`/devices`, params.data);
},
delete({ commit }, params) {
return this.$axios.delete(`/devices/${params.name}`);
},
};
export const getters = {
get: (state) => {
return state.device;
},
getDevices: (state) => {
return state.devices;
},
};