Skip to content

Commit

Permalink
hardcode admin auth for now, fix api url
Browse files Browse the repository at this point in the history
  • Loading branch information
himdel committed Jun 28, 2024
1 parent 4c34680 commit 39f8e63
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
5 changes: 0 additions & 5 deletions config/shared.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ module.exports = (inputConfigs) => {
globals[item.name] = JSON.stringify(customConfigs[item.name]);
});

// 4.6+: pulp APIs live under API_BASE_PATH now, ignore previous overrides
globals.PULP_API_BASE_PATH = JSON.stringify(
customConfigs.API_BASE_PATH + 'pulp/api/v3/',
);

return {
devtool: 'source-map',

Expand Down
9 changes: 8 additions & 1 deletion src/api/active-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ class API extends HubAPI {
apiPath = '_ui/v1/me/';

getUser(): Promise<UserType> {
return this.http.get(this.apiPath).then((result) => result.data);
// FIXME: return this.http.get(this.apiPath).then((result) => result.data);
return Promise.resolve({
username: 'admin',
groups: [],
is_superuser: true,
is_anonymous: false,
model_permissions: {},
});
}

saveUser(data) {
Expand Down
2 changes: 2 additions & 0 deletions src/api/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export class BaseAPI {
paramsSerializer: {
serialize: (params) => ParamHelper.getQueryString(params),
},
// TODO fix, more methods
auth: { username: 'admin', password: 'admin' },
});

this.http.interceptors.request.use((request) => this.authHandler(request));
Expand Down
2 changes: 1 addition & 1 deletion src/api/pulp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export class PulpAPI extends BaseAPI {
sortParam = 'ordering';

constructor() {
super(PULP_API_BASE_PATH);
super(API_BASE_PATH);
}
}
2 changes: 1 addition & 1 deletion src/api/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class API extends PulpAPI {
if (for_object_type) {
// ?for_object_type=/api/automation-hub/pulp/api/v3/.../
// list visible in http://localhost:8002/api/automation-hub/pulp/api/v3/
newParams.for_object_type = PULP_API_BASE_PATH + for_object_type + '/';
newParams.for_object_type = API_BASE_PATH + for_object_type + '/';
}
return super.list(newParams);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface TabProps {

const AnyAPI = (href) =>
new (class extends PulpAPI {
apiPath = href.replace(PULP_API_BASE_PATH, '');
apiPath = href.replace(API_BASE_PATH, '');
})();

const VersionContent = ({
Expand Down
2 changes: 1 addition & 1 deletion src/containers/task-management/task-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class TaskDetail extends Component<RouteProps, IState> {
}
if (result.data.reserved_resources_record.length) {
result.data.reserved_resources_record.forEach((resource) => {
const url = resource.replace(PULP_API_BASE_PATH, '');
const url = resource.replace(API_BASE_PATH, '');
const id = parsePulpIDFromURL(url);
const urlParts = url.split('/');
let resourceType = '';
Expand Down
1 change: 0 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ declare module '*.svg';
declare var API_BASE_PATH;
declare var API_HOST;
declare var APPLICATION_NAME;
declare var PULP_API_BASE_PATH;
declare var UI_BASE_PATH;
declare var UI_COMMIT_HASH;
declare var UI_DOCS_URL;
Expand Down

0 comments on commit 39f8e63

Please sign in to comment.