Skip to content

Commit

Permalink
add monit system service in monit configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
satkunas committed Dec 8, 2022
1 parent 47560ba commit f82d5de
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<b-alert :show="isModified" variant="warning" fade>
<h4 class="alert-heading" v-t="'Warning'"/>
<p>
{{ $t('Some services must be restarted to load the new settings.') }}
<span v-html="$t('Creating or modifying the monit configuration requires to restart the monit service.')"></span>
</p>
<base-button-system-service service="monit" restart start stop
:disabled="isLoading" class="mr-1" size="sm"/>
</b-alert>
</template>
<script>
import {
BaseButtonSystemService
} from '@/components/new/'
const components = {
BaseButtonSystemService
}
const props = {
isLoading: {
type: Boolean,
default: true
},
isModified: {
type: Boolean,
default: true
}
}
const setup = () => {}
// @vue/component
export default {
name: 'alert-services',
inheritAttrs: false,
components,
props,
setup
}
</script>

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
:schema="schema"
:isLoading="isLoading"
>
<div
class="alert alert-warning mx-3"
>{{ $t('Modifying this configuration requires to restart monit using the following command: `systemctl restart monit`') }}</div>

<form-group-status namespace="status"
:column-label="$i18n.t('Status')"
:text="$i18n.t('Whether or not monit should be enabled on this system. Enabling or disabling the service requires to run the following command: `/usr/local/pf/bin/pfcmd service pf updatesystemd`')"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
AlertServices,
BaseView,

FormButtonBar,
TheForm
} from './'
Expand All @@ -10,18 +10,36 @@ const components = {
TheForm
}

import { computed } from '@vue/composition-api'
import { renderHOCWithScopedSlots } from '@/components/new/'
import { useViewResource, useViewResourceProps as props } from '../../_composables/useViewResource'

import * as resource from '../_composables/useResource'
const setup = (props, context) => useViewResource(resource, props, context)

const setup = (props, context) => {

const viewResource = useViewResource(resource, props, context)
const {
isLoading,
isModified
} = viewResource

const scopedSlotProps = computed(() => ({ ...props, isLoading: isLoading.value, isModified: isModified.value }))

return {
...viewResource,
scopedSlotProps
}
}

const render = renderHOCWithScopedSlots(BaseView, { components, props, setup }, {
buttonsPrepend: AlertServices
})

// @vue/component
export default {
name: 'the-view',
extends: BaseView,
inheritAttrs: false,
components,
props,
setup
render
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BaseFormGroupTextarea,
BaseFormGroupToggleDisabledEnabled
} from '@/components/new/'
import AlertServices from './AlertServices'
import TheForm from './TheForm'
import TheView from './TheView'

Expand All @@ -18,7 +19,8 @@ export {
BaseFormGroupToggleDisabledEnabled as FormGroupStatus,
BaseFormGroupInput as FormGroupSubjectPrefix,

BaseViewResource as BaseView,
BaseViewResource as BaseView,
AlertServices,
TheForm,
TheView
}

0 comments on commit f82d5de

Please sign in to comment.