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

Add build step for cloudbuild workflow #63

Merged
merged 9 commits into from
Oct 17, 2023
5 changes: 5 additions & 0 deletions locales/cs/flashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"Add new device": "Přidat zařízení",
"Available devices": "Dostupná zařízení",
"Build": "Sestavit",
"Build finished": "Build finished",
"Building": "Sestavuji",
"Building firmware with specified configurations": "Sestavuji firmware s vybranou konfigurací",
"Building on server": "Building on server",
"Built": "Sestaveno",
"Cancel": "Zrušit",
"Click here to select firmware file, or drag it here to upload.": "Vyberte firmware nebo ho sem přetáhňete",
Expand All @@ -30,6 +32,7 @@
"Could not unlock device: {{message}}": "Could not unlock device: {{message}}",
"Could not use firmware": "Nemohu použít firmware",
"Could not write new firmware to radio": "Nemohu zapsat firmware do rádia",
"Created": "Created",
"Details": "Detaily",
"Device firmware may be read protected, preventing updates": "Device firmware may be read protected, preventing updates",
"Device successfully unlocked! You will need to re-enter DFU mode to continue flashing": "Device successfully unlocked! You will need to re-enter DFU mode to continue flashing",
Expand All @@ -47,6 +50,7 @@
"Erasing": "Mazání",
"Error": "Chyba",
"Existing firmware erased": "Stávající firmware smazán",
"Failed": "Failed",
"Filters": "Filtry",
"Firmware": "Firmware",
"Firmware build completed": "Firmware sestaven",
Expand All @@ -61,6 +65,7 @@
"Flashing done": "Zapisování dokončeno",
"Flashing EdgeTX": "Zapisování EdgeTX",
"Go back": "Zpět",
"In queue": "In queue",
"Include pre-releases": "Include pre-releases",
"Loading commits...": "Stahuji commity...",
"Loading pull requests...": "Stahuji pull requesty...",
Expand Down
5 changes: 5 additions & 0 deletions locales/de/flashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"Add new device": "Neues Gerät hinzufügen",
"Available devices": "Verfügbare Geräte",
"Build": "Build",
"Build finished": "Build finished",
"Building": "Baut",
"Building firmware with specified configurations": "Bauen von Firmware mit vorgegebenen Konfigurationen",
"Building on server": "Building on server",
"Built": "Gebaut",
"Cancel": "Abbrechen",
"Click here to select firmware file, or drag it here to upload.": "Klicken Sie hier, um die Firmware-Datei auszuwählen, oder ziehen Sie sie zum Hochladen hierher.",
Expand All @@ -30,6 +32,7 @@
"Could not unlock device: {{message}}": "Could not unlock device: {{message}}",
"Could not use firmware": "Firmware konnte nicht verwendet werden",
"Could not write new firmware to radio": "Neue Firmware konnte nicht in den Sender geschrieben werden",
"Created": "Created",
"Details": "Einzelheiten",
"Device firmware may be read protected, preventing updates": "Device firmware may be read protected, preventing updates",
"Device successfully unlocked! You will need to re-enter DFU mode to continue flashing": "Device successfully unlocked! You will need to re-enter DFU mode to continue flashing",
Expand All @@ -47,6 +50,7 @@
"Erasing": "Lösche",
"Error": "Fehler",
"Existing firmware erased": "Vorhandene Firmware gelöscht",
"Failed": "Failed",
"Filters": "Filter",
"Firmware": "Firmware",
"Firmware build completed": "Firmware-Bau abgeschlossen",
Expand All @@ -61,6 +65,7 @@
"Flashing done": "Flashen fertig",
"Flashing EdgeTX": "Flashe EdgeTX",
"Go back": "Zurück",
"In queue": "In queue",
"Include pre-releases": "Vorabversionen einbeziehen",
"Loading commits...": "Commits werden geladen...",
"Loading pull requests...": "Pull-Requests werden geladen...",
Expand Down
5 changes: 5 additions & 0 deletions locales/es/flashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"Add new device": "Add new device",
"Available devices": "Available devices",
"Build": "Build",
"Build finished": "Build finished",
"Building": "Building",
"Building firmware with specified configurations": "Building firmware with specified configurations",
"Building on server": "Building on server",
"Built": "Built",
"Cancel": "Cancel",
"Click here to select firmware file, or drag it here to upload.": "Click here to select firmware file, or drag it here to upload.",
Expand All @@ -30,6 +32,7 @@
"Could not unlock device: {{message}}": "Could not unlock device: {{message}}",
"Could not use firmware": "Could not use firmware",
"Could not write new firmware to radio": "Could not write new firmware to radio",
"Created": "Created",
"Details": "Details",
"Device firmware may be read protected, preventing updates": "Device firmware may be read protected, preventing updates",
"Device successfully unlocked! You will need to re-enter DFU mode to continue flashing": "Device successfully unlocked! You will need to re-enter DFU mode to continue flashing",
Expand All @@ -47,6 +50,7 @@
"Erasing": "Erasing",
"Error": "Error",
"Existing firmware erased": "Existing firmware erased",
"Failed": "Failed",
"Filters": "Filters",
"Firmware": "Firmware",
"Firmware build completed": "Firmware build completed",
Expand All @@ -61,6 +65,7 @@
"Flashing done": "Flashing done",
"Flashing EdgeTX": "Flashing EdgeTX",
"Go back": "Go back",
"In queue": "In queue",
"Include pre-releases": "Include pre-releases",
"Loading commits...": "Loading commits...",
"Loading pull requests...": "Loading pull requests...",
Expand Down
7 changes: 6 additions & 1 deletion locales/fr/flashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,10 @@
"Writing new firmware to radio, this could take several minutes": "Writing new firmware to radio, this could take several minutes",
"You may now want to <1>setup your SD Card</1>": "You may now want to <1>setup your SD Card</1>",
"You're all set!": "You're all set!",
"Your radio has been flashed with EdgeTX": "Your radio has been flashed with EdgeTX"
"Your radio has been flashed with EdgeTX": "Your radio has been flashed with EdgeTX",
"Created": "Created",
"In queue": "In queue",
"Building on server": "Building on server",
"Build finished": "Build finished",
"Failed": "Failed"
}
5 changes: 5 additions & 0 deletions locales/it/flashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"Add new device": "Aggiungi un nuovo dispositivo",
"Available devices": "Dispositivi disponibili",
"Build": "Compila",
"Build finished": "Build finished",
"Building": "Compilando",
"Building firmware with specified configurations": "Compilando il firmware con le configurazioni specificate",
"Building on server": "Building on server",
"Built": "Compilato",
"Cancel": "Cancella",
"Click here to select firmware file, or drag it here to upload.": "Clicca qui per selezionare il file del firmware, o trascinalo qui per caricarlo.",
Expand All @@ -30,6 +32,7 @@
"Could not unlock device: {{message}}": "Impossibile sbloccare il dispositivo: {{message}}",
"Could not use firmware": "Impossibile usare il firmware",
"Could not write new firmware to radio": "Impossibile scrivere il nuovo firmware nella radio",
"Created": "Created",
"Details": "Dettagli",
"Device firmware may be read protected, preventing updates": "Il firmware del dispositivo potrebbe essere protetto in lettura, prevenendo aggiornamenti",
"Device successfully unlocked! You will need to re-enter DFU mode to continue flashing": "Dispositivo sbloccato con successo! Rientra in modalità DFU per continuare il flash",
Expand All @@ -47,6 +50,7 @@
"Erasing": "Cancellando",
"Error": "Errore",
"Existing firmware erased": "Firmware esistente cancellato",
"Failed": "Failed",
"Filters": "Filtri",
"Firmware": "Firmware",
"Firmware build completed": "Compilamento Firmware completato",
Expand All @@ -61,6 +65,7 @@
"Flashing done": "Flash completato",
"Flashing EdgeTX": "Flash di EdgeTX",
"Go back": "Torna",
"In queue": "In queue",
"Include pre-releases": "Includi le pre-releases",
"Loading commits...": "Carico i commit...",
"Loading pull requests...": "Carico le richieste pull...",
Expand Down
5 changes: 5 additions & 0 deletions locales/ru/flashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"Add new device": "Добавить новое устройство",
"Available devices": "Доступные устройства",
"Build": "Build",
"Build finished": "Build finished",
"Building": "Сборка",
"Building firmware with specified configurations": "Сборка встроенного ПО с заданными конфигурациями",
"Building on server": "Building on server",
"Built": "Built",
"Cancel": "Отменить",
"Click here to select firmware file, or drag it here to upload.": "Нажмите здесь, чтобы выбрать файл прошивки, или перетащите его сюда, чтобы загрузить.",
Expand All @@ -30,6 +32,7 @@
"Could not unlock device: {{message}}": "Не удалось разблокировать устройство: {{message}}",
"Could not use firmware": "Не удалось использовать встроенное ПО",
"Could not write new firmware to radio": "Не удалось записать новое ПО на радио",
"Created": "Created",
"Details": "Детали",
"Device firmware may be read protected, preventing updates": "Встроенное ПО устройства может быть защищено от чтения, что предотвращает обновление",
"Device successfully unlocked! You will need to re-enter DFU mode to continue flashing": "Устройство успешно разблокировано! Вам нужно будет повторно войти в режим DFU, чтобы продолжить прошивку",
Expand All @@ -47,6 +50,7 @@
"Erasing": "Удаляется",
"Error": "Ошибка",
"Existing firmware erased": "Существующее ПО удалено",
"Failed": "Failed",
"Filters": "Фильтры",
"Firmware": "ПО",
"Firmware build completed": "Сборка ПО завершена",
Expand All @@ -61,6 +65,7 @@
"Flashing done": "Перепрошивка завершена",
"Flashing EdgeTX": "Прошивка EdgeTX",
"Go back": "Назад",
"In queue": "In queue",
"Include pre-releases": "Включать пре-релизы",
"Loading commits...": "Загрузка коммитов...",
"Loading pull requests...": "Загрузка запросов на извлечение...",
Expand Down
5 changes: 5 additions & 0 deletions locales/zh/flashing.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"Add new device": "添加新设备",
"Available devices": "可用设备",
"Build": "构建",
"Build finished": "Build finished",
"Building": "正在编译",
"Building firmware with specified configurations": "用指定配置编译固件",
"Building on server": "Building on server",
"Built": "编译好了",
"Cancel": "取消",
"Click here to select firmware file, or drag it here to upload.": "单击此处选择固件文件,或将其拖动到这里来上传。",
Expand All @@ -30,6 +32,7 @@
"Could not unlock device: {{message}}": "无法解锁设备: {{message}}",
"Could not use firmware": "无法使用固件",
"Could not write new firmware to radio": "无法写入新的固件到遥控器",
"Created": "Created",
"Details": "详情",
"Device firmware may be read protected, preventing updates": "设备固件可能被读取保护,防止更新",
"Device successfully unlocked! You will need to re-enter DFU mode to continue flashing": "设备已成功解锁!您需要重新进入 DFU 模式来继续刷写",
Expand All @@ -47,6 +50,7 @@
"Erasing": "正在擦除",
"Error": "错误",
"Existing firmware erased": "已擦除现有固件",
"Failed": "Failed",
"Filters": "过滤器",
"Firmware": "固件",
"Firmware build completed": "固件编译完成",
Expand All @@ -61,6 +65,7 @@
"Flashing done": "刷写完成",
"Flashing EdgeTX": "正在刷写 EdgeTX",
"Go back": "返回",
"In queue": "In queue",
"Include pre-releases": "包括预发布版本",
"Loading commits...": "正在加载 commits...",
"Loading pull requests...": "正在加载 pull requests...",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"apollo-link-logger": "^2.0.0",
"base64-arraybuffer": "^1.0.1",
"copy-text-to-clipboard": "^3.0.1",
"date-fns": "^2.30.0",
"debounce": "^1.2.1",
"detect-browser": "^5.3.0",
"electron-window-controls": "^1.0.23",
Expand Down
59 changes: 59 additions & 0 deletions src/renderer/components/flashing/FlashBuildStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { InfoCircleOutlined } from "@ant-design/icons";
import React, { useEffect, useState } from "react";
import { JobStatus } from "shared/backend/types";
import { format } from "date-fns";
import { TFunction, useTranslation } from "react-i18next";
import type { FlashingBuildStageStatus } from "./FlashJobTimeline";

function jobStatusText(
status: JobStatus,
t: TFunction<"flashing", undefined>
): string {
return {
VOID: t("Created"),
WAITING_FOR_BUILD: t("In queue"),
BUILD_IN_PROGRESS: t("Building on server"),
BUILD_SUCCESS: t("Build finished"),
BUILD_ERROR: t("Failed"),
}[status];
}

type Props = {
status: FlashingBuildStageStatus;
};

const FlashBuildStatus: React.FC<Props> = ({ status }) => {
const [sinceTime, setSinceTime] = useState(0);
const { t } = useTranslation("flashing");

useEffect(() => {
const interval = setInterval(() => {
setSinceTime(
Math.round((new Date().getTime() - Number(status.startedAt)) / 1000)
);
}, 500);
return () => clearInterval(interval);
}, [status]);

return (
<div
style={{
display: "flex",
alignItems: "baseline",
marginTop: 8,
marginLeft: 12,
gap: 8,
}}
>
<InfoCircleOutlined
style={{ transform: "translate(0, 2px)", color: "gray" }}
/>{" "}
<p style={{ color: "gray", border: "black" }}>
{jobStatusText(status.jobStatus as JobStatus, t)} -{" "}
{format(sinceTime * 1000, "mm:ss")}
</p>
</div>
);
};

