Storage Selector

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am working on one of my widgets and got to the point where i need the storage selector. My question is where are these three script files located.
 
bower_components/angular/angular.js
bower_components/angular-bootstrap/ui-bootstrap-tpls.js
bower_components/component-storage-selector/dist/storage-selector.js

It said i needed those files to be added but i didn't know where exactly those were located. If you can give me a hint then i should be good to go. Thanks
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Donna Peplinskie

Donna Peplinskie

  • 7,142 Points 5k badge 2x thumb
Hey William,

You can bring in the Storage selector component using Bower:
bower install https://github.com/Rise-Vision/component-storage-selector.git
The component is an Angular directive so it needs to be used in an Angular app. You can find the Github repo for the component here. If you'd like to see an example of its usage, please refer to the URL component.

Thx.
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Ok i have that in there without any errors but I'm still confused on adding the storage icon in. When i add the button in from the documentation i get a grey button and not the normal icon that is supposed to be there. Might be a css file I'm missing. I can click and get the popup with an error about no company id. I also don't understand the Your_comapny_id. Is that supplied automatically through the components or is that something ill have to work in as well.

In reality i wish there was a good template to go by on this because the documentation is either incomplete or hard to follow unless you really know what your doing. 
Photo of Stuart Lees

Stuart Lees, Employee

  • 586 Points 500 badge 2x thumb
Hi William,

You will need to use our common style CSS in order for the storage icon to appear correctly. The repo to link to in your bower file is common-style and the file you will need to import is rise.min.css. This CSS file should be imported when using any of our Rise Vision components as it provides all our common styling.

The "YOUR_COMPANY_ID" is just signify that you will need to provide a company id for the storage selector directive to use, which you provide as the value of the "company-id" attribute. Eg.

<storage-selector company-id="abc123"></storage-selector>

A good template for you to follow is the test file that comes with the storage selector component repo which you can view here . This shows exactly what needs importing for the directive to work in your Angular app. 

Thanks,
Stu
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Thats better the css file is working the way it should. Thanks for that and i do believe i figured out a few other things as well. My next question would be on the company id. I want the company id of the client using the widget and not my own. So what is the best way to get that for the setting page. Would i need to do something like this in my settings js or is there a better way. 

gadgets.rpc.call("", "rsparam_get", null, id, "companyId");
Photo of Stuart Lees

Stuart Lees, Employee

  • 586 Points 500 badge 2x thumb
Hi William,

Yes, you can retrieve the company id via RVA in that way. However, if you are developing your own widget settings to be an Angular app then I would recommend reviewing existing widget settings source code to get an understanding of how to set up your own.

A fairly straight forward one to review would be Web Page Widget. In the settings.html file you will notice an import for a file called widget-settings-ui-core.js which the repo for is here . This import (along with the gadgets.min.js file) makes it easy for you to save settings to RVA and also provide an abstracted retrieval of the company id to which you can easily bind a value to - see here. This is what you'll want to do with your usage of Storage Selector. 

Thanks,
Stu
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
I pretty much took the video widget settings and applied that to my widget settings since its for video on android. They have almost the same exact settings. Im in the process of testing the storage button now but I'm getting company not found on my account. My only question is does that happen if your not subscribed? I will probably make a fake company with a 30 day trial just to test as well because i use my own storage on my main account. 
(Edited)
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Ok i tested and the storage worked for me. Thanks for the help on this. 
Photo of Stuart Lees

Stuart Lees, Employee

  • 586 Points 500 badge 2x thumb
Great! Glad to help.