{{#section/base-editor document=document folder=folder page=page busy=waiting tip="Papertrail cloud logging service (https://papertrailapp.com)" isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}

	<div class="pull-left width-45">
		<form {{ action 'auth' on="submit" }} >
			<div class="input-control">
				<label>Papertrail API Key</label>
				<div class="tip">API Token (from your profile)</div>
				{{focus-input id="papertrail-apitoken" type="password" value=config.APIToken }}
			</div>
			<div class="regular-button button-blue" {{ action 'auth' }} >
				{{#if authenticated}}
					Re-Authenticate
				{{else}}
					Authenticate
				{{/if}}
			</div>
		</form>
	</div>

	{{#if authenticated}}
		<div class="pull-left width-10">&nbsp;</div>
		<div class="pull-left width-45">
			<form {{action 'onAction' on="submit"}}>
				<div class="input-control">
					<label>Search query</label>
					<div class="tip">Determine which log entries you want to display e.g. bob OR ("some phrase" AND sally)</div>
					{{input id="papertrail-query" type="text" class="mousetrap" value=config.query}}
				</div>
				<div class="input-control">
					<label>Maximum results</label>
					<div class="tip">How many log entries do you want?</div>
					{{input id="papertrail-max" type="number" class="mousetrap" value=config.max}}
				</div>
				<div class="input-control">
					<label>Group</label>
					<div class="tip">Optional Papertrail group</div>
					{{ui-select id="group-dropdown" prompt="<group>" content=options.groups action=(action 'onGroupsChange') optionValuePath="id" optionLabelPath="name" selection=config.group}}
				</div>
			</form>
		</div>
	{{/if}}

	<div class="clearfix" />

{{/section/base-editor}}
