Skip to content

Commit

Permalink
Merge branch 'develop' into custom-fileds-e2e-test
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Apr 16, 2024
2 parents 04d4602 + cf95b3e commit 9520728
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
2 changes: 1 addition & 1 deletion e2e/server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ honcho==1.1.0
# via -r requirements.in
httplib2==0.22.0
# via oauth2client
idna==3.6
idna==3.7
# via requests
itsdangerous==1.1.0
# via
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"sass-loader": "6.0.6",
"shortid": "2.2.8",
"style-loader": "0.20.2",
"superdesk-ui-framework": "^3.0.79",
"superdesk-ui-framework": "^3.0.82",
"ts-loader": "3.5.0",
"typescript": "4.9.5",
"uuid": "8.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {WidgetsConfig} from './WidgetsConfig';
import {NewFieldSelect} from './new-field-select';
import {GenericArrayListPageComponent} from 'core/helpers/generic-array-list-page-component';
import {arrayMove} from '@superdesk/common';
import {getTypeForFieldId} from 'apps/workspace/helpers/getTypeForFieldId';

// should be stored in schema rather than editor section of the content profile
// but the fields should be editable via GUI
Expand Down Expand Up @@ -509,14 +510,19 @@ export class ContentProfileFieldsConfig extends React.Component<IProps, IState>
return this.state.editor[id]?.field_name ?? getLabelForFieldId(id, this.state.vocabularies);
};

const availableIds: Array<{id: string; label: string}> = this.state.allFieldIds
const availableIds: Array<{id: string; label: string; fieldType: string;}> = this.state.allFieldIds
.filter((id) => {
return (
this.isAllowedForSection(this.state.selectedSection, id)
&& !this.existsInFields(id)
);
})
.map((id) => ({id, label: getLabel(id)}));
.map((id) => ({
id,
label: getLabel(id),
fieldType: getTypeForFieldId(id, this.state.vocabularies),
}))
.sort((x, y) => x.label.localeCompare(y.label));

const setIndexForNewItem = (index) => {
this.setState({insertNewItemAtIndex: index});
Expand Down
20 changes: 13 additions & 7 deletions scripts/apps/workspace/content/components/new-field-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Button, Menu} from 'superdesk-ui-framework/react';
import {gettext} from 'core/utils';

interface IProps {
availableFields: Array<{id: string; label: string}>;
availableFields: Array<{id: string; label: string; fieldType?: string;}>;
onSelect(value: string): void;
}

Expand All @@ -14,12 +14,18 @@ export class NewFieldSelect extends React.PureComponent<IProps> {
return (
<div>
<Menu
items={availableFields.map(({id, label}) => ({
label: label,
onClick: () => {
this.props.onSelect(id);
},
}))}
items={availableFields.map(({id, label, fieldType}) => {
const maybeLabelAndFieldType = (fieldType != null && fieldType !== '')
? <>{label} <span className="sd-text--italic sd-text--light">({fieldType})</span></>
: label;

return {
label: maybeLabelAndFieldType,
onClick: () => {
this.props.onSelect(id);
},
};
})}
>
{(toggle) => (
<Button
Expand Down

0 comments on commit 9520728

Please sign in to comment.