mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' into 'master'
Add UI for System Update COSU) and Global Proxy policies See merge request entgra/carbon-device-mgt!494
This commit is contained in:
commit
ff2691f5bb
@ -45,7 +45,8 @@ const { TabPane } = Tabs;
|
|||||||
const { Option } = Select;
|
const { Option } = Select;
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
|
|
||||||
const subPanelpayloadAttributes = {};
|
const subPanelpayloadAttributesforCheckboxes = {};
|
||||||
|
const subPanelpayloadAttributesforSelect = {};
|
||||||
let formContainers = {};
|
let formContainers = {};
|
||||||
|
|
||||||
class ConfigureProfile extends React.Component {
|
class ConfigureProfile extends React.Component {
|
||||||
@ -309,12 +310,14 @@ class ConfigureProfile extends React.Component {
|
|||||||
Object.keys(allFields).map(key => {
|
Object.keys(allFields).map(key => {
|
||||||
if (key.includes(`${this.state.activePanelKeys[i]}-`)) {
|
if (key.includes(`${this.state.activePanelKeys[i]}-`)) {
|
||||||
if (
|
if (
|
||||||
subPanelpayloadAttributes.hasOwnProperty(
|
subPanelpayloadAttributesforCheckboxes.hasOwnProperty(
|
||||||
`${this.state.activePanelKeys[i]}`,
|
`${this.state.activePanelKeys[i]}`,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Object.entries(
|
Object.entries(
|
||||||
subPanelpayloadAttributes[this.state.activePanelKeys[i]],
|
subPanelpayloadAttributesforCheckboxes[
|
||||||
|
this.state.activePanelKeys[i]
|
||||||
|
],
|
||||||
).map(([subPanel, subContent]) => {
|
).map(([subPanel, subContent]) => {
|
||||||
subContentsList[subContent] = {};
|
subContentsList[subContent] = {};
|
||||||
if (
|
if (
|
||||||
@ -326,6 +329,27 @@ class ConfigureProfile extends React.Component {
|
|||||||
activeFields.push(key);
|
activeFields.push(key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (
|
||||||
|
subPanelpayloadAttributesforSelect.hasOwnProperty(
|
||||||
|
`${this.state.activePanelKeys[i]}`,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Object.entries(
|
||||||
|
subPanelpayloadAttributesforSelect[this.state.activePanelKeys[i]],
|
||||||
|
).map(([subPanelSwitch, subPanels]) => {
|
||||||
|
if (
|
||||||
|
subPanels.includes(allFields[subPanelSwitch]) &&
|
||||||
|
key.includes(`${subPanelSwitch}-${allFields[subPanelSwitch]}-`)
|
||||||
|
) {
|
||||||
|
activeFields.push(key);
|
||||||
|
} else {
|
||||||
|
for (let panel of subPanels) {
|
||||||
|
if (!key.includes(`${subPanelSwitch}-${panel}-`)) {
|
||||||
|
activeFields.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
activeFields.push(key);
|
activeFields.push(key);
|
||||||
}
|
}
|
||||||
@ -341,12 +365,14 @@ class ConfigureProfile extends React.Component {
|
|||||||
Object.entries(values).map(([key, value]) => {
|
Object.entries(values).map(([key, value]) => {
|
||||||
if (key.includes(`${this.state.activePanelKeys[i]}-`)) {
|
if (key.includes(`${this.state.activePanelKeys[i]}-`)) {
|
||||||
if (
|
if (
|
||||||
subPanelpayloadAttributes.hasOwnProperty(
|
subPanelpayloadAttributesforCheckboxes.hasOwnProperty(
|
||||||
`${this.state.activePanelKeys[i]}`,
|
`${this.state.activePanelKeys[i]}`,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Object.entries(
|
Object.entries(
|
||||||
subPanelpayloadAttributes[this.state.activePanelKeys[i]],
|
subPanelpayloadAttributesforCheckboxes[
|
||||||
|
this.state.activePanelKeys[i]
|
||||||
|
],
|
||||||
).map(([subPanel, contentKey]) => {
|
).map(([subPanel, contentKey]) => {
|
||||||
if (key.includes(`-${subPanel}-`)) {
|
if (key.includes(`-${subPanel}-`)) {
|
||||||
subContentsList[contentKey][
|
subContentsList[contentKey][
|
||||||
@ -362,7 +388,8 @@ class ConfigureProfile extends React.Component {
|
|||||||
] = value;
|
] = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (this.state.activePanelKeys[i] in formContainers) {
|
}
|
||||||
|
if (this.state.activePanelKeys[i] in formContainers) {
|
||||||
formContainers[this.state.activePanelKeys[i]].forEach(
|
formContainers[this.state.activePanelKeys[i]].forEach(
|
||||||
subFeature => {
|
subFeature => {
|
||||||
if (
|
if (
|
||||||
@ -386,6 +413,32 @@ class ConfigureProfile extends React.Component {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
subPanelpayloadAttributesforSelect.hasOwnProperty(
|
||||||
|
`${this.state.activePanelKeys[i]}`,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Object.keys(
|
||||||
|
subPanelpayloadAttributesforSelect[
|
||||||
|
this.state.activePanelKeys[i]
|
||||||
|
],
|
||||||
|
).map(subPanelSwitch => {
|
||||||
|
if (
|
||||||
|
key.includes(`${subPanelSwitch}-${values[subPanelSwitch]}-`)
|
||||||
|
) {
|
||||||
|
content[
|
||||||
|
key.replace(
|
||||||
|
`${subPanelSwitch}-${values[subPanelSwitch]}-`,
|
||||||
|
'',
|
||||||
|
)
|
||||||
|
] = value;
|
||||||
|
} else {
|
||||||
|
content[
|
||||||
|
key.replace(`${this.state.activePanelKeys[i]}-`, '')
|
||||||
|
] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
content[
|
content[
|
||||||
key.replace(`${this.state.activePanelKeys[i]}-`, '')
|
key.replace(`${this.state.activePanelKeys[i]}-`, '')
|
||||||
@ -411,7 +464,8 @@ class ConfigureProfile extends React.Component {
|
|||||||
// generate form items
|
// generate form items
|
||||||
getPanelItems = (panel, panelId) => {
|
getPanelItems = (panel, panelId) => {
|
||||||
const { getFieldDecorator } = this.props.form;
|
const { getFieldDecorator } = this.props.form;
|
||||||
const subPanelList = {};
|
const subPanelListforCheckbox = {};
|
||||||
|
const subPanelListforSelect = {};
|
||||||
return panel.map((item, k) => {
|
return panel.map((item, k) => {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 'select':
|
case 'select':
|
||||||
@ -538,6 +592,7 @@ class ConfigureProfile extends React.Component {
|
|||||||
style={{ display: 'block' }}
|
style={{ display: 'block' }}
|
||||||
>
|
>
|
||||||
{getFieldDecorator(`${item.id}`, {
|
{getFieldDecorator(`${item.id}`, {
|
||||||
|
initialValue: null,
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
pattern: new RegExp(`${item.optional.rules.regex}`),
|
pattern: new RegExp(`${item.optional.rules.regex}`),
|
||||||
@ -580,17 +635,21 @@ class ConfigureProfile extends React.Component {
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
{item.optional.subPanel.map((panel, i) => {
|
{item.optional.subPanel.map((panel, i) => {
|
||||||
subPanelList[panel.others.itemSwitch] =
|
subPanelListforCheckbox[panel.others.itemSwitch] =
|
||||||
panel.others.itemPayload;
|
panel.others.itemPayload;
|
||||||
if (
|
if (
|
||||||
subPanelpayloadAttributes.hasOwnProperty(panelId)
|
subPanelpayloadAttributesforCheckboxes.hasOwnProperty(
|
||||||
|
panelId,
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
Object.assign(
|
Object.assign(
|
||||||
subPanelpayloadAttributes[panelId],
|
subPanelpayloadAttributesforCheckboxes[panelId],
|
||||||
subPanelList,
|
subPanelListforCheckbox,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
subPanelpayloadAttributes[panelId] = subPanelList;
|
subPanelpayloadAttributesforCheckboxes[
|
||||||
|
panelId
|
||||||
|
] = subPanelListforCheckbox;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div key={i}>
|
<div key={i}>
|
||||||
@ -647,6 +706,8 @@ class ConfigureProfile extends React.Component {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
case 'radioGroup':
|
case 'radioGroup':
|
||||||
|
// eslint-disable-next-line no-case-declarations
|
||||||
|
let subPanelkeys = [];
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@ -681,6 +742,13 @@ class ConfigureProfile extends React.Component {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className={'sub-panel-container'}>
|
<div className={'sub-panel-container'}>
|
||||||
{item.optional.subPanel.map((panel, i) => {
|
{item.optional.subPanel.map((panel, i) => {
|
||||||
|
if (panel.hasOwnProperty('others')) {
|
||||||
|
subPanelkeys.push(panel.id);
|
||||||
|
subPanelListforSelect[`${item.id}`] = subPanelkeys;
|
||||||
|
subPanelpayloadAttributesforSelect[
|
||||||
|
panelId
|
||||||
|
] = subPanelListforSelect;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
|
|||||||
@ -47,6 +47,9 @@ const { TextArea } = Input;
|
|||||||
|
|
||||||
const subPanelpayloadAttributes = {};
|
const subPanelpayloadAttributes = {};
|
||||||
let subFormContainer = {};
|
let subFormContainer = {};
|
||||||
|
let radioSubPanelSwitches = [];
|
||||||
|
let initialRadioPanels = {};
|
||||||
|
let radioPanelStatusList = {};
|
||||||
|
|
||||||
class ConfigureProfile extends React.Component {
|
class ConfigureProfile extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -60,13 +63,20 @@ class ConfigureProfile extends React.Component {
|
|||||||
subPanelpayloadAttributes: {},
|
subPanelpayloadAttributes: {},
|
||||||
customInputDataArray: [],
|
customInputDataArray: [],
|
||||||
inputTableDataSources: {},
|
inputTableDataSources: {},
|
||||||
|
subPanelRadio: {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {}
|
||||||
|
|
||||||
setProfileInfo = e => {
|
setProfileInfo = e => {
|
||||||
let activePolicies = [];
|
let activePolicies = [];
|
||||||
let activePolicyFields = {};
|
let activePolicyFields = {};
|
||||||
let activeSubPanels = [];
|
let activeSubPanels = [];
|
||||||
|
let subPanelRadio = this.state.subPanelRadio;
|
||||||
|
this.setState({
|
||||||
|
subPanelRadio: radioPanelStatusList,
|
||||||
|
});
|
||||||
const allFields = this.props.form.getFieldsValue();
|
const allFields = this.props.form.getFieldsValue();
|
||||||
this.props.policyFeatureList.map(element => {
|
this.props.policyFeatureList.map(element => {
|
||||||
activePolicies.push(element.featureCode);
|
activePolicies.push(element.featureCode);
|
||||||
@ -109,14 +119,35 @@ class ConfigureProfile extends React.Component {
|
|||||||
if (fieldName.match(regex) != null) {
|
if (fieldName.match(regex) != null) {
|
||||||
activePolicyFields[fieldName] = featureData[key];
|
activePolicyFields[fieldName] = featureData[key];
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
radioSubPanelSwitches.includes(
|
||||||
|
`${element.featureCode}-${featureData[key]}`,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
let subPanelViewStatus = {
|
||||||
|
[featureData[key]]: true,
|
||||||
|
};
|
||||||
|
Object.assign(subPanelRadio, subPanelViewStatus);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.props.form.setFieldsValue(activePolicyFields);
|
this.props.form.setFieldsValue(activePolicyFields);
|
||||||
|
Object.keys(initialRadioPanels).map(policy => {
|
||||||
|
if (!activePolicies.includes(policy)) {
|
||||||
|
for (let subPanelKey of initialRadioPanels[policy]) {
|
||||||
|
let subPanelViewStatus = {
|
||||||
|
[subPanelKey]: true,
|
||||||
|
};
|
||||||
|
Object.assign(subPanelRadio, subPanelViewStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
this.setState({
|
this.setState({
|
||||||
activePanelKeys: activePolicies,
|
activePanelKeys: activePolicies,
|
||||||
activeSubPanelKeys: activeSubPanels,
|
activeSubPanelKeys: activeSubPanels,
|
||||||
|
subPanelRadio,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -417,6 +448,7 @@ class ConfigureProfile extends React.Component {
|
|||||||
getPanelItems = (panel, panelId) => {
|
getPanelItems = (panel, panelId) => {
|
||||||
const { getFieldDecorator } = this.props.form;
|
const { getFieldDecorator } = this.props.form;
|
||||||
const subPanelList = {};
|
const subPanelList = {};
|
||||||
|
let initialRadioOptions = [];
|
||||||
return panel.map((item, k) => {
|
return panel.map((item, k) => {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 'select':
|
case 'select':
|
||||||
@ -652,6 +684,8 @@ class ConfigureProfile extends React.Component {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
);
|
);
|
||||||
case 'radioGroup':
|
case 'radioGroup':
|
||||||
|
initialRadioOptions.push(item.optional.initialValue);
|
||||||
|
initialRadioPanels[panelId] = initialRadioOptions;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@ -686,12 +720,15 @@ class ConfigureProfile extends React.Component {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className={'sub-panel-container'}>
|
<div className={'sub-panel-container'}>
|
||||||
{item.optional.subPanel.map((panel, i) => {
|
{item.optional.subPanel.map((panel, i) => {
|
||||||
|
radioSubPanelSwitches.push(`${panelId}-${panel.id}`);
|
||||||
|
radioPanelStatusList[panel.id] = false;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
id={panel.id}
|
id={panel.id}
|
||||||
|
ref={panel.id}
|
||||||
style={
|
style={
|
||||||
panel.id === item.optional.initialValue
|
this.state.subPanelRadio[panel.id]
|
||||||
? { display: 'block' }
|
? { display: 'block' }
|
||||||
: { display: 'none' }
|
: { display: 'none' }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,6 +47,8 @@ const { TextArea } = Input;
|
|||||||
const subPanelpayloadAttributes = {};
|
const subPanelpayloadAttributes = {};
|
||||||
const fieldKeys = [];
|
const fieldKeys = [];
|
||||||
let subFormContainer = {};
|
let subFormContainer = {};
|
||||||
|
let radioSubPanelSwitches = [];
|
||||||
|
let radioPanelStatusList = {};
|
||||||
|
|
||||||
class PolicyInfo extends React.Component {
|
class PolicyInfo extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -61,6 +63,7 @@ class PolicyInfo extends React.Component {
|
|||||||
customInputDataArray: [],
|
customInputDataArray: [],
|
||||||
inputTableDataSources: {},
|
inputTableDataSources: {},
|
||||||
isInfoPreview: false,
|
isInfoPreview: false,
|
||||||
|
subPanelRadio: {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +71,10 @@ class PolicyInfo extends React.Component {
|
|||||||
let activePolicies = [];
|
let activePolicies = [];
|
||||||
let activePolicyFields = {};
|
let activePolicyFields = {};
|
||||||
let activeSubPanels = [];
|
let activeSubPanels = [];
|
||||||
|
let subPanelRadio = this.state.subPanelRadio;
|
||||||
|
this.setState({
|
||||||
|
subPanelRadio: radioPanelStatusList,
|
||||||
|
});
|
||||||
const allFields = this.props.form.getFieldsValue();
|
const allFields = this.props.form.getFieldsValue();
|
||||||
this.props.policyFeatureList.map(element => {
|
this.props.policyFeatureList.map(element => {
|
||||||
activePolicies.push(element.featureCode);
|
activePolicies.push(element.featureCode);
|
||||||
@ -110,6 +117,16 @@ class PolicyInfo extends React.Component {
|
|||||||
if (fieldName.match(regex) != null) {
|
if (fieldName.match(regex) != null) {
|
||||||
activePolicyFields[fieldName] = featureData[key];
|
activePolicyFields[fieldName] = featureData[key];
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
radioSubPanelSwitches.includes(
|
||||||
|
`${element.featureCode}-${featureData[key]}`,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
let subPanelViewStatus = {
|
||||||
|
[featureData[key]]: true,
|
||||||
|
};
|
||||||
|
Object.assign(subPanelRadio, subPanelViewStatus);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -118,6 +135,7 @@ class PolicyInfo extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
activePanelKeys: activePolicies,
|
activePanelKeys: activePolicies,
|
||||||
activeSubPanelKeys: activeSubPanels,
|
activeSubPanelKeys: activeSubPanels,
|
||||||
|
subPanelRadio,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -399,7 +417,7 @@ class PolicyInfo extends React.Component {
|
|||||||
{getFieldDecorator(`${item.id}`, {
|
{getFieldDecorator(`${item.id}`, {
|
||||||
initialValue: item.optional.initialDataIndex,
|
initialValue: item.optional.initialDataIndex,
|
||||||
})(
|
})(
|
||||||
<Select>
|
<Select disabled>
|
||||||
{this.getOptionForTimeSelectors(
|
{this.getOptionForTimeSelectors(
|
||||||
item.optional.firstOptionValue,
|
item.optional.firstOptionValue,
|
||||||
item.optional.lastOptionValue,
|
item.optional.lastOptionValue,
|
||||||
@ -555,6 +573,7 @@ class PolicyInfo extends React.Component {
|
|||||||
onChange={e =>
|
onChange={e =>
|
||||||
this.handleRadioPanel(e, item.optional.radio)
|
this.handleRadioPanel(e, item.optional.radio)
|
||||||
}
|
}
|
||||||
|
disabled
|
||||||
>
|
>
|
||||||
{item.optional.radio.map((option, i) => {
|
{item.optional.radio.map((option, i) => {
|
||||||
return (
|
return (
|
||||||
@ -568,12 +587,14 @@ class PolicyInfo extends React.Component {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<div className={'sub-panel-container'}>
|
<div className={'sub-panel-container'}>
|
||||||
{item.optional.subPanel.map((panel, i) => {
|
{item.optional.subPanel.map((panel, i) => {
|
||||||
|
radioSubPanelSwitches.push(`${panelId}-${panel.id}`);
|
||||||
|
radioPanelStatusList[panel.id] = false;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
id={panel.id}
|
id={panel.id}
|
||||||
style={
|
style={
|
||||||
panel.id === item.optional.initialValue
|
this.state.subPanelRadio[panel.id]
|
||||||
? { display: 'block' }
|
? { display: 'block' }
|
||||||
: { display: 'none' }
|
: { display: 'none' }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user