web: Call qr-std-upload

This commit is contained in:
Fam Zheng 2025-05-14 22:25:14 +01:00
parent 38ab815ba2
commit 81008a65b9

View File

@ -44,17 +44,14 @@
<CDropdown> <CDropdown>
<CDropdownToggle size="sm" color="secondary">操作</CDropdownToggle> <CDropdownToggle size="sm" color="secondary">操作</CDropdownToggle>
<CDropdownMenu> <CDropdownMenu>
<CDropdownItem v-if="true || e.status == 'imported'" href="javascript:void(0)" @click="show_feature_extract(e)">特征提取...</CDropdownItem> <CDropdownItem href="javascript:void(0)" @click="qr_std_upload(e)">
<CDropdownItem v-if="false" href="javascript:void(0)" @click="do_dup(e)">DUP</CDropdownItem> 备案到云
<CDropdownItem v-if="e.status == 'feature_extracted'" href="javascript:void(0)" @click="feature_upload(e)">特征上传</CDropdownItem>
<CDropdownItem href="javascript:void(0)" @click="show_image_convert(e)">
图像格式转换
</CDropdownItem> </CDropdownItem>
<CDropdownItem href="javascript:void(0)" @click="archive_to_cloud(e)"> <CDropdownItem href="javascript:void(0)" @click="show_image_convert(e)">
归档到云 图像格式转换
</CDropdownItem> </CDropdownItem>
<CDropdownItem class="text-danger" href="javascript:void(0)" @click="delete_batch(e)"> <CDropdownItem class="text-danger" href="javascript:void(0)" @click="delete_batch(e)">
删除 删除
</CDropdownItem> </CDropdownItem>
</CDropdownMenu> </CDropdownMenu>
</CDropdown> </CDropdown>
@ -101,20 +98,6 @@
</div> </div>
</div> </div>
</Modal> </Modal>
<Modal title="特征提取" ref="feature_extract_modal" @close="feature_extract">
<div>
准备特征提取
<div class="my-2 alert alert-secondary">
{{ feature_extract_target.name }}
</div>
</div>
<div>
<input type="checkbox" id="feaor" v-model="feature_extract_abort_on_error" />
<label for="feaor">
出错时停止任务
</label>
</div>
</Modal>
</div> </div>
</template> </template>
@ -129,10 +112,6 @@ export default {
loading: true, loading: true,
search_query: '', search_query: '',
entries: [], entries: [],
feature_extract_target: null,
feature_extract_abort_on_error: false,
feature_upload_overwrite: false,
feature_upload_fail_if_exists: false,
image_convert_target: null, image_convert_target: null,
image_convert_format: "jpeg", image_convert_format: "jpeg",
image_convert_size_enabled: false, image_convert_size_enabled: false,
@ -160,86 +139,6 @@ export default {
await this.$root.estor_delete(this.get_batch_dir(e)); await this.$root.estor_delete(this.get_batch_dir(e));
this.reload(); this.reload();
}, },
async archive_to_cloud(e) {
var base_url = this.base_url();
this.$root.notify("归档到云", "正在创建归档任务");
var url = base_url + '/api/v1/estor-archive/';
var r = await this.$root.estor_call("CreateJob", {
name: "[归档到云存储]" + e.name,
spec: {
type: "HttpPost",
args: {
space: this.$root.estor_space,
files: [this.get_batch_dir(e, "features/qr")],
url,
params: {
'Emblem-Token': this.$root.token_for_estor,
},
recursive: true,
},
},
});
console.log(r)
this.$router.push("/estor/jobs");
},
async feature_extract(ok) {
if (!ok) return;
this.$root.notify("特征提取", "正在创建特征提取任务");
var e = this.feature_extract_target;
var ib = this.get_batch_dir(e, "import");
var r = await this.$root.estor_call("CreateJob", {
name: "[特征ROI提取]" + e.name,
spec: {
type: "HttpPost",
args: {
space: this.$root.estor_space,
files: [ib],
url: "http://127.0.0.1:32439/roi",
recursive: true,
concurrency: 8,
convert: {
pattern: "/emblem/batches/([^/]*)/import/(.*)",
replace: "/emblem/batches/$1/roi/$2",
},
},
},
});
console.log("CreateJob", r);
await this.set_batch_state(e.name, {
status: 'feature_extracting',
job: r.data.data,
});
this.$router.push("/estor/jobs");
},
async do_dup(e) {
var ib = this.get_batch_dir(e, "import");
var r = await this.$root.estor_call("CreateJob", {
name: "[DUP]" + e.name,
spec: {
type: "HttpPost",
args: {
space: this.$root.estor_space,
files: [ib],
url: 'http://192.168.0.139:6006/estor-dup',
concurrency: 8,
params: {
'Estor-Addr': this.estor_url,
'Estor-Token': this.estor_token,
'Input-Basedir': ib,
'Output-Basedir': this.get_batch_dir(e, "dup/"),
},
recursive: true,
abort_on_error: this.feature_extract_abort_on_error,
},
},
});
console.log(r);
this.reload_status();
},
show_feature_extract(e) {
this.feature_extract_target = e;
this.$refs.feature_extract_modal.show();
},
show_image_convert(e) { show_image_convert(e) {
this.image_convert_target = e; this.image_convert_target = e;
this.$refs.image_convert_modal.show(); this.$refs.image_convert_modal.show();
@ -277,19 +176,19 @@ export default {
console.log(r); console.log(r);
this.$router.push("/estor/jobs"); this.$router.push("/estor/jobs");
}, },
async feature_upload(e) { async qr_std_upload(e) {
this.$root.notify("特征上传", "正在创建特征上传任务"); this.$root.notify("备案到云", "正在创建备案任务");
var base_url = this.base_url(); var base_url = this.base_url();
var url = base_url + '/api/v1/code-feature-roi/'; var url = base_url + '/api/v1/qr-std-upload/';
await this.$root.estor_call("CreateJob", { await this.$root.estor_call("CreateJob", {
name: "[特征上传]" + e.name, name: "[备案到云]" + e.name,
spec: { spec: {
type: "HttpPost", type: "HttpPost",
args: { args: {
space: this.$root.estor_space, space: this.$root.estor_space,
files: [this.get_batch_dir(e, 'roi')], files: [this.get_batch_dir(e, 'import')],
url, url,
concurrency: 128, concurrency: 256,
recursive: true, recursive: true,
headers: { headers: {
'Authorization': 'token ' + this.$root.token, 'Authorization': 'token ' + this.$root.token,