export default FlashBuildStatus;
10 changes: 10 additions & 0 deletions src/renderer/components/flashing/FlashJobTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ import {
import { Alert, Button, Progress, Steps, Typography } from "antd";
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import FlashBuildStatus from "./FlashBuildStatus";

export type FlashingBuildStageStatus = {
jobStatus: string;
startedAt: string;
};

type FlashingStageStatus = {
progress: number;
started: boolean;
completed: boolean;
error?: string | null;
status?: FlashingBuildStageStatus | null;
};

type FlashingState = {
Expand Down Expand Up @@ -298,6 +305,9 @@ const FlashJobTimeline: React.FC<Props> = ({
<Typography.Text type={descriptionTextColor(stageStatus)}>
{stageDescription(config, stageStatus)}
</Typography.Text>
{!stageStatus.error && stageStatus.status && (
<FlashBuildStatus status={stageStatus.status} />
)}
{config.showProgess && !isSpecialError && (
<div
style={{
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/hooks/useFlashJobStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
completed
progress
error
status {
jobStatus
startedAt
}

Check warning on line 48 in src/renderer/hooks/useFlashJobStatus.ts

View check run for this annotation

Codecov / codecov/patch

src/renderer/hooks/useFlashJobStatus.ts#L45-L48

Added lines #L45 - L48 were not covered by tests
}
`),
{
Expand Down Expand Up @@ -86,6 +90,10 @@
completed
progress
error
status {
jobStatus
startedAt
}

Check warning on line 96 in src/renderer/hooks/useFlashJobStatus.ts

View check run for this annotation

Codecov / codecov/patch

src/renderer/hooks/useFlashJobStatus.ts#L93-L96

Added lines #L93 - L96 were not covered by tests
}
`),
variables: {
Expand Down
11 changes: 10 additions & 1 deletion src/renderer/pages/flash/steps/FirmwareSelectionStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ const FirmwareStep: StepComponent = ({ onNext }) => {
const { selectedFlags, encodeFlags } = useFlags(parseParam("selectedFlags"));
const { filters, encodeFilters } = useVersionFilters(parseParam("filters"));

const isCloudBuildValid =
!!version &&
!!target &&
(selectedFlags?.every((flag) => flag.name && flag.value) ?? true);

const [activeTab, setActiveTab] = useState<string>(
selectedFlags ? "cloudbuild" : "releases"
);
Expand Down Expand Up @@ -238,7 +243,11 @@ const FirmwareStep: StepComponent = ({ onNext }) => {
</DownloadFirmwareButton>
)}
<FlashButton
disabled={!target || !version || activeTab === "cloudbuild"}
disabled={
!target ||
!version ||
(activeTab === "cloudbuild" && !isCloudBuildValid)
}
onClick={() => {
onNext?.();
}}
Expand Down
Loading
Loading