Formatted according to eslint

This commit is contained in:
Maximilian Giller 2021-01-03 12:31:24 +01:00
parent 444acaf046
commit a2473bd06d
6 changed files with 388 additions and 393 deletions

View file

@ -1,6 +1,5 @@
<template>
<form @submit="submitForm">
<b-input-group id="form">
<b-form-input
id="name"
@ -49,16 +48,17 @@ export default {
// Try to login
store
.dispatch("addProject", {
name: this.form.name,
name: this.form.name
})
.then(() => {
this.form.name = "";
this.working = false;
}).catch((e) => {
})
.catch(e => {
console.log(e);
this.working = false;
})
});
return false;
}

View file

@ -72,13 +72,13 @@ export default {
sortDesc: {
required: false,
type: Boolean,
default: false,
default: false
},
running: {
required: false,
type: Boolean,
default: false,
},
default: false
}
},
data() {
return {
@ -86,31 +86,31 @@ export default {
requiredFields: [
{
key: "project",
label: "Project",
label: "Project"
},
{
key: "start",
label: "Start",
label: "Start"
},
{
key: "duration",
label: "Duration",
label: "Duration"
},
{
key: "details",
label: "Details",
},
label: "Details"
}
],
runningFields: [
{
key: "abort",
label: "Abort",
label: "Abort"
},
{
key: "stop",
label: "Stop",
},
],
label: "Stop"
}
]
};
},
computed: {
@ -125,7 +125,7 @@ export default {
}
return fields;
},
}
},
methods: {
getDurationTimestamp: helperService.getDurationTimestamp,
@ -147,8 +147,8 @@ export default {
detailsRecord: function(id) {
return id;
// this.$router.push("/record/" + id);
},
},
}
}
};
</script>

View file

@ -10,7 +10,7 @@ export const juggl = {
usingFinishedRecords: false,
usingRunningRecords: false,
usingProjects: false,
recordsLimit: 0,
recordsLimit: 0
},
mutations: {
setKey(state, key) {
@ -46,35 +46,31 @@ export const juggl = {
state.auth = { apiKey: apiKey, userId: userId };
localStorage.setItem("apiKey", apiKey);
localStorage.setItem("userId", userId);
},
}
},
getters: {
runningRecords: (state) => {
return Object.values(state.records).filter(
(record) => record.running
);
runningRecords: state => {
return Object.values(state.records).filter(record => record.running);
},
finishedRecords: (state) => {
return Object.values(state.records).filter(
(record) => !record.running
);
finishedRecords: state => {
return Object.values(state.records).filter(record => !record.running);
},
auth: (state) => state.auth,
apiUrl: (state) => state.apiUrl,
user: (state) => state.user,
isLoggedIn: (state) => !!state.auth,
records: (state) => state.records,
projects: (state) => state.projects,
projectIds: (state) => {
auth: state => state.auth,
apiUrl: state => state.apiUrl,
user: state => state.user,
isLoggedIn: state => !!state.auth,
records: state => state.records,
projects: state => state.projects,
projectIds: state => {
var projectIds = [];
Object.values(state.projects).forEach((project) => {
Object.values(state.projects).forEach(project => {
projectIds.push(project.project_id);
});
return projectIds;
},
runningProjectIds: (state, getters) => {
var runningProjectIds = [];
Object.values(getters.runningRecords).forEach((record) => {
Object.values(getters.runningRecords).forEach(record => {
var projectId = record.project_id;
if (runningProjectIds.includes(runningProjectIds) === false) {
runningProjectIds.push(projectId);
@ -84,36 +80,34 @@ export const juggl = {
},
finishedProjectIds: (state, getters) => {
var runningProjectIds = getters.runningProjectIds;
return getters.projectIds.filter(
(id) => !runningProjectIds.includes(id)
);
return getters.projectIds.filter(id => !runningProjectIds.includes(id));
},
finishedProjects: (state, getters) => {
var ids = getters.finishedProjectIds;
return Object.values(state.projects).filter((project) =>
return Object.values(state.projects).filter(project =>
ids.includes(project.project_id)
);
},
runningProjects: (state, getters) => {
var ids = getters.runningProjectIds;
return Object.values(state.projects).filter((project) =>
return Object.values(state.projects).filter(project =>
ids.includes(project.project_id)
);
},
getProjectById: (state, getters) => (id) => {
getProjectById: (state, getters) => id => {
return Object.values(getters.projects).find(
(project) => project.project_id === id
project => project.project_id === id
);
},
getRecordById: (state, getters) => (id) => {
getRecordById: (state, getters) => id => {
return Object.values(getters.records).find(
(record) => record.record_id === id
record => record.record_id === id
);
},
}
},
actions: {
loadProjects({ commit }) {
return jugglService.getProjects().then((r) => {
return jugglService.getProjects().then(r => {
commit("setProjects", r.data.projects);
commit("usingProjects", true);
});
@ -124,24 +118,26 @@ export const juggl = {
.catch(() => {
return false;
})
.then((r) => {
.then(r => {
commit("setUser", r.data.users[0]);
return true;
});
},
loadRecords({ commit, state }, { limit, finished }) {
commit("setRecordsLimit", limit);
return jugglService.getRecords({ limit: state.recordsLimit, finished: finished }).then((r) => {
return jugglService
.getRecords({ limit: state.recordsLimit, finished: finished })
.then(r => {
commit("setRecords", r.data.records);
commit("usingFinishedRecords", true);
commit("usingRunningRecords", true);
});
},
loadRunningRecords({ commit, getters }) {
return jugglService.getRunningRecords().then((r) => {
return jugglService.getRunningRecords().then(r => {
var allRecords = {
...getters.finishedRecords,
...r.data.records,
...r.data.records
};
commit("setRecords", allRecords);
commit("usingRunningRecords", true);
@ -160,7 +156,7 @@ export const juggl = {
this.dispatch("logout");
return false;
})
.then((r) => {
.then(r => {
if (r === false) {
this.dispatch("logout");
return false;
@ -239,6 +235,6 @@ export const juggl = {
}
commit("login", { apiKey: apiKey, userId: userId });
},
},
}
}
};

View file

@ -39,5 +39,4 @@ export default {
};
</script>
<style lang="sass">
</style>
<style lang="sass"></style>