Comments (3)
To address the issue where resizing the window causes the "Launch Task" modal to close and lose user inputs, you can implement a solution that preserves the modal state and user inputs across window resizes. This involves storing the modal state and user inputs when the modal is opened and restoring them when the window is resized. Here's how you can do it:
-
Save Modal State and Inputs: Create functions to save the current state of the modal and the inputs within it. Use
localStorage
to store this data. -
Restore Modal State and Inputs on Resize: Implement a function that restores the modal state and inputs from
localStorage
when the window is resized. -
Hook into Modal Open/Close Events: Ensure that the modal state is saved every time the modal is opened or closed.
Here's a simplified example of how this could be implemented in JavaScript:
// Save modal state and inputs
function saveModalState() {
const modal = document.getElementById('launchTaskModal');
const isOpen = !!modal && modal.style.display === 'block';
const inputs = modal.querySelectorAll('input, textarea');
const inputValues = Array.from(inputs).map(input => input.value);
localStorage.setItem('modalState', JSON.stringify({ isOpen, inputValues }));
}
// Restore modal state and inputs
function restoreModalState() {
const savedState = localStorage.getItem('modalState');
if (savedState) {
const { isOpen, inputValues } = JSON.parse(savedState);
const modal = document.getElementById('launchTaskModal');
const inputs = modal.querySelectorAll('input, textarea');
if (isOpen) {
modal.style.display = 'block';
inputValues.forEach((value, index) => {
if (inputs[index]) inputs[index].value = value;
});
}
}
}
// Example event listeners for window resize, modal open, and modal close
window.addEventListener('resize', restoreModalState);
document.getElementById('yourOpenModalButtonId').addEventListener('click', () => {
document.getElementById('launchTaskModal').style.display = 'block';
saveModalState();
});
document.getElementById('yourCloseModalButtonId').addEventListener('click', () => {
document.getElementById('launchTaskModal').style.display = 'none';
saveModalState();
});
// Restore modal state on page load
document.addEventListener('DOMContentLoaded', restoreModalState);
Adjust the code to match your modal's implementation details, such as the correct IDs and how your modal's visibility is managed. This approach ensures that the user's inputs and the modal's open state are preserved during window resizes, addressing the issue you've encountered.
Sources
- docs/_static/custom.js
- flyteidl/gen/pb-es/flyteidl/admin/launch_plan_pb.ts
- docs/concepts/console.rst
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
from flyte.
Thank you for opening your first issue here! 🛠
from flyte.
Ah, I see what you're saying. Unfortunately my team doesn't have the bandwidth to fix this at the moment but we'll keep this as an active issue in our backlog and perhaps someone from the community can pick it up.
from flyte.
Related Issues (20)
- [BUG] rshift '>>' operator doesn't work properly with remoteEntities HOT 2
- [Core feature] Allow flytectl to set a targetExecutionCluster HOT 1
- [BUG] Boolean values within pydantic base model being casted to scalar value HOT 1
- [Housekeeping] Files used in `data_types_and_io.normalize_csv_file` and `data_types_and_io.download_and_normalize_csv_files` are no longer accessible HOT 6
- [Core feature] Default task resource behavior should apply for node level overrides HOT 3
- [Core feature] Update/register multiple launch plans with different inputs HOT 3
- [BUG] (Kubeflow) PyTorchPlugin sets Replicas to 0 casuing infinite loop HOT 5
- [BUG] regression: envFrom provided from pod template is discarded HOT 1
- [BUG] Relaunch workflow converts large numbers in array of structs to objects. HOT 5
- [BUG] `uri` of the input with `Any` type of the workflow is incorrect when run remotely HOT 3
- [BUG] Accessing attributes fails on complex types HOT 3
- [BUG] Plugin Collector does not include group HOT 4
- [BUG] Flyte v1.11.0 will fail to load the task's input & output ran by Flyte v1.3.2 HOT 1
- [BUG] Task errors are not directly surfaced in unit tests in 1.12.0 HOT 3
- [Docs] Help messages, error messages, and documentation for `pyflyte package` unfortunately result in a very bad first-time UX HOT 1
- [Core Feature] Local logs for local container task executions. HOT 1
- [BUG] Task should not attempt to retry if fails to deserialize the input HOT 1
- [BUG] Local `FlyteFile` whose name contains spaces fail in remote execution with "File Not Found" error
- [Housekeeping] Add support for protobuf version 5 in flytekit HOT 1
- [BUG] When triggering a remote LP, Flytekit fails with TypeError: 'NoneType' object is not subscriptable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flyte.