sharebutton

package
v0.0.0-...-a5a65f0 Latest Latest
Warning

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

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

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 https://facebook.github.io/react/docs/lists-and-keys.html

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

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

Types

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 {
	react.ComponentDef
}

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 {
	react.Element
}

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 myitcv.io/react.Props 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
y or Y : Canonical URL