Skip to content

Commit 8f70a0f

Browse files
committed
api call for accept action
1 parent 4609791 commit 8f70a0f

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

app/controllers/miq_ae_class_controller.rb

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,8 +1442,8 @@ def create_namespace
14421442
def field_select
14431443
assert_privileges('miq_ae_field_edit')
14441444
fields_get_form_vars
1445-
@combo_xml = build_type_options
1446-
@dtype_combo_xml = build_dtype_options
1445+
# @combo_xml = build_type_options
1446+
# @dtype_combo_xml = build_dtype_options
14471447
session[:field_data] = {}
14481448
@edit[:new_field][:substitute] = session[:field_data][:substitute] = true
14491449
@changed = (@edit[:new] != @edit[:current])
@@ -1461,14 +1461,15 @@ def field_accept
14611461
assert_privileges('miq_ae_field_edit')
14621462
fields_get_form_vars
14631463
@changed = (@edit[:new] != @edit[:current])
1464-
@combo_xml = build_type_options
1465-
@dtype_combo_xml = build_dtype_options
1464+
# @combo_xml = build_type_options
1465+
# @dtype_combo_xml = build_dtype_options
14661466
# render :update do |page|
14671467
# page << javascript_prologue
14681468
# page.replace("class_fields_div", :partial => "class_fields")
14691469
# page << javascript_for_miq_button_visibility(@changed)
14701470
# page << "miqSparkle(false);"
14711471
# end
1472+
# byebug
14721473
render :json => {
14731474
:message => 'Accepted',
14741475
:data => {:icons => [ae_field_fonticon(params[:aetype]), ae_field_fonticon(params[:datatype])]}
@@ -2396,14 +2397,19 @@ def fields_get_form_vars
23962397
end
23972398
end
23982399
elsif params[:button] == "accept"
2400+
# byebug
23992401
# if session[:field_data][:name].blank? || session[:field_data][:aetype].blank?
2400-
# field = session[:field_data][:name].blank? ? "Name" : "Type"
2401-
# field += " and Type" if field == "Name" && session[:field_data][:aetype].blank?
2402-
# add_flash(_("%{field} is required") % {:field => field}, :error)
2403-
# return
2404-
# end
2402+
if params[:name].blank? || params[:aetype].blank?
2403+
# field = session[:field_data][:name].blank? ? "Name" : "Type"
2404+
# field += " and Type" if field == "Name" && session[:field_data][:aetype].blank?
2405+
field = params[:name].blank? ? "Name" : "Type"
2406+
field += " and Type" if field == "Name" && params[:aetype].blank?
2407+
add_flash(_("%{field} is required") % {:field => field}, :error)
2408+
return
2409+
end
24052410
new_fields = {}
24062411
field_attributes.each do |field_attribute|
2412+
# byebug
24072413
# new_fields[field_attribute] = @edit[:new_field][field_attribute.to_sym]
24082414
# new_fields[field_attribute] = params[:field][field_attribute.to_sym]
24092415
new_fields[field_attribute] = params[field_attribute.to_sym]

app/javascript/components/data-tables/datastore/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
44
import {
55
tableData, addSelected, removeSelected,
66
} from './helper';
7-
import { ClassFieldsEditor } from './class-fields-editor';
7+
import { ClassFieldsEditor } from './schema/class-fields-editor';
88
import MiqDataTable from '../../miq-data-table';
99
import { CellAction } from '../../miq-data-table/helper';
1010

app/javascript/components/data-tables/datastore/class-fields-editor.jsx renamed to app/javascript/components/data-tables/datastore/schema/class-fields-editor.jsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React, { useState } from 'react';
22
import PropTypes from 'prop-types';
33
import { Button, Modal } from 'carbon-components-react';
44
import MiqFormRenderer from '@@ddf';
5-
import { schemaHeaders, createEditableRows } from './helper';
6-
import MiqDataTable from '../../miq-data-table';
5+
import { schemaHeaders, createEditableRows } from '../helper';
6+
import MiqDataTable from '../../../miq-data-table';
77
import createClassFieldsSchema from './modal-form.schema';
8-
import { CellAction } from '../../miq-data-table/helper';
8+
import { CellAction } from '../../../miq-data-table/helper';
99
// import miqRedirectBack from '../../helpers/miq-redirect-back';
1010

1111
export const ClassFieldsEditor = (props) => {
@@ -177,6 +177,10 @@ export const ClassFieldsEditor = (props) => {
177177
}
178178
};
179179

180+
const onSchemaSave = (values) => {
181+
debugger
182+
};
183+
180184
// const onCancel = () => {
181185
// debugger
182186
// miqSparkleOn();
@@ -211,7 +215,7 @@ export const ClassFieldsEditor = (props) => {
211215
onSubmit={onModalSubmit}
212216
onCancel={handleModalClose}
213217
canReset
214-
buttonsLabels={{ submitLabel: __('Save') }}
218+
buttonsLabels={{ submitLabel: __('Acc/savw') }}
215219
/>
216220
</Modal>
217221

@@ -238,7 +242,7 @@ export const ClassFieldsEditor = (props) => {
238242
/>
239243
<>
240244
<MiqFormRenderer
241-
onSubmit={() => {}}
245+
onSubmit={onSchemaSave}
242246
onCancel={onCancel}
243247
canReset
244248
buttonsLabels={{ submitLabel: __('Save') }}

app/javascript/components/data-tables/datastore/modal-form.schema.js renamed to app/javascript/components/data-tables/datastore/schema/modal-form.schema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { componentTypes, validatorTypes } from '@@ddf';
2-
import { transformSelectOptions, handleSchemaFieldChange } from './helper';
2+
import { transformSelectOptions, handleSchemaFieldChange } from '../helper';
33

44
const createClassFieldsSchema = (aeTypeOptions, dTypeOptions, selectedRowId, schemaField = {}) => {
55
const classField = schemaField;

0 commit comments

Comments
 (0)