Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 9fdb7d55

Přidáno uživatelem Lukáš Vlček před asi 2 roky(ů)

Deleting occurences

Zobrazit rozdíly:

webapp/api/api.ts
566 566
 * @interface TagInstanceInfo
567 567
 */
568 568
export interface TagInstanceInfo {
569
    /**
570
     * 
571
     * @type {string}
572
     * @memberof TagInstanceInfo
573
     */
574
    'occurenceId'?: string;
569 575
    /**
570 576
     * 
571 577
     * @type {string}
......
752 758

  
753 759

  
754 760
    
761
            setSearchParams(localVarUrlObj, localVarQueryParameter);
762
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
763
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
764

  
765
            return {
766
                url: toPathString(localVarUrlObj),
767
                options: localVarRequestOptions,
768
            };
769
        },
770
        /**
771
         * 
772
         * @param {string} annotationId 
773
         * @param {string} occurenceId 
774
         * @param {*} [options] Override http request option.
775
         * @throws {RequiredError}
776
         */
777
        annotationAnnotationIdOccurenceIdDelete: async (annotationId: string, occurenceId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
778
            // verify required parameter 'annotationId' is not null or undefined
779
            assertParamExists('annotationAnnotationIdOccurenceIdDelete', 'annotationId', annotationId)
780
            // verify required parameter 'occurenceId' is not null or undefined
781
            assertParamExists('annotationAnnotationIdOccurenceIdDelete', 'occurenceId', occurenceId)
782
            const localVarPath = `/annotation/{annotationId}/{occurenceId}`
783
                .replace(`{${"annotationId"}}`, encodeURIComponent(String(annotationId)))
784
                .replace(`{${"occurenceId"}}`, encodeURIComponent(String(occurenceId)));
785
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
786
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
787
            let baseOptions;
788
            if (configuration) {
789
                baseOptions = configuration.baseOptions;
790
            }
791

  
792
            const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
793
            const localVarHeaderParameter = {} as any;
794
            const localVarQueryParameter = {} as any;
795

  
796

  
797
    
755 798
            setSearchParams(localVarUrlObj, localVarQueryParameter);
756 799
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
757 800
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
......
851 894
            const localVarAxiosArgs = await localVarAxiosParamCreator.annotationAnnotationIdGet(annotationId, options);
852 895
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
853 896
        },
897
        /**
898
         * 
899
         * @param {string} annotationId 
900
         * @param {string} occurenceId 
901
         * @param {*} [options] Override http request option.
902
         * @throws {RequiredError}
903
         */
904
        async annotationAnnotationIdOccurenceIdDelete(annotationId: string, occurenceId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
905
            const localVarAxiosArgs = await localVarAxiosParamCreator.annotationAnnotationIdOccurenceIdDelete(annotationId, occurenceId, options);
906
            return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
907
        },
854 908
        /**
855 909
         * 
856 910
         * @param {string} annotationId 
......
891 945
        annotationAnnotationIdGet(annotationId: string, options?: any): AxiosPromise<AnnotationInfo> {
892 946
            return localVarFp.annotationAnnotationIdGet(annotationId, options).then((request) => request(axios, basePath));
893 947
        },
948
        /**
949
         * 
950
         * @param {string} annotationId 
951
         * @param {string} occurenceId 
952
         * @param {*} [options] Override http request option.
953
         * @throws {RequiredError}
954
         */
955
        annotationAnnotationIdOccurenceIdDelete(annotationId: string, occurenceId: string, options?: any): AxiosPromise<void> {
956
            return localVarFp.annotationAnnotationIdOccurenceIdDelete(annotationId, occurenceId, options).then((request) => request(axios, basePath));
957
        },
894 958
        /**
895 959
         * 
896 960
         * @param {string} annotationId 
......
931 995
        return AnnotationApiFp(this.configuration).annotationAnnotationIdGet(annotationId, options).then((request) => request(this.axios, this.basePath));
932 996
    }
933 997

  
998
    /**
999
     * 
1000
     * @param {string} annotationId 
1001
     * @param {string} occurenceId 
1002
     * @param {*} [options] Override http request option.
1003
     * @throws {RequiredError}
1004
     * @memberof AnnotationApi
1005
     */
1006
    public annotationAnnotationIdOccurenceIdDelete(annotationId: string, occurenceId: string, options?: AxiosRequestConfig) {
1007
        return AnnotationApiFp(this.configuration).annotationAnnotationIdOccurenceIdDelete(annotationId, occurenceId, options).then((request) => request(this.axios, this.basePath));
1008
    }
1009

  
934 1010
    /**
935 1011
     * 
936 1012
     * @param {string} annotationId 
webapp/contexts/AnnotationContext.tsx
181 181
                length: selectionInfo.selectionLengthOriginalDocument,
182 182
            }
183 183
        );
184
        console.log('res');
185
        console.log(res);
186 184

  
187 185
        await refreshAnnotation();
188 186
    }
......
207 205
     * Deletes an occurrence of an annotation.
208 206
     * @param occurrence Occurrence that should be deleted.
209 207
     */
210
    const deleteOccurrence = (occurrence: TagInstanceInfo) => {
211
        //TODO: Implement method (should use objects from server API)
208
    const deleteOccurrence = async (occurrence: TagInstanceInfo) => {
209
        if (!occurrence.occurenceId) {
210
            console.log('invalid occurrence');
211
            return;
212
        }
213

  
214
        const deleteRes =
215
            await annotationController.annotationAnnotationIdOccurenceIdDelete(
216
                props.annotationId,
217
                occurrence.occurenceId
218
            );
219

  
220
        await refreshAnnotation();
212 221
    };
213 222

  
214 223
    /**

Také k dispozici: Unified diff