debian-mirror-gitlab/app/assets/javascripts/serverless/serverless_bundle.js

68 lines
1.8 KiB
JavaScript
Raw Normal View History

2019-02-15 15:39:39 +05:30
import Vue from 'vue';
2019-03-02 22:35:43 +05:30
import FunctionDetails from './components/function_details.vue';
2021-03-11 19:13:27 +05:30
import Functions from './components/functions.vue';
2019-07-07 11:18:12 +05:30
import { createStore } from './store';
2019-02-15 15:39:39 +05:30
export default class Serverless {
constructor() {
2019-03-02 22:35:43 +05:30
if (document.querySelector('.js-serverless-function-details-page') != null) {
2020-10-24 23:57:45 +05:30
const entryPointData = document.querySelector('.js-serverless-function-details-page').dataset;
const store = createStore(entryPointData);
2019-03-02 22:35:43 +05:30
const {
serviceName,
serviceDescription,
serviceEnvironment,
serviceUrl,
serviceNamespace,
servicePodcount,
2019-07-07 11:18:12 +05:30
serviceMetricsUrl,
prometheus,
2020-10-24 23:57:45 +05:30
} = entryPointData;
2019-03-02 22:35:43 +05:30
const el = document.querySelector('#js-serverless-function-details');
2019-02-15 15:39:39 +05:30
2019-03-02 22:35:43 +05:30
const service = {
name: serviceName,
description: serviceDescription,
environment: serviceEnvironment,
url: serviceUrl,
namespace: serviceNamespace,
podcount: servicePodcount,
2019-07-07 11:18:12 +05:30
metricsUrl: serviceMetricsUrl,
2019-03-02 22:35:43 +05:30
};
2019-02-15 15:39:39 +05:30
2019-03-02 22:35:43 +05:30
this.functionDetails = new Vue({
el,
2020-10-24 23:57:45 +05:30
store,
2019-03-02 22:35:43 +05:30
render(createElement) {
return createElement(FunctionDetails, {
props: {
2019-07-07 11:18:12 +05:30
func: service,
hasPrometheus: prometheus !== undefined,
2019-03-02 22:35:43 +05:30
},
});
},
});
} else {
2020-10-24 23:57:45 +05:30
const entryPointData = document.querySelector('.js-serverless-functions-page').dataset;
const store = createStore(entryPointData);
2019-03-02 22:35:43 +05:30
2019-07-07 11:18:12 +05:30
const el = document.querySelector('#js-serverless-functions');
this.functions = new Vue({
el,
2020-10-24 23:57:45 +05:30
store,
2019-07-07 11:18:12 +05:30
render(createElement) {
2020-10-24 23:57:45 +05:30
return createElement(Functions);
2019-07-07 11:18:12 +05:30
},
});
2019-05-30 16:15:17 +05:30
}
}
2019-02-15 15:39:39 +05:30
destroy() {
this.destroyed = true;
this.functions.$destroy();
2019-03-02 22:35:43 +05:30
this.functionDetails.$destroy();
2019-02-15 15:39:39 +05:30
}
}