UI: Use `client_id` instead of `scope_id` (#2169)

* scope_id --> client_id

* skip looking into auto_create ws
This commit is contained in:
David Moore 2022-06-30 09:55:32 +01:00 коммит произвёл GitHub
Родитель 06c553ec91
Коммит a6e92b8a16
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -108,9 +108,8 @@ export const App: React.FunctionComponent = () => {
setRoles: (roles: Array<string>) => { console.warn("Workspace roles", roles); setWorkspaceRoles(roles) },
workspace: selectedWorkspace,
setWorkspace: (w: Workspace) => { console.warn("Workspace set", w); setSelectedWorkspace(w) },
workspaceClientId: selectedWorkspace.properties?.scope_id.replace("api://", "")
workspaceClientId: selectedWorkspace.properties?.client_id
}}>
<WorkspaceProvider />
</WorkspaceContext.Provider>
} />

Просмотреть файл

@ -52,7 +52,8 @@ export const NotificationPanel: React.FunctionComponent = () => {
workspaceList && workspaceList.length > 0 && (opsToAdd = opsToAdd.concat(await getOpsFromResourceList(workspaceList)));
for (let i=0;i<workspaceList.length;i++){
let w = workspaceList[i];
let appId = w.properties.scope_id.replace("api://", "");
let appId = w.properties.client_id;
if (appId === "auto_create") continue; // skip getting stuff from the workspace if it's auto_create as it doesn't have auth setup yet
let workspaceServicesList = (await apiCall(`${w.resourcePath}/${ApiEndpoint.WorkspaceServices}`, HttpMethod.Get, appId)).workspaceServices as Array<Resource>;
if (workspaceServicesList && workspaceServicesList.length > 0) (opsToAdd = opsToAdd.concat(await getOpsFromResourceList(workspaceServicesList, appId)));
for(let n=0;n<workspaceServicesList.length;n++){
@ -84,7 +85,7 @@ export const NotificationPanel: React.FunctionComponent = () => {
}
if (!isWs) {
let r = await apiCall(op.resourcePath, HttpMethod.Get, ws.properties.scope_id.replace("api://", ""));
let r = await apiCall(op.resourcePath, HttpMethod.Get, ws.properties.client_id);
resource = getResourceFromResult(r);
}
} else {

Просмотреть файл

@ -16,7 +16,7 @@ export const NotificationPoller: React.FunctionComponent<NotificationPollerProps
useInterval(async () => {
let op = (await apiCall(`${props.notification.operation.resourcePath}/${ApiEndpoint.Operations}/${props.notification.operation.id}`,
HttpMethod.Get, props.notification.workspace ? props.notification.workspace.properties.scope_id.replace("api://", "") : null)).operation as Operation;
HttpMethod.Get, props.notification.workspace ? props.notification.workspace.properties.client_id: null)).operation as Operation;
// check if any fields have changed - ie the json is any different. we don't care _what_ has changed, just that something has
if (JSON.stringify(op) !== JSON.stringify(props.notification.operation)) {

Просмотреть файл

@ -28,7 +28,7 @@ export const WorkspaceProvider: React.FunctionComponent = () => {
// get the workspace
const ws = (await apiCall(`${ApiEndpoint.Workspaces}/${workspaceId}`, HttpMethod.Get)).workspace;
workspaceCtx.current.setWorkspace(ws);
const clientId = ws.properties.scope_id.replace("api://", "");
const clientId = ws.properties.client_id;
// use the client ID to get a token against the workspace (tokenOnly), and set the workspace roles in the context
let wsRoles: Array<string> = [];