2020-07-02 17:09:14 -04:00
|
|
|
import Vue from 'vue';
|
2020-10-29 14:09:11 -04:00
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2020-07-02 17:09:14 -04:00
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2020-10-28 20:08:36 -04:00
|
|
|
import AlertSettingsWrapper from './components/alerts_settings_wrapper.vue';
|
2020-07-02 17:09:14 -04:00
|
|
|
|
2020-10-29 14:09:11 -04:00
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
2020-07-02 17:09:14 -04:00
|
|
|
export default el => {
|
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
|
|
|
prometheusActivated,
|
|
|
|
prometheusUrl,
|
|
|
|
prometheusAuthorizationKey,
|
|
|
|
prometheusFormPath,
|
|
|
|
prometheusResetKeyPath,
|
|
|
|
prometheusApiUrl,
|
|
|
|
activated: activatedStr,
|
|
|
|
alertsSetupUrl,
|
|
|
|
alertsUsageUrl,
|
|
|
|
formPath,
|
|
|
|
authorizationKey,
|
|
|
|
url,
|
2020-07-15 02:09:35 -04:00
|
|
|
opsgenieMvcAvailable,
|
|
|
|
opsgenieMvcFormPath,
|
|
|
|
opsgenieMvcEnabled,
|
|
|
|
opsgenieMvcTargetUrl,
|
2020-10-29 14:09:11 -04:00
|
|
|
projectPath,
|
2020-07-02 17:09:14 -04:00
|
|
|
} = el.dataset;
|
|
|
|
|
2020-10-29 14:09:11 -04:00
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
cacheConfig: {},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
});
|
|
|
|
|
|
|
|
apolloProvider.clients.defaultClient.cache.writeData({
|
|
|
|
data: {},
|
|
|
|
});
|
|
|
|
|
2020-07-02 17:09:14 -04:00
|
|
|
return new Vue({
|
|
|
|
el,
|
2020-08-19 08:10:17 -04:00
|
|
|
provide: {
|
|
|
|
prometheus: {
|
2020-11-04 07:09:14 -05:00
|
|
|
active: parseBoolean(prometheusActivated),
|
|
|
|
url: prometheusUrl,
|
|
|
|
authKey: prometheusAuthorizationKey,
|
2020-08-19 08:10:17 -04:00
|
|
|
prometheusFormPath,
|
|
|
|
prometheusResetKeyPath,
|
|
|
|
prometheusApiUrl,
|
|
|
|
},
|
|
|
|
generic: {
|
|
|
|
alertsSetupUrl,
|
|
|
|
alertsUsageUrl,
|
2020-11-04 07:09:14 -05:00
|
|
|
active: parseBoolean(activatedStr),
|
2020-08-19 08:10:17 -04:00
|
|
|
formPath,
|
2020-11-04 07:09:14 -05:00
|
|
|
authKey: authorizationKey,
|
2020-08-19 08:10:17 -04:00
|
|
|
url,
|
|
|
|
},
|
|
|
|
opsgenie: {
|
|
|
|
formPath: opsgenieMvcFormPath,
|
2020-11-04 07:09:14 -05:00
|
|
|
active: parseBoolean(opsgenieMvcEnabled),
|
2020-08-19 08:10:17 -04:00
|
|
|
opsgenieMvcTargetUrl,
|
2020-10-28 20:08:36 -04:00
|
|
|
opsgenieMvcIsAvailable: parseBoolean(opsgenieMvcAvailable),
|
2020-08-19 08:10:17 -04:00
|
|
|
},
|
2020-10-29 14:09:11 -04:00
|
|
|
projectPath,
|
2020-08-19 08:10:17 -04:00
|
|
|
},
|
2020-10-29 14:09:11 -04:00
|
|
|
apolloProvider,
|
2020-08-19 08:10:17 -04:00
|
|
|
components: {
|
2020-10-28 20:08:36 -04:00
|
|
|
AlertSettingsWrapper,
|
2020-08-19 08:10:17 -04:00
|
|
|
},
|
2020-07-02 17:09:14 -04:00
|
|
|
render(createElement) {
|
2020-10-28 20:08:36 -04:00
|
|
|
return createElement('alert-settings-wrapper');
|
2020-07-02 17:09:14 -04:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|