Esempio n. 1
0
    def post(self, request, workbook_id=None, **kwargs):
        def read_data():
            data = json.loads(request.read())
            return data['name'], data['yaml']

        if workbook_id is None:
            name, yaml = read_data()
            api.create_workbook(request, name, yaml)
            message = "The workbook {0} has been successfully created".format(
                name)
        else:
            name, yaml = read_data()
            api.modify_workbook(request, workbook_id, name, yaml)
            message = "The workbook {0} has been successfully modified".format(
                name)
        messages.success(request, message)
        return http.HttpResponseRedirect(
            reverse_lazy('horizon:project:mistral:index'))
Esempio n. 2
0
    def post(self, request, workbook_id=None, **kwargs):
        def read_data():
            data = json.loads(request.read())
            return data['name'], data['yaml']

        if workbook_id is None:
            name, yaml = read_data()
            api.create_workbook(request, name, yaml)
            message = "The workbook {0} has been successfully created".format(
                name)
        else:
            name, yaml = read_data()
            api.modify_workbook(request, workbook_id, name, yaml)
            message = "The workbook {0} has been successfully modified".format(
                name)
        messages.success(request, message)
        return http.HttpResponseRedirect(
            reverse_lazy('horizon:project:mistral:index'))
Esempio n. 3
0
 def handle(self, request, data):
     json = yaml.load(data['workbook'])
     return api.modify_workbook(request, json)
Esempio n. 4
0
 def handle(self, request, data):
     json = yaml.load(data['workbook'])
     return api.modify_workbook(request, json)