Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "Clear all Entries" function #214

Merged
merged 6 commits into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion public/src/components/server_config/bop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:entry="entry"
v-on:remove="removeEntry"></entry>
<button v-on:click="addEntry">{{$t("add_entry_button")}}</button>
<button v-on:click="clearEntries">{{$t("clear_entries_button")}}</button>
</collapsible>
</template>

Expand Down Expand Up @@ -91,6 +92,14 @@ export default {
}

return value;
},
clearEntries(){
if (!window.confirm(this.$t("confirm_clear_entries"))) {
return;
}
while(this.entries.length > 0) {
this.entries.splice(this.entries[this.entries.length - 1], 1);
}
}
}
}
Expand All @@ -104,7 +113,9 @@ export default {
"carModel_label": "Car Model #",
"ballast_label": "Ballast: 0 to 100kg max.",
"restrictor_label": "Motor Restrictor: 0 to 20% max.",
"add_entry_button": "Add BOP"
"add_entry_button": "Add BOP",
mrpbdy marked this conversation as resolved.
Show resolved Hide resolved
"clear_entries_button": "Clear all BOP",
"confirm_clear_entries": "Do you really want to remove all BOP?"
}
}
</i18n>
15 changes: 13 additions & 2 deletions public/src/components/server_config/entrylist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
v-on:remove="removeEntry"></entry>
<checkbox :label="$t('forceentrylist_label')" v-model="forceEntryList"></checkbox>
<button v-on:click="addEntry">{{$t("add_entry_button")}}</button>
<button v-on:click="clearEntries">{{$t("clear_entries_button")}}</button>
</collapsible>
</template>

Expand Down Expand Up @@ -44,7 +45,6 @@ export default {
});
this.entryIndex++;
}

this.forceEntryList = data.forceEntryList;
},
getData() {
Expand Down Expand Up @@ -98,7 +98,16 @@ export default {
break;
}
}
},
clearEntries(){
if (!window.confirm(this.$t("confirm_clear_entries"))) {
return;
}
while(this.entries.length > 0) {
this.entries.splice(this.entries[this.entries.length - 1], 1);
}
}

}
}
</script>
Expand All @@ -108,7 +117,9 @@ export default {
"en": {
"title": "Entry List",
"forceentrylist_label": "Force Entry List",
"add_entry_button": "Add Entry"
"add_entry_button": "Add Entry",
"clear_entries_button": "Clear all Entries",
"confirm_clear_entries": "Do you really want to remove all entries?"
}
}
</i18n>
13 changes: 12 additions & 1 deletion public/src/components/server_config/event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<button v-on:click="addSession">{{$t("add_session_button")}}</button>
<button v-on:click="addDefaultSessions('Q/R')">{{$t("add_sessions_q_r_button")}}</button>
<button v-on:click="addDefaultSessions('P/Q/R')">{{$t("add_sessions_p_q_r_button")}}</button>
<button v-on:click="clearSessions">{{$t("clear_sessions_button")}}</button>
</div>
</collapsible>
</template>
Expand Down Expand Up @@ -173,6 +174,14 @@ export default {
}
}
},
clearSessions() {
if (!window.confirm(this.$t("confirm_clear_sessions"))) {
return;
}
while(this.sessions.length > 0) {
this.sessions.splice(this.sessions[this.sessions.length - 1], 1);
}
},
toFloat(value) {
if(typeof value === "string") {
return parseFloat(value.replace(",", "."));
Expand Down Expand Up @@ -202,7 +211,9 @@ export default {
"isFixedConditionQualification_label": "Is Fixed Weather Conditions in Qualification",
"add_session_button": "Add session",
"add_sessions_q_r_button": "Add sessions (Q/R)",
"add_sessions_p_q_r_button": "Add sessions (P/Q/R)"
"add_sessions_p_q_r_button": "Add sessions (P/Q/R)",
"clear_sessions_button": "Clear all Sessions",
"confirm_clear_sessions": "Do you really want to remove all sessions?"
}
}
</i18n>