* chore: 🤖 Upgrade eslint config for admin ui * chore: 🤖 Fix eslint issues for admin * chore: 🤖 Upgrade eslint config for desktop * chore: 🤖 Fix linting errors in desktop * chore: 🤖 Upgrade eslint for api addon * chore: 🤖 Fix eslint issues in api addon * chore: 🤖 Upgrade eslint for auth addon * chore: 🤖 Fix eslint issues in auth addon * chore: 🤖 Upgrade core eslint config * chore: 🤖 Fix eslint issue for core addon * chore: 🤖 Upgrade eslint config for rose addon * chore: 🤖 Fix eslint issue for rose addon * chore: 🤖 Upgrade e2e eslint config * chore: 🤖 Fix eslint issues in e2e * chore: 🤖 Fix CI linting issues * chore: 🤖 Add back linting server files for the future * chore: 🤖 Update qunit rules to use extends
34 lines
908 B
JavaScript
34 lines
908 B
JavaScript
/**
|
|
* Copyright IBM Corp. 2021, 2026
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import ApplicationAdapter from './application';
|
|
|
|
export default class StorageBucketAdapter extends ApplicationAdapter {
|
|
/**
|
|
* Overrides the default `buildURL` such that on _create_, URLs for records of
|
|
* type `plugin` get an extra query parameter `?plugin_name`. All other
|
|
* request types behave as normal.
|
|
*
|
|
* @override
|
|
* @param {string} modelName
|
|
* @param {string} id
|
|
* @return {string} url
|
|
* @return {string} requestType
|
|
*/
|
|
buildURL(modelName, id, snapshot, requestType) {
|
|
let url = super.buildURL(...arguments);
|
|
let pluginName;
|
|
try {
|
|
pluginName = snapshot?.attr('plugin')?.name;
|
|
} catch {
|
|
// Ignore any adapter errors here
|
|
}
|
|
if (requestType === 'createRecord' && pluginName) {
|
|
url = `${url}?plugin_name=${pluginName}`;
|
|
}
|
|
return url;
|
|
}
|
|
}
|