2019-02-15 15:39:39 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import Functions from './components/functions.vue';
|
2019-03-02 22:35:43 +05:30
|
|
|
import FunctionDetails from './components/function_details.vue';
|
2019-05-18 00:54:41 +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) {
|
|
|
|
const {
|
|
|
|
serviceName,
|
|
|
|
serviceDescription,
|
|
|
|
serviceEnvironment,
|
|
|
|
serviceUrl,
|
|
|
|
serviceNamespace,
|
|
|
|
servicePodcount,
|
2019-05-18 00:54:41 +05:30
|
|
|
serviceMetricsUrl,
|
|
|
|
prometheus,
|
|
|
|
clustersPath,
|
|
|
|
helpPath,
|
2019-03-02 22:35:43 +05:30
|
|
|
} = document.querySelector('.js-serverless-function-details-page').dataset;
|
|
|
|
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-05-18 00:54:41 +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,
|
2019-05-18 00:54:41 +05:30
|
|
|
store: createStore(),
|
2019-03-02 22:35:43 +05:30
|
|
|
render(createElement) {
|
|
|
|
return createElement(FunctionDetails, {
|
|
|
|
props: {
|
2019-05-18 00:54:41 +05:30
|
|
|
func: service,
|
|
|
|
hasPrometheus: prometheus !== undefined,
|
|
|
|
clustersPath,
|
|
|
|
helpPath,
|
2019-03-02 22:35:43 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
const { statusPath, clustersPath, helpPath, installed } = document.querySelector(
|
|
|
|
'.js-serverless-functions-page',
|
|
|
|
).dataset;
|
|
|
|
|
2019-05-18 00:54:41 +05:30
|
|
|
const el = document.querySelector('#js-serverless-functions');
|
|
|
|
this.functions = new Vue({
|
|
|
|
el,
|
|
|
|
store: createStore(),
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(Functions, {
|
|
|
|
props: {
|
|
|
|
installed: installed !== undefined,
|
|
|
|
clustersPath,
|
|
|
|
helpPath,
|
|
|
|
statusPath,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
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
|
|
|
}
|
|
|
|
}
|