Version: v0.0.0-...-f9dcdfb Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2017 License: Apache-2.0 Imports: 11 Imported by: 0



Package sharebutton provides a Button element that is used in the sidebar of the web UI, to share the selected items with a share claim. On success, the URL that can be used to share the items is displayed in a dialog. If the one item is a file, the URL can be used directly to fetch the file. If the one item is a directory, the URL should be used with camget -shared. If several (file or directory) items are selected, a new directory blob containing these items is created, and is the item getting shared instead.



This section is empty.


This section is empty.


func New

func New(key string, config map[string]string, cbs *Callbacks) react.Element

New returns the button element. It should be used as the entry point, to create the needed React element.

key is the id for when the button is in a list, see

config is the web UI config that was fetched from the server.

cbs is a wrapper around the callback functions required by this component.


type Callbacks

type Callbacks struct {

	// GetSelection returns the list of items selected for sharing.
	GetSelection func() []SharedItem `js:"getSelection"`

	// ShowSharedURL displays in a dialog an anchor with anchorURL for its
	// href and anchorText for its text.
	ShowSharedURL func(anchorURL string, anchorText string) `js:"showSharedURL"`
	// contains filtered or unexported fields

Callbacks defines the callbacks that must be provided when creating a ShareItemsBtn instance.

type ShareItemsBtnDef

type ShareItemsBtnDef struct {

ShareItemsBtnDef is the definition for the button, that Renders as a React Button.

func (ShareItemsBtnDef) OnClick

On success, handleShareSelection calls d.showSharedURL with the URL that can be used to share the item. If the item is a file, the URL can be used directly to fetch the file. If the item is a directory, the URL should be used with camget -shared.

func (ShareItemsBtnDef) Props

Props is an auto-generated proxy to the current props of ShareItemsBtn

func (ShareItemsBtnDef) Render

func (d ShareItemsBtnDef) Render() react.Element

func (ShareItemsBtnDef) ShouldComponentUpdateIntf

func (s ShareItemsBtnDef) ShouldComponentUpdateIntf(nextProps react.Props, prevState, nextState react.State) bool

type ShareItemsBtnElem

type ShareItemsBtnElem struct {

type ShareItemsBtnProps

type ShareItemsBtnProps struct {
	// contains filtered or unexported fields

func (ShareItemsBtnProps) EqualsIntf

func (s ShareItemsBtnProps) EqualsIntf(val react.Props) bool

func (ShareItemsBtnProps) IsProps

func (s ShareItemsBtnProps) IsProps()

IsProps is an auto-generated definition so that ShareItemsBtnProps implements the interface.

type SharedItem

type SharedItem map[string]string

SharedItem's only purpose is of documentation, since we can't enforce the type and the fields of what we get from javascript through GetSelection. A SharedItem's expected keys are:

"blobRef": "sha1-foo",
"isDir": "boolString",

where "sha1-foo" is the ref of a file or a dir to share. and the value for "isDir", interpreted as a boolean with strconv, reports whether the ref is of a dir.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL