Commit 1b8f7a7e authored by janis.streib's avatar janis.streib 🦉
Browse files

UPD: removed colanme (datadict) endpoint + cleanup

parent 1d23dec1
Pipeline #93603 failed with stages
in 4 minutes and 8 seconds
import Axios from 'axios';
const RESOURCE_NAME = '/api/colnames';
export default {
getAll() {
return Axios.get(RESOURCE_NAME)
}
};
......@@ -280,37 +280,30 @@ Axios.interceptors.response.use(
Vue.config.productionTip = false
Axios.defaults.baseURL = '/';
ColnameService.getAll().then((response) => {
Vue.prototype.$colnames = response.data
Object.freeze(Vue.prototype.$colnames)
SystemInfoService.getAll().then((sysinfo) => {
Vue.prototype.$sysinfo = sysinfo.data
let mods_by_name = {}
for (var i = 0; i < sysinfo.data.mods.length; i++) {
mods_by_name[sysinfo.data.mods[i].name] = sysinfo.data.mods[i]
SystemInfoService.getAll().then((sysinfo) => {
Vue.prototype.$sysinfo = sysinfo.data
let mods_by_name = {}
for (var i = 0; i < sysinfo.data.mods.length; i++) {
mods_by_name[sysinfo.data.mods[i].name] = sysinfo.data.mods[i]
}
Vue.prototype.$sysinfo_mods_by_name = mods_by_name
let v = new Vue({
router,
store,
render: h => h(App),
beforeCreate: function () {
}
Vue.prototype.$sysinfo_mods_by_name = mods_by_name
let v = new Vue({
router,
store,
render: h => h(App),
beforeCreate: function () {
}
}).$mount('#app')
if (v.$store) {
v.$store.subscribe((mutation, state) => {
if (watchedMutations.indexOf(mutation.type) >= 0) {
v.$store.commit('pushUndoRedoDone', mutation)
if (state.undo_redo_new_mutaion) {
window.console.debug("New mutation")
v.$store.commit('clearUndoRedoUndone')
}
}).$mount('#app')
if (v.$store) {
v.$store.subscribe((mutation, state) => {
if (watchedMutations.indexOf(mutation.type) >= 0) {
v.$store.commit('pushUndoRedoDone', mutation)
if (state.undo_redo_new_mutaion) {
window.console.debug("New mutation")
v.$store.commit('clearUndoRedoUndone')
}
});
}
}
});
}
)
}).catch((err) => {
window.console.log(err)
alert(err)
})
}
)
from json import JSONEncoder
from flask import Flask, url_for, jsonify
import jinja2
from flask_compress import Compress
from flask_breadcrumbs import Breadcrumbs
from beaker.middleware import SessionMiddleware
from kitnet.lib.netdb import PostgreSQL
import sys
......@@ -14,10 +11,6 @@ from .model import DBObject, MetaDBObject
import importlib
import kitnet.lib.netdd
import kitnet.lib.host_oper_mode_data
from jinja2 import evalcontextfilter, Markup, escape
import re
import datetime
import collections
import ipaddress
import postgresql.types
......@@ -102,26 +95,7 @@ def load_mods():
url_prefix='{prefix}{url}'.format(prefix='/tools' if mod.METADATA.is_tool else '',
url=m['url']))
def update_and_load_datadict():
global colnames
app.logger.info("Updating datadict...")
dd = kitnet.lib.netdd.DataDict()
dd.writer()
db.api_dd = dd.reader()
colnames = {name: {k: v for k, v in db.api_dd['tabcol'][obj.TABLE]['col'].items()} for name, obj in
inspect.getmembers(sys.modules['net_suite.model']) if inspect.isclass(obj)
and DBObject in inspect.getmro(obj)
and obj is not DBObject and MetaDBObject not in inspect.getmro(obj)}
def finalize_init():
db_conn.close()
@app.route('/api/colnames')
def api_colnames():
return jsonify(colnames)
from . import views
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment