(window.webpackJsonp=window.webpackJsonp||[]).push([[258,259],{1207:function(e,t,n){"use strict";n.r(t),n.d(t,"useDatasetViewModel",(function(){return r}));n(15);var a=n(73),o=n(44),i=n(292),s=n(239),r=function useDatasetViewModel(){var e=Object(a.d)(!1),t=Object(a.h)(),n=Object(s.i)(),r=t.value.params.id;return{datasetId:r,isLoadingDataset:e,handleError:function handleError(e){var t="";switch(e){case i.a.ERROR_FETCHING_DATASET_INFO:t="Can't get dataset info for dataset_id: ".concat(r);break;case i.a.ERROR_FETCHING_WORKSPACE_INFO:t="Can't get workspace info for dataset_id: ".concat(r);break;default:t="There was an error on fetching dataset info and workspace info. Please try again"}var n={message:t,numberOfChars:t.length,type:"error"};o.a.dispatch("notify",n)},createRootBreadCrumbs:function createRootBreadCrumbs(e){return[{link:{name:"datasets"},name:n("breadcrumbs.home")},{link:{path:"/datasets?workspaces=".concat(e.workspace)},name:e.workspace},{link:{path:"annotation-mode"},name:e.name}]}}}},1489:function(e,t,n){"use strict";n.r(t),n.d(t,"useDatasetSettingViewModel",(function(){return f}));var a=n(35),o=(n(10),n(30),n(6),n(148)),i=n(20),s=n(1207),r=n(314),c=n(308),u=n(239),d=n(44),__awaiter=function(e,t,n,a){return new(n||(n=Promise))((function(o,i){function fulfilled(e){try{step(a.next(e))}catch(e){i(e)}}function rejected(e){try{step(a.throw(e))}catch(e){i(e)}}function step(e){e.done?o(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((a=a.apply(e,t||[])).next())}))},f=function useDatasetSettingViewModel(){var e=Object(u.h)(),t=Object(u.b)(),n=Object(u.i)(),f=Object(u.g)().isAdminOrOwnerRole,l=Object(c.a)().state,p=Object(s.useDatasetViewModel)(),m=p.datasetId,b=p.isLoadingDataset,g=p.handleError,h=p.createRootBreadCrumbs,v=Object(i.useResolve)(r.a),w=Object(o.f)([]),O=function configureTabs(e){w.value.push({id:"info",name:"Info",component:"SettingsInfo"}),w.value.push({id:"fields",name:n("fields"),component:"SettingsFields"}),w.value.push({id:"questions",name:n("questions"),component:"SettingsQuestions"}),e.hasMetadataProperties&&w.value.push({id:"metadata",name:n("metadata"),component:"SettingsMetadata"}),e.hasVectors&&w.value.push({id:"vector",name:n("vectors"),component:"SettingsVectors"}),w.value.push({id:"danger-zone",name:n("dangerZone"),component:"SettingsDangerZone"})},k=Object(o.a)((function(){return[].concat(Object(a.a)(h(l.dataset)),[{link:{},name:n("breadcrumbs.datasetSettings")}])})),j=function onGoToDataset(){if(e.previousRouteMatchWith(m))return e.goBack();e.goToFeedbackTaskAnnotationPage(m)};return Object(o.b)((function(){!function loadDatasetSetting(){__awaiter(void 0,void 0,void 0,regeneratorRuntime.mark((function _callee(){var t;return regeneratorRuntime.wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,b.value=!0,n.next=4,v.execute(m);case 4:t=n.sent,O(t),n.next=12;break;case 8:n.prev=8,n.t0=n.catch(0),g(n.t0.response),e.go("/");case 12:return n.prev=12,b.value=!1,n.finish(12);case 15:case"end":return n.stop()}}),_callee,null,[[0,8,12,15]])})))}()})),Object(o.c)((function(){t.destroy()})),Object(o.g)((function(){return l.isModified}),(function(e){if(e)return t.confirm();t.destroy()})),{isLoadingDataset:b,breadcrumbs:k,tabs:w,isAdminOrOwnerRole:f,datasetId:m,datasetSetting:l,goToDataset:function goToDataset(){if(l.isModified)return d.a.dispatch("notify",{message:n("changes_no_submit"),buttonText:n("button.ignore_and_continue"),permanent:!0,type:"warning",onClick:function onClick(){j()},onClose:function onClose(){!function goToTabWithModification(){var e=function goToTab(e){document.getElementById(e).click()};l.isDatasetModified?e("info"):l.isFieldsModified?e("fields"):l.isQuestionsModified?e("questions"):l.isMetadataPropertiesModified?e("metadata"):l.isVectorsModified&&e("vector")}()}});j()}}}}}]);