Skip to content

Commit 9c1b190

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 3be7f59 + 1e2a876 commit 9c1b190

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

src/client/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ declare module fng {
759759
readRecord: (modelName: string, id: string, formName?: string) => angular.IHttpPromise<any>;
760760
getAll: (modelName: string, _options: any) => angular.IHttpPromise<any[]>;
761761
getAllListAttributes: (ref: string) => angular.IHttpPromise<ILookupItem[]>;
762+
getAllPickListAttributes: (ref: string) => angular.IHttpPromise<ILookupItem[]>;
762763
getPagedAndFilteredList: (
763764
modelName: string,
764765
options: IListQueryOptions

src/client/js/services/record-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ module fng.services {
769769
$scope.$watch(
770770
"record",
771771
function (newValue, oldValue) {
772-
if ($scope.phase === "ready" && !$scope.dirtyChecked && Object.keys(oldValue).length > 0 && $scope.topLevelFormName && $scope[$scope.topLevelFormName].$dirty && typeof $scope.dataEventFunctions?.checkDirty === "function") {
772+
if ($scope.phase === "ready" && !$scope.dirtyChecked && Object.keys(oldValue).length > 0 && $scope.topLevelFormName && $scope[$scope.topLevelFormName] && $scope[$scope.topLevelFormName].$dirty && typeof $scope.dataEventFunctions?.checkDirty === "function") {
773773
$scope.dirtyChecked = true;
774774
// An opportunity to ask whether we can edit this document or not - pessimistic locking can be implemented by using this
775775
const checkDirty = $scope.dataEventFunctions.checkDirty(newValue, oldValue);

src/client/js/services/submissions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,14 @@ module fng.services {
130130
},
131131

132132
// return only the list attributes for ALL records in the given collection, returning ILookupItem[]
133+
// getAllPickListAttributes() is intended to be used to retrieve records for display in a picklist;
134+
// getAllListAttributes() for all other use cases
133135
getAllListAttributes: function (ref: string): angular.IHttpPromise<ILookupItem[]> {
134136
return $http.get(`/api/${ref}/listAll`, { cache: expCache });
135137
},
138+
getAllPickListAttributes: function (ref: string): angular.IHttpPromise<ILookupItem[]> {
139+
return $http.get(`/api/${ref}/picklistAll`, { cache: expCache });
140+
},
136141

137142
// return only the list attributes for records in the given collection that satisfy the given query conditions (filter, limit etc.)
138143
// return ILookupItem[] if options.concatenate is true, else the raw documents

src/server/data_form.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ export class FormsAngular {
150150
processArgs(this.options, [resourceName, this.collectionGet()])
151151
);
152152

153-
// return the List attributes for all records - used by record-handler's setUpLookupOptions() method, for cases
153+
// return the List attributes for all records. two endpoints that go through the same handler so permissions
154+
// can be applied differently for the two use cases. /listAll is intended for listing records on a page;
155+
// /picklistAll for listing them in a <select> or similar - used by record-handler's setUpLookupOptions() method, for cases
154156
// where there's a lookup that doesn't use the fngajax option
155157
this.app.get.apply(
156158
this.app,
@@ -159,6 +161,13 @@ export class FormsAngular {
159161
this.entityListAll(),
160162
])
161163
);
164+
this.app.get.apply(
165+
this.app,
166+
processArgs(this.options, [
167+
resourceName + "/picklistAll",
168+
this.entityListAll(),
169+
])
170+
);
162171

163172
// return the List attributes for a record - used by fng-ui-select
164173
this.app.get.apply(

0 commit comments

Comments
 (0)