Beispiel #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'))
Beispiel #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'))
Beispiel #3
0
 def handle(self, request, data):
     json = yaml.load(data['workbook'])
     return api.create_workbook(request, json)
Beispiel #4
0
 def handle(self, request, data):
     json = yaml.load(data['workbook'])
     return api.create_workbook(request, json)