Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion app/components/sidebar/logs/Logs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default Vue.extend({
name: "logs",
computed: mapState(["running", "currentProject", "textLog"]),
watch: {
'$store.state.textLog': throttle(function (_) {
"$store.state.textLog": throttle(function (_) {
this.$nextTick(() => {
const wrapper = this.$refs.logsWrapper as HTMLElement;
if (wrapper) {
Expand Down
42 changes: 37 additions & 5 deletions app/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const SERVICE_NOTES = {
"shepherd-run": "Code runner",
"shepherd-watch": "Status information",
"shepherd-ws": "Logs and images",
"hopper": "Logs and images",
hopper: "Logs and images",
};

export interface StatusSummary {
Expand Down Expand Up @@ -175,6 +175,8 @@ const MESSAGE_RUN = "RUN";
const MESSAGE_STOP = "STOP";
const MESSAGE_SAVED = "SAVED";
const MESSAGE_JSON_ERROR = "JSON_ERROR";
const MESSAGE_TEAM_IMAGE = "TEAM_IMAGE";
const MESSAGE_PATCH = "PATCH";

// Create a promise which resolves after a certain time
export function wait(time: number): Promise<number> {
Expand Down Expand Up @@ -584,24 +586,54 @@ export default new Vuex.Store<State>({
},

/**Upload a new team logo image*/
[ACTION_UPLOAD_TEAM_LOGO]({ state }, file: File) {
[ACTION_UPLOAD_TEAM_LOGO]({ state, dispatch }, file: File) {
const formData = new FormData();
formData.append("team-image.jpg", file);

return fetch("/upload/team-image", {
fetch("/upload/team-image", {
method: "POST",
body: formData,
}).then((resp) => {
if (!resp.ok) {
console.error(resp);
dispatch(ACTION_SHOW_MESSAGE, {
id: MESSAGE_TEAM_IMAGE,
message: "Failed to upload team image, check console for details.",
icon: "exclamation-circle",
});
} else {
dispatch(ACTION_SHOW_MESSAGE, {
id: MESSAGE_TEAM_IMAGE,
message: "Team image uploaded",
icon: "info-circle",
});
}
});
},

/**Upload a patch file*/
[ACTION_UPLOAD_PATCH]({ state }, file: File) {
[ACTION_UPLOAD_PATCH]({ state, dispatch }, file: File) {
const formData = new FormData();
formData.append("patch.zip", file);

return fetch("/patch/upload", {
fetch("/patch/upload", {
method: "POST",
body: formData,
}).then((resp) => {
if (!resp.ok) {
console.error(resp);
dispatch(ACTION_SHOW_MESSAGE, {
id: MESSAGE_PATCH,
message: "Failed to upload patch, check console for details.",
icon: "exclamation-circle",
});
} else {
dispatch(ACTION_SHOW_MESSAGE, {
id: MESSAGE_PATCH,
message: "Patching robot...",
icon: "info-circle",
});
}
});
},

Expand Down
Loading