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

Feature: Create Development tab #4089

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@
"tabOptions": {
"message": "Options"
},
"tabDevelopment": {
"message": "Development"
},

"tabSetup": {
"message": "Setup"
Expand Down Expand Up @@ -6279,7 +6282,7 @@
"message": "RSSI dBm",
"description": "Text of the RSSI dBm alarm"
},

"osdWarningTextArmingDisabled": {
"message": "Arming disabled",
"description": "One of the warnings that can be selected to be shown in the OSD"
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
<li class="tab_help" id="tab_help"><a href="#" i18n="tabHelp" class="tabicon ic_help" i18n_title="tabHelp"></a></li>
<li class="tab_options" id="tab_options"><a href="#" i18n="tabOptions" class="tabicon ic_config" i18n_title="tabOptions"></a></li>
<li class="tab_firmware_flasher" id="tabFirmware"><a href="#" i18n="tabFirmwareFlasher" class="tabicon ic_flasher" i18n_title="tabFirmwareFlasher"></a></li>
<li class="tab_development" id="tab_development"><a href="#" i18n="tabDevelopment" class="tabicon ic_config" i18n_title="tabDevelopment"></a></li>
</ul>
<ul class="mode-connected">
<li class="tab_setup"><a href="#" i18n="tabSetup" class="tabicon ic_setup" i18n_title="tabSetup"></a></li>
Expand Down
6 changes: 6 additions & 0 deletions src/js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Switchery from 'switchery-latest';
import jBox from 'jbox';
import $ from 'jquery';

const appMode = import.meta.env.MODE;

const TABS = {};

const GUI_MODES = {
Expand Down Expand Up @@ -60,6 +62,10 @@ class GuiControl {
'transponder',
];

if (appMode === 'development') {
this.defaultAllowedTabsWhenDisconnected.push('development');
}

this.defaultAllowedFCTabsWhenConnected = [ ...this.defaultAllowedTabs, ...this.defaultCloudBuildTabOptions];

this.allowedTabs = this.defaultAllowedTabsWhenDisconnected;
Expand Down
7 changes: 7 additions & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ function appReady() {

cleanupLocalStorage();

updateTabList();

i18n.init(function() {

// pass the configurator version as a custom header for every AJAX request.
Expand Down Expand Up @@ -435,6 +437,11 @@ function startProcess() {
presets.initialize(content_ready),
);
break;
case 'development':
import("./tabs/development").then(({ development }) =>
development.initialize(content_ready),
);
break;

default:
console.log(`Tab not found: ${tab}`);
Expand Down
25 changes: 25 additions & 0 deletions src/js/tabs/development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import GUI, { TABS } from '../gui';
import { i18n } from '../localization';
import $ from 'jquery';

const development = {};
development.initialize = function (callback) {

if (GUI.active_tab != 'development') {
GUI.active_tab = 'development';
}

$('#content').load("./tabs/development.html", function () {
i18n.localizePage();

GUI.content_ready(callback);
});
};

development.cleanup = function (callback) {
if (callback) callback();
};

TABS.development = development;

export { development };
13 changes: 9 additions & 4 deletions src/js/utils/updateTabList.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import $ from 'jquery';
import FC from '../fc';

const appMode = import.meta.env.MODE;

export function updateTabList(features) {
const isExpertModeEnabled = $('input[name="expertModeCheckbox"]').is(':checked');
const isDevelopmentMode = appMode === 'development';

$('#tabs ul.mode-disconnected li.tab_development').toggle(isDevelopmentMode);

$('#tabs ul.mode-connected li.tab_failsafe').toggle(isExpertModeEnabled);
$('#tabs ul.mode-connected li.tab_adjustments').toggle(isExpertModeEnabled);
$('#tabs ul.mode-connected li.tab_sensors').toggle(isExpertModeEnabled);
$('#tabs ul.mode-connected li.tab_logging').toggle(isExpertModeEnabled);
$('#tabs ul.mode-connected li.tab_servos').toggle(isExpertModeEnabled && FC.CONFIG?.buildOptions?.includes('USE_SERVOS'));

$('#tabs ul.mode-connected li.tab_gps').toggle(features.isEnabled('GPS'));
$('#tabs ul.mode-connected li.tab_led_strip').toggle(features.isEnabled('LED_STRIP'));
$('#tabs ul.mode-connected li.tab_transponder').toggle(features.isEnabled('TRANSPONDER'));
$('#tabs ul.mode-connected li.tab_osd').toggle(features.isEnabled('OSD'));
$('#tabs ul.mode-connected li.tab_gps').toggle(features?.isEnabled('GPS'));
$('#tabs ul.mode-connected li.tab_led_strip').toggle(features?.isEnabled('LED_STRIP'));
$('#tabs ul.mode-connected li.tab_transponder').toggle(features?.isEnabled('TRANSPONDER'));
$('#tabs ul.mode-connected li.tab_osd').toggle(features?.isEnabled('OSD'));
}
1 change: 1 addition & 0 deletions src/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
<li class="tab_help" id="tab_help"><a href="#" i18n="tabHelp" class="tabicon ic_help" i18n_title="tabHelp"></a></li>
<li class="tab_options" id="tab_options"><a href="#" i18n="tabOptions" class="tabicon ic_config" i18n_title="tabOptions"></a></li>
<li class="tab_firmware_flasher" id="tabFirmware"><a href="#" i18n="tabFirmwareFlasher" class="tabicon ic_flasher" i18n_title="tabFirmwareFlasher"></a></li>
<li class="tab_development" id="tab_development"><a href="#" i18n="tabDevelopment" class="tabicon ic_config" i18n_title="tabDevelopment"></a></li>
</ul>
<ul class="mode-connected">
<li class="tab_setup"><a href="#" i18n="tabSetup" class="tabicon ic_setup" i18n_title="tabSetup"></a></li>
Expand Down
105 changes: 105 additions & 0 deletions src/tabs/development.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<div class="tab-development">
<div class="content_wrapper">

<div class="grid-box col1">
<div class="grid-box col2">
<div class="col-span-2">
<div class="gui_box">
<div class="gui_box_titlebar">
<div class="spacer_box_title">Wide GUI Box</div>
</div>
<div class="spacer_box">
<div>Spacer Box Content</div>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptates reiciendis magnam tempora eligendi, nobis sapiente consectetur commodi harum. Debitis voluptatibus iure provident ea esse eveniet eaque inventore? Consequatur, sapiente iste?
</div>
</div>
</div>
<div class="col-span-1">
<div class="gui_box">
<div class="gui_box_titlebar">
<div class="spacer_box_title">GUI Box</div>
</div>
<div class="spacer_box">
<div>Spacer Box Content</div>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptates reiciendis magnam tempora eligendi, nobis sapiente consectetur commodi harum. Debitis voluptatibus iure provident ea esse eveniet eaque inventore? Consequatur, sapiente iste?
</div>
</div>
</div>
<div class="col-span-1">
<div class="gui_box">
<div class="gui_box_titlebar">
<div class="spacer_box_title">GUI Box</div>
</div>
<div class="spacer_box">
<div>Spacer Box Content</div>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptates reiciendis magnam tempora eligendi, nobis sapiente consectetur commodi harum. Debitis voluptatibus iure provident ea esse eveniet eaque inventore? Consequatur, sapiente iste?
</div>
</div>
</div>
</div>

<div class="note">
<div>
Note Content
</div>
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit doloribus amet voluptas error corporis veniam recusandae adipisci a rerum distinctio asperiores omnis inventore eum, illum aut delectus vel pariatur alias.
</div>
</div>

<div class="danger">
<div>
Danger Content
</div>
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit doloribus amet voluptas error corporis veniam recusandae adipisci a rerum distinctio asperiores omnis inventore eum, illum aut delectus vel pariatur alias.
</div>
</div>

<div class="default_btn">
<a href="#">Button</a>
</div>

<div class="default_btn" style="width: fit-content">
<a href="#">Button</a>
</div>

<div class="default_btn" style="width: fit-content">
<a href="#" class="disabled">Button</a>
</div>

<label>
<input class="toggle" type="checkbox" />
<span></span>
</label>

<label>
<input class="togglesmall" type="checkbox" />
<span></span>
</label>

<select style="width: fit-content">
<option value="0">Option 1</option>
<option value="1">Option 2</option>
<option value="2">Option 3</option>
<option value="3">Option 4 with more text</option>
</select>

<input type="text" style="width: fit-content">

</div>

</div>

</div>
<div class="content_toolbar toolbar_fixed_bottom">
<div class="btn">
<a href="#">B</a>
</div>
<div class="btn">
<a href="#">Button</a>
</div>
<div class="btn">
<a href="#">Very Long Button With A Lot Of Text To Break On Small Screens</a>
</div>
</div>