refactor: 💡 update how we determine is pagination is supported (#2122)
This commit is contained in:
1 parent
13f1c5cc23
commit
cb972cfc8a
3 files changed
+11
-9
No files matched your search
@@ -74,10 +74,10 @@ function routes() {
|
||||
});
|
||||
}
|
||||
const filteredResultSet = resultSet.filter(makeBooleanFilter(filter));
|
||||
// add a list_token to the response to simulate pagination
|
||||
// without having list_token, the unsupported controller modal
|
||||
// add a response_type to the response to simulate pagination
|
||||
// without having response_type, the unsupported controller modal
|
||||
// will show when running with mirage
|
||||
return { items: filteredResultSet.models, list_token: '12345' };
|
||||
return { items: filteredResultSet.models, response_type: 'complete' };
|
||||
},
|
||||
);
|
||||
this.post('/scopes', function ({ scopes }) {
|
||||
|
||||
@@ -25,7 +25,9 @@ export default class ScopesRoute extends Route {
|
||||
page_size: 1,
|
||||
recursive: true,
|
||||
});
|
||||
if (scopesCheck.list_token) {
|
||||
// we use the response_type to determine if pagination is supported
|
||||
// and this will still pass even if there are no scopes returned
|
||||
if (scopesCheck.response_type) {
|
||||
this.isPaginationSupported = true;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -259,7 +259,7 @@ module('Acceptance | scopes', function (hooks) {
|
||||
return new Response(200, {}, META_DATA_RESPONSE);
|
||||
});
|
||||
this.server.get('/scopes', () => {
|
||||
// no "list_token" field
|
||||
// no "response_type" field
|
||||
return new Response(200, {}, { scopes: [] });
|
||||
});
|
||||
|
||||
@@ -279,7 +279,7 @@ module('Acceptance | scopes', function (hooks) {
|
||||
isLinux: false,
|
||||
});
|
||||
this.server.get('/scopes', () => {
|
||||
// no "list_token" field
|
||||
// no "response_type" field
|
||||
return new Response(200, {}, { scopes: [] });
|
||||
});
|
||||
this.server.get('https://api.releases.hashicorp.com/*', () => {
|
||||
@@ -302,7 +302,7 @@ module('Acceptance | scopes', function (hooks) {
|
||||
isLinux: true,
|
||||
});
|
||||
this.server.get('/scopes', () => {
|
||||
// no "list_token" field
|
||||
// no "response_type" field
|
||||
return new Response(200, {}, { scopes: [] });
|
||||
});
|
||||
this.server.get('https://api.releases.hashicorp.com/*', () => {
|
||||
@@ -325,7 +325,7 @@ module('Acceptance | scopes', function (hooks) {
|
||||
isLinux: false,
|
||||
});
|
||||
this.server.get('/scopes', () => {
|
||||
// no "list_token" field
|
||||
// no "response_type" field
|
||||
return new Response(200, {}, { scopes: [] });
|
||||
});
|
||||
this.server.get('https://api.releases.hashicorp.com/*', () => {
|
||||
@@ -350,7 +350,7 @@ module('Acceptance | scopes', function (hooks) {
|
||||
isLinux: false,
|
||||
});
|
||||
this.server.get('/scopes', () => {
|
||||
// no "list_token" field
|
||||
// no "response_type" field
|
||||
return new Response(200, {}, { scopes: [] });
|
||||
});
|
||||
this.server.get('https://api.releases.hashicorp.com/*', () => {
|
||||
|
||||
Reference in new issue
Block a user