MCPcopy Create free account
hub / github.com/alephdata/aleph / render

Method render

ui/src/components/Document/DocumentManager.jsx:110–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108 }
109
110 render() {
111 const {
112 collection,
113 document,
114 fileSizeProp,
115 query,
116 result,
117 hasPending,
118 intl,
119 showSearch = true,
120 } = this.props;
121 const { selection } = this.state;
122 const mutableDocument =
123 document === undefined || document?.schema?.name === 'Folder';
124 const showActions = collection?.writeable && mutableDocument;
125 const canUpload = this.canUpload();
126 const canMap = selection.length === 1 && selection[0].schema.isA('Table');
127
128 const searchPlaceholder = !!document
129 ? intl.formatMessage(messages.search_placeholder_document, {
130 label: document.getCaption(),
131 })
132 : intl.formatMessage(messages.search_placeholder);
133
134 const emptyComponent = canUpload ? (
135 <div className="DocumentManager__content__empty">
136 <DialogToggleButton
137 buttonProps={{
138 minimal: true,
139 fill: true,
140 }}
141 Dialog={DocumentUploadDialog}
142 dialogProps={{ collection, parent: document }}
143 >
144 <ErrorSection
145 icon="plus"
146 title={intl.formatMessage(messages.emptyCanUpload)}
147 />
148 </DialogToggleButton>
149 </div>
150 ) : (
151 <ErrorSection
152 icon="folder-open"
153 title={intl.formatMessage(messages.empty)}
154 />
155 );
156
157 return (
158 <div className="DocumentManager">
159 {(showSearch || showActions) && (
160 <EntityActionBar
161 query={query}
162 writeable={showActions}
163 selection={selection}
164 resetSelection={() => this.setState({ selection: [] })}
165 onSearchSubmit={this.onSearchSubmit}
166 searchPlaceholder={searchPlaceholder}
167 searchDisabled={result.total === 0 && !query.hasQuery()}

Callers

nothing calls this directly

Calls 3

canUploadMethod · 0.95
getGroupFieldFunction · 0.90
hasQueryMethod · 0.80

Tested by

no test coverage detected