Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
scc-net
netvs
netvs-core
Commits
1b8f7a7e
Commit
1b8f7a7e
authored
Jun 24, 2020
by
janis.streib
🦉
Browse files
UPD: removed colanme (datadict) endpoint + cleanup
parent
1d23dec1
Pipeline
#93603
failed with stages
in 4 minutes and 8 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/api-services/colnames.service.js
deleted
100644 → 0
View file @
1d23dec1
import
Axios
from
'
axios
'
;
const
RESOURCE_NAME
=
'
/api/colnames
'
;
export
default
{
getAll
()
{
return
Axios
.
get
(
RESOURCE_NAME
)
}
};
frontend/src/main.js
View file @
1b8f7a7e
...
...
@@ -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
)
})
}
)
middleware/net_suite/__init__.py
View file @
1b8f7a7e
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment