def idcs_add(): name = request.form.get('name', '') address = request.form.get('address', '') ip = request.form.get('ip', '') _idc = Idcs(id=None, name=name, address=address, ip=ip) ret, error = _idc.validate_idcs_add() if ret: _idc.idcs_add() return jsonify({'status': ret, 'error': error})
def idcs_modify(): uid = request.args.get('id', '') _idc = Idcs.get_idc_id(uid) return render_template('idcs_modify.html', id=_idc['id'], name=_idc['name'], address=_idc['address'], ip=_idc['ip'])
def get_asset_name(cls): _assets = cls.get_asset_list() _idcs = Idcs.get_idcs_list() for _asset in _assets: _id = _asset['machine_room_id'] for _idc in _idcs: if _idc['id'] == _id: _asset['machine_room_id'] = _idc['name'] return _assets
def idcs_delete(): uid = request.args.get('id', '') Idcs.idcs_delete(uid) return redirect(url_for('idcs'))
def idcs(): idcs_list = Idcs.get_idcs_list() return render_template('idcs.html', idcs=idcs_list)
def asset_view(): aid = request.args.get('id', 0, type=int) assets = Asset.get_asset_id(aid) idcs = Idcs.get_idcs_list() return jsonify({'assets': assets, 'idcs': idcs})
def asset_add(): idcs_list = Idcs.get_idcs_list() return render_template('asset_create.html', idcs=idcs_list)
def idcs_delete(): aid = request.args.get('id', 0, type=int) Idcs.idcs_delete(aid) return ''
def idcs_update(): _form = request.form ret, error = Idcs.validate_idcs_change(_form) if ret: Idcs.idcs_update(_form) return jsonify({'error': error})
def idcs_view(): aid = request.args.get('id', 0, type=int) idcs = Idcs.get_idc_id(aid) return jsonify(idcs)
def idcs_list(): idcs_list = Idcs.get_idcs_list() return jsonify({'data': idcs_list})