Skip to content

Commit

Permalink
Drop Vue.js dynamic lookup as not supported by "vue-fomantic-ui" (#2041)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 9, 2023
1 parent 6c08e81 commit 3cd916c
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 235 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
php: ['7.4', '8.0', '8.1', '8.2']
type: ['Phpunit', 'Phpunit Lowest']
include:
- php: '8.1' # TODO replace with 'latest' once it represents at least PHP 8.1
- php: 'latest'
type: 'Phpunit Burn'
env:
LOG_COVERAGE: "${{ fromJSON('{true: \"1\", false: \"\"}')[matrix.php == '8.0' && matrix.type == 'Phpunit' && (github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')))] }}"
Expand Down
46 changes: 1 addition & 45 deletions js/src/vue-components/share/atk-lookup.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import atk from 'atk';

/**
* Wrapper for Fomantic-UI dropdown component into a lookup component.
*
* Properties:
* config:
* url: the callback URL. Callback should return model data in form of { key: modelId, text: modelTitle, value: modelId }
* reference: the reference field name associate with model or hasOne name. This field name will be sent along with URL callback parameter as of 'field=name'.
* Note: The remaining config object may contain any or SuiDropdown { props: value } pair.
*
Expand All @@ -19,9 +16,7 @@ export default {
v-bind="dropdownProps"
ref="drop"
:modelValue="getDropdownValue(modelValue)"
` /* :loading="isLoading" */
+ `@update:modelValue="onUpdate"
@filtered="onFiltered"
@update:modelValue="onUpdate"
></SuiDropdown>`,
props: ['config', 'modelValue', 'optionalValue'],
data: function () {
Expand All @@ -33,7 +28,6 @@ export default {
return {
dropdownProps: otherConfig,
url: url || null,
isLoading: false,
field: reference,
query: '',
temp: '',
Expand All @@ -52,43 +46,5 @@ export default {
onUpdate: function (value) {
this.$emit('update:modelValue', value.value);
},
/**
* Receive user input text for search.
*/
onFiltered: function (inputValue) {
if (inputValue) {
this.isLoading = true;
}

if (!this.onFiltered.debouncedFx) {
this.onFiltered.debouncedFx = atk.createDebouncedFx(() => {
this.onFiltered.debouncedFx = null;
if (this.query !== this.temp) {
this.query = this.temp;
if (this.query) {
this.fetchItems(this.query);
}
}
}, 250);
}
this.temp = inputValue;
this.onFiltered.debouncedFx(this);
},
/**
* Fetch new data from server.
*/
fetchItems: async function (q) {
try {
const data = { atkVueLookupQuery: q, atkVueLookupField: this.field };
const response = await atk.apiService.suiFetch(this.url, { method: 'get', data: data });
if (response.success) {
this.dropdownProps.options = response.results;
}
} catch (e) {
console.error(e);
} finally {
this.isLoading = false;
}
},
},
};
51 changes: 1 addition & 50 deletions public/js/atk-vue-multiline.js

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

2 changes: 1 addition & 1 deletion public/js/atk-vue-multiline.js.map

Large diffs are not rendered by default.

0 comments on commit 3cd916c

Please sign in to comment.