Skip to content

Commit

Permalink
alliance org changed from select to input
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldsce committed Mar 30, 2022
1 parent 8d8dba1 commit ba689e8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/hoc/forms/MexTextArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MexTextArea = (props) => {
const getForm = () => (
<TextArea
id={form.field}
rows={rules ? rules.rows : 5}
rows={rules?.rows ?? 3}
icon={form.error ? <Icon color='red' name='times circle outline' /> : null}
label={props.label ? props.label : null}
placeholder={form.placeholder ? form.placeholder : null}
Expand Down
3 changes: 1 addition & 2 deletions src/hoc/listView/ListViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,10 @@ class ListViewer extends React.Component {
const { viewerEdit } = this.props
return (
this.actionMenu.length > 0 ?
<Popper open={Boolean(actionEl)} anchorEl={actionEl} role={undefined} transition disablePortal>
<Popper open={Boolean(actionEl)} anchorEl={actionEl} role={undefined} transition disablePortal style={{zIndex:5}}>
{({ TransitionProps, placement }) => (
<Grow
{...TransitionProps}
style={{ transformOrigin: placement === 'bottom' ? 'center top' : 'center right' }}
>
<Paper style={{ backgroundColor: '#212121', color: 'white' }}>
<ClickAwayListener onClickAway={() => this.setState({ actionEl: null })}>
Expand Down
25 changes: 13 additions & 12 deletions src/pages/main/cloudlets/Reg.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class CloudletReg extends React.Component {
this.cloudletPropsList = [];
this.gpuDriverList = [];
this.kafkaRequired = true;
this.allianceList = [];
}

updateState = (data) => {
Expand Down Expand Up @@ -250,10 +249,7 @@ class CloudletReg extends React.Component {
for (const form of forms) {
if (form.field === fields.trustPolicyName) {
this.updateUI(form)
}
else if (form.field === fields.allianceOrganization) {
this.allianceList = currentForm.value ? this.operatorList.filter(org => org !== currentForm.value) : []
this.updateUI(form)
break;
}
}
if (!isInit) {
Expand Down Expand Up @@ -636,9 +632,6 @@ class CloudletReg extends React.Component {
case fields.key:
form.options = this.cloudletPropsList
break;
case fields.allianceOrganization:
form.options = this.allianceList
break;
default:
form.options = undefined;
}
Expand Down Expand Up @@ -803,7 +796,7 @@ class CloudletReg extends React.Component {
{ field: fields.infraApiAccess, label: 'Infra API Access', formType: SELECT, placeholder: 'Select Infra API Access', rules: { required: true }, visible: true, tip: 'Infra Access Type is the type of access available to Infra API Endpoint\nDirect:</b> Infra API endpoint is accessible from public network\nRestricted:</b> Infra API endpoint is not accessible from public network' },
{ field: fields.infraFlavorName, label: 'Infra Flavor Name', formType: 'Input', placeholder: 'Enter Infra Flavor Name', rules: { required: false }, visible: true, tip: 'Infra specific flavor name' },
{ field: fields.infraExternalNetworkName, label: 'Infra External Network Name', formType: 'Input', placeholder: 'Enter Infra External Network Name', rules: { required: false }, visible: true, tip: 'Infra specific external network name' },
{ field: fields.allianceOrganization, label: 'Alliance Organization', formType: MULTI_SELECT, placeholder: 'Select Alliance Operator', visible: true, tip: 'Alliance Organization of the cloudlet site', update: { id: ['47'] } },
{ field: fields.allianceOrganization, label: 'Alliance Organization', formType: TEXT_AREA, rules: { rows: 5 }, placeholder: 'Enter Alliance Operator Names\nExample:\nOperator1\nOperator2\nPlease use new line to enter multiple operator names', visible: true, tip: 'Alliance Organization of the cloudlet site', update: { id: ['47'] } },
{ field: fields.envVars, label: 'Environment Variable', formType: HEADER, forms: this.isUpdate ? [] : [{ formType: ICON_BUTTON, label: 'Add Env Vars', icon: 'add', visible: true, onClick: this.addMultiForm, multiForm: this.getEnvForm }], visible: true, tip: 'Single Key-Value pair of env var to be passed to CRM' },
{ field: fields.resourceQuotas, label: 'Resource Quota', formType: HEADER, forms: [{ formType: ICON_BUTTON, label: 'Add Resource Quota', icon: 'add', visible: true, onClick: this.addMultiForm, multiForm: this.getResoureQuotaForm }], visible: true, update: { id: ['39', '39.1', '39.2', '39.3'] }, tip: 'Alert Threshold:</b> Generate alert when more than threshold percentage of resource is used\nName:</b> Resource name on which to set quota\nValue:</b> Quota value of the resource' },
{ label: 'Advanced Settings', formType: HEADER, forms: [{ formType: ICON_BUTTON, label: 'Advance Options', icon: 'expand_less', visible: true, onClick: this.advanceMenu }], visible: true },
Expand Down Expand Up @@ -833,6 +826,17 @@ class CloudletReg extends React.Component {
else if (form.field === fields.openRCData || form.field === fields.caCertdata) {
form.visible = false
}
else if (form.field === fields.allianceOrganization) {
let allianceOrgs = data[fields.allianceOrganization]
if (allianceOrgs) {
let value = ''
let length = allianceOrgs.length - 1
allianceOrgs.forEach((org, i) => {
value = value + org + (i < length ? '\n' : '')
})
form.value = value
}
}
else if (form.field === fields.kafkaCluster) {
this.kafkaRequired = data[fields.kafkaCluster] === undefined
form.value = data[fields.kafkaCluster]
Expand Down Expand Up @@ -861,9 +865,6 @@ class CloudletReg extends React.Component {
else {
let organizationList = await showAuthSyncRequest(self, showOrganizations(self, { type: perpetual.OPERATOR }))
this.operatorList = _sort(organizationList.map(org => (org[fields.organizationName])))
if (redux_org.isOperator(this)) {
this.allianceList = this.operatorList.filter(org => (org !== redux_org.nonAdminOrg(this)))
}
}
forms.push(
{ label: this.isUpdate ? 'Update' : 'Create', formType: 'Button', onClick: this.onCreate, validate: true },
Expand Down
6 changes: 4 additions & 2 deletions src/services/modules/cloudlet/cloudlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const keys = () => ([
{ field: fields.createdAt, serverField: 'created_at', label: 'Created', dataType: perpetual.TYPE_DATE, date: { format: FORMAT_FULL_DATE_TIME, dataFormat: 'seconds' } },
{ field: fields.updatedAt, serverField: 'updated_at', label: 'Updated', dataType: perpetual.TYPE_DATE, date: { format: FORMAT_FULL_DATE_TIME, dataFormat: 'seconds' } },
{ field: fields.allianceOrganization, label: 'Alliance Organization', serverField: 'alliance_orgs', dataType: perpetual.TYPE_STRING },
{ field: fields.trusted, label: 'Trusted', icon: 'trusted.svg', format:true },
{ field: fields.trusted, label: 'Trusted', icon: 'trusted.svg', format: true },
{ field: fields.gpuExist, label: 'GPU', detailView: false },
{ field: fields.actions, label: 'Actions', sortable: false, visible: true, clickable: true, roles: constant.operatorRoles }
])
Expand Down Expand Up @@ -165,7 +165,9 @@ export const getKey = (data, isCreate) => {
cloudlet.infra_config = infraConfig
}
if (data[fields.allianceOrganization]) {
cloudlet.alliance_orgs = data[fields.allianceOrganization]
let allianceOrganization = data[fields.allianceOrganization]
allianceOrganization = allianceOrganization.split('\n')
cloudlet.alliance_orgs = allianceOrganization
}

}
Expand Down

0 comments on commit ba689e8

Please sign in to comment.