rucio / webui

RucioWebUI (v2.0)
Apache License 2.0
4 stars 15 forks source link

Rules without a subscription fail to load through list-did-rules feature #466

Open MytsV opened 2 months ago

MytsV commented 2 months ago

Description

An Invalid Request: Subscription ID not provided error message is returned for all the rules which don't have a subscription. However, a rule having a subscription is optional.

Steps to reproduce

No response

Rucio WebUI Version

35.1.0

Additional Information

No response

MytsV commented 2 months ago

Additionally, trying to list rules for a DID that is nonexistent leads to infinite loading

MytsV commented 2 months ago

Probably the change has to be made to this method in postprocessing-pipeline-elements.ts

_transform(
        chunk: { status: 'success' | 'error'; reqeuestModel: TRequestModel; responseModel: TResponseModel | TErrorModel },
        encoding: BufferEncoding,
        callback: TransformCallback,
    ): void {
        let { status, responseModel } = chunk;
        if (status === 'error') {
            const errorModel = responseModel as TErrorModel;
            callback(null, errorModel);
            return;
        }
        responseModel = responseModel as TResponseModel;
        const validationResult = this.validateResponseModel(responseModel);
        if (validationResult.isValid) {
            callback(null, responseModel);
        } else {
            callback(null, validationResult.errorModel);
        }
    }
MytsV commented 2 months ago

Additionally, trying to list rules for a DID that is nonexistent leads to infinite loading

Turned out to be an issue not only with the DID rules! The PR fixes all similar bugs