VSCODE extension - How to show file save dialog - visual-studio-code

Is it possible in existing API, to show a dialog to user to save a file at custom location ?

if you want custom path and data saving, I think the best you can do is:
vscode.window.showSaveDialog({...options}).then(fileInfos => {
// here you can use fs to handle data saving
fs.writeFileSync(fileInfos.path, yourData)
});
This will prompt the user to enter a saving location and store the user choice in the fileInfos response.
Here is the doc: https://code.visualstudio.com/api/references/vscode-api#SaveDialogOptions

Yes, your extension can use the workbench.action.files.saveAs command to bring up the save as dialog for the current file.

Related

can any one tell why this save button is not enable after entering the document data?

I am working on Firebase and I am a beginner in Firebase. I want to use Firebase a back end service as well as store the data with react Js.I created the project.I select the Firestore database and create the collection. I come to the document window where I enter the field name and value of the field.But why after entering the value and field the save button is not enabled ?
After typing id press enter. It will be added
You are getting that behavior because you didn't assign an ID to the document you want to create. To solve this, simply press "Auto-ID" or type any ID of your choice and the "save" button will be enabled.

How To reuse .getText value in another page Java Selenium

I am trying to use .getText and want to use that retrieved text, on another page(Search box).
Can I get any help?
I am using Java Selenium.
Thanks
In advance.
You can use the sessionStorage and store the text using getText() add data
to the session storage and it will be accessible to any page from the same site opened in that window.
Update
SessionStorage can store up to approx 5MB of data which will be store on the browser and will be available to the pages which will be open in that tab, It means once you close the tab it will be deleted and not accessible. It expires on the closure of the tab.
String text = driver.findElement(By.xpath("//*[text()='Google offered in: ']")).getText();
WebStorage s = (WebStorage) new Augmenter().augment(driver);
SessionStorage ss =s.getSessionStorage();
ss.setItem("Text", text);
driver.findElement(By.name("q")).sendKeys(ss.getItem("Text"),Keys.ENTER);

Typo3 extbase create global array

I am using the version TYPO3 9.5.13. If a user is doing a successful login, I store the user data in the controller. If the user comes back from any view to the same controller, the user information, saved in the controller before, are gone. So it seems, that every time the user comes back to the controller a new instance of controller will be opened. PHP globals in TYPO3 are not working.
Therefore I am looking for a way, to have some data always available in the ncontroller. The extension is my own, as well the templates and the views. So if neccessary, I can make any changes.
The only way I currently see, is to send the user data to the views and from the views back to the controller. But that is not easy possible for all my views and also not a elegant way to do.
Do you have any suggestions? Thanks for your support!
You should store your user data in a session variable. this data can be acceessed globaly and TYPO3 will manage it for you. it is available for each request of the client, until he logs out or ends his session (terminate browser, ...)
Thank to Bernd, I found a solution:
$GLOBALS['TSFE']->fe_user->setkey('ses','user',$Setup);
$GLOBALS['TSFE']->storeSessionData();
I stored an array under user. Important is the second line, to store the Session data.
With the below instruction I read it into an array.
$user['user'] = $GLOBALS['TSFE']->fe_user->getKey("ses", "user" );
It is possible to store several variables und of course to change the name user.
You can clear, if you write NULL to it:
$GLOBALS['TSFE']->fe_user->setkey('ses', 'user', NULL);
$GLOBALS['TSFE']->storeSessionData();

Service Called when clicking on a document in Content Navigator

I created a response filter to change the value of our Name property for folder to make it more readable for our users. This all works and it displays fine.
But when the folder is opened or clicked on the name reverts back to what it was before before the response filter did any of it's work.
Is there a service called when a folder is open/when a folder is clicked on single click?
This is currently what I have as my filtered services.
public String[] getFilteredServices() {
return new String[] {"/cm/search","/cm/openFolder","/cm/lock","/cm/unlock","/cm/editAttributes","/cm/continueQuery" };
}
Am I just missing a service here that needs put in? I can't find anything on what service would be called when clicking on an item. Thanks in advance!
I believe it is the openItem that is being called, and it is to retrieve all the attributes of the selected item.
Also, you could figure out yourself by using your browser's network-inspector and observe the request fired at the server after you click the document - really useful!

Upload Form Input resets if error message

Is there a way to preserve the uploaded file with a input upload value if a server side error happens?
What is happening now is when the form submits it throws the error and the uploaded image that we were trying to process clears out and i have to re-attach it each time.
Is there a way to keep it stored in the form data?
Trying to not store a temp file on my server due to the space constraints
I don't believe you can set the value of an upload field, the user has to select the file each time for security reasons. If you were able to choose what file should be selected via a script it would mean you could potentially force the user to submit sensitive information.