mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Merge pull request #12523 from Godmartinz/bug/sc-20041/slack-ui-livewire-tweaks
Fixes slack settings submit button availability
This commit is contained in:
commit
df64e0e291
|
@ -11,6 +11,7 @@ class SlackSettingsForm extends Component
|
|||
public $slack_endpoint;
|
||||
public $slack_channel;
|
||||
public $slack_botname;
|
||||
public $isDisabled ='disabled' ;
|
||||
|
||||
public Setting $setting;
|
||||
|
||||
|
@ -35,6 +36,9 @@ class SlackSettingsForm extends Component
|
|||
|
||||
public function render()
|
||||
{
|
||||
if(empty($this->slack_channel || $this->slack_endpoint)){
|
||||
$this->isDisabled= 'disabled';
|
||||
}
|
||||
return view('livewire.slack-settings-form');
|
||||
}
|
||||
|
||||
|
@ -57,9 +61,11 @@ class SlackSettingsForm extends Component
|
|||
|
||||
try {
|
||||
$slack->post($this->slack_endpoint, ['body' => $payload]);
|
||||
$this->isDisabled='';
|
||||
return session()->flash('success' , 'Your Slack Integration works!');
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->isDisabled= 'disabled';
|
||||
return session()->flash('error' , trans('admin/settings/message.slack.error', ['error_message' => $e->getMessage()]));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
<div class="col-md-8 required">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
<input type="text" wire:model.lazy="slack_endpoint" class= 'form-control' placeholder="https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX" {{old('slack_endpoint', $slack_endpoint)}}>
|
||||
<input type="text" wire:model="slack_endpoint" class= 'form-control' placeholder="https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX" {{old('slack_endpoint', $slack_endpoint)}}>
|
||||
@else
|
||||
<input type="text" wire:model.lazy="slack_endpoint" class= 'form-control' placeholder="https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX" {{old('slack_endpoint', $slack_endpoint)}}>
|
||||
<input type="text" wire:model="slack_endpoint" class= 'form-control' placeholder="https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXXX" {{old('slack_endpoint', $slack_endpoint)}}>
|
||||
@endif
|
||||
{!! $errors->first('slack_endpoint', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
</div>
|
||||
|
@ -49,11 +49,11 @@
|
|||
</div>
|
||||
<div class="col-md-8 required">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<input type="text" wire:model.lazy="slack_channel" class='form-control' placeholder="#IT-Ops" value="{{old('slack_channel', $slack_channel)}}">
|
||||
<input type="text" wire:model="slack_channel" class='form-control' placeholder="#IT-Ops" value="{{old('slack_channel', $slack_channel)}}">
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
|
||||
@else
|
||||
<input type="text" wire:model.lazy="slack_channel" class= 'form-control' placeholder="#IT-Ops" value="{{old('slack_channel', $slack_channel)}}">
|
||||
<input type="text" wire:model="slack_channel" class= 'form-control' placeholder="#IT-Ops" value="{{old('slack_channel', $slack_channel)}}">
|
||||
@endif
|
||||
{!! $errors->first('slack_channel', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
</div>
|
||||
|
@ -64,20 +64,20 @@
|
|||
<div class="col-md-2">
|
||||
{{ Form::label('slack_botname', trans('admin/settings/general.slack_botname')) }}
|
||||
</div>
|
||||
<div class="col-md-8 required">
|
||||
<div class="col-md-8">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
<input type="text" wire:model.lazy="slack_botname" class= 'form-control' placeholder="Snipe-Bot" {{old('slack_botname', $slack_botname)}}>
|
||||
<input type="text" wire:model="slack_botname" class= 'form-control' placeholder="Snipe-Bot" {{old('slack_botname', $slack_botname)}}>
|
||||
<p class="text-warning"><i class="fas fa-lock"></i> {{ trans('general.feature_disabled') }}</p>
|
||||
|
||||
@else
|
||||
<input type="text" wire:model.lazy="slack_botname" class= 'form-control' placeholder="Snipe-Bot" {{old('slack_botname', $slack_botname)}}>
|
||||
<input type="text" wire:model="slack_botname" class= 'form-control' placeholder="Snipe-Bot" {{old('slack_botname', $slack_botname)}}>
|
||||
@endif
|
||||
{!! $errors->first('slack_botname', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
</div><!--col-md-10-->
|
||||
</div>
|
||||
|
||||
<!--Slack Integration Test-->
|
||||
@if($slack_endpoint != null && $slack_channel != null && $slack_botname != null)
|
||||
@if($slack_endpoint != null && $slack_channel != null)
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-8">
|
||||
<a href="#" wire:click.prevent="testSlack" class="btn btn-default btn-sm pull-left"><span>{!! trans('admin/settings/general.slack_test') !!}</span></a>
|
||||
|
@ -89,7 +89,7 @@
|
|||
<div class="box-footer" style="margin-top: 45px;">
|
||||
<div class="text-right col-md-12">
|
||||
<a class="btn btn-link text-left" href="{{ route('settings.index') }}">{{ trans('button.cancel') }}</a>
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button>
|
||||
<button type="submit" {{$isDisabled}} class="btn btn-primary"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button>
|
||||
</div>
|
||||
</div><!--box-footer-->
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue